-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/TruffleSqueak-Tests.package/TruffleSqueakTest.class/instance/testCallTarget.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
testing | ||
testCallTarget | ||
| method string | | ||
Java primitiveIsHostLookupAllowed ifFalse: [ ^ false ]. | ||
|
||
method := SmallInteger >> #/. | ||
|
||
self deny: method callTarget isNil. | ||
|
||
string := CallTargetBrowser callTargetInfoStringFor: method. | ||
self assert: (string includesSubstring: 'knownCallSiteCount') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
27 changes: 27 additions & 0 deletions
27
...TruffleSqueak-Utilities.package/CallTargetBrowser.class/class/callTargetInfoStringFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
helpers | ||
callTargetInfoStringFor: aCompiledMethod | ||
^ aCompiledMethod callTarget | ||
ifNil: [ 'no call target available' ] | ||
ifNotNil: [ :c | | ||
'name: {1} | ||
callCount: {2} | ||
callAndLoopCount: {3} | ||
knownCallSiteCount: {4} | ||
nonTrivialNodeCount: {5} | ||
profiled return value: {6} | ||
profiled arguments: {7}' format: { | ||
c getName asString. | ||
c getCallCount. | ||
c getCallAndLoopCount. | ||
c getKnownCallSiteCount. | ||
c getNonTrivialNodeCount. | ||
c returnProfile | ||
ifNil: [ 'unknown' ] | ||
ifNotNil: [ :p | p getType ifNil: [ 'unknown' ] ifNotNil: [ :e | e getSimpleName asString ]]. | ||
c argumentsProfile | ||
ifNil: [ 'all unknown' ] | ||
ifNotNil: [ :p | p getTypes | ||
ifNil: [ 'all unknown' ] | ||
ifNotNil: [ :t | ((t asCollection allButFirst: 3) collect: [ :ea | ea | ||
ifNil: ['unknown'] | ||
ifNotNil: [ ea getSimpleName asString ]]) joinSeparatedBy: ', ' ] ] } ] |
3 changes: 3 additions & 0 deletions
3
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/class/showClassIcons.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
preferences | ||
showClassIcons | ||
^ false |
3 changes: 3 additions & 0 deletions
3
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/class/showMessageIcons.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
preferences | ||
showMessageIcons | ||
^ false |
6 changes: 6 additions & 0 deletions
6
...ruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/callTargetInfoContents.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
message list | ||
callTargetInfoContents | ||
^ contents := self selectedClassOrMetaClass methodDict | ||
at: self selectedMessageName | ||
ifPresent: [ :cm | self class callTargetInfoStringFor: cm ] | ||
ifAbsent: [ 'not found' ] |
4 changes: 4 additions & 0 deletions
4
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/contentsSymbolQuints.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
controls | ||
contentsSymbolQuints | ||
^ super contentsSymbolQuints, #(#- | ||
(callTargetInfo toggleCallTargetInfo showingCallTargetInfoString 'call target' 'information on underlying call target')) |
16 changes: 16 additions & 0 deletions
16
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/countsToMessages..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
helpers | ||
countsToMessages: aMessageList | ||
| result | | ||
result := Dictionary new. | ||
aMessageList do: [ :ea | | callTarget | | ||
callTarget := (self selectedClassOrMetaClass >> ea asSymbol) callTarget. | ||
result | ||
at: (callTarget ifNil: [-1] ifNotNil: [ :c | | ||
self sortBy caseOf: { | ||
[#callCount] -> [ c getCallCount ln ]. | ||
[#callAndLoopCount] -> [ c getCallAndLoopCount ln ]. | ||
[#knownCallSiteCount] -> [ c getKnownCallSiteCount ]. | ||
[#nonTrivialNodeCount] -> [ c getNonTrivialNodeCount ] } ] ) | ||
ifPresent: [ :v | v add: ea ] | ||
ifAbsentPut: [ OrderedCollection with: ea ] ]. | ||
^ result |
3 changes: 3 additions & 0 deletions
3
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/defaultBrowserTitle.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
initialize-release | ||
defaultBrowserTitle | ||
^ 'CallTarget Browser' |
3 changes: 3 additions & 0 deletions
3
...Utilities.package/CallTargetBrowser.class/instance/formattedLabel.forSelector.inClass..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
message list | ||
formattedLabel: aString forSelector: aSymbol inClass: aClass | ||
^ aString |
6 changes: 6 additions & 0 deletions
6
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/inspectCallTarget.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
message functions | ||
inspectCallTarget | ||
(self selectedClassOrMetaClass | ||
compiledMethodAt: self selectedMessageName | ||
ifAbsent: []) ifNotNil: | ||
[:method| method callTarget inspect] |
12 changes: 12 additions & 0 deletions
12
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/mainMessageListMenu..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
message functions | ||
mainMessageListMenu: aMenu | ||
^ (super mainMessageListMenu: aMenu) | ||
add: 'inspect call target' action: #inspectCallTarget; | ||
addLine; | ||
add: 'sort alphabetically' action: #sortAlphabetically; | ||
add: 'sort by call and loop count (default)' action: #sortByCallAndLoopCount; | ||
add: 'sort by call count' action: #sortByCallCount; | ||
add: 'sort by known call site count' action: #sortByKnownCallSiteCount; | ||
add: 'sort by non-trivial node count' action: #sortByNonTrivialNodeCount; | ||
addLine; | ||
yourself |
16 changes: 16 additions & 0 deletions
16
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/messageList.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
message list | ||
messageList | ||
| messages countsToMessages sortedCounts highestCount result | | ||
messages := super messageList. | ||
(self sortBy == #alphabetically or: [ messages isEmpty]) | ||
ifTrue: [ ^ messages ]. | ||
countsToMessages := self countsToMessages: messages. | ||
result := OrderedCollection new. | ||
sortedCounts := countsToMessages keysInOrder reversed. | ||
highestCount := sortedCounts first. | ||
sortedCounts do: [ :count | | ||
result addAll: ((countsToMessages at: count) collect: [ :ea | | ||
ea asText | ||
addAttribute: (self textColorFor: count with: highestCount) | ||
yourself])]. | ||
^ result |
8 changes: 8 additions & 0 deletions
8
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/selectedMessage.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
message list | ||
selectedMessage | ||
contents == nil ifFalse: [^ contents copy]. | ||
|
||
self showingCallTargetInfo ifTrue: | ||
[ ^ self callTargetInfoContents ]. | ||
|
||
^ super selectedMessage |
3 changes: 3 additions & 0 deletions
3
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/showCallTargetInfo..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
what to show | ||
showCallTargetInfo: aBoolean | ||
self contentsSymbol: (aBoolean ifFalse: [#source] ifTrue: [#callTargetInfo]) |
3 changes: 3 additions & 0 deletions
3
...TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/showingCallTargetInfo.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
what to show | ||
showingCallTargetInfo | ||
^ contentsSymbol == #callTargetInfo |
9 changes: 9 additions & 0 deletions
9
...eSqueak-Utilities.package/CallTargetBrowser.class/instance/showingCallTargetInfoString.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
what to show | ||
showingCallTargetInfoString | ||
"Answer a string telling whether the receiver is showing plain source" | ||
|
||
^ (self showingCallTargetInfo | ||
ifTrue: | ||
['<yes>'] | ||
ifFalse: | ||
['<no>']), 'call target' |
3 changes: 3 additions & 0 deletions
3
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortAlphabetically.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
sortAlphabetically | ||
self sortBy: #alphabetically |
4 changes: 4 additions & 0 deletions
4
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortBy..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
sortBy: anObject | ||
|
||
sortBy := anObject. |
4 changes: 4 additions & 0 deletions
4
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortBy.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
sortBy | ||
|
||
^ sortBy ifNil: [ sortBy := #callAndLoopCount ] |
3 changes: 3 additions & 0 deletions
3
...ruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortByCallAndLoopCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
sortByCallAndLoopCount | ||
self sortBy: #callAndLoopCount |
3 changes: 3 additions & 0 deletions
3
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortByCallCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
sortByCallCount | ||
self sortBy: #callCount |
3 changes: 3 additions & 0 deletions
3
...ffleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortByKnownCallSiteCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
sortByKnownCallSiteCount | ||
self sortBy: #knownCallSiteCount |
3 changes: 3 additions & 0 deletions
3
...fleSqueak-Utilities.package/CallTargetBrowser.class/instance/sortByNonTrivialNodeCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
sortByNonTrivialNodeCount | ||
self sortBy: #nonTrivialNodeCount |
11 changes: 11 additions & 0 deletions
11
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/textColorFor.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
helpers | ||
textColorFor: aCount with: aMax | ||
|
||
^ aCount >= 0 | ||
ifTrue: [ | r | | ||
r := 1.0 * aCount / aMax. | ||
TextColor color: (Color | ||
r: r | ||
g: 0 | ||
b: 1.0 - r) ] | ||
ifFalse: [ TextColor gray] |
9 changes: 9 additions & 0 deletions
9
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/toggleCallTargetInfo.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
what to show | ||
toggleCallTargetInfo | ||
| wasShowing | | ||
self okToChange ifTrue: | ||
[wasShowing := self showingCallTargetInfo. | ||
self restoreTextualCodingPane. | ||
self showCallTargetInfo: wasShowing not. | ||
self setContentsToForceRefetch. | ||
self contentsChanged] |
27 changes: 27 additions & 0 deletions
27
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"class" : { | ||
"callTargetInfoStringFor:" : "fn 2/18/2021 09:14", | ||
"showClassIcons" : "fn 2/16/2021 22:17", | ||
"showMessageIcons" : "fn 2/16/2021 22:17" }, | ||
"instance" : { | ||
"callTargetInfoContents" : "fn 2/18/2021 10:12", | ||
"contentsSymbolQuints" : "fn 2/17/2021 12:00", | ||
"countsToMessages:" : "fn 2/17/2021 14:33", | ||
"defaultBrowserTitle" : "fn 2/16/2021 16:54", | ||
"formattedLabel:forSelector:inClass:" : "fn 2/16/2021 22:10", | ||
"inspectCallTarget" : "fn 2/17/2021 14:50", | ||
"mainMessageListMenu:" : "fn 2/17/2021 14:51", | ||
"messageList" : "fn 2/16/2021 22:13", | ||
"selectedMessage" : "fn 2/17/2021 12:26", | ||
"showCallTargetInfo:" : "fn 2/17/2021 12:28", | ||
"showingCallTargetInfo" : "fn 2/17/2021 12:01", | ||
"showingCallTargetInfoString" : "fn 2/17/2021 12:01", | ||
"sortAlphabetically" : "fn 2/16/2021 17:44", | ||
"sortBy" : "fn 2/16/2021 17:33", | ||
"sortBy:" : "fn 2/16/2021 17:27", | ||
"sortByCallAndLoopCount" : "fn 2/16/2021 17:33", | ||
"sortByCallCount" : "fn 2/16/2021 17:30", | ||
"sortByKnownCallSiteCount" : "fn 2/16/2021 17:39", | ||
"sortByNonTrivialNodeCount" : "fn 2/16/2021 17:39", | ||
"textColorFor:with:" : "fn 2/17/2021 11:08", | ||
"toggleCallTargetInfo" : "fn 2/17/2021 12:28" } } |
14 changes: 14 additions & 0 deletions
14
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"category" : "TruffleSqueak-Utilities", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"sortBy" ], | ||
"name" : "CallTargetBrowser", | ||
"pools" : [ | ||
], | ||
"super" : "Browser", | ||
"type" : "normal" } |
4 changes: 4 additions & 0 deletions
4
src/TruffleSqueak-Utilities.package/CompiledMethod.extension/instance/callTarget.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*TruffleSqueak-Utilities | ||
callTarget | ||
<primitive: 'primitiveGetCallTarget' module: 'TruffleSqueakPlugin'> | ||
^ nil |
5 changes: 5 additions & 0 deletions
5
src/TruffleSqueak-Utilities.package/CompiledMethod.extension/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"callTarget" : "fn 2/16/2021 17:00" } } |
2 changes: 2 additions & 0 deletions
2
src/TruffleSqueak-Utilities.package/CompiledMethod.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
"name" : "CompiledMethod" } |