You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VM has a lifetime 'a. This lifetime is arbitrary – it is chosen by the caller with no restrictions. This means it can outlive the VM, but other structs assume the VM is life for 'a. This is unsound.
Segfaulting example:
letmut vm = create_base_vm(DEFAULT_MAX_MEMORY);let call_stack = vm.allocate_call_stack();let main_method = vm
.resolve_class_method(
call_stack,"rjvm/SimpleMain","main","([Ljava/lang/String;)V",).expect("should find main method");drop(vm);println!("{main_method:?}");
Possible solutions:
Remove lifetime from VM. All methods that produce lifetimed objects take their lifetime from the reference to the VM.
Remove lifetime from VM. Keep VM in an Arc. Erase lifetimes internally. Don't hand out structs referencing VM memory directly, instead hand out a wrapper object that also contains a copy of the Arc (this can be transparent to the user).
The text was updated successfully, but these errors were encountered:
I don't think I am going to fix this honestly, it sounds too much work and I consider the project "finished" (in the sense that I learnt what I had in mind initially and I want to move on to other things).
In any case, solution 1 is pretty clear to me.
I am a bit uncertain on solution 2: what do you mean with erase lifetimes internally? Can you point out to any example or just sketch a few lines of code?
VM
has a lifetime'a
. This lifetime is arbitrary – it is chosen by the caller with no restrictions. This means it can outlive theVM
, but other structs assume theVM
is life for'a
. This is unsound.Segfaulting example:
Possible solutions:
VM
. All methods that produce lifetimed objects take their lifetime from the reference to theVM
.VM
. Keep VM in anArc
. Erase lifetimes internally. Don't hand out structs referencing VM memory directly, instead hand out a wrapper object that also contains a copy of theArc
(this can be transparent to the user).The text was updated successfully, but these errors were encountered: