Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false # facilitates debugging
matrix:
os: [ ubuntu-latest, windows-latest ]
smalltalk: [ Squeak64-Trunk ]
smalltalk: [ Squeak64-Trunk, Squeak64-5.3 ]
name: ${{ matrix.smalltalk }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .squot
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ OrderedDictionary {
'packages/SimulationStudio-Tracing.package' : #SquotCypressCodeSerializer,
'packages/SimulationStudio-Tests-Sandbox.package' : #SquotCypressCodeSerializer,
'packages/BaselineOfSimulationStudio.package' : #SquotCypressCodeSerializer,
'packages/SimulationStudio-Tests-Base.package' : #SquotCypressCodeSerializer
'packages/SimulationStudio-Tests-Base.package' : #SquotCypressCodeSerializer,
'packages/SimulationStudio-Compatibility-Squeak5.package' : #SquotCypressCodeSerializer
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ baseline: spec
"groups"
spec
group: #default with: #('SimulationStudio-Base' 'SimulationStudio-Sandbox' 'SimulationStudio-Tracing' 'SimulationStudio-Tests-Base' 'SimulationStudio-Tests-Sandbox');
group: #tests with: #('SimulationStudio-Tests-Base' 'SimulationStudio-Tests-Sandbox')].
group: #tests with: #('SimulationStudio-Tests-Base' 'SimulationStudio-Tests-Sandbox')].

spec for: #'squeak5.x' do: [
spec package: 'SimulationStudio-Compatibility-Squeak5'.
spec package: 'SimulationStudio-Base' with: [
spec includes: 'SimulationStudio-Compatibility-Squeak5']].
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ installPreviewDependenciesForTests
^ self installPreviewDependencies: {
self depInbox: 'SUnit-ct.125'. "TestCase>>#runCaseWithoutTimeout for SandboxKernelTest"
self depInbox: 'SUnit-ct.132'. "TestCase>>#assert:equals:description: with lazy descriptions"
self depInbox: 'Kernel-ct.1407'. "Fixes Context >> #isPrimFailToken: for ProtoObjects"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"class" : {
},
"instance" : {
"baseline:" : "ct 3/14/2021 19:21",
"baseline:" : "ct 11/1/2021 14:55",
"depChangeset:" : "ct 3/22/2021 21:34",
"depInbox:" : "ct 4/12/2021 22:28",
"depSqueakSource:name:" : "ct 4/12/2021 22:27",
"depSqueakSource:name:targetRepository:" : "ct 4/12/2021 22:45",
"installPreviewDependencies:" : "ct 3/5/2021 22:10",
"installPreviewDependenciesForTests" : "ct 5/16/2021 19:07",
"installPreviewDependenciesForTests" : "ct 11/1/2021 14:32",
"projectClass" : "ct 3/5/2021 19:01" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*SimulationStudio-Base-private-Kernel-ct.1407-override
isPrimFailToken: contextOrPrimFailToken
"Answer if contextOrPrimFailToken, which will either be a Context object or
a primitive fail token (a tuple of the PrimitiveFailToken unique object and
a primitive failure code), is the latter. This should only be used with the
(possibly indirect) results of Context>>doPrimitive:method:receiver:args:"
^ (self objectClass: contextOrPrimFailToken) == Array
and: [contextOrPrimFailToken size = 2
and: [(contextOrPrimFailToken at: 1) == PrimitiveFailToken]]
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"debug" : "ct 3/5/2021 02:21",
"insertEnsure:" : "ct 3/5/2021 19:35",
"insertOn:do:" : "ct 3/5/2021 19:35",
"isPrimFailToken:" : "ct 5/16/2021 19:03",
"simCustomizationLevel" : "ct 3/5/2021 19:23",
"wrap:" : "ct 3/5/2021 19:30" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#objectsReplacedByNames : true,
#serializer : #SquotCypressCodeSerializer
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*SimulationStudio-Compatibility-Squeak5-write barrier
isReadOnlyObject

^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"isReadOnlyObject" : "ct 11/1/2021 14:58" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "Object" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SystemOrganization addCategory: #'SimulationStudio-Compatibility-Squeak5'!
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
private
doMorePrimitive: primitiveIndex method: meth receiver: rcvr args: arguments ifAbsent: absentBlock

| accessIndirectors selector directRcvrAndArgs |
self flag: #refactor. "Maybe use a generated array of blocks/symbols instead? Could also be faster."
accessIndirectors := Array new: arguments size + 1 "withAll: nil".
primitiveIndex
caseOf: {
[158 "primitiveCompareWith"] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[160 "primitiveAdoptInstance"] -> [accessIndirectors
at: 1 put: #readableObjectFor:;
at: 2 put: #writableObjectFor:].
[161 "primitiveSetOrHasIdentityHash"] -> [self shouldBeImplemented: 'primitiveSetOrHasIdentityHash'].
[163 "primitiveGetImmutability"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[164 "primitiveSetImmutability"] -> [selector := #doPrimitiveSetImmutability:receiver:args:].
[165 "primitiveIntegerAt"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[166 "primitiveIntegerAtPut"] -> [accessIndirectors at: 1 put: #writableObjectFor:].
[167 "primitiveYield"] -> [^ self activateOperationForbidden: 'Control primitives are disabled in sandbox simulation'].
[168 "primitiveCopyObject"] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[169 "primitiveNotIdentical"] -> [accessIndirectors
at: 1 put: #readableObjectFor:;
at: 2 put: #readableObjectFor:].
[170 "primitiveAsCharacter"] -> [
accessIndirectors at: 1 put: #readableObjectFor:.
selector := #doPrimitiveNew:receiver:args:].
[171 "primitiveImmediateAsInteger"] -> [
accessIndirectors at: 1 put: #readableObjectFor:.
selector := #doPrimitiveNew:receiver:args:].
[172 "primitiveFetchNextMourner"] -> [self flag: #reconsider].
[173 "primitiveSlotAt"] -> [accessIndirectors atLast: 2 put: #readableObjectFor:].
[174 "primitiveSlotAtPut"] -> [accessIndirectors atLast: 3 put: #writableObjectFor:].
[175 "primitiveBehaviorHash"] -> [#doPrimitiveHash:receiver:args:].
[176 "primitiveMaxIdentityHash"] -> ["allowed"].
[177 "primitiveAllInstances"] -> ["allowed"].
[178 "primitiveAllObjects"] -> ["allowed"].
[180 "primitiveGrowMemoryByAtLeast"] -> [^ self activateOperationForbidden: 'primitiveGrowMemoryByAtLeast is disabled in sandbox simulation'].
[181 "primitiveSizeInBytesOfInstance"] -> [
self flag: #shouldBeImplemented.
^ self activateOperationForbidden: 'primitiveSizeInBytesOfInstance is disabled in sandbox simulation'].
[182 "primitiveSizeInBytes"] -> [
self flag: #shouldBeImplemented.
^ self activateOperationForbidden: 'primitiveSizeInBytesOfInstance is disabled in sandbox simulation'].
[183 "primitiveIsPinned"] -> [^ self activateOperationForbidden: 'Pinning primitives are disabled in sandbox simulation'].
[184 "primitivePin"] -> [
self flag: #forLater. "We could simulate that, too. Maybe interesting for TelegramSmalltalkSession?"
^ self activateOperationForbidden: 'Pinning primitives are disabled in sandbox simulation'].
[185 "primitiveExitCriticalSection"] -> [^ self activateOperationForbidden: 'Critical section primitives are disabled in sandbox simulation'].
[186 "primitiveEnterCriticalSection"] -> [^ self activateOperationForbidden: 'Critical section primitives are disabled in sandbox simulation'].
[187 "primitiveTestAndSetOwnershipOfCriticalSection"] -> [^ self activateOperationForbidden: 'Critical section primitives are disabled in sandbox simulation'].
[195 "primitiveFindNextUnwindContext"] -> [
"Note: Usually, this primitive will not be called for thisContext during simulation. However, if that's what the client is after, don't fall for it but use the image implementation."
^ self class primitiveFailTokenFor: nil].
[196 "primitiveTerminateTo"] -> [
"Note: Usually, this primitive will not be called for thisContext during simulation. However, if that's what the client is after, don't fall for it but use the image implementation."
^ self class primitiveFailTokenFor: nil].
[197 "primitiveFindHandlerContext"] -> [
"Note: Usually, this primitive will not be called for thisContext during simulation. However, if that's what the client is after, don't fall for it but use the image implementation."
^ self class primitiveFailTokenFor: nil].
[210 "primitiveContextAt"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[211 "primitiveContextAtPut"] -> [accessIndirectors at: 1 put: #writableObjectFor:].
[212 "primitiveContextSize"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[213 "primitiveContextXray"] -> [self shouldBeImplemented: 'primitiveContextXray'].
[214 "primitiveVoidVMState"] -> [self shouldBeImplemented: 'primitiveVoidVMState'].
[215 "primitiveFlushCacheByMethod"] -> [
self flag: #shouldBeImplemented. "This has not been tested. See primitiveFlushCache."
accessIndirectors at: 1 put: #writableObjectFor:].
[230 "primitiveRelinquishProcessor"] -> [^ self class primitiveFailTokenFor: nil "optional primitive, just skip it"].
[231 "primitiveForceDisplayUpdate"] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[232 "primitiveFormPrint"] -> [^ self class primitiveFailTokenFor: nil "don't support"].
[233 "primitiveSetFullScreen"] -> [^ self activateOperationForbidden: 'primitiveSetFullScreen is disabled in sandbox simulation'].
[238] -> [self isThisEverCalled: 'serial port primitive?'].
[239] -> [self isThisEverCalled: 'serial port primitive?'].
[242 "primitiveSignalAtUTCMicroseconds"] -> [^ self activateOperationForbidden: 'primitiveSignalAtMilliseconds is disabled in sandbox simulation'].
[243 "primitiveUpdateTimezone"] -> [^ self class primitiveFailTokenFor: nil "don't support"].
[247 "primitiveSnapshotEmbedded"] -> [^ self activateOperationForbidden: 'primitiveSnapshotEmbedded is disabled in sandbox simulation'].
[248 "primitiveArrayBecomeOneWayNoCopyHash"] -> [
^ self elements: rcvr forwardIdentityTo: arguments first].
[249 "primitiveArrayBecomeOneWayCopyHash"] -> [
^ self elements: rcvr forwardIdentityTo: arguments first copyHash: arguments second].
[570 "primitiveFlushExternalPrimitives"] -> [^ self activateOperationForbidden: 'primitiveFlushExternalPrimitives is disabled in sandbox simulation'].
[571 "primitiveUnloadModule"] -> [^ self activateOperationForbidden: 'primitiveUnloadModule is disabled in sandbox simulation'].
[572 "primitiveListBuiltinModule"] -> ["allowed"].
[573 "primitiveListExternalModule"] -> ["allowed"].
}
otherwise: [
^ absentBlock value].

self flag: #forLater. "Rethink several restrictions, e.g. instance enumeration, process signaling etc. Can we simulate sum of them?"

directRcvrAndArgs := self
access: (arguments copyWithFirst: rcvr)
indirectors: accessIndirectors.
selector ifNotNil: [
^ self
perform: selector
with: primitiveIndex
with: directRcvrAndArgs first
with: directRcvrAndArgs allButFirst].

^ super
doPrimitive: primitiveIndex
method: meth
receiver: directRcvrAndArgs first
args: directRcvrAndArgs allButFirst
Original file line number Diff line number Diff line change
Expand Up @@ -106,87 +106,17 @@ doPrimitive: primitiveIndex method: meth receiver: rcvr args: arguments
selector := #doPrimitiveNew:receiver:args:.
accessIndirectors at: 1 put: #readableObjectFor:].
[149 "primitiveGetAttribute"] -> ["allowed"].
[158 "primitiveCompareWith"] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[160 "primitiveAdoptInstance"] -> [accessIndirectors
at: 1 put: #readableObjectFor:;
at: 2 put: #writableObjectFor:].
[161 "primitiveSetOrHasIdentityHash"] -> [self shouldBeImplemented: 'primitiveSetOrHasIdentityHash'].
[163 "primitiveGetImmutability"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[164 "primitiveSetImmutability"] -> [selector := #doPrimitiveSetImmutability:receiver:args:].
[165 "primitiveIntegerAt"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[166 "primitiveIntegerAtPut"] -> [accessIndirectors at: 1 put: #writableObjectFor:].
[167 "primitiveYield"] -> [^ self activateOperationForbidden: 'Control primitives are disabled in sandbox simulation'].
[168 "primitiveCopyObject"] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[169 "primitiveNotIdentical"] -> [accessIndirectors
at: 1 put: #readableObjectFor:;
at: 2 put: #readableObjectFor:].
[170 "primitiveAsCharacter"] -> [
accessIndirectors at: 1 put: #readableObjectFor:.
selector := #doPrimitiveNew:receiver:args:].
[171 "primitiveImmediateAsInteger"] -> [
accessIndirectors at: 1 put: #readableObjectFor:.
selector := #doPrimitiveNew:receiver:args:].
[172 "primitiveFetchNextMourner"] -> [self flag: #reconsider].
[173 "primitiveSlotAt"] -> [accessIndirectors atLast: 2 put: #readableObjectFor:].
[174 "primitiveSlotAtPut"] -> [accessIndirectors atLast: 3 put: #writableObjectFor:].
[175 "primitiveBehaviorHash"] -> [#doPrimitiveHash:receiver:args:].
[176 "primitiveMaxIdentityHash"] -> ["allowed"].
[177 "primitiveAllInstances"] -> ["allowed"].
[178 "primitiveAllObjects"] -> ["allowed"].
[180 "primitiveGrowMemoryByAtLeast"] -> [^ self activateOperationForbidden: 'primitiveGrowMemoryByAtLeast is disabled in sandbox simulation'].
[181 "primitiveSizeInBytesOfInstance"] -> [
self flag: #shouldBeImplemented.
^ self activateOperationForbidden: 'primitiveSizeInBytesOfInstance is disabled in sandbox simulation'].
[182 "primitiveSizeInBytes"] -> [
self flag: #shouldBeImplemented.
^ self activateOperationForbidden: 'primitiveSizeInBytesOfInstance is disabled in sandbox simulation'].
[183 "primitiveIsPinned"] -> [^ self activateOperationForbidden: 'Pinning primitives are disabled in sandbox simulation'].
[184 "primitivePin"] -> [
self flag: #forLater. "We could simulate that, too. Maybe interesting for TelegramSmalltalkSession?"
^ self activateOperationForbidden: 'Pinning primitives are disabled in sandbox simulation'].
[185 "primitiveExitCriticalSection"] -> [^ self activateOperationForbidden: 'Critical section primitives are disabled in sandbox simulation'].
[186 "primitiveEnterCriticalSection"] -> [^ self activateOperationForbidden: 'Critical section primitives are disabled in sandbox simulation'].
[187 "primitiveTestAndSetOwnershipOfCriticalSection"] -> [^ self activateOperationForbidden: 'Critical section primitives are disabled in sandbox simulation'].
[195 "primitiveFindNextUnwindContext"] -> [
"Note: Usually, this primitive will not be called for thisContext during simulation. However, if that's what the client is after, don't fall for it but use the image implementation."
^ self class primitiveFailTokenFor: nil].
[196 "primitiveTerminateTo"] -> [
"Note: Usually, this primitive will not be called for thisContext during simulation. However, if that's what the client is after, don't fall for it but use the image implementation."
^ self class primitiveFailTokenFor: nil].
[197 "primitiveFindHandlerContext"] -> [
"Note: Usually, this primitive will not be called for thisContext during simulation. However, if that's what the client is after, don't fall for it but use the image implementation."
^ self class primitiveFailTokenFor: nil].
[210 "primitiveContextAt"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[211 "primitiveContextAtPut"] -> [accessIndirectors at: 1 put: #writableObjectFor:].
[212 "primitiveContextSize"] -> [accessIndirectors at: 1 put: #readableObjectFor:].
[213 "primitiveContextXray"] -> [self shouldBeImplemented: 'primitiveContextXray'].
[214 "primitiveVoidVMState"] -> [self shouldBeImplemented: 'primitiveVoidVMState'].
[215 "primitiveFlushCacheByMethod"] -> [
self flag: #shouldBeImplemented. "This has not been tested. See primitiveFlushCache."
accessIndirectors at: 1 put: #writableObjectFor:].
[230 "primitiveRelinquishProcessor"] -> [^ self class primitiveFailTokenFor: nil "optional primitive, just skip it"].
[231 "primitiveForceDisplayUpdate"] -> [^ self class primitiveFailTokenFor: nil "use image implementation"].
[232 "primitiveFormPrint"] -> [^ self class primitiveFailTokenFor: nil "don't support"].
[233 "primitiveSetFullScreen"] -> [^ self activateOperationForbidden: 'primitiveSetFullScreen is disabled in sandbox simulation'].
[238] -> [self isThisEverCalled: 'serial port primitive?'].
[239] -> [self isThisEverCalled: 'serial port primitive?'].
[242 "primitiveSignalAtUTCMicroseconds"] -> [^ self activateOperationForbidden: 'primitiveSignalAtMilliseconds is disabled in sandbox simulation'].
[243 "primitiveUpdateTimezone"] -> [^ self class primitiveFailTokenFor: nil "don't support"].
[247 "primitiveSnapshotEmbedded"] -> [^ self activateOperationForbidden: 'primitiveSnapshotEmbedded is disabled in sandbox simulation'].
[248 "primitiveArrayBecomeOneWayNoCopyHash"] -> [
^ self elements: rcvr forwardIdentityTo: arguments first].
[249 "primitiveArrayBecomeOneWayCopyHash"] -> [
^ self elements: rcvr forwardIdentityTo: arguments first copyHash: arguments second].
[570 "primitiveFlushExternalPrimitives"] -> [^ self activateOperationForbidden: 'primitiveFlushExternalPrimitives is disabled in sandbox simulation'].
[571 "primitiveUnloadModule"] -> [^ self activateOperationForbidden: 'primitiveUnloadModule is disabled in sandbox simulation'].
[572 "primitiveListBuiltinModule"] -> ["allowed"].
[573 "primitiveListExternalModule"] -> ["allowed"].
}
otherwise: [
(primitiveIndex >= 250 and: [primitiveIndex <= 254]) "VM implementor primitives"
ifTrue: [^ self activateOperationForbidden: 'VM implementor primitives are disabled in sandbox simulation'].
(primitiveIndex >= 264 and: [primitiveIndex <= 519]) "primitiveLoadInstVar"
ifTrue: [accessIndirectors at: 1 put: #readableObjectFor:]].
otherwise: [ | morePrimitive moreResult |
self flag: #vmCapability. "Squeak 5.3/ClosureV3 encoder cannot handle more literals in one method..."
morePrimitive := true.
moreResult := self doMorePrimitive: primitiveIndex method: meth receiver: rcvr args: arguments ifAbsent: [
morePrimitive := false.
(primitiveIndex >= 250 and: [primitiveIndex <= 254]) "VM implementor primitives"
ifTrue: [^ self activateOperationForbidden: 'VM implementor primitives are disabled in sandbox simulation'].
(primitiveIndex >= 264 and: [primitiveIndex <= 519]) "primitiveLoadInstVar"
ifTrue: [accessIndirectors at: 1 put: #readableObjectFor:]].
morePrimitive ifTrue: [^ moreResult]].

self flag: #forLater. "Rethink several restrictions, e.g. instance enumeration, process signaling etc. Can we simulate sum of them?"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"access:indirectors:" : "ct 3/20/2021 23:35",
"activateOperationForbidden:" : "ct 3/3/2021 17:55",
"canBeImmutable:" : "ct 3/22/2021 23:47",
"doMorePrimitive:method:receiver:args:ifAbsent:" : "ct 11/1/2021 14:41",
"doNamedPrimitiveIn:for:withArgs:" : "ct 3/22/2021 17:43",
"doPrimitive:method:receiver:args:" : "ct 3/22/2021 23:39",
"doPrimitive:method:receiver:args:" : "ct 11/1/2021 14:40",
"doPrimitiveHash:receiver:args:" : "ct 3/22/2021 18:51",
"doPrimitiveNew:receiver:args:" : "ct 3/4/2021 20:16",
"doPrimitiveSetImmutability:receiver:args:" : "ct 3/22/2021 23:39",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ testSelectorsFromGroups: testGroups

(true
caseOf: {
[SystemVersion current isAlpha not and: [testClass isNil]] -> [
Transcript showln: ('Skipping {1} on legacy version of Squeak' format: {key}).
#()].
[selectors isSymbol] -> [
(testClass perform: selectors) tests
collect: #selector].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"shouldInheritSelectors" : "ct 3/5/2021 16:44",
"testGroups" : "ct 3/24/2021 20:33",
"testSelectors" : "ct 3/5/2021 17:14",
"testSelectorsFromGroups:" : "ct 3/5/2021 23:18",
"testSelectorsFromGroups:" : "ct 11/1/2021 14:49",
"wantsToTest:" : "ct 3/5/2021 16:50" },
"instance" : {
"basicPerformTest" : "ct 3/14/2021 16:08",
Expand Down