Stream: git-wasmtime

Topic: wasmtime / PR #2403 SimpleJIT hot code swapping


view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 18:38):

bjorn3 opened PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 18:39):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 18:49):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 19:03):

pchickey requested pchickey for a review on PR #2403.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 20:46):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 20:46):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 20:46):

pchickey created PR Review Comment:

I'm not clear on how 16 bytes was arrived at, and how platform specific this is - is it due to 16-byte alignment on x86_64? does some other sequence of instructions have to fit in here besides the plt_val at line 179?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 20:46):

pchickey edited PR Review Comment.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 21:10):

bjorn3 submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2020 at 21:10):

bjorn3 created PR Review Comment:

In the future I may extend it to be more like the lazy symbol binding used by ELF. In that case the GOT entry will initially point just after the jump instruction in the PLT. After this jump instruction it pushes a specific value to the stack depending on which PLT entry it is and then it jumps to a function common between all entries in a module. This function then resolves the symbol. This avoids having to create a new wrapper function for each lazily compiled function.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2020 at 08:29):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Nov 16 2020 at 18:34):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 16 2020 at 18:34):

pchickey created PR Review Comment:

That makes sense. a comment to this effect would be appreciated :)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2020 at 23:45):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 03 2020 at 17:49):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Dec 03 2020 at 17:57):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Dec 03 2020 at 18:07):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Dec 03 2020 at 18:25):

bjorn3 updated PR #2403 from simplejit_hot_swapping to main:

This makes it possible to change functions when using SimpleJIT without having to recompile everything or even restart the jitted code. When a changed function is currently on the stack, the old version will be returned to, but all new calls will be redirected to the new version. It is not yet possible to swap data objects.

This is a prerequisite of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087.

I have tested this PR by implementing lazy compilation in cg_clif as suggested by @flodiebold in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/cranelift.20backend.20work/near/187645798 in February.

r? @pchickey (By the way, is it deliberate that you are marked as unavailable on zulip? I sent you a PM)
cc https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/hot.20code.20swapping.20for.20simplejit/near/216403611

view this post on Zulip Wasmtime GitHub notifications bot (Dec 03 2020 at 21:36):

pchickey merged PR #2403.


Last updated: Dec 23 2024 at 12:05 UTC