Skip to content

Commit

Permalink
More work on simulator.
Browse files Browse the repository at this point in the history
  • Loading branch information
stlutz committed Feb 25, 2019
1 parent 1d21fa9 commit 5813240
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instance creation
compilerClass

^ Compiler
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
callbacksEnabled

^ callbacksEnabled ifNil: [callbacksEnabled := true]
^ callbacksEnabled ifNil: [true]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
change
updateLastValue

self setLastValue: self currentValue
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"class" : {
"compilerClass" : "sl 10/12/2018 09:59",
"monitoring:" : "sl 12/26/2017 18:55" },
"instance" : {
"addCallback:" : "sl 1/10/2018 19:51",
"callbacks" : "sl 1/10/2018 19:27",
"callbacksEnabled" : "sl 1/10/2018 19:27",
"callbacksEnabled" : "sl 2/25/2019 13:16",
"callbacksEnabled:" : "sl 12/26/2017 21:06",
"currentValue" : "sl 12/26/2017 20:23",
"disable" : "sl 2/4/2018 16:49",
Expand All @@ -22,4 +23,4 @@
"setLastValue:" : "sl 12/26/2017 18:43",
"setMonitoredBlock:" : "sl 12/26/2017 09:53",
"update" : "sl 2/7/2018 15:54",
"updateLastValue" : "sl 2/7/2018 16:13" } }
"updateLastValue" : "sl 2/25/2019 13:21" } }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
change
updateLastValue

self setLastValue: self currentValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"updateLastValue" : "sl 2/25/2019 13:18" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "ActiveExpressions-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "ManualActiveExpression",
"pools" : [
],
"super" : "ActiveExpression",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
change detection
updateLastValue

self updateSubscriptionsAndLastValue
| simulator |
simulator := AxSimulator new.
[simulator simulate: [monitoredBlock value].
self updateSubscriptions: simulator]
on: Error
do: [^ self].
self setLastValue: simulator result

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"instVarNamed:ofObject:changedFrom:to:inContext:" : "sl 10/10/2018 09:58",
"litVar:changedFrom:to:inContext:" : "sl 10/10/2018 09:59",
"tempVarNamed:changedFrom:to:inContext:" : "sl 10/10/2018 09:59",
"updateLastValue" : "sl 10/11/2018 11:55",
"updateSubscriptions:" : "sl 10/11/2018 11:43",
"updateSubscriptionsAndLastValue" : "sl 10/11/2018 11:35" } }
"updateLastValue" : "sl 2/25/2019 13:22",
"updateSubscriptions:" : "sl 10/11/2018 11:43" } }
2 changes: 1 addition & 1 deletion src/ActiveExpressions-Core.package/monticello.meta/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'ActiveExpressions-Core-sl.3' message 'empty log message' id '9aa1eb9e-e325-4bde-bc51-f7868a4fc4ad' date '11 October 2018' time '12:52:43.435234 pm' author 'sl' ancestors ((name 'ActiveExpressions-Core-sl.2' message 'empty log message' id '41ca1443-0aeb-4357-823d-106bb24155a2' date '10 October 2018' time '10:35:53.535738 pm' author 'sl' ancestors ((name 'ActiveExpressions-Core-cypress.1' message 'fabricated from a Cypress format repository' id '2cd42bda-65a2-4a1c-94fb-5a30b7e75183' date '10 October 2018' time '9:53:46.888779 am' author '' ancestors () stepChildren ())) stepChildren ())) stepChildren ())
(name 'ActiveExpressions-Core-stlu.4' message 'empty log message' id '34099b2e-56c9-4de8-854a-3865294d1fb1' date '25 February 2019' time '1:34:03.587085 pm' author 'stlu' ancestors ((name 'ActiveExpressions-Core-sl.3' message 'empty log message' id '9aa1eb9e-e325-4bde-bc51-f7868a4fc4ad' date '11 October 2018' time '12:52:43.435234 pm' author 'sl' ancestors ((name 'ActiveExpressions-Core-sl.2' message 'empty log message' id '41ca1443-0aeb-4357-823d-106bb24155a2' date '10 October 2018' time '10:35:53.535738 pm' author 'sl' ancestors ((name 'ActiveExpressions-Core-cypress.1' message 'fabricated from a Cypress format repository' id '2cd42bda-65a2-4a1c-94fb-5a30b7e75183' date '10 October 2018' time '9:53:46.888779 am' author '' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
accessing
instVarAccessed: offset of: receiver

(instVarAccesses
"Remembers inst var accesses as offsets instead of variable names to avoid building the complete list of variable names each time."
(self instVarAccesses
at: receiver
ifAbsentPut: [IdentitySet new]) add: offset.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ instruction decoding
pushLiteralVariable: anAssociation

anAssociation isSubscriptionsBinding ifFalse: [
litVarAccesses add: anAssociation].
self litVarAccesses add: anAssociation].
^ super pushLiteralVariable: anAssociation
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
instruction decoding
send: selector super: supered numArgs: numberArguments
"Probe for selectors which should not be simulated. Step over them. This has to be quick, so it was optimized for speed at the cost of code cleanliness."
selector == #notify:instVarNamed:ofObject:changedFrom:to:inContext: ifTrue: [
6 timesRepeat: [currentContext pop]. ^ currentContext].
(selector == #notify:litVar:changedFrom:to:inContext:
or: [selector == #notify:tempVarNamed:changedFrom:to:inContext:]) ifTrue: [
5 timesRepeat: [currentContext pop]. ^ currentContext].
"Probe for return fields (quick methods)"
numberArguments = 0 ifTrue: [
| receiver nextMethod |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
},
"instance" : {
"initialize" : "sl 10/11/2018 11:38",
"instVarAccessed:of:" : "sl 10/10/2018 22:27",
"instVarAccessed:of:" : "sl 2/25/2019 13:27",
"instVarAccesses" : "sl 10/10/2018 21:46",
"litVarAccesses" : "sl 10/10/2018 21:46",
"pushLiteralVariable:" : "sl 10/10/2018 22:07",
"pushReceiverVariable:" : "sl 10/10/2018 22:28",
"send:super:numArgs:" : "sl 10/10/2018 22:29" } }
"pushLiteralVariable:" : "sl 2/25/2019 12:12",
"pushReceiverVariable:" : "sl 2/25/2019 13:07",
"send:super:numArgs:" : "sl 2/25/2019 13:05" } }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
as yet unclassified
distanceFrom: topContext to: bottomContext

| c distance |
distance := 0.
c := bottomContext.
[c ~~ nil]
whileTrue:
[c == topContext
ifTrue: [^ distance]
ifFalse:
[distance := distance + 1.
c := c sender]].
self error: 'topContext is not in the sender chain of bottomContext'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
logContext: aContext

depth * 2 timesRepeat: [Transcript space].
aContext printOn: Transcript.
Transcript
cr;
flush
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
as yet unclassified
send: selector super: supered numArgs: numberArguments

| receiver nextMethod |
receiver := currentContext at: (currentContext stackPtr - numberArguments).
nextMethod := receiver class lookupSelector: selector.
nextMethod primitive > 0 ifTrue: [
(depth + 1) * 2 timesRepeat: [Transcript space].
Transcript nextPutAll: receiver class name.
nextMethod methodClass ~~ receiver class ifTrue:
[Transcript nextPut: $(; nextPutAll: nextMethod methodClass name; nextPut: $)].
Transcript nextPutAll: '>>'; nextPutAll: nextMethod selector; cr].
^ super send: selector super: supered numArgs: numberArguments
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
as yet unclassified
simulate: aBlock

| topContext |
aBlock hasMethodReturn
ifTrue: [self error: 'simulation of blocks with ^ can run loose'].
topContext := thisContext.
depth := 0.
currentContext := aBlock asContext.
currentContext pushArgs: Array new from: topContext.
Transcript nextPutAll: '#################################'; cr.
self logContext: currentContext.
[currentContext == topContext]
whileFalse:
[| previousContext previousDepth |
previousContext := currentContext.
previousDepth := depth.
currentContext := currentContext interpretNextInstructionFor: self.
depth := self distanceFrom: topContext to: currentContext.
(previousContext ~~ currentContext and: [previousDepth < depth]) ifTrue: [
self logContext: currentContext]].
result := topContext pop.
Transcript flush
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"class" : {
},
"instance" : {
"distanceFrom:to:" : "sl 10/12/2018 19:29",
"logContext:" : "sl 10/12/2018 18:52",
"send:super:numArgs:" : "sl 10/12/2018 19:25",
"simulate:" : "sl 10/12/2018 18:55" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "ActiveExpressions-Simulation",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"depth" ],
"name" : "AxVerboseSimulator",
"pools" : [
],
"super" : "AxSimulator",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
instruction decoding
popIntoReceiverVariable: offset
popIntoReceiverVariable: offset
"Remove Top Of Stack And Store Into Instance Variable bytecode."
^ currentContext popIntoReceiverVariable: offset
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"methodReturnReceiver" : "sl 10/10/2018 16:34",
"methodReturnTop" : "sl 10/10/2018 22:05",
"popIntoLiteralVariable:" : "sl 10/10/2018 16:35",
"popIntoReceiverVariable:" : "sl 10/10/2018 16:35",
"popIntoReceiverVariable:" : "sl 10/12/2018 09:46",
"popIntoRemoteTemp:inVectorAt:" : "sl 10/10/2018 16:35",
"popIntoTemporaryVariable:" : "sl 10/10/2018 16:36",
"pushActiveContext" : "sl 10/10/2018 16:36",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'ActiveExpressions-Simulation-sl.2' message 'empty log message' id '5c5661d6-b402-4384-b4d6-af84df4d8f00' date '11 October 2018' time '12:52:33.137125 pm' author 'sl' ancestors ((name 'ActiveExpressions-Simulation-sl.1' message 'empty log message' id 'a3005c4b-ad41-4b8d-82b9-27cfe19c9ad4' date '10 October 2018' time '10:39:40.320292 pm' author 'sl' ancestors () stepChildren ())) stepChildren ())
(name 'ActiveExpressions-Simulation-stlu.3' message 'empty log message' id 'e18821e4-8753-4ca5-8775-260e2e448329' date '25 February 2019' time '1:34:49.78656 pm' author 'stlu' ancestors ((name 'ActiveExpressions-Simulation-sl.2' message 'empty log message' id '5c5661d6-b402-4384-b4d6-af84df4d8f00' date '11 October 2018' time '12:52:33.137125 pm' author 'sl' ancestors ((name 'ActiveExpressions-Simulation-sl.1' message 'empty log message' id 'a3005c4b-ad41-4b8d-82b9-27cfe19c9ad4' date '10 October 2018' time '10:39:40.320292 pm' author 'sl' ancestors () stepChildren ())) stepChildren ())) stepChildren ())

0 comments on commit 5813240

Please sign in to comment.