Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making it loadable in P12 #825

Merged
merged 1 commit into from
Jun 28, 2024
Merged
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
11 changes: 6 additions & 5 deletions smalltalksrc/BaselineOfVMMaker/BaselineOfVMMaker.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #BaselineOfVMMaker,
#superclass : #BaselineOf,
#category : #BaselineOfVMMaker
#name : 'BaselineOfVMMaker',
#superclass : 'BaselineOf',
#category : 'BaselineOfVMMaker',
#package : 'BaselineOfVMMaker'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfVMMaker >> baseline: spec [
<baseline>
spec
Expand Down Expand Up @@ -37,7 +38,7 @@ BaselineOfVMMaker >> baseline: spec [
spec baseline: 'LLVMDisassembler' with: [
spec repository: 'github://pharo-project/pharo-llvmDisassembler' ].
spec baseline: 'OpalSimdBytecode' with: [
spec repository: 'github://nrainhart/pharo-opal-simd-bytecode:main' ].
spec repository: 'github://evref-inria/pharo-opal-simd-bytecode:main' ].

"Tests"
spec
Expand Down
2 changes: 1 addition & 1 deletion smalltalksrc/BaselineOfVMMaker/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfVMMaker }
Package { #name : 'BaselineOfVMMaker' }
40 changes: 21 additions & 19 deletions smalltalksrc/VMMaker/AbstractComposedImageAccess.class.st
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
Class {
#name : #AbstractComposedImageAccess,
#superclass : #AbstractImageAccess,
#category : #'VMMaker-ImageFormat'
#name : 'AbstractComposedImageAccess',
#superclass : 'AbstractImageAccess',
#category : 'VMMaker-ImageFormat',
#package : 'VMMaker',
#tag : 'ImageFormat'
}

{ #category : #translation }
{ #category : 'translation' }
AbstractComposedImageAccess class >> declareCVarsIn: aCCodeGenerator [

aCCodeGenerator
addHeaderFile:'<sys/stat.h> /* for e.g. mkdir */'

]

{ #category : #'file operations' }
{ #category : 'file operations' }
AbstractComposedImageAccess >> createImageDirectory: imageFileName [

self
Expand All @@ -26,7 +28,7 @@ AbstractComposedImageAccess >> createImageDirectory: imageFileName [
imageFileName asFileReference ensureCreateDirectory ]
]

{ #category : #'file operations' }
{ #category : 'file operations' }
AbstractComposedImageAccess >> existSegment: segmentIndex inImage: imageFileName [

<var: #buffer declareC: 'char buffer[255]'>
Expand All @@ -43,15 +45,15 @@ AbstractComposedImageAccess >> existSegment: segmentIndex inImage: imageFileName

]

{ #category : #formats }
{ #category : 'formats' }
AbstractComposedImageAccess >> fieldFormat [

<cmacro: '() "\t#%s : %" PRIdSQINT'>

^ '\t#%s : %' , PRIdSQINT.
]

{ #category : #'file operations' }
{ #category : 'file operations' }
AbstractComposedImageAccess >> fileExists: fileName [

| sb |
Expand All @@ -65,7 +67,7 @@ AbstractComposedImageAccess >> fileExists: fileName [
inSmalltalk: [ fileName asFileReference exists ]
]

{ #category : #'file primitives' }
{ #category : 'file primitives' }
AbstractComposedImageAccess >> fscanf: file _: format _: varHolder [

<doNotGenerate>
Expand All @@ -75,7 +77,7 @@ AbstractComposedImageAccess >> fscanf: file _: format _: varHolder [
yourself
]

{ #category : #'file primitives' }
{ #category : 'file primitives' }
AbstractComposedImageAccess >> fscanf: file _: format _: varHolder1 _: varHolder2 [

<doNotGenerate>
Expand All @@ -93,14 +95,14 @@ AbstractComposedImageAccess >> fscanf: file _: format _: varHolder1 _: varHolder
yourself
]

{ #category : #formats }
{ #category : 'formats' }
AbstractComposedImageAccess >> headFormat [

<inline: true>
^ '%s {\n'.
]

{ #category : #'file operations' }
{ #category : 'file operations' }
AbstractComposedImageAccess >> headerFileNameinImage: imageFileName into: buffer bufferSize: bufferSize [

| headerFileName |
Expand All @@ -118,15 +120,15 @@ AbstractComposedImageAccess >> headerFileNameinImage: imageFileName into: buffer
inSmalltalk: [ imageFileName , '/', headerFileName ]
]

{ #category : #formats }
{ #category : 'formats' }
AbstractComposedImageAccess >> msgFormat: aMessage [

<cmacro: '(aMessage) aMessage "%" PRIdSQINT'>

^ aMessage , '%' , PRIdSQINT.
]

{ #category : #'perm - space' }
{ #category : 'perm - space' }
AbstractComposedImageAccess >> permSpaceDataFileInImage: imageFileName [

<inline: #always>
Expand All @@ -139,7 +141,7 @@ AbstractComposedImageAccess >> permSpaceDataFileInImage: imageFileName [
^ self permSpaceFileName: 'permSpace.data' inImage: imageFileName into: buffer bufferSize: 255
]

{ #category : #'perm - space' }
{ #category : 'perm - space' }
AbstractComposedImageAccess >> permSpaceFileName: fileName inImage: imageFileName into: buffer bufferSize: bufferSize [

^ self
Expand All @@ -153,7 +155,7 @@ AbstractComposedImageAccess >> permSpaceFileName: fileName inImage: imageFileNam
inSmalltalk: [ imageFileName , '/', fileName ].
]

{ #category : #'perm - space' }
{ #category : 'perm - space' }
AbstractComposedImageAccess >> permSpaceMetadataFileNameInImage: imageFileName [

<inline: #always>
Expand All @@ -166,7 +168,7 @@ AbstractComposedImageAccess >> permSpaceMetadataFileNameInImage: imageFileName [
^ self permSpaceFileName: 'permSpace.ston' inImage: imageFileName into: buffer bufferSize: 255
]

{ #category : #segments }
{ #category : 'segments' }
AbstractComposedImageAccess >> segmentDataFile: segmentIndex inImage: imageFileName [

<inline: true>
Expand All @@ -180,7 +182,7 @@ AbstractComposedImageAccess >> segmentDataFile: segmentIndex inImage: imageFileN

]

{ #category : #segments }
{ #category : 'segments' }
AbstractComposedImageAccess >> segmentFileName: segmentIndex withExtension: extension inImage: imageFileName into: buffer bufferSize: bufferSize [

^ self
Expand All @@ -194,7 +196,7 @@ AbstractComposedImageAccess >> segmentFileName: segmentIndex withExtension: exte
inSmalltalk: [ imageFileName , '/seg', segmentIndex asString , extension ]
]

{ #category : #segments }
{ #category : 'segments' }
AbstractComposedImageAccess >> segmentMetadataFile: segmentIndex inImage: imageFileName [

<inline: true>
Expand Down
4 changes: 2 additions & 2 deletions smalltalksrc/VMMaker/AbstractFileReference.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #AbstractFileReference }
Extension { #name : 'AbstractFileReference' }

{ #category : #'*VMMaker' }
{ #category : '*VMMaker' }
AbstractFileReference >> hasChildrenMatching: patterns [

^ (self childrenMatching: patterns) isNotEmpty
Expand Down
50 changes: 26 additions & 24 deletions smalltalksrc/VMMaker/AbstractImageAccess.class.st
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
Class {
#name : #AbstractImageAccess,
#superclass : #VMClass,
#name : 'AbstractImageAccess',
#superclass : 'VMClass',
#instVars : [
'objectMemory',
'segmentManager',
'coInterpreter'
],
#category : #'VMMaker-ImageFormat'
#category : 'VMMaker-ImageFormat',
#package : 'VMMaker',
#tag : 'ImageFormat'
}

{ #category : #translation }
{ #category : 'translation' }
AbstractImageAccess class >> implicitReturnTypeFor: aSelector [
"Answer the return type for methods that don't have an explicit return."
^#void
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
AbstractImageAccess class >> newWithMemory: memory andInterpreter: anInterpreter [

| newInstance |
Expand All @@ -28,7 +30,7 @@ AbstractImageAccess class >> newWithMemory: memory andInterpreter: anInterpreter
^ newInstance
]

{ #category : #'accessing - files' }
{ #category : 'accessing - files' }
AbstractImageAccess >> beginWriteImageSegments [

" self assert:
Expand All @@ -39,7 +41,7 @@ AbstractImageAccess >> beginWriteImageSegments [

]

{ #category : #reading }
{ #category : 'reading' }
AbstractImageAccess >> extractImageVersionFrom: fileVersion into: header [
"Read and verify the image file version number and return true if the the given image file needs to be byte-swapped. As a side effect, position the file stream just after the version number of the image header. This code prints a warning and does a hard-exit if it cannot find a valid version number."
"This code is based on C code by Ian Piumarta."
Expand Down Expand Up @@ -70,7 +72,7 @@ AbstractImageAccess >> extractImageVersionFrom: fileVersion into: header [

]

{ #category : #segments }
{ #category : 'segments' }
AbstractImageAccess >> finalizeSegmentsRead: totalBytesRead newBase: newBase [

"newBase should point just past the last bridge. all others should have been eliminated."
Expand All @@ -85,14 +87,14 @@ AbstractImageAccess >> finalizeSegmentsRead: totalBytesRead newBase: newBase [

]

{ #category : #reading }
{ #category : 'reading' }
AbstractImageAccess >> imageFormatCompatibilityVersion [
"This VM is backward-compatible with the immediately preceding version."

^objectMemory wordSize = 4 ifTrue: [6504] ifFalse: [68002]
]

{ #category : #reading }
{ #category : 'reading' }
AbstractImageAccess >> imageFormatVersion [
"Return a magic constant that changes when the image format changes.
Since the image reading code uses this to detect byte ordering, one
Expand All @@ -102,7 +104,7 @@ AbstractImageAccess >> imageFormatVersion [
^objectMemory imageFormatVersion
]

{ #category : #reading }
{ #category : 'reading' }
AbstractImageAccess >> initializeInterpreterFromHeader: header withBytes: bytesRead [

| bytesToShift |
Expand All @@ -119,23 +121,23 @@ AbstractImageAccess >> initializeInterpreterFromHeader: header withBytes: bytesR
coInterpreter initializeInterpreter: bytesToShift "adjusts all oops to new location"
]

{ #category : #accessing }
{ #category : 'accessing' }
AbstractImageAccess >> interpreter [

<doNotGenerate>

^ coInterpreter
]

{ #category : #accessing }
{ #category : 'accessing' }
AbstractImageAccess >> interpreter: anObject [

<doNotGenerate>

coInterpreter := anObject
]

{ #category : #reading }
{ #category : 'reading' }
AbstractImageAccess >> loadHeaderToMemory: header [

<var: #header type: #'SpurImageHeaderStruct'>
Expand All @@ -159,27 +161,27 @@ AbstractImageAccess >> loadHeaderToMemory: header [

]

{ #category : #accessing }
{ #category : 'accessing' }
AbstractImageAccess >> objectMemory: memory [

<doNotGenerate>
objectMemory := memory
]

{ #category : #segments }
{ #category : 'segments' }
AbstractImageAccess >> prepareSegmentsToRead [

segmentManager clearSegments.
segmentManager allocateOrExtendSegmentInfos
]

{ #category : #segments }
{ #category : 'segments' }
AbstractImageAccess >> readSegmentsFromImageFile: imageFile header: header [

self subclassResponsibility
]

{ #category : #reading }
{ #category : 'reading' }
AbstractImageAccess >> readableFormat: imageVersion [
"Anwer true if images of the given format are readable by this interpreter.
Allows a virtual machine to accept selected older image formats."
Expand All @@ -188,14 +190,14 @@ AbstractImageAccess >> readableFormat: imageVersion [
or: [imageVersion = self imageFormatCompatibilityVersion] "Float words in BigEndian order"
]

{ #category : #accessing }
{ #category : 'accessing' }
AbstractImageAccess >> segmentManager: anObject [

<doNotGenerate>
segmentManager := anObject
]

{ #category : #'accessing - files' }
{ #category : 'accessing - files' }
AbstractImageAccess >> sq: startingAddress Image: byteSize File: bytesToRead Read: aZnBufferedReadStream [

<doNotGenerate>
Expand All @@ -209,7 +211,7 @@ AbstractImageAccess >> sq: startingAddress Image: byteSize File: bytesToRead Rea
count: bytesToRead
]

{ #category : #'accessing - files' }
{ #category : 'accessing - files' }
AbstractImageAccess >> sq: start Image: n File: segSize Write: file [

<doNotGenerate>
Expand All @@ -224,7 +226,7 @@ AbstractImageAccess >> sq: start Image: n File: segSize Write: file [
^ segSize
]

{ #category : #'accessing - files' }
{ #category : 'accessing - files' }
AbstractImageAccess >> sqImageFile: imageName Open: fileMode [

<doNotGenerate>
Expand All @@ -237,14 +239,14 @@ AbstractImageAccess >> sqImageFile: imageName Open: fileMode [
self error: 'File mode not supported'
]

{ #category : #'accessing - files' }
{ #category : 'accessing - files' }
AbstractImageAccess >> sqImageFileClose: file [

<doNotGenerate>
file close
]

{ #category : #testing }
{ #category : 'testing' }
AbstractImageAccess >> validateImage: imageName [

<doNotGenerate>
Expand Down
Loading