Add Jit integration tests#2187
Merged
BenLewis-Seequent merged 4 commits intoSep 18, 2020
Merged
Conversation
coolreader18
approved these changes
Sep 7, 2020
Member
coolreader18
left a comment
There was a problem hiding this comment.
Nice work! I really like the freeze/compile separation, and the tests for jit look good
|
|
||
| // Pop all values from stack: | ||
| for _ in 0..amount { | ||
| values.push(self.stack.pop().unwrap()); |
Member
There was a problem hiding this comment.
You might be able to do something like values.extend(stack.drain(len-amount..).rev()) here
|
|
||
| // Push other value back in order: | ||
| for value in values.into_iter().rev() { | ||
| self.stack.push(value); |
854553c to
b0e97f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This add a test utility macro
jit_function, which allows declaring jitted python functions inside rust test functions. Example:The above define the python function
add, which is compiled to bytecode at compile time. That bytecode is then jitted into native code at runtime(we could also do this a compile time in the future). The return value of the macro is a lambda with the signaturefn(i64, i64) -> i64.As part of that I refactored
py_compile_bytecodeinto two different macrospy_compileandpy_freeze.