Skip to content

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

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open

Stackless bytecode #22428

wants to merge 39 commits into from

Conversation

lollobene
Copy link

First version of stackless bytecode implemented using model 2.
It also contains optimization for immediates inlining.

lollobene and others added 29 commits May 26, 2025 18:15
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.
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'
Copy link

vercel bot commented Jun 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 2:17pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jun 19, 2025 2:17pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jun 19, 2025 2:17pm

@vercel vercel bot temporarily deployed to Preview – sui-kiosk June 18, 2025 15:57 Inactive
Comment on lines 1 to 3
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0
Copy link
Contributor

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:

Suggested change
// 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

Copy link
Author

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?

@@ -29,17 +29,12 @@ members = [

Copy link
Contributor

@cgswords cgswords Jun 18, 2025

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
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not the largest fan of exposing this as a top-level tool -- do @tzakian or @tnowacki have thoughts?

Comment on lines 293 to 299
let args = _struct_ref
.struct_
.fields
.0
.iter()
.map(|_| Var(ctxt.pop_register()))
.collect::<Vec<_>>();
Copy link
Contributor

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.

Copy link
Author

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

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.

2 participants