Skip to content

Conversation

@ilyalesokhin-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

ilyalesokhin-starkware commented Dec 3, 2025

@ilyalesokhin-starkware
Copy link
Contributor Author

crates/cairo-lang-executable/src/compile_test_data/basic line 902 at r2 (raw file):

ret;
// footer
ret;

with standalone_mode = false.

Suggestion:

//! > standalone_mode
false

//! > cairo_code
#[executable]
#[inline(never)]
fn main() implicits(RangeCheck, Bitwise) {}

//! > result
// builtins: output, range_check, bitwise
// header
[ap + 0] = [fp + -4], ap++;
[ap + 0] = [fp + -3], ap++;
%{ WriteRunParam { dst: [ap + 0], index: 0 } %}
[ap + 2] = [fp + -5], ap++;
[ap + 2] = [fp + -5], ap++;
ap += 2;
call rel 9;
[ap + 0] = 0, ap++;
%{ AddMarker { start: memory[ap + -3], end: memory[ap + -2] } %}
[ap + -1] = [ap + -4];
[ap + 0] = [ap + -2], ap++;
[ap + 0] = [ap + -7], ap++;
[ap + 0] = [ap + -7], ap++;
ret;
// sierra based code
[fp + -5] = [ap + 0] + [fp + -6], ap++;
jmp rel 4 if [ap + -1] != 0;
jmp rel 11;
call rel 20;
[ap + 0] = [fp + -8], ap++;
[ap + 0] = [fp + -7], ap++;
[ap + 0] = 1, ap++;
[ap + 0] = [ap + -5], ap++;
[ap + 0] = [ap + -5], ap++;
ret;
ap += 4;
[ap + 0] = [fp + -8], ap++;
[ap + 0] = [fp + -7], ap++;
call rel 12;
[ap + 0] = 0, ap++;
[ap + 0] = [fp + -4], ap++;
[ap + 0] = [fp + -3], ap++;
ret;
[ap + 0] = 117999715903629884655797335944760714204113152088920212735095598, ap++;
call rel 6;
ret;
[ap + 0] = [fp + -4], ap++;
[ap + 0] = [fp + -3], ap++;
ret;
%{ memory[ap + 0] = segments.add() %}
ap += 1;
[fp + -3] = [[ap + -1] + 0];
[ap + 0] = [ap + -1], ap++;
[ap + 0] = [ap + -2] + 1, ap++;
ret;
// footer
ret;

@ilyalesokhin-starkware
Copy link
Contributor Author

crates/cairo-lang-executable/src/compile_test_data/basic line 1010 at r2 (raw file):

ret;
// footer
ret;

with standalone_mode = false.

Suggestion:

//! > standalone_mode
false

//! > cairo_code
#[executable]
#[inline(never)]
fn main() implicits(RangeCheck, Bitwise, SegmentArena) {}

//! > result
// builtins: output, range_check, bitwise
// header
ap += 3;
%{ memory[ap + 0] = segments.add() %}
%{ memory[ap + 1] = segments.add() %}
[ap + 2] = 0, ap++;
[ap + 0] = [[ap + -1] + 0], ap++;
[ap + 0] = [[ap + -2] + 1], ap++;
[ap + -1] = [[ap + -3] + 2];
[ap + 0] = [fp + -4], ap++;
[ap + 0] = [fp + -3], ap++;
[ap + 0] = [ap + -5] + 3, ap++;
%{ WriteRunParam { dst: [ap + 0], index: 0 } %}
[ap + 2] = [fp + -5], ap++;
[ap + 2] = [fp + -5], ap++;
ap += 2;
call rel 36;
[ap + 0] = 0, ap++;
%{ AddMarker { start: memory[ap + -3], end: memory[ap + -2] } %}
[ap + -1] = [ap + -4];
[fp + 0] = [ap + -7];
[fp + 1] = [ap + -6];
[fp + 2] = [ap + -2];
[ap + 0] = [[ap + -5] + -2], ap++;
[ap + 0] = [[ap + -6] + -1], ap++;
[ap + -2] = [ap + -1];
jmp rel 4 if [ap + -2] != 0;
jmp rel 19;
[ap + 0] = [[ap + -7] + -3], ap++;
[ap + -3] = [ap + 0] + 1, ap++;
jmp rel 4 if [ap + -1] != 0;
jmp rel 12;
[ap + 0] = [[ap + -2] + 1], ap++;
[ap + 0] = [[ap + -3] + 3], ap++;
%{ memory.add_relocation_rule(src_ptr=memory[ap + -1], dest_ptr=memory[ap + -2] + 1) %}
[ap + -1] = [ap + -2] + 1;
[ap + 0] = [ap + -4] + 3, ap++;
[ap + -4] = [ap + 0] + 1, ap++;
jmp rel -12;
[ap + 0] = [fp + 2], ap++;
[ap + 0] = [fp + 0], ap++;
[ap + 0] = [fp + 1], ap++;
ret;
// sierra based code
[fp + -5] = [ap + 0] + [fp + -6], ap++;
jmp rel 4 if [ap + -1] != 0;
jmp rel 12;
call rel 23;
[ap + 0] = [fp + -9], ap++;
[ap + 0] = [fp + -8], ap++;
[ap + 0] = [fp + -7], ap++;
[ap + 0] = 1, ap++;
[ap + 0] = [ap + -6], ap++;
[ap + 0] = [ap + -6], ap++;
ret;
[ap + 0] = [fp + -9], ap++;
[ap + 0] = [fp + -7], ap++;
[ap + 0] = [fp + -8], ap++;
call rel 15;
[ap + 0] = [ap + -3], ap++;
[ap + 0] = [ap + -2], ap++;
[ap + 0] = [ap + -4], ap++;
[ap + 0] = 0, ap++;
[ap + 0] = [fp + -4], ap++;
[ap + 0] = [fp + -3], ap++;
ret;
[ap + 0] = 117999715903629884655797335944760714204113152088920212735095598, ap++;
call rel 7;
ret;
[ap + 0] = [fp + -5], ap++;
[ap + 0] = [fp + -4], ap++;
[ap + 0] = [fp + -3], ap++;
ret;
%{ memory[ap + 0] = segments.add() %}
ap += 1;
[fp + -3] = [[ap + -1] + 0];
[ap + 0] = [ap + -1], ap++;
[ap + 0] = [ap + -2] + 1, ap++;
ret;
// footer
ret;

@ilyalesokhin-starkware
Copy link
Contributor Author

crates/cairo-lang-executable/src/compile_test_data/basic line 1010 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

with standalone_mode = false.

ignore, there was a here where local_exprs and output_builtin_vars got out of sync.

See r2 <-> r3

@ilyalesokhin-starkware
Copy link
Contributor Author

crates/cairo-lang-executable/src/compile_test_data/basic line 902 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

with standalone_mode = false.

ignore, same a the comment bellow.

@ilyalesokhin-starkware
Copy link
Contributor Author

crates/cairo-lang-runnable-utils/src/builder.rs line 428 at r4 (raw file):

                casm_build_extend!(self.ctx, localvar local;);
                self.local_exprs.insert(BuiltinName::output, self.ctx.get_value(local, false));
            }

Why wasn't this needed before?

Code quote:

            if !self.config.testing {
                // Add a local variable for the output builtin
                casm_build_extend!(self.ctx, localvar local;);
                self.local_exprs.insert(BuiltinName::output, self.ctx.get_value(local, false));
            }

Copy link
Contributor Author

@ilyalesokhin-starkware ilyalesokhin-starkware left a comment

Choose a reason for hiding this comment

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

@ilyalesokhin-starkware resolved 2 discussions.
Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion.

@ilyalesokhin-starkware
Copy link
Contributor Author

crates/cairo-lang-runnable-utils/src/builder.rs line 428 at r4 (raw file):

Previously, ilyalesokhin-starkware wrote…

Why wasn't this needed before?

ok, it's because of the change above.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

@orizi reviewed 5 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware).


crates/cairo-lang-runnable-utils/src/builder.rs line 583 at r5 (raw file):

        }

        for (name, var) in self.input_builtin_vars.iter() {

doc the loop.

@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from ilya/ty_to_name to graphite-base/8856 January 1, 2026 14:43
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from graphite-base/8856 to ilya/builtin_vars January 1, 2026 14:44
Copy link
Contributor Author

@ilyalesokhin-starkware ilyalesokhin-starkware left a comment

Choose a reason for hiding this comment

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

@ilyalesokhin-starkware made 1 comment.
Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @orizi).


crates/cairo-lang-runnable-utils/src/builder.rs line 583 at r5 (raw file):

Previously, orizi wrote…

doc the loop.

done,
decided to merge self.input_builtin_vars and self.output_builtin_vars in the process.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware).

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

@orizi reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware).

@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from graphite-base/8856 to main January 4, 2026 09:07
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from main to graphite-base/8856 January 4, 2026 09:08
@ilyalesokhin-starkware ilyalesokhin-starkware changed the base branch from graphite-base/8856 to main January 4, 2026 09:21
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

@orizi reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware).

@ilyalesokhin-starkware ilyalesokhin-starkware added this pull request to the merge queue Jan 4, 2026
Merged via the queue into main with commit 4876b97 Jan 4, 2026
55 checks passed
@orizi orizi deleted the ilya/builtin_list branch January 5, 2026 07:54
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.

4 participants