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

fix(c-api) wasm_limits_t contains Pages, not Bytes + sentinel value #1690

Merged
merged 4 commits into from
Oct 8, 2020

Commits on Oct 8, 2020

  1. fix(c-api) wasm_limits_t contains Pages, not Bytes.

    When building a `wasm_memorytype_t` with `wasm_memorytype_new`, we
    pass a `wasm_limits_t`, where `min` and `max` represent `Pages`. This
    semantics is set by `wasm_memorytype_new` itself where `min` and `max`
    from `wasm_limits_t` are used to compute `Pages`, which are then passed
    to `MemoryType`.
    
    Then, in `wasm_memorytype_limits`, we expect to get the same
    `wasm_limits_t` given to `wasm_memorytype_new`. But it's not!
    
    The same `MemoryType` is read, good. The `minimum` and `maximum`
    fields are `Pages`, good. Then, we compute the `min` and `max` values
    for the resulting `wasm_limits_t`, which receive `Page.bytes().0`, not
    good! We don't want the number of bytes, but the number of pages.
    
    This patch fixes that.
    Hywan committed Oct 8, 2020
    Configuration menu
    Copy the full SHA
    5d19813 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f6595cd View commit details
    Browse the repository at this point in the history
  3. feat(c-api) Replace the max limit sentinel value by a constant.

    In the `wasm.h` header file, it is defined by `wasm_limits_max_default`.
    Hywan committed Oct 8, 2020
    Configuration menu
    Copy the full SHA
    80459f3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3e77b8f View commit details
    Browse the repository at this point in the history