| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Make the JIT optimizer understand that slicing a string/list/tuple returns the same type. |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| Expand Up | @@ -1216,6 +1216,20 @@ dummy_func(void) { | |||||||
| sym_set_const(callable, list_append); | ||||||||
| } | ||||||||
|
|
||||||||
| op(_BINARY_SLICE, (container, start, stop -- res)) { | ||||||||
| // Slicing a string/list/tuple always returns the same type. | ||||||||
| PyTypeObject *type = sym_get_type(container); | ||||||||
| if (type == &PyUnicode_Type || | ||||||||
| type == &PyList_Type || | ||||||||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
I do not know whether slicing a bytes object occurs often enough to add PyBytes_Type here (and whether the jit slows down if we add more cases here), but if I understand correctly slicing bytes (or bytearray) results in a bytes (or bytearray) so we could add them.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality@fluhus, this PR is probably fine for now, but feel free to add other sequence types like this in a follow-up PR (with tests)!
Sorry, something went wrong.
All reactions
|
||||||||
| type == &PyTuple_Type) | ||||||||
| { | ||||||||
| res = sym_new_type(ctx, type); | ||||||||
| } | ||||||||
| else { | ||||||||
| res = sym_new_not_null(ctx); | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| // END BYTECODES // | ||||||||
|
|
||||||||
| } | ||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityNice!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.