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

chore: remove all instances of inline(always) from corelib #6114

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

javra
Copy link
Contributor

@javra javra commented Aug 1, 2024

As suggested by @orizi in the discussion to PR #5911.


This change is Reviewable

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.

Reviewed 25 of 25 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @javra)


corelib/src/option.cairo line 56 at r1 (raw file):

    fn unwrap(self: Option<T>) -> T {
        self.expect('Option::unwrap failed.')
    }

these are a must - without your builds would crash.

Suggestion:

    #[inline(never)]
    fn expect(self: Option<T>, err: felt252) -> T {
        match self {
            Option::Some(x) => x,
            Option::None => core::panic_with_felt252(err),
        }
    }

    #[inline(never)]
    fn unwrap(self: Option<T>) -> T {
        self.expect('Option::unwrap failed.')
    }

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.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @javra)

a discussion (no related file):
@ilyalesokhin-starkware for 2nd eye.


Copy link
Contributor Author

@javra javra left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @orizi)


corelib/src/option.cairo line 56 at r1 (raw file):

Previously, orizi wrote…

these are a must - without your builds would crash.

Did you mean to add never? They were inline(always) before.

What's special about unwrap and expect in terms of inlining? You already mentioned it on the other PR and I tested it on a small example which didn't crash.

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.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @javra)


corelib/src/option.cairo line 56 at r1 (raw file):

Previously, javra (Jakob von Raumer) wrote…

Did you mean to add never? They were inline(always) before.

What's special about unwrap and expect in terms of inlining? You already mentioned it on the other PR and I tested it on a small example which didn't crash.

i meant always - sorry.

it is required due to code doing withdraw_gas().unwrap() (or expect).
if it isn't inlined - gas variables won't be able to properly be solved.

Copy link
Contributor Author

@javra javra left a comment

Choose a reason for hiding this comment

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

Reviewable status: 24 of 25 files reviewed, 2 unresolved discussions (waiting on @orizi)


corelib/src/option.cairo line 56 at r1 (raw file):

Previously, orizi wrote…

i meant always - sorry.

it is required due to code doing withdraw_gas().unwrap() (or expect).
if it isn't inlined - gas variables won't be able to properly be solved.

Done.

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:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @javra)

@javra
Copy link
Contributor Author

javra commented Aug 7, 2024

@ilyalesokhin-starkware

@javra
Copy link
Contributor Author

javra commented Aug 29, 2024

Can we move this forward before it rots more than it already has? 😅 cc @orizi

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @javra)

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.

yes - sorry - unblocking - rebase and i'll merge.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @javra)

Copy link
Contributor Author

@javra javra left a comment

Choose a reason for hiding this comment

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

done 👍

Reviewable status: 1 of 25 files reviewed, all discussions resolved (waiting on @orizi)

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:

Reviewed 24 of 24 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @javra)

@orizi orizi enabled auto-merge August 29, 2024 08:26
@orizi orizi added this pull request to the merge queue Aug 29, 2024
Merged via the queue into starkware-libs:main with commit 0d88a8f Aug 29, 2024
44 checks passed
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