diff --git a/packages/TraceDebugger.package/TDBCursor.class/instance/basicCalleeOf..st b/packages/TraceDebugger.package/TDBCursor.class/instance/basicCalleeOf..st index 536ea3ae..768f5e93 100644 --- a/packages/TraceDebugger.package/TDBCursor.class/instance/basicCalleeOf..st +++ b/packages/TraceDebugger.package/TDBCursor.class/instance/basicCalleeOf..st @@ -2,4 +2,4 @@ private - stepping basicCalleeOf: aContext "Answer the context whose sender is aContext." - ^ self context findContextSuchThat: [:c | c sender == aContext] \ No newline at end of file + ^ self context findContextSuchThat: [:c | c sender tdbIdentical: aContext] \ No newline at end of file diff --git a/packages/TraceDebugger.package/TDBCursor.class/instance/doStepOver..st b/packages/TraceDebugger.package/TDBCursor.class/instance/doStepOver..st index 761115b6..c1dcc475 100644 --- a/packages/TraceDebugger.package/TDBCursor.class/instance/doStepOver..st +++ b/packages/TraceDebugger.package/TDBCursor.class/instance/doStepOver..st @@ -10,6 +10,6 @@ doStepOver: aContext ifTrue: [self step ifNil: [^ self]. ((self context tdbIdentical: aContext) not - and: [aContext in: [:ctx | self context hasSender: ctx]]) + and: [self context hasSender: aContext tdbproxyYourself]) ifTrue: [self completeStep: self context]]. self stepToSendOrReturn]. \ No newline at end of file diff --git a/packages/TraceDebugger.package/TDBCursor.class/methodProperties.json b/packages/TraceDebugger.package/TDBCursor.class/methodProperties.json index 591407b4..449cf79f 100644 --- a/packages/TraceDebugger.package/TDBCursor.class/methodProperties.json +++ b/packages/TraceDebugger.package/TDBCursor.class/methodProperties.json @@ -20,7 +20,7 @@ "allContextsDo:" : "ct 2/20/2022 21:00", "allContextsGather:" : "ct 3/11/2022 19:14", "assureTracingDuring:" : "ct 3/17/2022 19:47", - "basicCalleeOf:" : "ct 2/20/2022 21:12", + "basicCalleeOf:" : "ct 7/7/2022 17:01", "basicStep" : "ct 3/16/2022 00:25", "basicStepBack" : "ct 3/11/2022 16:11", "calleeOf:" : "ct 3/17/2022 19:16", @@ -45,7 +45,7 @@ "doStepInto" : "ct 3/11/2022 16:48", "doStepInto:" : "ct 3/16/2022 16:41", "doStepOver" : "ct 3/11/2022 16:48", - "doStepOver:" : "ct 3/16/2022 16:40", + "doStepOver:" : "ct 7/7/2022 17:04", "doStepThrough" : "ct 3/11/2022 16:48", "doStepThrough:" : "ct 3/11/2022 16:48", "doStepThrough:until:" : "ct 3/17/2022 19:20", diff --git a/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st b/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st index 31bfd6c1..6346d559 100644 --- a/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st +++ b/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st @@ -1,15 +1,16 @@ controlling context: aContext doPrimitive: primitiveIndex method: aCompiledMethod receiver: receiver args: originalArguments do: aBlock - "Redirect primitives that read any state. If the relevant object's slot is defined in the historic memory, use the recorded state from there instead of the current state for the object in the image." + "Redirect primitives that read any state. If the relevant object's slot is defined in the historic memory, use the recorded state from there instead of the current state for the object in the image." | arguments receiverAndArgs | "Resolve proxy receiver/arguments for the same memory by replacing them with the original object. See TDBProxy>>#xxxtdbproxyForward: and senders." arguments := nil. originalArguments withIndexDo: [:argument :index | ((aContext objectClass: argument) isTdbProxyClass - and: [argument xxxtdbproxyMemory == memory]) - ifTrue: [(arguments ifNil: [arguments := originalArguments copy]) - at: index put: argument xxxtdbproxyObject]]. + and: [argument xxxtdbproxyMemory == memory + and: [argument xxxtdbproxyTimeIndex = timeIndices]]) + ifTrue: [(arguments ifNil: [arguments := originalArguments copy]) + at: index put: argument xxxtdbproxyObject]]. arguments ifNil: [arguments := originalArguments]. self flag: #todo. "Handle missing arguments gracefully" @@ -17,7 +18,11 @@ context: aContext doPrimitive: primitiveIndex method: aCompiledMethod receiver: self flag: #optimize. "Array lookup for primitives?" (PrimitiveHandlers at: primitiveIndex) ifNotNil: [:handler | - ^ self perform: handler withArguments: {aContext. primitiveIndex. aCompiledMethod. receiver. arguments. aBlock}]. + | result | + lastPrimitive := primitiveIndex. + result := self perform: handler withArguments: {aContext. primitiveIndex. aCompiledMethod. receiver. arguments. aBlock}. + lastPrimitive := nil. + ^ result]. receiverAndArgs := self context: aContext diff --git a/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.send.super.numArgs.do..st b/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.send.super.numArgs.do..st index 73ba66d5..1f914c8c 100644 --- a/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.send.super.numArgs.do..st +++ b/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/instance/context.send.super.numArgs.do..st @@ -8,6 +8,13 @@ context: aContext send: selector super: superFlag numArgs: numArgs do: aBlock numArgs to: 1 by: -1 do: [:i | arguments at: i put: aContext pop]. thisReceiver := aContext pop. + "Resolve proxy receiver for the same memory by replacing them with the original receiver. See TDBProxy>>#xxxtdbproxyForward: and senders." + ((aContext objectClass: thisReceiver) isTdbProxyClass + and: [thisReceiver xxxtdbproxyMemory == memory + and: [thisReceiver xxxtdbproxyTimeIndex = timeIndices]]) + ifTrue: + [thisReceiver := thisReceiver xxxtdbproxyObject]. + lookupClass := self context: aContext combineArguments: {thisReceiver} collect: [:eachReceiver | aContext objectClass: eachReceiver first]. (self context: aContext isVector: lookupClass) ifTrue: diff --git a/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/methodProperties.json b/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/methodProperties.json index 363e3326..e37205d9 100644 --- a/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/methodProperties.json +++ b/packages/TraceDebugger.package/TDBRangeRetracingSimulator.class/methodProperties.json @@ -20,7 +20,7 @@ "initializePrimitiveHandlers" : "ct 6/1/2022 11:41" }, "instance" : { "context:combineArguments:collect:" : "ct 6/18/2022 15:29", - "context:doPrimitive:method:receiver:args:do:" : "ct 6/18/2022 15:53", + "context:doPrimitive:method:receiver:args:do:" : "ct 7/5/2022 16:47", "context:doReadPrimitive:method:receiver:args:do:" : "ct 7/3/2022 01:39", "context:doWritePrimitive:method:receiver:args:do:" : "ct 7/3/2022 01:40", "context:isVector:" : "ct 5/28/2022 22:48", @@ -28,14 +28,15 @@ "context:okToStore:inBits:" : "ct 6/2/2022 13:54", "context:primitiveBitBlt:method:receiver:arguments:do:" : "ct 6/3/2022 00:35", "context:pushReceiverVariable:do:" : "ct 6/2/2022 10:41", - "context:return:from:do:" : "ct 5/30/2022 14:49", + "context:return:from:do:" : "ct 7/2/2022 19:36", "context:runPrimitive:method:receiver:args:" : "ct 6/1/2022 11:57", "context:runSimulated:contextAtEachStep:do:" : "ct 7/5/2022 17:47", - "context:send:super:numArgs:do:" : "ct 6/2/2022 10:41", + "context:send:super:numArgs:do:" : "ct 7/5/2022 16:47", "context:sendSpecial:numArgs:do:" : "ct 5/28/2022 22:42", - "context:simulatedObject:basicAt:ifHit:" : "ct 6/3/2022 18:09", + "context:simulatedObject:basicAt:ifHit:" : "ct 7/7/2022 15:05", "context:simulatedObject:instVarAt:ifHit:" : "ct 6/3/2022 18:09", "context:simulatedObject:instVarAt:put:do:" : "ct 7/5/2022 10:39", + "contextCleanVectors:arguments:" : "ct 7/5/2022 19:13", "contextCopies" : "ct 5/26/2022 17:56", "contextCopies:" : "ct 5/26/2022 17:57", "contextForceRetracingFork:arguments:" : "ct 6/1/2022 16:49", @@ -55,6 +56,5 @@ "matchesSimulator:" : "ct 5/28/2022 19:37", "memorySliceClass" : "ct 6/2/2022 15:02", "postFork" : "ct 6/3/2022 18:09", - "timeIndex" : "ct 7/7/2022 15:07", "timeIndices" : "ct 5/12/2022 12:31", "timeIndices:" : "ct 5/28/2022 19:24" } } diff --git a/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st b/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st index 4abd54af..046069ba 100644 --- a/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st +++ b/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.doPrimitive.method.receiver.args.do..st @@ -6,9 +6,10 @@ context: aContext doPrimitive: primitiveIndex method: aCompiledMethod receiver: arguments := nil. originalArguments withIndexDo: [:argument :index | ((aContext objectClass: argument) isTdbProxyClass - and: [argument xxxtdbproxyMemory == memory]) - ifTrue: [(arguments ifNil: [arguments := originalArguments copy]) - at: index put: argument xxxtdbproxyObject]]. + and: [argument xxxtdbproxyMemory == memory + and: [argument xxxtdbproxyTimeIndex = self timeIndex]]) + ifTrue: [(arguments ifNil: [arguments := originalArguments copy]) + at: index put: argument xxxtdbproxyObject]]. arguments ifNil: [arguments := originalArguments]. ^ super diff --git a/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.send.to.with.lookupIn.do..st b/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.send.to.with.lookupIn.do..st index 5d089725..e84222f8 100644 --- a/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.send.to.with.lookupIn.do..st +++ b/packages/TraceDebugger.package/TDBRetracingSimulator.class/instance/context.send.to.with.lookupIn.do..st @@ -4,10 +4,11 @@ context: aContext send: selector to: originalReceiver with: arguments lookupIn: | receiver lookupClass | "Resolve proxy receiver for the same memory by replacing them with the original receiver. See TDBProxy>>#xxxtdbproxyForward: and senders." ((aContext objectClass: (receiver := originalReceiver)) isTdbProxyClass - and: [originalReceiver xxxtdbproxyMemory == memory]) - ifTrue: - [receiver := originalReceiver xxxtdbproxyObject. - lookupClass := aContext objectClass: receiver]. + and: [originalReceiver xxxtdbproxyMemory == memory + and: [originalReceiver xxxtdbproxyTimeIndex = self timeIndex]]) + ifTrue: + [receiver := originalReceiver xxxtdbproxyObject. + lookupClass := aContext objectClass: receiver]. ^ super context: aContext diff --git a/packages/TraceDebugger.package/TDBRetracingSimulator.class/methodProperties.json b/packages/TraceDebugger.package/TDBRetracingSimulator.class/methodProperties.json index 56b1926c..98cd1a14 100644 --- a/packages/TraceDebugger.package/TDBRetracingSimulator.class/methodProperties.json +++ b/packages/TraceDebugger.package/TDBRetracingSimulator.class/methodProperties.json @@ -3,16 +3,15 @@ "forMemory:atTime:" : "ct 5/12/2022 12:22", "forMemory:atTimes:" : "ct 5/12/2022 12:30" }, "instance" : { - "context:doPrimitive:method:receiver:args:do:" : "ct 5/28/2022 19:22", - "context:primitiveTraceDebugger:receiver:arguments:" : "ct 6/1/2022 18:56", - "context:send:to:with:lookupIn:do:" : "ct 5/2/2022 22:24", + "context:doPrimitive:method:receiver:args:do:" : "ct 7/5/2022 16:46", + "context:primitiveTraceDebugger:receiver:arguments:" : "ct 7/5/2022 19:07", + "context:send:to:with:lookupIn:do:" : "ct 7/7/2022 15:39", "contextForceRetracingFork:arguments:" : "ct 6/1/2022 18:56", - "contextPushRetracingTimeIndex:" : "ct 7/5/2022 16:45", + "contextPushRetracingTimeIndex:" : "ct 6/1/2022 18:56", "initialize" : "ct 5/10/2022 23:30", "memory" : "ct 5/2/2022 13:53", "memory:" : "ct 5/2/2022 13:53", "printOn:" : "ct 7/5/2022 16:45", "sideEffects" : "ct 6/18/2022 16:00", "sideEffects:" : "ct 6/18/2022 16:00", - "timeIndex" : "ct 7/5/2022 16:44", "wantsToControlReads" : "ct 5/10/2022 21:18" } } diff --git a/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/expectedFailures.st b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/expectedFailures.st index c20151cf..16e36173 100644 --- a/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/expectedFailures.st +++ b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/expectedFailures.st @@ -2,4 +2,5 @@ failures expectedFailures ^ super expectedFailures , - {#testAutomaticCoalescion flag: #gc} \ No newline at end of file + {#testAutomaticCoalescion flag: #gc. + #testForeignProxy "Nested range retracing is not possible because the outer simulator cannot distinguish between vectors and actual TDBMemorySlice instances created by the inner simulator"} \ No newline at end of file diff --git a/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/testForeignProxy.st b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/testForeignProxy.st new file mode 100644 index 00000000..f4c82b20 --- /dev/null +++ b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/testForeignProxy.st @@ -0,0 +1,7 @@ +tests +testForeignProxy + + | proxy | + simulator timeIndices: (2 to: 3). + proxy := memory object: object atTimes: (2 to: 4) withSideEffects: nil. + self assertQuery: [proxy griffle] values: #(3). "intersection of (2 to: 4) and (2 to: 3)" \ No newline at end of file diff --git a/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/testOwnProxy.st b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/testOwnProxy.st new file mode 100644 index 00000000..8e911fe4 --- /dev/null +++ b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/instance/testOwnProxy.st @@ -0,0 +1,7 @@ +tests +testOwnProxy + + | proxy | + simulator timeIndices: (3 to: 4). + proxy := memory object: object atTimes: (3 to: 4) withSideEffects: nil. + self assertQuery: [proxy griffle] values: #(3 2). \ No newline at end of file diff --git a/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/methodProperties.json b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/methodProperties.json index 05052cbd..e906d2ca 100644 --- a/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/methodProperties.json +++ b/packages/TraceDebuggerTests.package/TDBRangeRetracingSimulatorTest.class/methodProperties.json @@ -14,7 +14,7 @@ "assertSlice:times:values:" : "ct 7/7/2022 16:35", "classUnderTest" : "ct 5/26/2022 15:37", "denyForkDuring:" : "ct 5/27/2022 15:25", - "expectedFailures" : "ct 6/2/2022 15:10", + "expectedFailures" : "ct 7/7/2022 15:48", "memorySliceClass" : "ct 6/1/2022 13:01", "newSimulator" : "ct 5/26/2022 15:40", "testAutomaticCoalescion" : "ct 5/26/2022 19:03", @@ -23,14 +23,17 @@ "testCloneObject" : "ct 7/3/2022 23:08", "testCombineArgumentsCollect" : "ct 6/2/2022 10:28", "testContextPrimitives" : "ct 7/3/2022 01:30", + "testCutVectorFromSideEffect" : "ct 7/7/2022 16:44", "testDebugForks" : "ct 6/2/2022 10:27", "testError" : "ct 6/2/2022 10:41", + "testForeignProxy" : "ct 7/7/2022 15:41", "testIsolateState" : "ct 5/26/2022 15:45", "testIsolatedForks" : "ct 5/26/2022 20:04", "testJump" : "ct 5/26/2022 19:05", "testMaintainSlices" : "ct 6/2/2022 18:05", "testMessageSend" : "ct 5/27/2022 15:18", "testNonLocalReturn" : "ct 5/27/2022 16:14", + "testOwnProxy" : "ct 7/7/2022 15:35", "testPrimitive118" : "ct 6/18/2022 15:40", "testPrimitiveExecuteMethod" : "ct 7/7/2022 16:54", "testPrimitiveStringAtPut" : "ct 7/2/2022 23:42", diff --git a/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/instance/testForeignProxy.st b/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/instance/testForeignProxy.st new file mode 100644 index 00000000..f9fc6a35 --- /dev/null +++ b/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/instance/testForeignProxy.st @@ -0,0 +1,6 @@ +tests +testForeignProxy + + | proxy | + proxy := memory object: object atTime: 4. + self assert: 3 equals: (simulator evaluate: [proxy griffle]). \ No newline at end of file diff --git a/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/instance/testOwnProxy.st b/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/instance/testOwnProxy.st new file mode 100644 index 00000000..b70716cb --- /dev/null +++ b/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/instance/testOwnProxy.st @@ -0,0 +1,6 @@ +tests +testOwnProxy + + | proxy | + proxy := memory object: object atTime: 3. + self assert: 3 equals: (simulator evaluate: [proxy griffle]). \ No newline at end of file diff --git a/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/methodProperties.json b/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/methodProperties.json index e01033c4..890621fb 100644 --- a/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/methodProperties.json +++ b/packages/TraceDebuggerTests.package/TDBRetracingSimulatorTest.class/methodProperties.json @@ -4,8 +4,10 @@ "instance" : { "newSimulator" : "ct 5/10/2022 21:54", "testContextPrimitives" : "ct 7/3/2022 01:53", + "testForeignProxy" : "ct 7/7/2022 15:35", "testIsolatePrimitives" : "ct 5/26/2022 16:01", "testIsolateState" : "ct 5/26/2022 16:03", + "testOwnProxy" : "ct 7/7/2022 15:33", "testPrimitive118" : "ct 6/18/2022 15:40", "testPrimitiveExecuteMethod" : "ct 7/7/2022 16:54", "testReadYourOwnWrites" : "ct 5/10/2022 21:46",