-
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.
Show bytecode coverage in CallTargetBrowser
Since bytecode nodes are lazily inserted into Truffle AST, we can use this information to find out whether a bytecode has been executed or not. This displays this information in the bytecode view of the CallTargetBrowser. Red means not covered, green means covered, gray means unknown (closures are currently not supported).
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/TruffleSqueak-Utilities.package/CallTargetBrowser.class/instance/selectedBytecodes.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,21 @@ | ||
message list | ||
selectedBytecodes | ||
| cm text | | ||
cm := (self selectedClassOrMetaClass compiledMethodAt: self selectedMessageName | ||
ifAbsent: [ ^ '' asText ]). | ||
text := cm symbolic asText. | ||
text addAttribute: TextColor gray; yourself. | ||
cm callTarget ifNotNil: [ :ct | | nodes index string | | ||
nodes := ct getRootNode executeBytecodeNode bytecodeNodes. | ||
index := 1. | ||
string := text string. | ||
string lineIndicesDo: [ :start :end :endWithLineEnding | | ||
(string at: start) = Character tab ifFalse: [ | numBytesOfBytecode | | ||
text addAttribute: (TextColor color: ( | ||
(nodes at: index) | ||
ifNil: [ Color red ] ifNotNil: [ Color green ]) muchDarker) | ||
from: start to: end. | ||
numBytesOfBytecode := ((string indexOf: $> startingAt: start) - | ||
(string indexOf: $< startingAt: start)) // 3. | ||
index := index + numBytesOfBytecode ]]]. | ||
^ text |
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