Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge cmf cmf callgraph and develop #30

Open
wants to merge 82 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7123aa9
MY STUFF \o/
cmfcmf Oct 29, 2020
7d1b89d
Complete merge
cmfcmf Oct 30, 2020
ce7a8e1
Integrate callgraph visualizations into BPBrowser
cmfcmf Oct 30, 2020
03e6ffb
Integrate sidebar with trace values
cmfcmf Oct 30, 2020
9b1f0fb
More visualizations, improved "context moving right" positioning
cmfcmf Nov 3, 2020
961611c
Introduce "path parts" :)
cmfcmf Nov 3, 2020
5bef663
Simplify and improve sidebar
cmfcmf Nov 4, 2020
8cc618d
Further simplify, consolidate, and improve visualizations
cmfcmf Nov 5, 2020
ea755fc
Add support for background colors in multicolumn lists, add preferenc…
cmfcmf Nov 9, 2020
5af8cb8
Generate callgraphs in background, add global registry for selecting …
cmfcmf Nov 10, 2020
4ad2cf1
Moar trace visualization
cmfcmf Dec 6, 2020
9714307
Minor improvements to bytecode rewriting
cmfcmf Dec 6, 2020
6bb05d6
Add missing methods to git
cmfcmf Dec 6, 2020
be02eb3
Refactor tracer to use a custom instance variable on Process. This is…
cmfcmf Dec 7, 2020
ef418fd
Minor fixes, latex export for callgraphs
cmfcmf Jan 2, 2021
1b8bf18
Minor fixes
cmfcmf Jan 3, 2021
cc1ce8f
Fix a recursion bug that ate all my RAM :((
cmfcmf Jan 3, 2021
4a804e5
ARGH???
cmfcmf Jan 3, 2021
9e2f996
Fix ByteCode Rewriting when the last statement is a TempVariableNode,…
cmfcmf Jan 5, 2021
f18101d
Move code that is not part of the example out of the block being traced.
cmfcmf Jan 5, 2021
244bd0a
Greatly improve handling of out-of-stack context jumps
cmfcmf Jan 8, 2021
2f718ad
Merge branch 'develop' into pr/29
codeZeilen Jan 12, 2021
714d331
Remove hard dependency on ReentrantSimulator
cmfcmf Jan 13, 2021
59b802e
Merge remote-tracking branch 'cmfcmf/callgraphs' into merge-cmf-cmf-c…
codeZeilen Jan 13, 2021
dcc4c48
Remove extension method from RSSimulatorConfiguration
cmfcmf Jan 14, 2021
b6e3a40
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Jan 14, 2021
4e67c15
Merge branch 'merge-cmf-cmf-callgraph-develop' of https://github.com/…
codeZeilen Jan 14, 2021
11ca445
Adds method wrappers as a dependency
codeZeilen Jan 14, 2021
9949b2a
Fixes a typo in the baseline
codeZeilen Jan 14, 2021
7acc79b
Adds preamble and postremove scripts for installing the tracer variable
codeZeilen Jan 14, 2021
648bec8
Adds the tracer method
codeZeilen Jan 14, 2021
90bcc09
Adds the missing tracer: and pauseFlushingCachesDuring: methods
codeZeilen Jan 14, 2021
09d41d5
Add missing inst var to MethodNode
cmfcmf Jan 14, 2021
0600bc3
Print relative blocks sizes when using the RelativeInstructionPrinter
cmfcmf Jan 14, 2021
1b4bd12
Fix pauseFlushingCachesDuring:
cmfcmf Jan 14, 2021
16ddd1a
Add missing method
cmfcmf Jan 14, 2021
f7c24fe
Fix botched rename
cmfcmf Jan 14, 2021
e757010
Makes the migration scripts more robust
codeZeilen Jan 15, 2021
1d2b1f1
Fixes the compiler tests by deleting methods that seem to have surviv…
codeZeilen Jan 15, 2021
820f682
Fixed trace notification tests to respect the tuple of trace and call…
codeZeilen Jan 15, 2021
60900a8
Improves the preamble / post-removal scripts again
codeZeilen Jan 15, 2021
39697a9
Resets the state of the UI package to the base state and applies the …
codeZeilen Jan 15, 2021
0645153
Implements re-instrumentation of instrumented methods
codeZeilen Jan 20, 2021
193f7e4
When preserving the callgraph instrumentation take care to not break …
codeZeilen Jan 20, 2021
639d787
Re-adds a method gone missing during the merge
codeZeilen Jan 20, 2021
5f8f2a9
Makes the preservation of the instrumentation less flaky with regard …
codeZeilen Jan 21, 2021
f72f51b
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Jan 22, 2021
12f69e2
Deactivates the callgraph tracing during bpSnapshot
codeZeilen Jan 22, 2021
9ac08f7
Extracts the callgraph browser into its own class
codeZeilen Jan 22, 2021
6a75453
Refactors the shouldNeverInstrument: method
codeZeilen Jan 22, 2021
c83f422
Adds a configuration dialog to set the packages to be instrumented
codeZeilen Jan 22, 2021
931fdef
Fixes minor bugs in the refactored blacklist of methods to instrument
codeZeilen Jan 22, 2021
4474f01
Uses the instrumentation configuration in deciding which methods to i…
codeZeilen Jan 22, 2021
70ea1d2
Moves some code to BPBrowser and adds the instrumented packages confi…
codeZeilen Feb 15, 2021
7a477b9
Adds recording of sender pc and method
codeZeilen Feb 15, 2021
40ee7b8
Removes the callgraphTracer from the TraceInformation after the callg…
codeZeilen Feb 15, 2021
4b270b7
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Feb 15, 2021
0625ba4
Adds a simple callgraph browser without icons for the instrumentation…
codeZeilen Feb 15, 2021
c34a933
Revert "Adds a simple callgraph browser without icons for the instrum…
codeZeilen Feb 15, 2021
b4cd596
Adds a simple callgraph browser without message icons for instrumenta…
codeZeilen Feb 15, 2021
e232a96
Fixes a bug in my "beautiful" #shouldNeverInstrument: (should never h…
codeZeilen Feb 15, 2021
25a0080
Deactivates the callgraph tracer during setting up receivers and argu…
codeZeilen Feb 15, 2021
e58c560
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Feb 15, 2021
fa99b40
Adds a fix for wrong offset of temporary and instance variables
codeZeilen Feb 15, 2021
d1ed2e5
Moves layered method code to the right source file
codeZeilen Feb 15, 2021
f4b3b9a
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Feb 22, 2021
9e2ef9b
Changes call graph sidebar to initialy display the full call graph an…
codeZeilen Feb 22, 2021
d328e81
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Feb 22, 2021
7308737
Change the layouting of the callgraph sidebar
codeZeilen Feb 22, 2021
688c11b
Slightly reworks the sidebar selection button in the method example m…
codeZeilen Feb 22, 2021
5bae816
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Feb 22, 2021
22e4b21
puts the callgraph visualization on the right of the browser (just to…
codeZeilen Feb 22, 2021
358fd9d
Adds the call site recording and the corresponding UI which I deactiv…
codeZeilen Feb 22, 2021
7482c48
Merge branch 'develop' into merge-cmf-cmf-callgraph-develop
codeZeilen Mar 2, 2021
0845127
Shows the probed source code in the call trace
codeZeilen Mar 2, 2021
af1c5a7
Renames the visualization types in the sidebar
codeZeilen Mar 10, 2021
5f70dbb
Several small UI simplifications
codeZeilen Mar 11, 2021
12b6b7f
Implements automatic instrumentation and fixes the configuration dial…
codeZeilen Mar 11, 2021
a14b8d0
Comitted all kinds of sins to keep the sidebar visualizations stable …
codeZeilen Mar 11, 2021
af079d8
Increases default width of callgraph browser
codeZeilen Mar 11, 2021
1916329
Keeps the scroll position constant (as best as possible)
codeZeilen Mar 12, 2021
7baa3ed
Changes the code rewriter filter to be less strict by adding an aster…
codeZeilen Mar 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
public access
compile: aCueWithBPSource ifFail: failBlock

"This method expects source code which has annotations embedded in comments, if any."
| originalMethodNode bpSource basicCue |
bpSource := aCueWithBPSource sourceStream contents asString.
basicCue := CompilationCue
source: bpSource readStream
context: aCueWithBPSource context
receiver: aCueWithBPSource receiver
class: aCueWithBPSource getClass
environment: aCueWithBPSource environment
requestor: aCueWithBPSource requestor.
originalMethodNode := super compile: basicCue ifFail: failBlock.
self haltOnce.
bpSource := originalMethodNode sourceText asString.
(self methodSourceRequiresBPLayers: bpSource) ifTrue: [
(self compileInstrumentedVersionOf: aCueWithBPSource) ifFalse: failBlock].

^ originalMethodNode
^ self compileCue: aCueWithBPSource noPattern: false ifFail: failBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
public access
compileCue: aCueWithBPSource noPattern: aBoolean ifFail: failBlock


"This method expects source code which has annotations embedded in comments, if any."
| originalMethodNode bpSource basicCue |

aBoolean ifTrue: [self error: 'Cannot use BPCompiler for methods without patterns.'].

bpSource := aCueWithBPSource sourceStream contents asString.
basicCue := CompilationCue
source: bpSource readStream
context: aCueWithBPSource context
receiver: aCueWithBPSource receiver
class: aCueWithBPSource getClass
environment: aCueWithBPSource environment
requestor: aCueWithBPSource requestor.
originalMethodNode := super compileCue: basicCue noPattern: aBoolean ifFail: failBlock.

bpSource := originalMethodNode sourceText asString.
(self methodSourceRequiresBPLayers: bpSource) ifTrue: [
(self compileInstrumentedVersionOf: aCueWithBPSource) ifFalse: failBlock].

^ originalMethodNode
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"class" : {
"bpInstrumentedLayerName" : "pre 11/25/2020 11:41",
"compilerClass" : "pre 11/25/2020 11:17",
"bpInstrumentedLayerName" : " 1/15/2021 09:22:32",
"compilerClass" : "cmfcmf 10/30/2020 12:39",
"exampleTextAnchor" : "pre 11/8/2019 12:05" },
"instance" : {
"annotationKeywords" : "pre 11/8/2019 20:29",
"backgroundCompileInstrumentedVersionOf:basedOn:" : "pre 10/12/2020 15:36",
"compile:ifFail:" : "pre 10/12/2020 15:28",
"compileInstrumentedVersionOf:" : "pre 1/11/2021 15:51",
"backgroundCompileInstrumentedVersionOf:basedOn:" : "pre 8/20/2020 15:46",
"compile:ifFail:" : "cmfcmf 10/27/2020 11:15",
"compileCue:noPattern:ifFail:" : "cmfcmf 10/30/2020 12:39",
"compileInstrumentedVersionOf:" : "pre 8/17/2020 08:58",
"keywords" : "pre 7/26/2019 14:00",
"methodSourceRequiresBPLayers:" : "pre 11/11/2019 15:49",
"parse:" : "pre 1/11/2021 15:51",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I am an association that is considered equal in the context of a literal if my key as well as my value is equal to another instance of myself.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
literals
literalEqual: other

^ self class == other class and: [self key == other key] and: [self value == other value]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"literalEqual:" : "cmfcmf 10/22/2020 12:59" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Babylonian-Core-Callgraph-ByteCode",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "cmfcmf 10/20/2020 12:33",
"instvars" : [
],
"name" : "BPByteCodeAssociation",
"pools" : [
],
"super" : "Association",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tracing
customEvent: aSymbol data: anObject


self value ifNotNil: [:t | t customEvent: aSymbol data: anObject]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
process local
deactivateDuring: aBlock

^ self value: nil during: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tracing
enter: aString invocation: aNumber


self value ifNotNil: [:t | t enter: aString invocation: aNumber]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tracing
exit: aString invocation: aNumber returns: aBoolean


self value ifNotNil: [:t | t exit: aString invocation: aNumber returns: aBoolean]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tracing
swapSenderOf: context newSender: newSender


self value ifNotNil: [:t | self value: nil during: [t swapSenderOf: context newSender: newSender]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
process local
value: anObject during: aBlock

^ self value: anObject during: aBlock inProcess: Processor activeProcess
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process local
value: anObject during: aBlock inProcess: aProcess

| old |
old := aProcess tracer.
aProcess tracer: anObject.
^ aBlock ensure: [aProcess tracer: old]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
process local
value

^ Processor activeProcess tracer
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
private
blockIdxFromContext: aContext

| pc state blockPositions blockIdx |
self assert: aContext isClosureContext.
pc := aContext closure blockCreationPC.
state := BPByteCodeMethodState ofMethod: aContext method.
blockPositions := state nopPositions select: [:each | each first == #beforeBlock] thenCollect: [:each | each second stop + 1].
blockIdx := blockPositions indexOf: pc.
self assert: blockIdx > 0.
^ blockIdx + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tracing
customEvent: aSymbol data: anObject


events nextPut: #custom.
events nextPut: aSymbol.
events nextPut: anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tracing
enter: aString invocation: aNumber

| senderContext |
events nextPut: #enter.
events nextPut: aString.
events nextPut: aNumber.
senderContext := thisContext sender sender sender.
events nextPut: senderContext pc.
events nextPut: senderContext method.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
eventStream

^ events readStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
post processing
eventsForTree

| callgraph depth depthAfterExit depthMap printContinuesHere eventStream treeCache addToTree prevDepth overwriteDepth executionContinuation senderMethod |

depth := 0.
depthAfterExit := nil.

depthMap := Dictionary new.

callgraph := BPCallgraph new.
treeCache := Dictionary new.
prevDepth := -1.
overwriteDepth := -1.
addToTree := [:entry | | theDepth |
theDepth := overwriteDepth >= 0 ifTrue: [overwriteDepth] ifFalse: [depth].
theDepth > (prevDepth + 1) ifTrue: [
"context jumped to the right by more than 1 step, therefore we need to add
new tree nodes (->) to correctly mount the following nodes"
self assert: theDepth - executionContinuation second size >= 0.

executionContinuation second withIndexDo: [:helper :i |
overwriteDepth := theDepth - 1 - (executionContinuation second size - i).
addToTree value: helper].
"(theDepth - 1 - executionContinuation second size) to: theDepth - 1 do: [:i |
overwriteDepth := i.
addToTree value: BPCallgraphEntryContextJumpHelper new]."
overwriteDepth := -1].

theDepth == 0
ifTrue: [callgraph addRoot: entry]
ifFalse: [(treeCache at: theDepth - 1) addChild: entry].
treeCache at: theDepth put: entry.
prevDepth := theDepth].

printContinuesHere := [| entry |
addToTree value: executionContinuation first.
executionContinuation := nil].

eventStream := self eventStream.
[eventStream atEnd] whileFalse: [| entry | eventStream next caseOf: {
[#enter] -> [ | parts class selector blockIdx invocationCount senderPC |
parts := eventStream next splitBy: ' >> '.
class := parts first.
selector := parts second.
blockIdx := parts third asInteger.
"invocation count of the surrounding method. In other words: 'Id' of the context of this block/method, unique per method"
invocationCount := eventStream next.
senderPC := eventStream next.
senderMethod := eventStream next.

entry := BPCallgraphEntryEnter new.
entry class: class selector: selector blockIdx: blockIdx invocationCount: invocationCount senderPC: senderPC senderMethod: senderMethod.
addToTree value: entry.

blockIdx == 1 ifTrue: [depthMap at: {class . selector . invocationCount} put: depth].
depth := depth + 1].
[#exit] -> [ | parts class selector blockIdx invocationCount blockReturns |
parts := eventStream next splitBy: ' >> '.
class := parts first.
selector := parts second.
blockIdx := parts third asInteger.
"invocation count of the surrounding method. In other words: 'Id' of the context of this block/method, unique per method"
invocationCount := eventStream next.
blockReturns := eventStream next.

depth := depth - 1.
self assert: depth >= 0.

entry := BPCallgraphEntryExit new.
entry class: class selector: selector blockIdx: blockIdx invocationCount: invocationCount returns: blockReturns.
addToTree value: entry.

blockReturns ifTrue: [| oldDepth |
oldDepth := depthMap removeKey: {class . selector . invocationCount}.
blockIdx > 1 ifTrue: [depth := oldDepth]].

depthAfterExit ifNotNil: [
depth := depthAfterExit.
depthAfterExit := nil.
printContinuesHere value]].
[#contextSenderChanged] -> [ | depthDelta inChainOrNumMoveRight inChain hasActiveTracing executionContinuationEntry |
depthDelta := eventStream next.
inChainOrNumMoveRight := eventStream next.
inChain := inChainOrNumMoveRight == true.
hasActiveTracing := eventStream next.

"ignore events when depth didn't change and method that causes the change does not have active tracing."
(depthDelta ~= 0 or: hasActiveTracing) ifTrue: [
hasActiveTracing
ifTrue: [
depthAfterExit := depth + depthDelta.
"depth := depth + 1"]
ifFalse: [depth := depth + depthDelta].
self assert: depth >= 0.

executionContinuationEntry := BPCallgraphEntryContextExecutionContinuation new.
executionContinuation := {executionContinuationEntry . inChainOrNumMoveRight}.
entry := BPCallgraphEntryContextSenderChanged new.
entry
depthDelta: depthDelta
inChain: inChain
hasActiveTracing: hasActiveTracing
executionContinuationEntry: executionContinuationEntry.
addToTree value: entry.

hasActiveTracing ifFalse: [printContinuesHere value]]].
[#custom] -> [| type data |
type := eventStream next.
data := eventStream next.

entry := (type caseOf: {
[#bpProbeHit] -> [BPCallgraphEntryBPProbe].
[#bpAssertionHit] -> [BPCallgraphEntryBPAssertion].
[#bpExample] -> [BPCallgraphEntryBPExample]}otherwise: [BPCallgraphEntryCustomEvent]) new.
entry type: type data: data.
addToTree value: entry]
}].

^ callgraph
Loading