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

Add ReadRef, WriteRef, [Unpack & UnpackGeneric] (commented because of mutual dependency in impl_values.v) definitions. #622

Merged
merged 15 commits into from
Nov 13, 2024

Conversation

0xMushow
Copy link
Collaborator

No description provided.

@0xMushow 0xMushow requested a review from clarus November 13, 2024 09:41
Comment on lines 1082 to 1088
| Bytecode.WriteRef =>
letS!? reference := liftS! Interpreter.Lens.lens_state_self (
liftS! Interpreter.Lens.lens_operand_stack $ Stack.Impl_Stack.pop_as Reference.t) in
letS!? value := liftS! Interpreter.Lens.lens_state_self (
liftS! Interpreter.Lens.lens_operand_stack Stack.Impl_Stack.pop) in
letS!? _ := returnS! $ Impl_ReferenceImpl.write_ref reference value in
returnS! $ Result.Ok InstrRet.Ok
Copy link
Collaborator

Choose a reason for hiding this comment

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

With one more level of indentation

@@ -1,4 +1,6 @@
Require Import CoqOfRust.CoqOfRust.
Require Import Coq.Lists.List.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not need this line, as we prefix all the calls to list functions with List. to help to know where they are from when reading the code.

@@ -1,4 +1,6 @@
Require Import CoqOfRust.CoqOfRust.
Require Import Coq.Lists.List.
Import ListNotations.
Copy link
Collaborator

Choose a reason for hiding this comment

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

These notations should already be in Require Import CoqOfRust.CoqOfRust..

@@ -7,6 +9,7 @@ Import simulations.M.Notations.
Require CoqOfRust.move_sui.simulations.move_binary_format.errors.
Module PartialVMResult := errors.PartialVMResult.
Module PartialVMError := errors.PartialVMError.
Import PartialVMResult.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should avoid this Import otherwise it is too unclear where the calls are from.

Module ReferenceImpl.
Inductive t : Set :=
| IndexedRef : IndexedRef.t -> t
| ContainerRef : ContainerRef.t -> t
.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should not have an empty line at the end of modules actually, even if this is often the case in our current code.

@0xMushow
Copy link
Collaborator Author

I will put these changes to effect. What about the L. 687 in values_impl.v ?

@0xMushow 0xMushow linked an issue Nov 13, 2024 that may be closed by this pull request
19 tasks
@0xMushow 0xMushow merged commit 01b2542 into main Nov 13, 2024
1 check passed
@0xMushow 0xMushow changed the title Add ReadRef & WriteRef implementation to the interpreter. Add ReadRef, WriteRef, [Unpack & UnpackGeneric] (commented because of mutual dependency in impl_values.v) definitions. Nov 13, 2024
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.

Complete interpreter instructions at the end
2 participants