Skip to content

Commit 4337be9

Browse files
committed
wip history explorer coalescion
current todos and challenges: * without #86, we cannot compare multiple proxies on the same object for different time indices * in general, performance! with #86, comparing two proxies would trigger simCustomizationLevel = 2! but even without that problem, it might be very slow * more proxy problems when trying to manually compare objects (because proxies often consist of shared memory slices) * add tests, also for publicCoalesce:, and deduplicate coalescion
1 parent bc15405 commit 4337be9

File tree

12 files changed

+83
-4
lines changed

12 files changed

+83
-4
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*TraceDebugger-UI-comparing
2+
tdbContentEquals: anotherObject
3+
4+
(self class = Form and: [anotherObject class = Form])
5+
ifFalse: [^ self = anotherObject].
6+
7+
^ {self width. self height. self offset. self bits}
8+
= {anotherObject width. anotherObject height. anotherObject offset. anotherObject bits}

packages/TraceDebugger.package/Form.extension/methodProperties.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
"class" : {
33
},
44
"instance" : {
5-
"tdbAsText" : "ct 3/21/2022 19:08" } }
5+
"tdbAsText" : "ct 3/21/2022 19:08",
6+
"tdbContentEquals:" : "ct 7/5/2022 16:26" } }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*TraceDebugger-UI-comparing
2+
tdbContentEquals: anotherObject
3+
4+
^ self = anotherObject

packages/TraceDebugger.package/Object.extension/methodProperties.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"isTdbIsolatedError" : "ct 7/21/2022 17:23",
77
"isTdbMemorySlice" : "ct 5/12/2022 20:38",
88
"isTdbProxyHolder" : "ct 3/10/2022 22:39",
9+
"tdbContentEquals:" : "ct 7/5/2022 16:24",
910
"tdbHalt" : "ct 3/19/2022 21:02",
1011
"tdbIdentical:" : "ct 3/17/2022 19:15",
1112
"tdbNotify:" : "ct 3/19/2022 21:02",

packages/TraceDebugger.package/TDBHistoryExplorer.class/instance/computeSliceFrom.for..st

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ computeSliceFrom: aStringOrText for: requestor
1010
memorySlice := Cursor wait showWhile:
1111
[self cursor object: self object collect: [:ea |
1212
TDBMaybeResult catch: self commonErrors during: [block value: ea]]].
13+
"memorySlice publicCoalesce: [:a :b | a tdbContentEquals: b]." "Depends on https://github.com/hpi-swa-lab/squeak-tracedebugger/pull/86"
14+
memorySlice halt publicCoalesce: [:a :b |
15+
[a hasError = b hasError
16+
and: [a error = b error]
17+
and:
18+
[a result isForm
19+
ifTrue:
20+
[(a result in: [:it | {it width. it height. it depth. it bits hash}]) tdbproxyYourself
21+
= (b result in: [:it | {it width. it height. it depth. it bits hash}]) tdbproxyYourself]
22+
ifFalse:
23+
[a tdbproxyYourself result = b tdbproxyYourself result
24+
and: [a isText ==> [b isText and: [a runs hash = b runs hash]]]]]]
25+
on: TDBRetracingFrayOut, (Error, Warning, Halt) do: [false]].
26+
self flag: #hacked. "Compare proxies and use custom comparer for Forms/Texts etc."
1327
self changed: #memorySlice.
1428

1529
^ true

packages/TraceDebugger.package/TDBHistoryExplorer.class/methodProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"commonErrors" : "ct 7/21/2022 21:17",
2727
"compileToBlock:requestor:ifFail:" : "ct 7/3/2022 21:06",
2828
"completionAdditionals" : "ct 7/3/2022 22:05",
29-
"computeSliceFrom:for:" : "ct 7/24/2022 00:04",
29+
"computeSliceFrom:for:" : "ct 7/24/2022 22:13",
3030
"contents:notifying:" : "ct 6/19/2022 00:04",
3131
"context" : "ct 6/18/2022 23:32",
3232
"context:" : "ct 6/18/2022 23:32",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
comparing
2+
tdbContentEquals: anotherObject
3+
4+
self class = anotherObject class ifFalse: [^ false].
5+
^ (self error tdbContentEquals: anotherObject error)
6+
and: [self result tdbContentEquals: anotherObject result]

packages/TraceDebugger.package/TDBMaybeResult.class/methodProperties.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
"ifError:ifResult:" : "ct 6/19/2022 21:26",
1515
"printOn:" : "ct 6/19/2022 21:24",
1616
"result" : "ct 6/19/2022 21:14",
17-
"result:" : "ct 6/19/2022 21:14" } }
17+
"result:" : "ct 6/19/2022 21:14",
18+
"tdbContentEquals:" : "ct 7/5/2022 16:32" } }
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
private
2+
publicCoalesce: equalBlock
3+
"Evaluate equalBlock with each overlapping pair of the receiver's raw values. If the block answers true for a pair, replace the second one with the first one. See also #basicCondense: for preserving all values in a nested slice."
4+
5+
| coalescedIntervals coalescedRawValues lastInterval lastValue index |
6+
coalescedIntervals := nil.
7+
lastInterval := nil.
8+
lastValue := Object new.
9+
index := 0.
10+
self timesAndValuesDo: [:interval :value |
11+
(lastInterval notNil
12+
and:
13+
[interval isEmpty
14+
or:
15+
[lastInterval stop + 1 = interval start and:
16+
[equalBlock value: lastValue value: value]]])
17+
ifTrue:
18+
[coalescedIntervals ifNil:
19+
[coalescedIntervals := (Array new: intervals size) writeStream.
20+
coalescedRawValues := (Array new: rawValues size) writeStream.
21+
coalescedIntervals next: index putAll: intervals startingAt: 1.
22+
coalescedRawValues next: index putAll: rawValues startingAt: 1].
23+
lastInterval := lastInterval start to: interval stop]
24+
ifFalse:
25+
[lastInterval isEmptyOrNil ifFalse:
26+
[coalescedIntervals ifNotNil:
27+
[coalescedIntervals nextPut: lastInterval.
28+
coalescedRawValues nextPut: lastValue tdbproxyYourself].
29+
index := index + 1].
30+
lastInterval := interval.
31+
lastValue := value]].
32+
coalescedIntervals ifNotNil:
33+
[lastInterval isEmptyOrNil ifFalse:
34+
[coalescedIntervals nextPut: lastInterval.
35+
coalescedRawValues nextPut: lastValue tdbproxyYourself].
36+
intervals := coalescedIntervals contents.
37+
rawValues := coalescedRawValues contents].

packages/TraceDebugger.package/TDBMemorySlice.class/methodProperties.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"pointsCollect:" : "ct 6/1/2022 19:41",
3434
"postCopy" : "ct 6/1/2022 19:08",
3535
"printOn:" : "ct 6/17/2022 22:03",
36+
"publicCoalesce:" : "ct 7/5/2022 16:30",
3637
"rangeValueAtTime:" : "ct 7/2/2022 20:23",
3738
"rangeValueAtTime:ifAbsent:" : "ct 7/2/2022 20:22",
3839
"rawAssociationAtTime:ifAbsent:" : "ct 6/2/2022 13:48",

0 commit comments

Comments
 (0)