Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General purpose instructions for bytes #49

Open
8 of 21 tasks
kwannoel opened this issue Jul 5, 2021 · 0 comments
Open
8 of 21 tasks

General purpose instructions for bytes #49

kwannoel opened this issue Jul 5, 2021 · 0 comments
Assignees

Comments

@kwannoel
Copy link
Collaborator

kwannoel commented Jul 5, 2021

Part of https://gitlab.com/mukn/glow/-/issues/80.

Features

Batch 1 (Merged: #46)

  • Methods for known-size bytes
    • Compat with bytes larger than EVM Word
    • Store at free memory pointer
    • Load at free memory pointer
    • Push for large bytes
  • Unit tests
  • Integration tests
  • Invariant assertions

Batch 2 (WIP: #50)

  • Call by reference methods (by storing offset, length on stack)
  • Static offset methods for load, store. Glow compiler uses mstoreat, mloadat.
  • Support types with have variable sizes during runtime.
    For example, given a Bytestring with a UInt64 length,
    during compile time we do not know the actual length / contents of the bytestring.
    instead we generate instructions to store the length:
    - on stack is just takes up a slot.
    - in memory it takes up 8bytes.
    And use it to decode the contents:
    - LOAD:
    Use the offset and length on stack to retrieve the entire bytestring from memory
    - STORE:
    Use length on stack to store bytestring in memory
  • memcpy
  • Hashing
  • calldataload, calldatacopy.
  • Limit memory offset to 16/24 bytes due to gas limits, rather than 32.

Batch 3

  • Integrate with existing EVM-Types - Extend? Create new types?
    • Either use .box? directly to handle boxed / unboxed types
    • or use it implicitly, with a general .evm<- method for marshalling data to EVM.

Batch 4

  • Handle singletons.
  • Benchmark gas for methods
  • Support for marshalling? (further investigation needed)
@kwannoel kwannoel self-assigned this Jul 5, 2021
kwannoel added a commit that referenced this issue Jul 6, 2021
Includes methods from Batch 2. See: #49
kwannoel added a commit that referenced this issue Jul 7, 2021
Includes methods from Batch 2. See: #49
kwannoel added a commit that referenced this issue Jul 9, 2021
Includes methods from Batch 2. See: #49
@kwannoel kwannoel changed the title Implement EVM type descriptors General purpose instructions for bytes Jul 9, 2021
kwannoel added a commit that referenced this issue Jul 9, 2021
kwannoel added a commit that referenced this issue Jul 9, 2021
kwannoel added a commit that referenced this issue Jul 9, 2021
kwannoel added a commit that referenced this issue Jul 9, 2021
kwannoel added a commit that referenced this issue Jul 21, 2021
kwannoel added a commit that referenced this issue Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant