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

wasmtime: VMRuntimeLimits pointer is already SSA #8689

Merged
merged 2 commits into from
May 24, 2024

Conversation

jameysharp
Copy link
Contributor

We don't need to use cranelift-frontend to keep track of the location of the VMRuntimeLimits pointer, because it is loaded once on entry to the function and never changed afterward.

Instead, just track the correct SSA Value.

We don't need to use cranelift-frontend to keep track of the location of
the `VMRuntimeLimits` pointer, because it is loaded once on entry to the
function and never changed afterward.

Instead, just track the correct SSA `Value`.
@jameysharp jameysharp requested a review from a team as a code owner May 24, 2024 08:10
@jameysharp jameysharp requested review from fitzgen and removed request for a team May 24, 2024 08:10
let vmctx = self.vmctx(builder.func);
let base = builder.ins().global_value(pointer_type, vmctx);
let offset = i32::try_from(self.offsets.vmctx_runtime_limits()).unwrap();
let interrupt_ptr = builder
.ins()
.load(pointer_type, ir::MemFlags::trusted(), base, offset);
builder.def_var(self.vmruntime_limits_ptr, interrupt_ptr);
self.vmruntime_limits_ptr = interrupt_ptr;
Copy link
Member

Choose a reason for hiding this comment

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

Can we debug assert that self.vmruntime_limits_ptr is the reserved value before we initialize it, to make sure that we aren't defining it multiple times? And/or use an Option or PackedOption for the field?

(
builder.use_var(self.vmruntime_limits_ptr),
self.vmruntime_limits_ptr,
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, can we debug assert that it has been initialized here?

@jameysharp jameysharp added this pull request to the merge queue May 24, 2024
Merged via the queue into bytecodealliance:main with commit f40aaa5 May 24, 2024
36 checks passed
@jameysharp jameysharp deleted the limits-ptr-is-ssa branch May 24, 2024 19:01
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.

2 participants