Skip to content

Commit

Permalink
Merge pull request #158 from Alamvic/simple-paper
Browse files Browse the repository at this point in the history
Simple paper
  • Loading branch information
PalumboN authored Dec 3, 2024
2 parents f31c2bc + 39946f0 commit 050892f
Show file tree
Hide file tree
Showing 24 changed files with 3,703 additions and 3,242 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ jobs:
- name: Load Image and Run Tests
run: smalltalkci -s ${{ matrix.smalltalk }} ${{ matrix.ston }}
shell: bash
timeout-minutes: 30
timeout-minutes: 60
42 changes: 32 additions & 10 deletions Druid-Tests/DRBytecodeCompilationTest.class.st
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
Class {
#name : #DRBytecodeCompilationTest,
#superclass : #DRDruidTest,
#superclass : #DRMetaCompilationTest,
#category : #'Druid-Tests'
}

{ #category : #'building suites' }
DRBytecodeCompilationTest class >> cogitStyleParameter [

^ ParametrizedTestMatrix new
addCase: { #cogitStyle -> #beForStackToRegisterMapping. #compilerClass -> DruidTestRTLCompiler};
"addCase: { #cogitStyle -> #beForSimpleStack. #compilerClass -> SimpleDruidTestRTLCompiler};"
yourself
]

{ #category : #enumerating }
DRBytecodeCompilationTest >> compileBytecode: bytecode1 selector: selector1 andBytecode: bytecode2 selector: selector2 thenDo: aFullBlockClosure [

Expand All @@ -18,7 +27,7 @@ DRBytecodeCompilationTest >> compileBytecode: bytecode1 selector: selector1 andB
};
interpreter: self interpreter;
targetName: generatorSelector;
configureForCompilerClass: DruidTestRTLCompiler.
configureForCompilerClass: compilerClass.

compiler compile.
"Then generate the machine code for that method"
Expand Down Expand Up @@ -47,7 +56,7 @@ DRBytecodeCompilationTest >> compileBytecode: bytecode selector: aSelector optio
compiler := DRBytecodeCompilerCompiler new
bytecodes: { (bytecode -> aSelector) };
interpreter: self interpreter;
configureForCompilerClass: DruidTestRTLCompiler;
configureForCompilerClass: compilerClass;
addCompilerOptions: options.

compiler compile.
Expand Down Expand Up @@ -87,23 +96,35 @@ DRBytecodeCompilationTest >> doCompileBytecode: bytecode selector: aSelector [
compiler := DRBytecodeCompilerCompiler new
sourceName: aSelector;
interpreter: self interpreter;
configureForCompilerClass: DruidTestRTLCompiler.
configureForCompilerClass: compilerClass.

compiler compile.
]

{ #category : #initialization }
DRBytecodeCompilationTest >> initializeSStack: argCount [

self isSimpleStack ifTrue: [ ^ self ]. "No SSTack"

cogit ssPushRegister: ReceiverResultReg.
argCount > 0 ifTrue: [ cogit ssPushRegister: Arg0Reg ].
argCount > 1 ifTrue: [ cogit ssPushRegister: Arg1Reg ]
]

{ #category : #helpers }
DRBytecodeCompilationTest >> makeFrame: aReceiver arguments: arguments method: aMethod [

"Callee side - make up the frame"

"Now push the link register, it will be popped by the return"
machineSimulator hasLinkRegister ifTrue: [
self pushAddress: machineSimulator linkRegisterValue ].
self pushAddress: machineSimulator fp.
machineSimulator fp: machineSimulator smalltalkStackPointerRegisterValue.
machineSimulator fp:
machineSimulator smalltalkStackPointerRegisterValue.
self pushAddress: aMethod.
self pushAddress: 0 "context".
self pushAddress: aReceiver.
self pushAddress: 0. "context"
self pushAddress: aReceiver.
"arguments do: [ :anArgument | self pushAddress: anArgument ]."

]

Expand All @@ -119,9 +140,10 @@ DRBytecodeCompilationTest >> prepareStackForPrimitiveReceiver: aReceiver argumen
DRBytecodeCompilationTest >> prepareStackForSendReceiver: aReceiver arguments: arguments method: aMethod [

super prepareStackForSendReceiver: aReceiver arguments: arguments method: aMethod.

self makeFrame: aReceiver arguments: arguments method: aMethod.


self flag: #TODO. "Receive this by param, method is not used for the tests"
cogit methodOrBlockNumTemps timesRepeat: [
self pushAddress: memory nilObject ]

Expand Down
Loading

0 comments on commit 050892f

Please sign in to comment.