-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Refactoring interpreter and paranoid mode, introducing traits to allo… #15350
Refactoring interpreter and paranoid mode, introducing traits to allo… #15350
Conversation
…w generic interpreter as well as compile time switch for the runtime type checks (formerly called paranoid mode)
⏱️ 1h 49m total CI duration on this PR
|
/// ((Type of the field, size of the field type) and (Type of its defining struct, size of its defining struct) | ||
field_instantiation: | ||
BTreeMap<FieldInstantiationIndex, ((Type, NumTypeNodes), (Type, NumTypeNodes))>, | ||
/// Same as above, bot for variant field instantiations |
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.
typo: bot
--> but
?
operand_stack.push_ty(output_ty) | ||
} | ||
|
||
pub(crate) struct NullRuntimeTypeCheck; |
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.
See some C++ here ahah, NoRuntimeTypeCheck
maybe?
|
||
/// Paranoid type checks to perform after instruction execution. | ||
/// | ||
/// This function and `pre_execution_type_stack_transition` should constitute the full type stack transition for the paranoid mode. |
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.
I think lines are > 100 chars again?
| Bytecode::Call(_) | ||
| Bytecode::CallGeneric(_) | ||
| Bytecode::Abort => { | ||
// Invariants hold because all of the instructions above will force VM to break from the interpreter loop and thus not hit this code path. |
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.
again, multiple lines
) -> PartialVMResult<()>; | ||
} | ||
|
||
/// Paranoid type checks to perform before instruction execution. |
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.
If this is meant for the module, you can do //! Your description here
on top of the file? This also seems like a good documentation to add to trait definition?
.into_iter() | ||
.zip(field_tys) | ||
{ | ||
// Fields ability should be a subset of the struct ability because abilities can be weakened but not the other direction. |
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.
Lines too long
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.
LGTM, thanks! Some minor comments from previous review are still pending, but those we can address as a follow-up if you prefer.
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.
LGTM, a step toward the right direction.
I'm aware that the PR mostly moves things around, but given the amount of critical code you've touched, I'd recommend us being cautious and run replay before landing the PR.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Refactoring interpreter and paranoid mode, introducing traits to allow generic interpreter as well as compile time switch for the runtime type checks (formerly called paranoid mode)
How Has This Been Tested?
Existing tests
Key Areas to Review
Should focus on making sure that the high level logic has not changed!
Type of Change
Which Components or Systems Does This Change Impact?
Checklist