-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Misc problems for interpreter
simulation
#612
Comments
2 Reference Counting
fn swap_loc(&mut self, idx: usize, x: Value, violation_check: bool) -> PartialVMResult<Value> {
let mut v = self.0.borrow_mut();
match v.get_mut(idx) {
Some(v) => {
if violation_check {
if let ValueImpl::Container(c) = v {
if c.rc_count() > 1 {
return Err(PartialVMError::new(
StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR,
)
.with_message(
"moving container with dangling references".to_string(),
));
}
}
}
Ok(Value(std::mem::replace(v, x.0)))
}
None => Err(
PartialVMError::new(StatusCode::VERIFIER_INVARIANT_VIOLATION).with_message(
format!("local index out of bounds: got {}, len: {}", idx, v.len()),
),
),
}
} In which there's a particular line: if c.rc_count() > 1 { // <- we are using the counter for rc values here So the problem is, we have to concern about |
We can ignore the external libraries for now and axiomatize the serialization/deserialization functions. This will block the evaluation if we try to run |
OK, this function seems quite complicated; this is the first time I have seen some code using the For now, what we can do is assume that |
1 Deserializing constant
In
Bytecode::LdConst
's case forexecute_instruction
, we will usedeserialize_constant
to deserialize a raw stream of u8 into a specific constant type.In
values_impl
, this function is defined by the following:Other dependencies are not presented in the above code.
But generally for
execute_instruction
to deserialize a constant:Constant
type, that contains a specified type ofSignatureToken
and a stream of[u8]
Constant
into a almost identical "layout", filtering out irrevalent items such asStruct
,TypeParameter
which are not types for constants. The layout would be stored in aSeedWrapper
SeedWrapper
also implements a deserializer. We use externalbcs
library to invoke the deserializer to massage the[u8]
stream into a singleValue
.Question: taken that the deserialization procedure involves external library, do we need to implement the deserializing process?
The text was updated successfully, but these errors were encountered: