Skip to content

Commit 611d79e

Browse files
committed
Merge remote-tracking branch 'origin/pharo-10' into versions
2 parents 76caa11 + cab16b3 commit 611d79e

24 files changed

+1388
-194
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Change log
22

3+
## What's Changed
4+
* Redo 294 by @guillep in https://github.com/pharo-project/pharo-vm/pull/829
5+
* Making it loadable in P12 by @guillep in https://github.com/pharo-project/pharo-vm/pull/825
6+
* Added test on extended store and pop by @guillep in https://github.com/pharo-project/pharo-vm/pull/520
7+
* Update build version to P12 by @guillep in https://github.com/pharo-project/pharo-vm/pull/826
8+
* Improving log of old space limit error reporting by @tesonep in https://github.com/pharo-project/pharo-vm/pull/833
9+
* a better comment support for Slang by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/838
10+
* a first version of Slang with no type conflict and an exception if one appear by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/819
11+
* remove unused cast and expression by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/837
12+
* fix warnings related to multiple include of the same header file by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/840
13+
* Fix a lot of unused expression by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/832
14+
* add a comment explaining why declareCVarsIn: is empty in some subclasses by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/842
15+
* small change in dead code elimination to considers a method with only comments empty by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/843
16+
* small change in copyWithoutReturn to handle CCoerce by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/836
17+
* Remove hostname lookup on network initialization by @guillep in https://github.com/pharo-project/pharo-vm/pull/845
18+
* Update SDL2 version in OSX (Intel & Apple) by @tesonep in https://github.com/pharo-project/pharo-vm/pull/849
19+
* Adding option for pin behaviour by @tesonep in https://github.com/pharo-project/pharo-vm/pull/844
20+
21+
**Full Changelog**: https://github.com/pharo-project/pharo-vm/compare/v10.3.0...v10.3.1
22+
323
## v10.3.0
424

525
* New harmonize rule by @RenaudFondeur in https://github.com/pharo-project/pharo-vm/pull/817

CMakeLists.txt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ if(MSVC)
183183
set(OS_TYPE "Win32")
184184
get_platform_name(VM_TARGET_OS)
185185
message(STATUS "Building for ${VM_TARGET_OS}")
186-
set(CMAKE_CURRENT_SOURCE_DIR_TO_OUT ${CMAKE_CURRENT_SOURCE_DIR})
187186

188187
# Define WIN32_LEAN_AND_MEAN to exclude APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets
189188
# They can be included if needed
@@ -197,17 +196,6 @@ elseif(WIN)
197196
unset(UNIX)
198197
unset(UNIX CACHE)
199198

200-
# transform the path into a windows path with unix backslashes C:/bla/blu
201-
# this is the path required to send as argument to libraries outside of the control of cygwin (like pharo itself)
202-
execute_process(
203-
COMMAND cygpath ${CMAKE_CURRENT_SOURCE_DIR} --mixed
204-
OUTPUT_VARIABLE CMAKE_CURRENT_SOURCE_DIR_TO_OUT
205-
OUTPUT_STRIP_TRAILING_WHITESPACE)
206-
execute_process(
207-
COMMAND cygpath ${CMAKE_CURRENT_BINARY_DIR} --mixed
208-
OUTPUT_VARIABLE CMAKE_CURRENT_BINARY_DIR_TO_OUT
209-
OUTPUT_STRIP_TRAILING_WHITESPACE)
210-
211199
set(CMAKE_SHARED_LIBRARY_PREFIX "")
212200
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
213201
set(CMAKE_SHARED_MODULE_PREFIX "")
@@ -232,10 +220,6 @@ elseif(WIN)
232220

233221
elseif(UNIX)
234222

235-
# Use the default path to send as argument of extrernal apps (like pharo itself)
236-
set(CMAKE_CURRENT_SOURCE_DIR_TO_OUT ${CMAKE_CURRENT_SOURCE_DIR})
237-
set(CMAKE_CURRENT_BINARY_DIR_TO_OUT ${CMAKE_CURRENT_BINARY_DIR})
238-
239223
set(COMMON_FLAGS "-Wall -Werror=implicit-function-declaration")
240224

241225
add_compile_definitions(LSB_FIRST=1)
@@ -258,9 +242,9 @@ endif()
258242
# If we are generating sources, set the binary dir as the generation source dir, as vmmaker will generate the C files here. (we do not alter the source directory)
259243
# Otherwise set it to by default to the current binary dir, parametrizable
260244
if(${GENERATE_SOURCES})
261-
set(GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR_TO_OUT})
245+
set(GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
262246
else()
263-
set(GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR_TO_OUT} CACHE STRING "Source directory where to find the generated source. Default value is CMAKE_CURRENT_BINARY_DIR")
247+
set(GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "Source directory where to find the generated source. Default value is CMAKE_CURRENT_BINARY_DIR")
264248
endif()
265249

266250
if (${FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS})

cmake/vmmaker.cmake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ set(PLUGIN_GENERATED_FILES
4646
if(GENERATE_SOURCES)
4747

4848
#Setting vmmaker directory and image
49-
set( VMMAKER_DIR "${CMAKE_CURRENT_BINARY_DIR_TO_OUT}/build/vmmaker")
49+
set( VMMAKER_DIR "${CMAKE_CURRENT_BINARY_DIR}/build/vmmaker")
5050

5151
# If we are generating the vmmaker image, set a the image path
5252
# Otherwise set it with a default, but parametrizable
@@ -115,15 +115,23 @@ if(GENERATE_SOURCES)
115115
)
116116
endif()
117117

118+
set(IMAGE_PATH ${VMMAKER_DIR}/image/Pharo12.0-SNAPSHOT-64bit-aa50f9c.image)
119+
120+
convert_cygwin_path_ifNeeded(${IMAGE_PATH} IMAGE_PATH_TO_USE)
121+
convert_cygwin_path_ifNeeded(${VMMAKER_IMAGE} VMMAKER_IMAGE_TO_USE)
122+
convert_cygwin_path_ifNeeded(${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_SOURCE_DIR_OUT)
123+
convert_cygwin_path_ifNeeded(${CMAKE_CURRENT_BINARY_DIR} CMAKE_CURRENT_BINARY_DIR_OUT)
124+
118125
if(GENERATE_VMMAKER)
119126
#Bootstrap VMMaker.image from downloaded plain Pharo image
127+
120128
ExternalProject_Add(
121129
vmmaker
122130

123131
URL https://files.pharo.org/image/120/Pharo12.0-SNAPSHOT.build.1519.sha.aa50f9c.arch.64bit.zip
124132
URL_HASH SHA256=b12270631ffc0c6adcb0b6449565b9abfd8e88a863a894a7320f660c05a0af1e
125-
BUILD_COMMAND ${VMMAKER_VM} --headless ${VMMAKER_DIR}/image/Pharo12.0-SNAPSHOT-64bit-aa50f9c.image --no-default-preferences save VMMaker
126-
COMMAND ${VMMAKER_VM} --headless ${VMMAKER_IMAGE} --no-default-preferences --save --quit "${CMAKE_CURRENT_SOURCE_DIR_TO_OUT}/scripts/installVMMaker.st" "${CMAKE_CURRENT_SOURCE_DIR_TO_OUT}" "${ICEBERG_DEFAULT_REMOTE}"
133+
BUILD_COMMAND ${VMMAKER_VM} --headless ${IMAGE_PATH_TO_USE} --no-default-preferences save VMMaker
134+
COMMAND ${VMMAKER_VM} --headless ${VMMAKER_IMAGE_TO_USE} --no-default-preferences --save --quit "${CMAKE_CURRENT_SOURCE_DIR_OUT}/scripts/installVMMaker.st" "${CMAKE_CURRENT_SOURCE_DIR_OUT}" "${ICEBERG_DEFAULT_REMOTE}"
127135
UPDATE_COMMAND ""
128136
CONFIGURE_COMMAND ""
129137
INSTALL_COMMAND ""
@@ -144,7 +152,7 @@ if(GENERATE_SOURCES)
144152
#Custom command that generates the vm source code from VMMaker into the generated folder
145153
add_custom_command(
146154
OUTPUT ${VMSOURCEFILES} ${PLUGIN_GENERATED_FILES}
147-
COMMAND ${VMMAKER_VM} --headless ${VMMAKER_IMAGE} --no-default-preferences perform PharoVMMaker generate:outputDirectory: ${FLAVOUR} ${CMAKE_CURRENT_BINARY_DIR_TO_OUT}
155+
COMMAND ${VMMAKER_VM} --headless ${VMMAKER_IMAGE_TO_USE} --no-default-preferences perform PharoVMMaker generate:outputDirectory: ${FLAVOUR} ${CMAKE_CURRENT_BINARY_DIR_OUT}
148156
VERBATIM
149157
DEPENDS vmmaker ${VMMAKER_IMAGE} ${VMMAKER_VM}
150158
COMMENT "Generating VM files for flavour: ${FLAVOUR}")

macros.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ macro(get_full_platform_name_with_osx VARNAME)
5151
endif()
5252
endmacro()
5353

54+
macro(convert_cygwin_path_ifNeeded INPUT OUTVARNAME)
55+
# transform the path into a windows path with unix backslashes C:/bla/blu
56+
# this is the path required to send as argument to libraries outside of the control of cygwin (like pharo itself)
57+
if(WIN AND NOT MSVC)
58+
execute_process(
59+
COMMAND cygpath ${INPUT} --mixed
60+
OUTPUT_VARIABLE ${OUTVARNAME}
61+
OUTPUT_STRIP_TRAILING_WHITESPACE)
62+
else()
63+
set(${OUTVARNAME} ${INPUT})
64+
endif()
65+
66+
endmacro()
67+
5468
# Add a third party dependency taken from the given URL
5569
macro(add_third_party_dependency_with_baseurl NAME BASEURL)
5670

smalltalksrc/Melchor/CCodeGeneratorGlobalStructure.class.st

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,26 @@ CCodeGeneratorGlobalStructure >> emitGlobalStructFlagOn: aStream [
190190
{ #category : 'CAST translation' }
191191
CCodeGeneratorGlobalStructure >> generateCASTSetFieldTo: aTSendNode [
192192

193-
| structType fieldName fieldVale setFieldStatements |
193+
| structType fieldName fieldVale setFieldStatements structClass |
194194
self assert: aTSendNode arguments size = 2.
195195

196196
fieldName := aTSendNode arguments first.
197197
fieldVale := aTSendNode arguments second.
198198

199199
structType := self structTypeFor: aTSendNode receiver.
200-
201-
202-
setFieldStatements := (structType asClassInEnvironment:
203-
self class environment) allSlots collect: [
200+
structClass := structType asClassInEnvironment: self class environment.
201+
202+
"If the field name is known at compile time, we can just use the accessor, we don't need to compare by the name"
203+
fieldName isConstant
204+
ifTrue: [
205+
self assert: (structClass hasSlotNamed: fieldName value).
206+
207+
^ (TSendNode
208+
receiver: aTSendNode receiver
209+
selector: fieldName value , ':'
210+
arguments: { fieldVale }) asCASTIn: self ].
211+
212+
setFieldStatements := structClass allSlots collect: [
204213
:slot |
205214
| comparison |
206215
comparison := TSendNode
@@ -237,7 +246,7 @@ CCodeGeneratorGlobalStructure >> generateCASTWithFieldsDoSeparatedBy: aTSendNode
237246
self assert: aTSendNode arguments second arguments size = 0.
238247

239248
fieldBlock := aTSendNode arguments first.
240-
blockSeparatorStatements := aTSendNode arguments second statements.
249+
blockSeparatorStatements := aTSendNode arguments second statements reject: [ :e | e isConstant and: [ e value isNil ] ].
241250

242251
structType := self structTypeFor: aTSendNode receiver.
243252

@@ -257,8 +266,7 @@ CCodeGeneratorGlobalStructure >> generateCASTWithFieldsDoSeparatedBy: aTSendNode
257266
do: [ :fieldArgs |
258267
allRewrittenStatements addAll:
259268
(self bindBlock: fieldBlock withArgs: fieldArgs) ]
260-
separatedBy: [
261-
allRewrittenStatements addAll: blockSeparatorStatements ].
269+
separatedBy: [ allRewrittenStatements addAll: blockSeparatorStatements ].
262270

263271
^ CCompoundStatementNode statements:
264272
(allRewrittenStatements collect: [ :e | e asCASTIn: self ])

smalltalksrc/Slang/SlangStructType.class.st

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,19 @@ SlangStructType class >> voidStructTypeCache [
256256
{ #category : 'macros' }
257257
SlangStructType >> setField: fieldName to: fieldValue [
258258

259-
| slot |
260-
slot := self class slotNamed: fieldName.
261-
slot write: fieldValue to: self
259+
self class
260+
slotNamed: fieldName
261+
ifFound: [ :slot | slot write: fieldValue to: self ]
262+
]
263+
264+
{ #category : 'macros' }
265+
SlangStructType >> withFieldsDo: forEachBlock [
266+
267+
<inline: #always>
268+
269+
self class allSlots
270+
do: [ :aSlot | forEachBlock value: aSlot name value: (aSlot read: self) ]
271+
separatedBy: [ ]
262272
]
263273

264274
{ #category : 'macros' }

smalltalksrc/Slang/TStatementListNode.class.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ TStatementListNode >> copyWithoutReturn [
371371
newStmtsListNode
372372
replaceChild: actualLast
373373
with: actualLast copyWithoutReturn ].
374-
^ newStmtsListNode]
374+
^ newStmtsListNode
375+
]
375376

376377
{ #category : 'declarations' }
377378
TStatementListNode >> declarationAt: aString ifPresent: aFullBlockClosure [

smalltalksrc/VMMaker/AbstractComposedImageAccess.class.st

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,44 @@ AbstractComposedImageAccess >> permSpaceMetadataFileNameInImage: imageFileName [
168168
^ self permSpaceFileName: 'permSpace.ston' inImage: imageFileName into: buffer bufferSize: 255
169169
]
170170

171+
{ #category : 'file primitives' }
172+
AbstractComposedImageAccess >> readLineFrom: file into: lineBuffer ofSize: bufferSize [
173+
174+
<var: #lineBuffer type: 'char*'>
175+
<var: #file type: #sqImageFile>
176+
177+
self
178+
cCode: [
179+
| idx aCharacter |
180+
181+
idx := 0.
182+
183+
aCharacter := self fgetc: file.
184+
185+
[ aCharacter = -1 ]
186+
whileFalse: [
187+
aCharacter = 10
188+
ifTrue: [ aCharacter := -1 ]
189+
ifFalse: [
190+
aCharacter = 13
191+
ifTrue: [
192+
aCharacter := self fgetc: file.
193+
aCharacter ~= 13 ifTrue: [ self ungetc: aCharacter _: file ].
194+
aCharacter := -1 ]
195+
ifFalse: [
196+
lineBuffer at: idx put: aCharacter.
197+
idx := idx + 1.
198+
bufferSize = (idx + 1)
199+
ifTrue: [ aCharacter := -1 ]
200+
ifFalse: [ aCharacter := self fgetc: file].
201+
]
202+
]].
203+
204+
lineBuffer at: idx put: 0.
205+
]
206+
inSmalltalk: [ lineBuffer contents: file nextLine].
207+
]
208+
171209
{ #category : 'segments' }
172210
AbstractComposedImageAccess >> segmentDataFile: segmentIndex inImage: imageFileName [
173211

@@ -209,3 +247,31 @@ AbstractComposedImageAccess >> segmentMetadataFile: segmentIndex inImage: imageF
209247
^ self segmentFileName: segmentIndex withExtension: '.ston' inImage: imageFileName into: buffer bufferSize: 255.
210248

211249
]
250+
251+
{ #category : 'file primitives' }
252+
AbstractComposedImageAccess >> sscanf: aString _: format _: varHolder [
253+
254+
<doNotGenerate>
255+
(format = self headFormat)
256+
ifTrue: [
257+
^ varHolder contents: (aString substrings: ' ') first ].
258+
259+
self error.
260+
]
261+
262+
{ #category : 'file primitives' }
263+
AbstractComposedImageAccess >> sscanf: line _: format _: varHolder1 _: varHolder2 [
264+
265+
<doNotGenerate>
266+
267+
(format = self fieldFormat)
268+
ifTrue: [
269+
| dataArray |
270+
dataArray := line substrings: '#:, '.
271+
dataArray first = '}' ifTrue: [ ^ self ].
272+
varHolder1 contents: dataArray second.
273+
varHolder2 contents: dataArray third asInteger.
274+
^ self ].
275+
276+
self error
277+
]

smalltalksrc/VMMaker/ComposedImageReader.class.st

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ ComposedImageReader class >> declareCVarsIn: aCCodeGenerator [
1515

1616
{ #category : 'reading' }
1717
ComposedImageReader >> endOfSTON: file [
18-
19-
"This method consume 2 chars from file and return they are equivalent to '\n}'"
20-
21-
| charLeft charRight |
22-
charLeft := self fgetc: file.
23-
charRight := self fgetc: file.
2418

25-
^ (self isEndOfLine: charLeft) and: [ charRight = $} ]
19+
^ self
20+
cCode: [ | aCharacter |
21+
aCharacter := self fgetc: file.
22+
self ungetc: aCharacter _:file.
23+
aCharacter = -1 or: [ aCharacter = $} ]]
24+
inSmalltalk: [ file peek = $} ].
25+
26+
2627
]
2728

2829
{ #category : 'reading' }
@@ -55,10 +56,13 @@ ComposedImageReader >> readFieldsSTONFrom: file into: aStruct [
5556
<inline: true>
5657
<var: #fieldName declareC: 'char fieldName[255]'>
5758
<var: #fieldValue type: #'long long'>
58-
| fieldName fieldValue |
59+
<var: #lineBuffer declareC: 'char lineBuffer[1024]'>
60+
61+
| fieldName fieldValue lineBuffer |
5962
self simulationOnly: [
6063
fieldName := ValueHolder new.
61-
fieldValue := ValueHolder new ].
64+
fieldValue := ValueHolder new.
65+
lineBuffer := ValueHolder new ].
6266

6367
"Initialize the Struct with zeros"
6468

@@ -67,9 +71,14 @@ ComposedImageReader >> readFieldsSTONFrom: file into: aStruct [
6771
separatedBy: [ ].
6872

6973
"This solution does NOT WORK with STON file without fields (empty STON)"
70-
[
74+
[
75+
self
76+
readLineFrom: file
77+
into: lineBuffer
78+
ofSize: 1024.
79+
7180
self
72-
fscanf: file
81+
sscanf: (self contentsOf: lineBuffer)
7382
_: self fieldFormat
7483
_: fieldName
7584
_: (self cCoerce: (self addressOf: fieldValue) to: #'sqInt*').
@@ -85,10 +94,20 @@ ComposedImageReader >> readHeadSTONFrom: file into: aStruct [
8594

8695
<inline: true>
8796
<var: #structName declareC: 'char structName[255]'>
88-
| structName |
89-
self simulationOnly: [ structName := ValueHolder new ].
97+
<var: #lineBuffer declareC: 'char lineBuffer[1024]'>
9098

91-
self fscanf: file _: self headFormat _: structName.
99+
| structName lineBuffer |
100+
101+
self simulationOnly: [
102+
lineBuffer := ValueHolder new.
103+
structName := ValueHolder new ].
104+
105+
self
106+
readLineFrom: file
107+
into: lineBuffer
108+
ofSize: 1024.
109+
110+
self sscanf: (self contentsOf: lineBuffer) _: self headFormat _: structName.
92111

93112
self simulationOnly: [
94113
aStruct withStructNameDo: [ :name |
@@ -123,6 +142,10 @@ ComposedImageReader >> readHeaderFromImage: imageFileName [
123142

124143
headerPtr := self addressOf: header.
125144
self readSTONFrom: file into: headerPtr.
145+
146+
"If the field is missing, as it was added later"
147+
header hdrOldSpaceSize = 0
148+
ifTrue: [ header hdrOldSpaceSize: header dataSize ].
126149

127150
self extractImageVersionFrom: (header imageFormat) into: headerPtr.
128151

0 commit comments

Comments
 (0)