Skip to content

Commit

Permalink
sandbox: speed up memory lookups (ported back from TraceDebugger)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Jan 2, 2025
1 parent a26d757 commit 51c7c52
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class initialization
initialize

Mirror := thisContext. "Used for accessing miror primitives while avoiding frequent invocations of the expensive bytecode pushThisContext."
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ initialize

objects := SimPluggableWeakKeyDictionary new
"Simulation-safe WeakIdentityKeyDictionary. We must not send any message to any simulated object here (the object could inject arbitrary code in the executor by this, or it might simply not understand the message and raise an error). Use mirror primitives for identity and hash testing."
equalBlock: [:first :second | thisContext object: first eqeq: second];
hashBlock: [:object | thisContext simObjectIdentityHash: object];
equalBlock: [:first :second | Mirror object: first eqeq: second];
hashBlock: [:object | Mirror simObjectIdentityHash: object];
yourself.
hashes := objects copy.
stepCount := 0.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"evaluate:" : "ct 3/6/2021 13:12",
"evaluate:ifFailed:" : "ct 3/6/2021 13:12",
"evaluate:on:do:" : "ct 3/6/2021 13:12",
"fromMemory:" : "ct 3/6/2021 01:39" },
"fromMemory:" : "ct 3/6/2021 01:39",
"initialize" : "ct 12/29/2024 21:14" },
"instance" : {
"addObject:" : "ct 3/22/2021 17:51",
"basicEvaluate:" : "ct 11/13/2021 16:12",
Expand All @@ -18,7 +19,7 @@
"exportMemory" : "ct 3/6/2021 01:38",
"hashFor:" : "ct 1/10/2021 21:40",
"importMemory:" : "ct 3/6/2021 01:39",
"initialize" : "ct 12/29/2021 14:40",
"initialize" : "ct 1/2/2025 03:33",
"lookupSelector:inClass:" : "ct 12/29/2021 01:55",
"patchObject:with:" : "ct 3/6/2021 13:25",
"readableObjectFor:" : "ct 12/28/2020 21:24",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"classinstvars" : [
],
"classvars" : [
],
"Mirror" ],
"commentStamp" : "ct 12/26/2021 21:36",
"instvars" : [
"stepLimit",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class initialization
initialize

Mirror := thisContext. "Used for accessing miror primitives while avoiding frequent invocations of the expensive bytecode pushThisContext."
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ initialize

objects := SimPluggableWeakKeyDictionary new
"Simulation-safe WeakIdentityKeyDictionary. We must not send any message to any simulated object here (the object could inject arbitrary code in the executor by this, or it might simply not understand the message and raise an error). Use mirror primitives for identity and hash testing."
equalBlock: [:first :second | thisContext object: first eqeq: second];
hashBlock: [:object | thisContext simObjectIdentityHash: object];
equalBlock: [:first :second | Mirror object: first eqeq: second];
hashBlock: [:object | Mirror simObjectIdentityHash: object];
yourself.
hashes := objects copy.
stepCount := 0.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"evaluate:" : "ct 11/13/2021 16:12",
"evaluate:ifFailed:" : "ct 11/13/2021 16:12",
"evaluate:on:do:" : "ct 11/13/2021 16:12",
"fromMemory:" : "ct 3/6/2021 01:39" },
"fromMemory:" : "ct 3/6/2021 01:39",
"initialize" : "ct 12/29/2024 21:14" },
"instance" : {
"access:indirectors:" : "ct 11/12/2021 23:58",
"addObject:" : "ct 3/22/2021 17:51",
Expand Down Expand Up @@ -45,7 +46,7 @@
"exportMemory" : "ct 3/6/2021 01:38",
"hashFor:" : "ct 1/10/2021 21:40",
"importMemory:" : "ct 3/6/2021 01:39",
"initialize" : "ct 12/29/2021 14:40",
"initialize" : "ct 12/29/2024 21:14",
"initializeContext:" : "ct 11/13/2021 00:18",
"operationForbidden:" : "ct 3/4/2021 23:48",
"patchObject:with:" : "ct 3/6/2021 13:25",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"classinstvars" : [
],
"classvars" : [
],
"Mirror" ],
"commentStamp" : "ct 11/19/2022 01:36",
"instvars" : [
"stepLimit",
Expand Down

0 comments on commit 51c7c52

Please sign in to comment.