Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ classRoles
#Association -> #PCAssociation.
#BlockClosure -> #PCBlock.
#MethodContext -> #PCMethodContext.
#Message -> #PCMessage.
#Point -> #PCPoint.
#Process -> #PCProcess.
#Semaphore -> #PCSemaphore.
Expand All @@ -29,5 +30,7 @@ classRoles
#Dictionary -> #PCDictionary.
#ClassVariable -> #PCAssociation.
#ClassInstaller -> #PCClassBuilder.
#Smalltalk -> #PCSmalltalk
#Smalltalk -> #PCSmalltalk.
#SystemDictionary -> #PCDictionary.
#System -> #PCSystem
} asDictionary
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
as yet unclassified
classRoles
^{
#ProtoObject -> #Object.
#ProcessorScheduler -> #ProcessorScheduler.
#Context -> #MethodContext.
#Class -> #Class.
#Metaclass -> #Metaclass.
#Array -> #Array.
#MethodDictionary -> #MethodDictionary.
#CompiledMethod -> #CompiledMethod.
#Character -> #Character.
#ByteArray -> #ByteArray.
#Association -> #Association.
#BlockClosure -> #Block.
#MethodContext -> #MethodContext.
#Message -> #Message.
#Point -> #Point.
#Process -> #Process.
#Semaphore -> #Semaphore.
#ByteString -> #ByteString.
#ByteSymbol -> #Symbol.
#True -> #True.
#False -> #False.
#UndefinedObject -> #UndefinedObject.
#Float -> #Float.
#SmallInteger -> #SmallInteger.
#LargePositiveInteger -> #LargePositiveInteger.
#LargeNegativeInteger -> #LargeNegativeInteger.
#Dictionary -> #Dictionary.
#ClassVariable -> #Association.
#ClassInstaller -> #ClassBuilder.
#Smalltalk -> #SmalltalkImage.
#SystemDictionary -> #SystemDictionary.
#System -> #System
} asDictionary
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cleaning
clean

self cleanWithMetaclassNamed: #Metaclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "PBLanguageDefinitionPharoCandle",
"category" : "PBBuilder-LanguageDefinition",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "PBLanguageDefinitionPharoCodeParadise",
"type" : "normal"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ writeImageNamed: aString
| imageFileReference aDictionary pbImage |
imageFileReference := (self locationOfBootstrappedImages pathString, '/', aString, '.', PBImageInDisk imageExtension) asFileReference.
imageFileReference exists ifTrue: [
^ nil ].
"^ nil" ].
self pbRepository pbBootstrapper builder writeImageIn: imageFileReference .

aDictionary := {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
arrayClass

^ self classWithRole: #Array
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
associationClass

^ self classNamed: (systemDefinition classWithRole: #Association) name
^ self classWithRole: #Association
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ createInitialObjects
"We add the main globals in the bootstrap environment before a system dictionary exists. These globals are needed to create a system dictionary, and will be used by the AST interpreter"
self bootstrapEnvironment at: #Processor put: objectSpace nilObject.
self bootstrapEnvironment at: #Smalltalk put: objectSpace nilObject.
self bootstrapEnvironment at: #Undeclared put: (self bootstrapInterpreter evaluateCode: 'PCDictionary new').
self bootstrapEnvironment at: #Undeclared put: (self bootstrapInterpreter evaluateCode: 'theDictionary new' withTemps: { 'theDictionary' -> (self classWithRole: #Dictionary) mirror }).

classLoader initializeClassPools.

rsDictionary := self bootstrapInterpreter
evaluateCode: 'aClassNamesCollection asDictionary'
withTemps: {
evaluateCode: 'dictionaryClass withAll: aClassNamesCollection'
withTemps: {
'dictionaryClass' ->
(self classWithRole: #SystemDictionary) mirror .
'aClassNamesCollection' ->
(self objectSpace newArrayWithAll:
(self bootstrapEnvironment associations collect: [ :assoc |
Expand All @@ -25,13 +27,16 @@ createInitialObjects
rsDictionary at: assoc key put: assoc value ].
"

smalltalk := self bootstrapInterpreter evaluateCode: 'Smalltalk := PCSmalltalk new instVarAt: 1 put: aSystemDictionary ; yourself.'
withTemps: { 'aSystemDictionary' -> rsDictionary }.
smalltalk := self bootstrapInterpreter evaluateCode: 'Smalltalk := theSmalltalk new instVarAt: 1 put: aSystemDictionary ; yourself.'
withTemps: {
'theSmalltalk' -> (self classWithRole: #Smalltalk) mirror.
'aSystemDictionary' -> rsDictionary }.
self bootstrapEnvironment at: #Smalltalk put: smalltalk.
self bootstrapInterpreter evaluateCode: 'Smalltalk globals at: #Smalltalk put: Smalltalk'.
espellBackend systemDictionary: (smalltalk instanceVariableAtIndex: 1).


self bootstrapInterpreter evaluateCode: 'PCString initialize.'.
" self bootstrapInterpreter evaluateCode: 'theString initialize.' withTemps: { 'theString' -> (self classWithRole: #ByteString) mirror }."
self bootstrapInterpreter evaluateCode: 'theFloat initialize.' withTemps: { 'theFloat' -> (self classWithRole: #Float) mirror }.

self checkpoint: 'created_initial_objects'.
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,35 @@ createVMStubs
objectSpace falseObject: objectSpace falseObject.
objectSpace trueObject: objectSpace trueObject.

objectSpace nilObject setClass: (self createStubForClassNamed: #PCUndefinedObject).
objectSpace falseObject setClass: (self createStubForClassNamed: #PCFalse).
objectSpace trueObject setClass: (self createStubForClassNamed: #PCTrue).
objectSpace nilObject setClass: (self createStubForClassWithRole: #UndefinedObject).
objectSpace falseObject setClass: (self createStubForClassWithRole: #False).
objectSpace trueObject setClass: (self createStubForClassWithRole: #True).

objectSpace backend smallIntegerClass: (self createStubForClassNamed: #PCSmallInteger).
objectSpace backend characterClass: (self createStubForClassNamed: #PCCharacter).
objectSpace backend byteSymbolClass: (self createStubForClassNamed: #PCSymbol).
objectSpace backend byteStringClass: (self createStubForClassNamed: #PCString).
objectSpace backend byteArrayClass: (self createStubForClassNamed: #PCByteArray).
objectSpace backend associationClass: (self createStubForClassNamed: #PCAssociation).
objectSpace backend arrayClass: (self createStubForClassNamed: #PCArray).
objectSpace backend smallIntegerClass: (self createStubForClassWithRole: #SmallInteger).
objectSpace backend characterClass: (self createStubForClassWithRole: #Character).
objectSpace backend byteSymbolClass: (self createStubForClassWithRole: #ByteSymbol).
objectSpace backend byteStringClass: (self createStubForClassWithRole: #ByteString).
objectSpace backend byteArrayClass: (self createStubForClassWithRole: #ByteArray).
objectSpace backend associationClass: (self createStubForClassWithRole: #Association).
objectSpace backend arrayClass: (self createStubForClassWithRole: #Array).
objectSpace backend symbolTableClass: objectSpace backend byteSymbolClass.
objectSpace backend largeNegativeIntegerClass: (self createStubForClassNamed: #PCLargeNegativeInteger).
objectSpace backend largePositiveIntegerClass: (self createStubForClassNamed: #PCLargePositiveInteger).
objectSpace backend methodClass: (self createStubForClassNamed: #PCCompiledMethod).
objectSpace backend floatClass: (self createStubForClassNamed: #PCFloat).
objectSpace backend contextClass: (self createStubForClassNamed: #PCMethodContext).
objectSpace backend processClass: (self createStubForClassNamed: #PCProcess).
objectSpace backend blockClass: (self createStubForClassNamed: #PCBlock).
"objectSpace backend fullBlockClass: (self createStubForClassNamed: #PCFullBlockClosure)."
objectSpace backend messageClass: (self createStubForClassNamed: #PCMessage).
objectSpace backend semaphoreClass: (self createStubForClassNamed: #PCSemaphore).
objectSpace backend largeNegativeIntegerClass: (self createStubForClassWithRole: #LargeNegativeInteger).
objectSpace backend largePositiveIntegerClass: (self createStubForClassWithRole: #LargePositiveInteger).
objectSpace backend methodClass: (self createStubForClassWithRole: #CompiledMethod).
objectSpace backend floatClass: (self createStubForClassWithRole: #Float).
objectSpace backend contextClass: (self createStubForClassWithRole: #MethodContext).
objectSpace backend processClass: (self createStubForClassWithRole: #Process).
objectSpace backend blockClass: (self createStubForClassWithRole: #BlockClosure).
"objectSpace backend fullBlockClass: (self createStubForClassWithRole: #FullBlockClosure)."
objectSpace backend messageClass: (self createStubForClassWithRole: #Message).
objectSpace backend semaphoreClass: (self createStubForClassWithRole: #Semaphore).

"Point is required in the special objects array because it is used to instantiate point objects faster.
If we do not put it here, the VM will crash.
Lots of tests in kernel use it."
objectSpace backend pointClass: (self createStubForClassNamed: #PCPoint).
objectSpace backend pointClass: (self createStubForClassWithRole: #Point).

objectSpace backend processorAssociation: (self classNamed: #PCAssociation) mirror basicNew.
objectSpace backend processorAssociation: self newAssociation.
objectSpace backend processorAssociation
instanceVariableAtIndex: 2 put: (self createStubForClassNamed: #PCProcessorScheduler) basicNew.
objectSpace backend specialSelectors: ((self classNamed: #PCArray) mirror basicNew: 64)
instanceVariableAtIndex: 2 put: (self createStubForClassWithRole: #ProcessorScheduler) basicNew.
objectSpace backend specialSelectors: (self newArray: 64)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ formatOfClass: aRFiClass
| newHeap instSize newInstSpec |

newHeap := objectSpace backend simulator objectMemory.
((aRFiClass name = 'PCSmallInteger')
or: [(aRFiClass name = 'PCCharacter')]) ifTrue:
((aRFiClass name = (self classNameWithRole: #SmallInteger))
or: [(aRFiClass name = (self classNameWithRole: #Character))]) ifTrue:
[^ newHeap integerObjectOf: newHeap instSpecForImmediateClasses << 16].
instSize := aRFiClass instSize.
newInstSpec := self instSpecOfClass: aRFiClass.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
running
initializeImage
| process association |
| processor process association |

self flag: 'should migrate this method'.
self checkpoint: 'image_initialization'.

self initializeSpecialObjectArray.

self bootstrapInterpreter
processor := self bootstrapInterpreter
evaluateCode: '
Processor := PCProcessorScheduler basicNew.
Processor initProcessLists.'
withTemps: #().
Processor := theProcessorScheduler basicNew
initProcessLists ;
yourself'
withTemps: { 'theProcessorScheduler' -> (self classWithRole: #ProcessorScheduler) mirror }.


self bootstrapEnvironment at: #Processor put: processor.
self bootstrapInterpreter evaluateCode: 'Smalltalk globals at: #Processor put: theProcessor' withTemps: { 'theProcessor' -> processor }.

" objectSpace backend processorAssociation: (self bootstrapInterpreter evaluateCode: 'Smalltalk globals associationAt: #Processor.').

Expand All @@ -24,12 +26,15 @@ initializeImage
association instanceVariableAtIndex: 2 put: (self bootstrapEnvironment at: #Processor).

objectSpace backend processorAssociation: association .
process := objectSpace createProcessWithPriority: 3 doing: 'PCSystem start' withTemps: #().
process := objectSpace createProcessWithPriority: 3 doing: (self classNameWithRole: #System), ' start' withTemps: #().
objectSpace installAsActiveProcess: process withProcessor: (self bootstrapEnvironment at: #Processor).

" The specialObjectsArray is already installed above
self bootstrapInterpreter
evaluateCode: 'PCSystem specialObjectsArray: newArray.'
withTemps: { 'newArray' -> objectSpace backend specialObjectsArray }.
evaluateCode: 'theSystem specialObjectsArray: newArray.'
withTemps: {
'theSystem' -> (self classWithRole: #System) mirror.
'newArray' -> objectSpace backend specialObjectsArray }."

self followForwardingPointers.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ initializeSpecialObjectArray
" objectSpace specialObjectsArray: self newSpecialObjectsArray.

self bootstrapInterpreter
evaluateCode: 'PCSystem specialObjectsArray: newArray.'
withTemps: { 'newArray' -> objectSpace backend specialObjectsArray }.
evaluateCode: 'theSystem specialObjectsArray: newArray.'
withTemps: {
'theSystem' -> (self classWithRole: #System) mirror.
'newArray' -> objectSpace backend specialObjectsArray }.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
newArray: size

^ self arrayClass mirror basicNew: size
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ stubs
classDefinitionFor: aClass
"Answer a String that defines the receiver."

| type classInstallerName |
| type classInstaller |

type := self typeFor: aClass.

classInstallerName := (systemDefinition classWithRole: #ClassInstaller).
classInstaller := (systemDefinition classWithRole: #ClassInstaller).

^ '| newClass |
newClass := (PCClassBuilder new
newClass := ({classInstaller} new
superclass: {superClass};
name: ''{name}'';
instVarNames: {instanceVariablesString};
Expand All @@ -19,6 +19,7 @@ classDefinitionFor: aClass
build.
newClass'
format: {
'classInstaller' -> classInstaller.
'superClass' -> (aClass superclass ifNil: ['nil'] ifNotNil: [ :superclass | superclass name ]).
'name' -> aClass name.
'type' -> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metaclassClass
Ok, so here we really go down and create the metaclass from nothing. We will use this metaclass to create all the others"
| aClassMapping theNewMetaclass theNewMetaclassClass classFormat metaclassFormat metaclassIndex classIndex |

environment at: #PCMetaclass ifPresent: [ :aClass | ^ aClass ].
aClassMapping := systemDefinition classNamed: #PCMetaclass.
aClassMapping := systemDefinition classWithRole: #Metaclass.
environment at: aClassMapping name asSymbol ifPresent: [ :aClass | ^ aClass ].
classFormat := self formatOfClass: aClassMapping.
metaclassFormat := self formatOfClass: aClassMapping metaclass.

Expand Down