Skip to content

Commit

Permalink
Use TRCodeCacheManager in test shell
Browse files Browse the repository at this point in the history
This commit makes use of `TRCodeCacheManager` in test shell, tying both
nzones and heaps (introduced in commit "Extend test shell") together.

This allows to test PIC code and relocation processing in various
scenarios such as when relaxation is or is not possible and/or use of
GOT/PLT entries.
  • Loading branch information
janvrany committed Nov 29, 2024
1 parent 639d0af commit 441dc6d
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/Tinyrossa-Tests/TRCompilationTestShell.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Class {
'target',
'binary',
'debugger',
'codeCacheManager',
'nzone1Base',
'nzone1Size',
'nzone1',
Expand Down Expand Up @@ -107,21 +108,17 @@ TRCompilationTestShell >> entry: entry [
{ #category : #accessing }
TRCompilationTestShell >> heap1 [
heap1 isNil ifTrue: [
| runtime |

runtime := TRRuntime forTarget: target.
heap1 := TRCodeCache runtime: runtime base: heap1Base size: heap1Size memory: debugger selectedInferior memory.
heap1 := TRCodeCache runtime: (codeCacheManager runtime) base: heap1Base size: heap1Size memory: debugger selectedInferior memory.
codeCacheManager addSegment: heap1.
].
^ heap1
]

{ #category : #accessing }
TRCompilationTestShell >> heap2 [
heap2 isNil ifTrue: [
| runtime |

runtime := TRRuntime forTarget: target.
heap2 := TRCodeCache runtime: runtime base: heap2Base size: heap2Size memory: debugger selectedInferior memory.
heap2 := TRCodeCache runtime: (codeCacheManager runtime) base: heap2Base size: heap2Size memory: debugger selectedInferior memory.
codeCacheManager addSegment: heap2.
].
^ heap2
]
Expand All @@ -145,6 +142,8 @@ TRCompilationTestShell >> initializeWithTarget: aTRCompilationTarget [
entryBase := 16r00090000.
entrySize := 8.

codeCacheManager := TRCodeCacheManager runtime: (TRRuntime forTarget: target).

self setUp.
]

Expand Down Expand Up @@ -219,21 +218,17 @@ TRCompilationTestShell >> nzone [
{ #category : #accessing }
TRCompilationTestShell >> nzone1 [
nzone1 isNil ifTrue: [
| runtime |

runtime := TRRuntime forTarget: target.
nzone1 := TRCodeCache runtime: runtime base: nzone1Base size: nzone1Size memory: debugger selectedInferior memory.
nzone1 := TRCodeCache runtime: (codeCacheManager runtime) base: nzone1Base size: nzone1Size memory: debugger selectedInferior memory.
codeCacheManager addSegment: nzone1.
].
^ nzone1
]

{ #category : #accessing }
TRCompilationTestShell >> nzone2 [
nzone2 isNil ifTrue: [
| runtime |

runtime := TRRuntime forTarget: target.
nzone2 := TRCodeCache runtime: runtime base: nzone2Base size: nzone2Size memory: debugger selectedInferior memory.
nzone2 := TRCodeCache runtime: (codeCacheManager runtime) base: nzone2Base size: nzone2Size memory: debugger selectedInferior memory.
codeCacheManager addSegment: nzone2.
].
^ nzone2
]
Expand Down

0 comments on commit 441dc6d

Please sign in to comment.