-
Notifications
You must be signed in to change notification settings - Fork 138
[move-vm] Removed most RCs from runtime #160
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
Open
tnowacki
wants to merge
4
commits into
diem:main
Choose a base branch
from
tnowacki:no-rc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+629
−981
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
495f9b6
[move-vm] Removed most RCs from runtime
42a4540
fixup! [move-vm] Removed most RCs from runtime
tnowacki d52353e
fixup! fixup! [move-vm] Removed most RCs from runtime
tnowacki 5ffed79
fixup! fixup! fixup! [move-vm] Removed most RCs from runtime
tnowacki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -395,12 +395,9 @@ fn native_add_box( | |
let table_context = context.extensions().get::<NativeTableContext>(); | ||
let mut table_data = table_context.table_data.borrow_mut(); | ||
|
||
// see REFERENCE SAFETY EXPLANATION in values | ||
let val = args.pop_back().unwrap(); | ||
let key = args | ||
.pop_back() | ||
.unwrap() | ||
.value_as::<Reference>()? | ||
.read_ref()?; | ||
let key = unsafe { args.pop_back().unwrap().value_as::<Reference>()?.read_ref() }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering: can't we isolate the |
||
let handle = get_table_handle(&pop_arg!(args, StructRef))?; | ||
|
||
let table = table_data.get_or_create_table(context, handle, &ty_args[0], &ty_args[2])?; | ||
|
@@ -450,11 +447,8 @@ fn native_borrow_box( | |
let table_context = context.extensions().get::<NativeTableContext>(); | ||
let mut table_data = table_context.table_data.borrow_mut(); | ||
|
||
let key = args | ||
.pop_back() | ||
.unwrap() | ||
.value_as::<Reference>()? | ||
.read_ref()?; | ||
// see REFERENCE SAFETY EXPLANATION in values | ||
let key = unsafe { args.pop_back().unwrap().value_as::<Reference>()?.read_ref() }; | ||
let handle = get_table_handle(&pop_arg!(args, StructRef))?; | ||
|
||
let table = table_data.get_or_create_table(context, handle, &ty_args[0], &ty_args[2])?; | ||
|
@@ -479,11 +473,8 @@ fn native_contains_box( | |
let table_context = context.extensions().get::<NativeTableContext>(); | ||
let mut table_data = table_context.table_data.borrow_mut(); | ||
|
||
let key = args | ||
.pop_back() | ||
.unwrap() | ||
.value_as::<Reference>()? | ||
.read_ref()?; | ||
// see REFERENCE SAFETY EXPLANATION in values | ||
let key = unsafe { args.pop_back().unwrap().value_as::<Reference>()?.read_ref() }; | ||
let handle = get_table_handle(&pop_arg!(args, StructRef))?; | ||
|
||
let table = table_data.get_or_create_table(context, handle, &ty_args[0], &ty_args[2])?; | ||
|
@@ -508,11 +499,8 @@ fn native_remove_box( | |
let table_context = context.extensions().get::<NativeTableContext>(); | ||
let mut table_data = table_context.table_data.borrow_mut(); | ||
|
||
let key = args | ||
.pop_back() | ||
.unwrap() | ||
.value_as::<Reference>()? | ||
.read_ref()?; | ||
// see REFERENCE SAFETY EXPLANATION in values | ||
let key = unsafe { args.pop_back().unwrap().value_as::<Reference>()?.read_ref() }; | ||
let handle = get_table_handle(&pop_arg!(args, StructRef))?; | ||
let table = table_data.get_or_create_table(context, handle, &ty_args[0], &ty_args[2])?; | ||
let (val, key_size, val_size) = table.remove(table_context, &key)?; | ||
|
@@ -568,7 +556,8 @@ fn get_table_handle(table: &StructRef) -> PartialVMResult<TableHandle> { | |
let field_ref = table | ||
.borrow_field(HANDLE_FIELD_INDEX)? | ||
.value_as::<Reference>()?; | ||
field_ref.read_ref()?.value_as::<u128>().map(TableHandle) | ||
// see REFERENCE SAFETY EXPLANATION in values | ||
unsafe { field_ref.read_ref().value_as::<u128>().map(TableHandle) } | ||
} | ||
|
||
fn serialize(layout: &MoveTypeLayout, val: &Value) -> PartialVMResult<Vec<u8>> { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! That actually works, great. Problem with that kind of magic is that the APIs aren't clearly documented and buried somewhere in all those trait impls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed its a bit hard to discover, not sure if @vgao1996 has any thoughts on that (to be clear the VMValueCast stuff has been around a while, not new to this PR)