Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Removing rounding support for maxByteLength #31

Closed

Description

@syg

@codehag @kmiller68

In light of the interop concerns in allowing an implementation-defined page size for rounding maxByteLength, I've come around back to removing the ability to observably round.

I find the interoperability and fingerprinting pushbacks reasonable, but if we address those concerns by fixing the page length, that makes the rounding support much less useful for engines. The original motivation was that the engine might want to round to a page-multiple anyway, and why track a separate length for what the real memory reservation is, which would complicate the implementation. If we fix a page length, the engine might still want to round to a page-multiple for its own page size, which then requires tracking a separate length again.

Since we aren't forcing implementations to round, I think fixing a page size doesn't make sense and would only make the rounding an extra complexity. So I'd like for us to go back to not having any observable rounding behavior at all. Thoughts?

Activity

  1. syg commented on Apr 1, 2021

    @syg
    CollaboratorAuthor

    Forgot to cc @marjakh.

  2. codehag commented on Apr 2, 2021

    @codehag

    I need to check with the broader team, but I think this is fine -- it would involve rounding within the implementation and tracking the intended size -- throwing if we get beyond that. It might be a bit annoying but that would be doable and not be as risky as implementation defined rounding.

    Most people are out for the next few days, i will get back to you with a concrete answer on tuesday.

  3. kmiller68 commented on Apr 3, 2021

    @kmiller68
    Contributor

    Just to refresh my memory/clarify, you’re proposing that if the byte length is not a multiple of the page size the engine handles that internally?

    If so, that sounds fine. My only thoughts are that it might be nice to provide JS uses the same VM based bounds checking behavior we provide for Wasm memories. I wouldn’t be too surprised if being able to skip the explicit bounds check is a few percentage point improvement. I also wouldn’t be surprised if there was no difference though.

    Perhaps we could make that easier by providing a pageSize static property on the constructor. This could be a multiple of the true page size of fingerprinting is a concern, although I think it wouldn’t be hard to find the true page size with timing so that may not matter really.

    That said, since at least for JSC, VM based bounds checked Wasm memories are somewhat limited, so perhaps something getting a VM bounds checked ArrayBuffer should be an option passed to the constructor? It might also make sense in the passed option world to force the any byteLength to be a multiple of 64k (matching Wasm).

  4. syg commented on Apr 8, 2021

    @syg
    CollaboratorAuthor

    Just to refresh my memory/clarify, you’re proposing that if the byte length is not a multiple of the page size the engine handles that internally?

    Yes, exactly.

    If so, that sounds fine. My only thoughts are that it might be nice to provide JS uses the same VM based bounds checking behavior we provide for Wasm memories.

    You can still do that, it's just that if the engine actually reserves a page-multiple size of virtual memory, it'd need to track that reservation internally with an additional length, since it won't be observable to user code.

  5. added a commit that references this issue on Apr 8, 2021
    073266e
  6. syg commented on Apr 13, 2021

    @syg
    CollaboratorAuthor

    @codehag ping for Mozilla's thoughts here.

  7. codehag commented on Apr 14, 2021

    @codehag

    On it, will have them tomorrow (likely the above comment. I spoke to a few people but we didn't fully discuss yet)

  8. codehag commented on Apr 19, 2021

    @codehag

    Forgot to write here: Thoughts are what I outlined above -> we are fine with this change and prefer it to the implementation defined behavior

  9. syg commented on Apr 19, 2021

    @syg
    CollaboratorAuthor

    Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions