Skip to content

Commit aadf589

Browse files
authored
Merge pull request #107 from guillep/cleanups
Cleanups
2 parents 6646346 + 4f2fdc9 commit aadf589

3 files changed

Lines changed: 68 additions & 16 deletions

File tree

src/BaselineOfSindarin/BaselineOfSindarin.class.st

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ BaselineOfSindarin >> baseline: spec [
1010

1111
<baseline>
1212
spec for: #common do: [
13-
spec postLoadDoIt: #postloadWithLoader:withPackageSpec:.
14-
1513
spec
1614
package: 'Sindarin';
1715
package: 'Sindarin-Tests';
@@ -21,17 +19,3 @@ BaselineOfSindarin >> baseline: spec [
2119
group: 'default' with: #( 'Sindarin' 'Sindarin-Tests' );
2220
group: 'experiments' with: #( 'default' 'Sindarin-Experiments' )
2321
]
24-
25-
{ #category : 'baselines' }
26-
BaselineOfSindarin >> postloadWithLoader: loader withPackageSpec: spec [
27-
28-
InstructionStream compiledMethodAt: #willJumpIfFalse ifAbsent: [
29-
Smalltalk compiler
30-
source: 'willJumpIfFalse
31-
"Answer whether the next bytecode is a jump-if-false."
32-
33-
^ self method encoderClass isBranchIfFalseAt: pc in: self method';
34-
class: InstructionStream;
35-
compile;
36-
install ]
37-
]

src/Sindarin-Tests/SindarinDebuggerTest.class.st

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,31 @@ SindarinDebuggerTest >> testStepUntilOverAnEnsureBlock [
20262026

20272027
]
20282028

2029+
{ #category : 'tests' }
2030+
SindarinDebuggerTest >> testSteppingAQuickMethod [
2031+
2032+
| newContext aMethodContext |
2033+
aMethodContext := Context
2034+
sender: thisContext
2035+
receiver: Rectangle new
2036+
method: Rectangle >> #center
2037+
arguments: #( ).
2038+
2039+
aMethodContext step.
2040+
aMethodContext stepIntoQuickMethod: true.
2041+
newContext := aMethodContext step.
2042+
2043+
"We're in the quick method now, it should be steppable"
2044+
self assert: newContext sender identicalTo: aMethodContext.
2045+
self deny: newContext instructionStream willReturn.
2046+
2047+
newContext := newContext step.
2048+
self assert: newContext instructionStream willReturn.
2049+
2050+
newContext := newContext step.
2051+
self assert: newContext identicalTo: aMethodContext
2052+
]
2053+
20292054
{ #category : 'tests' }
20302055
SindarinDebuggerTest >> testSteppingAnExecutionSignalingExceptions [
20312056
| scdbg |
@@ -2041,6 +2066,28 @@ SindarinDebuggerTest >> testSteppingAnExecutionSignalingExceptions [
20412066
raise: UnhandledExceptionSignalledByADebuggedExecution
20422067
]
20432068

2069+
{ #category : 'tests' }
2070+
SindarinDebuggerTest >> testSteppingReturnSelfMethod [
2071+
2072+
|newContext aMethodContext |
2073+
aMethodContext := Context
2074+
sender: thisContext
2075+
receiver: SimulationMock new
2076+
method: (SimulationMock >>#exampleSelfReturnCall)
2077+
arguments: #().
2078+
2079+
aMethodContext step.
2080+
aMethodContext stepIntoQuickMethod: true.
2081+
newContext := aMethodContext step.
2082+
2083+
"We're in the quick method now, it should be steppable"
2084+
self assert: newContext sender identicalTo: aMethodContext.
2085+
self assert: newContext instructionStream willReturn.
2086+
2087+
newContext := newContext step.
2088+
self assert: newContext identicalTo: aMethodContext
2089+
]
2090+
20442091
{ #category : 'tests' }
20452092
SindarinDebuggerTest >> testTemporaryNamed [
20462093
| dbg |

src/Sindarin/InstructionStream.extension.st

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
Extension { #name : 'InstructionStream' }
22

3+
{ #category : '*Sindarin' }
4+
InstructionStream >> willCreateBlock [
5+
"next bytecode is a block creation"
6+
7+
^ self method encoderClass isCreateFullBlockAt: pc in: self method
8+
]
9+
310
{ #category : '*Sindarin' }
411
InstructionStream >> willJump [
512
"Answer whether the next bytecode will jump."
@@ -21,6 +28,20 @@ InstructionStream >> willJumpTo [
2128
^ self method encoderClass isJumpAt: pc in: self method
2229
]
2330

31+
{ #category : '*Sindarin' }
32+
InstructionStream >> willReturn [
33+
"Answer whether the next bytecode is a return."
34+
35+
^ self method encoderClass isReturnAt: pc in: self method
36+
]
37+
38+
{ #category : '*Sindarin' }
39+
InstructionStream >> willSend [
40+
"Answer whether the next bytecode is a message-send."
41+
42+
^ self method encoderClass isSendAt: pc in: self method
43+
]
44+
2445
{ #category : '*Sindarin' }
2546
InstructionStream >> willSendOrReturnOrStoreOrCreateBlock [
2647

0 commit comments

Comments
 (0)