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

jit: support for memory grow/size #85

Merged
merged 7 commits into from
Dec 23, 2021
Merged

jit: support for memory grow/size #85

merged 7 commits into from
Dec 23, 2021

Conversation

mathetake
Copy link
Member

Signed-off-by: Takeshi Yoneda takeshi@tetrate.io

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just a few notes to consider

wasm/jit/engine.go Outdated Show resolved Hide resolved
wasm/jit/engine.go Show resolved Hide resolved
// Now size should return the new pages -- 10.
out, _, err = store.CallFunction("test", "size")
require.NoError(t, err)
require.Equal(t, newPages, out[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose there's no test we can do to see that the memory is usable? (ex using an offset that would only work if it was 10)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indirectly tested as the size instruction takes len of the memory region, meaning that these offsets can be assumed to work. (Plus memory load,store instructions are not implemented so I cannot write in-Wasm memory access to verify it for now :D)

wasm/jit/jit_amd64.go Outdated Show resolved Hide resolved
wasm/jit/jit_amd64_test.go Show resolved Hide resolved
wasm/jit/jit_amd64_test.go Outdated Show resolved Hide resolved
builder.initializeReservedRegisters()
// Emit memory.size instructions.
builder.handleMemorySize()
// At this point, the size of memory should be pushed onto the stack.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ex this is a good "what" comment because the assertion is a bit indirect. so this one helps a lot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed yeah:D I've put too many comments including the obvious ones. Will keep each line more meaningful from now on!

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@mathetake mathetake merged commit e34222d into main Dec 23, 2021
@mathetake mathetake deleted the memorygrowsize branch December 23, 2021 05:08
@mathetake
Copy link
Member Author

@codefromthecrypt thanks a lot! 🕺

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

Successfully merging this pull request may close these issues.

None yet

2 participants