Skip to content

Commit

Permalink
- Delegating allocation of code zone to MemoryMap
Browse files Browse the repository at this point in the history
- Adding test for PermSpace creation
- Removing CogClass
- Unifying StackPages to use the model of the JIT in all modes
  • Loading branch information
tesonep committed Apr 4, 2022
1 parent 6da1a68 commit 0df698e
Show file tree
Hide file tree
Showing 29 changed files with 508 additions and 787 deletions.
36 changes: 9 additions & 27 deletions smalltalksrc/VMMaker/CoInterpreter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ Class {
{ #category : #translation }
CoInterpreter class >> ancilliaryClasses [
"Answer any extra classes to be included in the translation."
^(super ancilliaryClasses copyWithout: InterpreterStackPages),
{ CoInterpreterStackPages.
^ super ancilliaryClasses,
{
CogBlockMethod.
CogPrimitiveDescriptor. },
((Cogit ancilliaryClasses) select: [:class| class inheritsFrom: CogBlockMethod])
Expand Down Expand Up @@ -383,11 +383,6 @@ CoInterpreter class >> interpreterVersion [
^ 'Cog'
]

{ #category : #translation }
CoInterpreter class >> isAcceptableAncilliaryClass: aClass [
^aClass ~~ InterpreterStackPages
]

{ #category : #translation }
CoInterpreter class >> isNonArgumentImplicitReceiverVariableName: aString [
^(#('self' 'stackPages' 'cogit' 'coInterpreter' 'cogMethodZone' 'interpreter' 'objectMemory') includes: aString)
Expand Down Expand Up @@ -672,19 +667,12 @@ CoInterpreter >> addNewMethodToCache: classObj [
super addNewMethodToCache: classObj
]

{ #category : #allocating }
CoInterpreter >> allocateJITMemory: desiredSize _: desiredPosition [

<doNotGenerate>
^ memoryManager allocate: desiredSize desiredPosition: desiredPosition
]

{ #category : #'image save/restore' }
CoInterpreter >> allocateMemoryForImage: f withHeader: header [

<var: #f type: #sqImageFile>
<var: #header type: #SpurImageHeaderStruct>
| cogCodeBase desiredPositionOfHeap |

cogCodeSize := desiredCogCodeSize ~= 0
ifTrue: [ desiredCogCodeSize ]
ifFalse: [
Expand All @@ -694,23 +682,17 @@ CoInterpreter >> allocateMemoryForImage: f withHeader: header [

cogCodeSize := cogCodeSize min: cogit maxCogCodeSize.

cogCodeBase := self
allocateJITMemory: cogCodeSize
desiredPosition: header oldBaseAddr - cogCodeSize.

"We want to avoid the swizzle in case the allocation of the code space is much below in the address space than the requested one"
desiredPositionOfHeap := cogCodeBase + cogCodeSize max:
header oldBaseAddr.
objectMemory getMemoryMap initialCodeZoneSize: cogCodeSize.

self allocateMemoryForImageHeader: header desiredStartingAddress: desiredPositionOfHeap.
self allocateMemoryForImageHeader: header.

imageReader loadImageFromFile: f withHeader: header.

self beforeCodeZoneInitialization.

cogit
initializeCodeZoneFrom: cogCodeBase
upTo: cogCodeBase + cogCodeSize
initializeCodeZoneFrom: objectMemory getMemoryMap codeZoneStart
upTo: objectMemory getMemoryMap codeZoneEnd
]

{ #category : #'cog jit support' }
Expand Down Expand Up @@ -6456,8 +6438,8 @@ CoInterpreter >> stackPageHeadroom [
CoInterpreter >> stackPagesClass [
<doNotGenerate>
^VMBIGENDIAN
ifTrue: [CoInterpreterStackPagesMSB]
ifFalse: [CoInterpreterStackPagesLSB]
ifTrue: [VMStackPagesMSB]
ifFalse: [VMStackPagesLSB]
]

{ #category : #initialization }
Expand Down
235 changes: 0 additions & 235 deletions smalltalksrc/VMMaker/CoInterpreterStackPages.class.st

This file was deleted.

38 changes: 0 additions & 38 deletions smalltalksrc/VMMaker/CogClass.class.st

This file was deleted.

9 changes: 8 additions & 1 deletion smalltalksrc/VMMaker/CogMethodZone.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ youngReferrers
"
Class {
#name : #CogMethodZone,
#superclass : #CogClass,
#superclass : #VMClass,
#instVars : [
'youngReferrers',
'unpairedMethodList',
Expand Down Expand Up @@ -167,6 +167,13 @@ CogMethodZone >> allocationLimit [
^limitAddress - (methodCount * objectMemory wordSize)
]

{ #category : #'as yet unclassified' }
CogMethodZone >> baseAddress [

<doNotGenerate>
^ baseAddress
]

{ #category : #'as yet unclassified' }
CogMethodZone >> baseAddress: anInteger [

Expand Down
2 changes: 1 addition & 1 deletion smalltalksrc/VMMaker/CogObjectRepresentation.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ I am an abstract superclass for object representations whose job it is to genera
"
Class {
#name : #CogObjectRepresentation,
#superclass : #CogClass,
#superclass : #VMClass,
#instVars : [
'cogit',
'methodZone',
Expand Down
2 changes: 1 addition & 1 deletion smalltalksrc/VMMaker/Cogit.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ methodZoneBase <Integer>
"
Class {
#name : #Cogit,
#superclass : #CogClass,
#superclass : #VMClass,
#instVars : [
'coInterpreter',
'objectMemory',
Expand Down

0 comments on commit 0df698e

Please sign in to comment.