-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Stackless bytecode #22428
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
base: main
Are you sure you want to change the base?
Stackless bytecode #22428
Conversation
Playing with model-2
- A bit of refactoring - ```move stackless --old``` now prints the old stackless bytecode version - ```move stackless --disassemble``` now prints the disassembled source bytecode using move-model-2 (a lot of opcodes are still missing) - ```move stackless``` now prints the first attempt of stackless conversion (a lot of opcodes are still missing)
## Description See title ## Test plan New tests, and now `cargo insta test` and `cargo insta review` work for the stackless bytecode generator. --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: --------- Co-authored-by: Cameron Swords <cgswords@CameronacStudio.hsd1.wa.comcast.net>
…stack-and-labels' into lorenzo/stackless-bytecode-2
Constant inlining optimization to the stackless bytecode translation process added. Deserializing constant Vectors from BCS.
CLI --optimized flag added
…to lorenzo/stackless-bytecode-2
Error[E03006]: unexpected name in this position ┌─ tests/move/vector/sources/Vector.move:30:9 │ │ vector::tabulate!(10, |i| i ) │ ^^^^^^ Could not resolve the name 'vector'
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
external-crates/move/crates/move-stackless-bytecode-2/src/disassembler.rs
Outdated
Show resolved
Hide resolved
// Copyright (c) The Diem Core Contributors | ||
// Copyright (c) The Move Contributors | ||
// SPDX-License-Identifier: Apache-2.0 |
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.
This file (and all new files) should have the following copyright header:
// Copyright (c) The Diem Core Contributors | |
// Copyright (c) The Move Contributors | |
// SPDX-License-Identifier: Apache-2.0 | |
// Copyright (c) The Move Contributors | |
// SPDX-License-Identifier: Apache-2.0 |
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.
.Move files have this copyright:
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
Should I replace those as well?
external-crates/move/crates/move-stackless-bytecode-2/src/stackless/translate.rs
Outdated
Show resolved
Hide resolved
@@ -29,17 +29,12 @@ members = [ | |||
|
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.
It is concerning that we removed so much from the toml
-- perhaps a rebase is in order?
@@ -0,0 +1,79 @@ | |||
// Copyright (c) The Move Contributors |
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.
external-crates/move/crates/move-stackless-bytecode-2/src/tester.rs
Outdated
Show resolved
Hide resolved
external-crates/move/crates/move-stackless-bytecode-2/src/utils.rs
Outdated
Show resolved
Hide resolved
external-crates/move/crates/move-stackless-bytecode-2/tests/tests.rs
Outdated
Show resolved
Hide resolved
external-crates/move/crates/move-stackless-bytecode-2/src/stackless/translate.rs
Outdated
Show resolved
Hide resolved
external-crates/move/crates/move-stackless-bytecode-2/src/stackless/translate.rs
Outdated
Show resolved
Hide resolved
external-crates/move/crates/move-stackless-bytecode-2/src/stackless/translate.rs
Outdated
Show resolved
Hide resolved
let args = _struct_ref | ||
.struct_ | ||
.fields | ||
.0 | ||
.iter() | ||
.map(|_| Var(ctxt.pop_register())) | ||
.collect::<Vec<_>>(); |
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.
Consider a macro or helper function for this pattern, as it is repeated a number of places.
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.
Done, for this I added this:
macro_rules! make_vec {
($n:expr, $e:expr) => {{ (0..$n).map(|_| $e).collect::<Vec<_>>() }};
}
I also added push!()
and pop!()
macros
…to lorenzo/stackless-bytecode-2
First version of stackless bytecode implemented using model 2.
It also contains optimization for immediates inlining.