Skip to content

Run bytecode meta-compilation tests fast #189

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 8 commits into
base: main
Choose a base branch
from

Conversation

PalumboN
Copy link
Contributor

@PalumboN PalumboN commented May 12, 2025

Fix #169

This PR introduce the DRBytecodeCompilationTestResource resource for all the tests compiling bytecode handlers.

The idea is:

  • Do all the meta-compilations once on the resource
  • Each test just invoke the generator and test the compiled code on Unicorn

I also removed all dependencies to PharoCodeGenerator (dead code)

@PalumboN PalumboN changed the title P12 druid faster tests Faster tests May 12, 2025
@PalumboN PalumboN changed the title Faster tests Run bytecode meta-compilation tests fast May 12, 2025
Comment on lines -1279 to 1013
"Push temporary 0 -- aka first argument if there are arguments"
self doCompileBytecode: 64 selector: #pushTemporaryVariableBytecode.
cogit methodOrBlockNumArgs: 1.
cogit methodOrBlockNumTemps: 1.
cogit initSimStackForFramefulMethod: 2.

self compileBytecode: 76 selector: #pushReceiverBytecode thenDo: [ :generator |
cogit methodOrBlockNumArgs: 1.
cogit methodOrBlockNumTemps: 1.
cogit initSimStackForFramefulMethod: 2.

"Push argument 0"
cogit gen_pushTemporaryVariableBytecode.

"Push the temp, then pop it"
generator value.
cogit ssPopTopToReg: (cogit allocateRegNotConflictingWith: 0).

"Pop the value pushed by the first bytecode"
cogit ssPopTopToReg: ReceiverResultReg.
self compileBytecode: [
"Push temporary 0 -- aka first argument if there are arguments"
self compileBytecodeSelector: #pushTemporaryVariableBytecode.

"Return the top of the stack which is the receiver"
cogit genUpArrowReturn ].
"Push receiver, then pop it"
self compileBytecodeSelector: #pushReceiverBytecode.
cogit ssPopTopToReg: (cogit allocateRegNotConflictingWith: 0).

cogit genReturnTopFromMethod ].

self
executeMethodWithReceiver: (memory integerObjectOf: 17)
executeMethodWithReceiver: memory nilObject
withArguments: #( 42 ).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is failing (just) on Ubuntu, now 🤔

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.

Avoid meta-compilation on each test
1 participant