seafoam 0.2 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/workflows.yml +39 -0
- data/.rubocop.yml +4 -1
- data/README.md +107 -27
- data/bin/bgv2isabelle +16 -45
- data/bin/bgv2json +18 -36
- data/bin/cfg2asm +24 -0
- data/bin/seafoam +2 -2
- data/demos/box-unbox-stats +65 -0
- data/docs/bgv.md +16 -7
- data/docs/getting-graphs.md +12 -0
- data/docs/json.md +35 -0
- data/examples/fib-java.bgv.gz +0 -0
- data/examples/fib.js +1 -1
- data/examples/java/JavaExamples.java +1 -1
- data/examples/ruby/clamps.rb +20 -0
- data/examples/ruby/graal.patch +15 -0
- data/examples/ruby/ruby_examples.rb +278 -0
- data/lib/seafoam.rb +5 -1
- data/lib/seafoam/annotators/graal.rb +1 -1
- data/lib/seafoam/bgv/bgv_parser.rb +12 -2
- data/lib/seafoam/cfg/cfg_parser.rb +93 -0
- data/lib/seafoam/cfg/disassembler.rb +70 -0
- data/lib/seafoam/commands.rb +196 -36
- data/lib/seafoam/graal/source.rb +23 -0
- data/lib/seafoam/isabelle_writer.rb +46 -0
- data/lib/seafoam/json_writer.rb +58 -0
- data/lib/seafoam/version.rb +1 -1
- data/seafoam.gemspec +4 -2
- data/spec/seafoam/annotators/graal_spec.rb +7 -7
- data/spec/seafoam/bgv/bgv_parser_spec.rb +27 -14
- data/spec/seafoam/cfg/cfg_parser_spec.rb +21 -0
- data/spec/seafoam/cfg/disassembler_spec.rb +32 -0
- data/spec/seafoam/command_spec.rb +94 -30
- data/spec/seafoam/graphviz_writer_spec.rb +2 -2
- data/spec/seafoam/json_writer_spec.rb +14 -0
- data/spec/seafoam/spec_helpers.rb +5 -1
- data/spec/seafoam/spotlight_spec.rb +1 -1
- data/tools/render-all +2 -2
- metadata +34 -98
- data/.github/workflows/rubocop.yml +0 -10
- data/.github/workflows/specs.yml +0 -19
- data/examples/fib-java.bgv +0 -0
- data/examples/fib-js.bgv +0 -0
- data/examples/fib-ruby.bgv +0 -0
- data/examples/identity.bgv +0 -0
- data/examples/java/exampleArithOperator.bgv +0 -0
- data/examples/java/exampleArithOperator.cfg +0 -925
- data/examples/java/exampleArrayAllocation.bgv +0 -0
- data/examples/java/exampleArrayAllocation.cfg +0 -5268
- data/examples/java/exampleArrayRead.bgv +0 -0
- data/examples/java/exampleArrayRead.cfg +0 -2263
- data/examples/java/exampleArrayWrite.bgv +0 -0
- data/examples/java/exampleArrayWrite.cfg +0 -2315
- data/examples/java/exampleCatch.bgv +0 -0
- data/examples/java/exampleCatch.cfg +0 -4150
- data/examples/java/exampleCompareOperator.bgv +0 -0
- data/examples/java/exampleCompareOperator.cfg +0 -1109
- data/examples/java/exampleDoubleSynchronized.bgv +0 -0
- data/examples/java/exampleDoubleSynchronized.cfg +0 -26497
- data/examples/java/exampleExactArith.bgv +0 -0
- data/examples/java/exampleExactArith.cfg +0 -1888
- data/examples/java/exampleFieldRead.bgv +0 -0
- data/examples/java/exampleFieldRead.cfg +0 -1228
- data/examples/java/exampleFieldWrite.bgv +0 -0
- data/examples/java/exampleFieldWrite.cfg +0 -1102
- data/examples/java/exampleFor.bgv +0 -0
- data/examples/java/exampleFor.cfg +0 -3936
- data/examples/java/exampleFullEscape.bgv +0 -0
- data/examples/java/exampleFullEscape.cfg +0 -5893
- data/examples/java/exampleIf.bgv +0 -0
- data/examples/java/exampleIf.cfg +0 -2462
- data/examples/java/exampleIfNeverTaken.bgv +0 -0
- data/examples/java/exampleIfNeverTaken.cfg +0 -2476
- data/examples/java/exampleInstanceOfManyImpls.bgv +0 -0
- data/examples/java/exampleInstanceOfManyImpls.cfg +0 -6391
- data/examples/java/exampleInstanceOfOneImpl.bgv +0 -0
- data/examples/java/exampleInstanceOfOneImpl.cfg +0 -2604
- data/examples/java/exampleIntSwitch.bgv +0 -0
- data/examples/java/exampleIntSwitch.cfg +0 -3121
- data/examples/java/exampleInterfaceCallManyImpls.bgv +0 -0
- data/examples/java/exampleInterfaceCallManyImpls.cfg +0 -1358
- data/examples/java/exampleInterfaceCallOneImpl.bgv +0 -0
- data/examples/java/exampleInterfaceCallOneImpl.cfg +0 -3859
- data/examples/java/exampleLocalInstanceOf.bgv +0 -0
- data/examples/java/exampleLocalInstanceOf.cfg +0 -5276
- data/examples/java/exampleLocalSynchronized.bgv +0 -0
- data/examples/java/exampleLocalSynchronized.cfg +0 -1364
- data/examples/java/exampleLocalVariables.bgv +0 -0
- data/examples/java/exampleLocalVariables.cfg +0 -1195
- data/examples/java/exampleLocalVariablesState.bgv +0 -0
- data/examples/java/exampleLocalVariablesState.cfg +0 -1673
- data/examples/java/exampleNestedWhile.bgv +0 -0
- data/examples/java/exampleNestedWhile.cfg +0 -15499
- data/examples/java/exampleNestedWhileBreak.bgv +0 -0
- data/examples/java/exampleNestedWhileBreak.cfg +0 -11162
- data/examples/java/exampleNoEscape.bgv +0 -0
- data/examples/java/exampleNoEscape.cfg +0 -974
- data/examples/java/exampleObjectAllocation.bgv +0 -0
- data/examples/java/exampleObjectAllocation.cfg +0 -5287
- data/examples/java/examplePartialEscape.bgv +0 -0
- data/examples/java/examplePartialEscape.cfg +0 -7042
- data/examples/java/examplePhi.bgv +0 -0
- data/examples/java/examplePhi.cfg +0 -3227
- data/examples/java/exampleReducible.bgv +0 -0
- data/examples/java/exampleReducible.cfg +0 -5578
- data/examples/java/exampleSimpleCall.bgv +0 -0
- data/examples/java/exampleSimpleCall.cfg +0 -1435
- data/examples/java/exampleStamp.bgv +0 -0
- data/examples/java/exampleStamp.cfg +0 -913
- data/examples/java/exampleStaticCall.bgv +0 -0
- data/examples/java/exampleStaticCall.cfg +0 -1154
- data/examples/java/exampleStringSwitch.bgv +0 -0
- data/examples/java/exampleStringSwitch.cfg +0 -15377
- data/examples/java/exampleSynchronized.bgv +0 -0
- data/examples/java/exampleSynchronized.cfg +0 -26027
- data/examples/java/exampleThrow.bgv +0 -0
- data/examples/java/exampleThrow.cfg +0 -780
- data/examples/java/exampleThrowCatch.bgv +0 -0
- data/examples/java/exampleThrowCatch.cfg +0 -744
- data/examples/java/exampleUnsafeRead.bgv +0 -0
- data/examples/java/exampleUnsafeRead.cfg +0 -912
- data/examples/java/exampleUnsafeWrite.bgv +0 -0
- data/examples/java/exampleUnsafeWrite.cfg +0 -962
- data/examples/java/exampleWhile.bgv +0 -0
- data/examples/java/exampleWhile.cfg +0 -3936
- data/examples/java/exampleWhileBreak.bgv +0 -0
- data/examples/java/exampleWhileBreak.cfg +0 -5963
- data/examples/matmult-java.bgv +0 -0
- data/examples/matmult-ruby.bgv +0 -0
- data/examples/overflow.bgv +0 -0
- data/lib/seafoam/binary/binary_reader.rb +0 -21
- data/spec/seafoam/bgv/fixtures/not.bgv +0 -1
- data/spec/seafoam/bgv/fixtures/unsupported.bgv +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a17a259b362af5eef7c3c874e6d796f647c6017d413cba708ac0a27e18043681
|
4
|
+
data.tar.gz: 39eba465ba4ed92b3085a276d541072ccff48d62fdd00a317961c7401bcb0ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e55cdfa1eea817f24bbaa22ef80916923441393529351df21c258987354cafe98d07ed4bff2fd3e6fc5ab5656ea7f85b938d7a906ee511cd9f06fa19c335431f
|
7
|
+
data.tar.gz: '070468e7e9c1fd55b6429c07d8c226e1c0c0e4225a0f9a90bd577e7b57bb8320bcd0a59e1da223632986245f6eb5482a1320b11e6b786f41f456187766664b9b'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: Workflows
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
rubocop:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- uses: actions/checkout@v2
|
8
|
+
- uses: ruby/setup-ruby@v1
|
9
|
+
- run: bundle install
|
10
|
+
- run: bundle exec rubocop
|
11
|
+
specs:
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
os: [ubuntu, macos]
|
15
|
+
ruby: [2.5, 2.6, 2.7]
|
16
|
+
runs-on: ${{ matrix.os }}-latest
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
bundler-cache: true
|
23
|
+
- run: bundle install
|
24
|
+
- run: if [[ $(uname) == "Darwin" ]]; then brew install graphviz capstone; else sudo apt-get install graphviz libcapstone3; fi
|
25
|
+
- run: bundle exec rspec
|
26
|
+
specs-no-dependencies:
|
27
|
+
strategy:
|
28
|
+
matrix:
|
29
|
+
os: [ubuntu, macos]
|
30
|
+
ruby: [2.5, 2.6, 2.7]
|
31
|
+
runs-on: ${{ matrix.os }}-latest
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
- uses: ruby/setup-ruby@v1
|
35
|
+
with:
|
36
|
+
ruby-version: ${{ matrix.ruby }}
|
37
|
+
bundler-cache: true
|
38
|
+
- run: bundle install
|
39
|
+
- run: NO_DEPENDENCIES_INSTALLED=true bundle exec rspec
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -10,13 +10,18 @@ GraalVM compiler graphs. Seafoam aims to solve several problems with IGV. Unlike
|
|
10
10
|
IGV, Seafoam:
|
11
11
|
|
12
12
|
* is open source and can be used according to the MIT license
|
13
|
+
* supports gzip-compressed BGV files
|
13
14
|
* is able to some extent seek BGV files to load specific graphs without loading the rest of the file
|
14
15
|
* has a command-line interface
|
15
16
|
* can be used as a library
|
16
|
-
* has easy PDF, SVG and
|
17
|
+
* has easy PDF, SVG, PNG and JSON output
|
17
18
|
* is designed for accessibility
|
18
19
|
* looks prettier, in our opinion
|
19
20
|
|
21
|
+
Additionally, Seafoam adds:
|
22
|
+
|
23
|
+
* support for disassembling CFG files
|
24
|
+
|
20
25
|
Admittedly, Seafoam does not yet have:
|
21
26
|
|
22
27
|
* an interactive user interface
|
@@ -37,34 +42,43 @@ Admittedly, Seafoam does not yet have:
|
|
37
42
|
### macOS
|
38
43
|
|
39
44
|
```
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
% brew install graphviz
|
46
|
+
% gem install seafoam
|
47
|
+
% seafoam --version
|
43
48
|
seafoam 0.1
|
44
49
|
```
|
45
50
|
|
46
51
|
### Ubuntu
|
47
52
|
|
48
53
|
```
|
49
|
-
|
50
|
-
|
51
|
-
|
54
|
+
% sudo apt-get install ruby graphviz
|
55
|
+
% gem install seafoam
|
56
|
+
% seafoam --version
|
52
57
|
seafoam 0.1
|
53
58
|
```
|
54
59
|
|
55
|
-
|
60
|
+
### RedHat
|
56
61
|
|
57
62
|
```
|
58
|
-
|
59
|
-
|
60
|
-
|
63
|
+
% sudo yum install ruby graphviz
|
64
|
+
% gem install seafoam
|
65
|
+
% seafoam --version
|
61
66
|
seafoam 0.1
|
62
67
|
```
|
63
68
|
|
69
|
+
### Capstone
|
70
|
+
|
71
|
+
To use the `cfg2asm` disassembler, you'll then need to install Capstone.
|
72
|
+
|
73
|
+
```
|
74
|
+
% brew install capstone # macOS
|
75
|
+
% sudo apt-get install libcapstone3 # Ubuntu
|
76
|
+
```
|
77
|
+
|
64
78
|
## Quick-start demo
|
65
79
|
|
66
80
|
```
|
67
|
-
|
81
|
+
% seafoam examples/fib-java.bgv:0 render
|
68
82
|
```
|
69
83
|
|
70
84
|
## Getting compiler graphs
|
@@ -78,14 +92,20 @@ This is just a quick summary - see more information on
|
|
78
92
|
### GraalVM for Java
|
79
93
|
|
80
94
|
```
|
81
|
-
|
82
|
-
|
95
|
+
% javac Fib.java
|
96
|
+
% java -XX:CompileOnly=::fib -Dgraal.Dump=:2 Fib 14
|
97
|
+
```
|
98
|
+
|
99
|
+
### GraalVM Native Image
|
100
|
+
|
101
|
+
```
|
102
|
+
% native-image -H:Dump=:2 -H:MethodFilter=fib Fib
|
83
103
|
```
|
84
104
|
|
85
105
|
### TruffleRuby and other Truffle languages
|
86
106
|
|
87
107
|
```
|
88
|
-
|
108
|
+
% ruby --experimental-options --engine.CompileOnly=fib --engine.Inlining=false --engine.OSR=false --vm.Dgraal.Dump=Truffle:2 fib.rb 14
|
89
109
|
```
|
90
110
|
|
91
111
|
You will usually want to look at the *After TruffleTier* graph.
|
@@ -105,14 +125,14 @@ Note that a *graph ID* is an ID found in BGV files, but is not unique. A
|
|
105
125
|
#### Print information about a file
|
106
126
|
|
107
127
|
```
|
108
|
-
|
128
|
+
% seafoam examples/fib-java.bgv info
|
109
129
|
BGV 6.1
|
110
130
|
```
|
111
131
|
|
112
132
|
#### List graphs in a file
|
113
133
|
|
114
134
|
```
|
115
|
-
|
135
|
+
% seafoam examples/fib-java.bgv list
|
116
136
|
examples/fib-java.bgv:0 2:Fib.fib(int)/After phase org.graalvm.compiler.java.GraphBuilderPhase
|
117
137
|
examples/fib-java.bgv:1 2:Fib.fib(int)/After phase org.graalvm.compiler.phases.PhaseSuite
|
118
138
|
examples/fib-java.bgv:2 2:Fib.fib(int)/After phase org.graalvm.compiler.phases.common.DeadCodeEliminationPhase
|
@@ -125,7 +145,7 @@ examples/fib-java.bgv:5 2:Fib.fib(int)/After phase org.graalvm.compiler.phases.
|
|
125
145
|
#### Search for strings in a graph, or node or edge within a graph
|
126
146
|
|
127
147
|
```
|
128
|
-
|
148
|
+
% seafoam examples/fib-java.bgv:0 search Start
|
129
149
|
examples/fib-java.bgv:0:0 ...node_class":"org.graalvm.compiler.nodes.StartNode","name_template":"Start","inputs":[...
|
130
150
|
examples/fib-java.bgv:0:0 ...piler.nodes.StartNode","name_template":"Start","inputs":[{"direct":true,"name":"state...
|
131
151
|
```
|
@@ -133,9 +153,9 @@ examples/fib-java.bgv:0:0 ...piler.nodes.StartNode","name_template":"Start","in
|
|
133
153
|
#### Print edges of a graph, or node or edge within a graph
|
134
154
|
|
135
155
|
```
|
136
|
-
|
156
|
+
% seafoam examples/fib-java.bgv:0 edges
|
137
157
|
22 nodes, 30 edges
|
138
|
-
|
158
|
+
% seafoam examples/fib-java.bgv:0:13 edges
|
139
159
|
Input:
|
140
160
|
13 (Call Fib.fib) <-() 6 (Begin)
|
141
161
|
13 (Call Fib.fib) <-() 14 (@{:declaring_class=>"Fib", :method_name=>"fib", :signature=>{:args=>["I"], :ret=>"I"}, :modifiers=>9}:13)
|
@@ -145,14 +165,14 @@ Output:
|
|
145
165
|
13 (Call Fib.fib) ->(values) 14 (@{:declaring_class=>"Fib", :method_name=>"fib", :signature=>{:args=>["I"], :ret=>"I"}, :modifiers=>9}:13)
|
146
166
|
13 (Call Fib.fib) ->(values) 19 (@{:declaring_class=>"Fib", :method_name=>"fib", :signature=>{:args=>["I"], :ret=>"I"}, :modifiers=>9}:19)
|
147
167
|
13 (Call Fib.fib) ->(x) 20 (+)
|
148
|
-
|
168
|
+
% seafoam examples/fib-java.bgv:0:13-20 edges
|
149
169
|
13 (Call Fib.fib) ->(x) 20 (+)
|
150
170
|
```
|
151
171
|
|
152
172
|
#### Print properties of a file, graph, or node or edge within a graph
|
153
173
|
|
154
174
|
```
|
155
|
-
|
175
|
+
% seafoam examples/fib-java.bgv:0 props
|
156
176
|
{
|
157
177
|
"group": [
|
158
178
|
{
|
@@ -160,7 +180,7 @@ $ seafoam examples/fib-java.bgv:0 props
|
|
160
180
|
"short_name": "2:Fib.fib(int)",
|
161
181
|
"method": null,
|
162
182
|
...
|
163
|
-
|
183
|
+
% seafoam examples/fib-java.bgv:0:13 props
|
164
184
|
{
|
165
185
|
"nodeSourcePosition": {
|
166
186
|
"method": {
|
@@ -168,7 +188,7 @@ $ seafoam examples/fib-java.bgv:0:13 props
|
|
168
188
|
"method_name": "fib",
|
169
189
|
"signature": {
|
170
190
|
...
|
171
|
-
|
191
|
+
% seafoam examples/fib-java.bgv:0:13-20 props
|
172
192
|
{
|
173
193
|
"direct": true,
|
174
194
|
"name": "x",
|
@@ -176,19 +196,39 @@ $ seafoam examples/fib-java.bgv:0:13-20 props
|
|
176
196
|
}
|
177
197
|
```
|
178
198
|
|
199
|
+
#### Print node source information
|
200
|
+
|
201
|
+
```
|
202
|
+
% seafoam examples/fib-ruby.bgv:8:2443 source
|
203
|
+
java.lang.Math#addExact
|
204
|
+
org.truffleruby.core.numeric.IntegerNodes$AddNode#add
|
205
|
+
org.truffleruby.core.numeric.IntegerNodesFactory$AddNodeFactory$AddNodeGen#executeAdd
|
206
|
+
org.truffleruby.core.inlined.InlinedAddNode#intAdd
|
207
|
+
org.truffleruby.core.inlined.InlinedAddNodeGen#execute
|
208
|
+
org.truffleruby.language.control.IfElseNode#execute
|
209
|
+
org.truffleruby.language.control.SequenceNode#execute
|
210
|
+
org.truffleruby.language.arguments.CheckArityNode#execute
|
211
|
+
org.truffleruby.language.control.SequenceNode#execute
|
212
|
+
org.truffleruby.language.methods.CatchForMethodNode#execute
|
213
|
+
org.truffleruby.language.methods.ExceptionTranslatingNode#execute
|
214
|
+
org.truffleruby.language.RubyRootNode#execute
|
215
|
+
org.graalvm.compiler.truffle.runtime.OptimizedCallTarget#executeRootNode
|
216
|
+
org.graalvm.compiler.truffle.runtime.OptimizedCallTarget#profiledPERoot
|
217
|
+
```
|
218
|
+
|
179
219
|
#### Render a graph
|
180
220
|
|
181
221
|
Render a graph as a PDF image and have it opened automatically.
|
182
222
|
|
183
223
|
```
|
184
|
-
|
224
|
+
% seafoam examples/fib-java.bgv:0 render
|
185
225
|
```
|
186
226
|
|
187
227
|
Render a graph showing just a few nodes and those surrounding them, similar to
|
188
228
|
the IGV feature of gradually revealing nodes.
|
189
229
|
|
190
230
|
```
|
191
|
-
|
231
|
+
% seafoam examples/fib-java.bgv:0 render --spotlight 13,20
|
192
232
|
```
|
193
233
|
|
194
234
|
<p>
|
@@ -206,7 +246,7 @@ $ seafoam examples/fib-java.bgv:0 render --spotlight 13,20
|
|
206
246
|
Convert a BGV file to the Isabelle graph format.
|
207
247
|
|
208
248
|
```
|
209
|
-
|
249
|
+
% bgv2isabelle examples/fib-java.bgv
|
210
250
|
graph0 = # 2:Fib.fib(int)/After phase org.graalvm.compiler.java.GraphBuilderPhase
|
211
251
|
(add_node 0 StartNode [2] [8]
|
212
252
|
(add_node 1 (ParameterNode 0) [] [2, 5, 9, 11, 14, 16]
|
@@ -220,6 +260,46 @@ graph0 = # 2:Fib.fib(int)/After phase org.graalvm.compiler.java.GraphBuilderPhas
|
|
220
260
|
...
|
221
261
|
```
|
222
262
|
|
263
|
+
Convert a BGV file to JSON.
|
264
|
+
|
265
|
+
```
|
266
|
+
% bgv2json examples/fib-java.bgv
|
267
|
+
graph0 = # 2:Fib.fib(int)/After phase org.graalvm.compiler.java.GraphBuilderPhase
|
268
|
+
(add_node 0 StartNode [2] [8]
|
269
|
+
(add_node 1 (ParameterNode 0) [] [2, 5, 9, 11, 14, 16]
|
270
|
+
(add_node 2 FrameState [1] [0]
|
271
|
+
(add_node 3 (ConstantNode 1) [] []
|
272
|
+
(add_node 4 (ConstantNode 2) [] [5]
|
273
|
+
(add_node 5 IntegerLessThanNode [1, 4] [8]
|
274
|
+
(add_node 6 BeginNode [8] [13]
|
275
|
+
(add_node 7 BeginNode [8] [9]
|
276
|
+
(add_node 8 IfNode [0, 5] [7, 6]
|
277
|
+
...
|
278
|
+
```
|
279
|
+
|
280
|
+
#### Disassembling
|
281
|
+
|
282
|
+
```
|
283
|
+
% cfg2asm examples/java/exampleArithOperator.cfg
|
284
|
+
[examples/java/exampleArithOperator.cfg]
|
285
|
+
;Comment 0: 3
|
286
|
+
;Comment 0: 1
|
287
|
+
0x112e2f660: nop dword ptr [rax + rax]
|
288
|
+
;Comment 5: block B0 null
|
289
|
+
;Comment 5: 0 [rsi|DWORD, rdx|DWORD, rbp|QWORD] = LABEL numbPhis: 0 align: false label: ?
|
290
|
+
;Comment 5: 4 [] = HOTSPOTLOCKSTACK frameMapBuilder: org.graalvm.compiler.lir.amd64.AMD64FrameMapBuilder@143082de0 slotKind: QWORD
|
291
|
+
;Comment 5: 10 rsi|DWORD = ADD (x: rsi|DWORD, y: rdx|DWORD) size: DWORD
|
292
|
+
0x112e2f665: add esi, edx
|
293
|
+
;Comment 7: 12 rax|DWORD = MOVE rsi|DWORD moveKind: DWORD
|
294
|
+
0x112e2f667: mov eax, esi
|
295
|
+
;Comment 9: 14 RETURN (savedRbp: rbp|QWORD, value: rax|DWORD) isStub: false requiresReservedStackAccessCheck: false thread: r15 scratchForSafepointOnReturn: rcx config: org.graalvm.compiler.hotspot.GraalHotSpotVMConfig@137f187d8
|
296
|
+
;Comment 9: 12
|
297
|
+
0x112e2f669: test dword ptr [rip - 0x46c4669], eax
|
298
|
+
0x112e2f66f: vzeroupper
|
299
|
+
0x112e2f672: ret
|
300
|
+
...
|
301
|
+
```
|
302
|
+
|
223
303
|
## Options for GraalVM graphs
|
224
304
|
|
225
305
|
* `--show-frame-state` shows frame state nodes, which are hidden by default
|
data/bin/bgv2isabelle
CHANGED
@@ -2,52 +2,23 @@
|
|
2
2
|
|
3
3
|
require 'seafoam'
|
4
4
|
|
5
|
-
#
|
6
|
-
# "eg_short_cut_or1 =
|
7
|
-
# (add_node 14 ReturnNode [13] []
|
8
|
-
# (add_node 13 PhiNode [10, 11, 12] []
|
9
|
-
# (add_node 12 (ConstantNode 0) [] []
|
10
|
-
# (add_node 11 (ConstantNode 42) [] []
|
11
|
-
# (add_node 10 MergeNode [7, 9] [14]
|
12
|
-
# (add_node 9 EndNode [] []
|
13
|
-
# (add_node 8 BeginNode [] [9]
|
14
|
-
# (add_node 7 EndNode [] []
|
15
|
-
# (add_node 6 BeginNode [] [7]
|
16
|
-
# (add_node 5 IfNode [3] [6, 8]
|
17
|
-
# (add_node 3 (ShortCircuitOrNode False False) [1, 2] []
|
18
|
-
# (add_node 2 (ParameterNode 1) [] []
|
19
|
-
# (add_node 1 (ParameterNode 0) [] []
|
20
|
-
# (add_node 0 StartNode [] [5]
|
21
|
-
# empty_graph))))))))))))))"
|
5
|
+
# This is the 'bgv2isabelle' command line entry point.
|
22
6
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
7
|
+
begin
|
8
|
+
# Load configuraiton.
|
9
|
+
config = Seafoam::Config.new
|
10
|
+
config.load_config
|
27
11
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
case node_class
|
40
|
-
when 'org.graalvm.compiler.nodes.ConstantNode'
|
41
|
-
desc = "(ConstantNode #{node.props['rawvalue']})"
|
42
|
-
when 'org.graalvm.compiler.nodes.ParameterNode'
|
43
|
-
desc = "(ParameterNode #{node.props['index']})"
|
44
|
-
else
|
45
|
-
desc = node_class.split('.').last
|
46
|
-
end
|
47
|
-
inputs = node.inputs.map(&:from).map(&:id)
|
48
|
-
outputs = node.outputs.map(&:to).map(&:id)
|
49
|
-
puts " (add_node #{node.id} #{desc} #{inputs.inspect} #{outputs.inspect}"
|
50
|
-
end
|
51
|
-
puts ' empty_graph' + (')' * graph.nodes.size)
|
12
|
+
# Run the command line.
|
13
|
+
commands = Seafoam::Commands.new($stdout, config)
|
14
|
+
commands.bgv2isabelle(*ARGV)
|
15
|
+
rescue StandardError => e
|
16
|
+
if $DEBUG
|
17
|
+
# Re-raise the exception so the user sees it, if debugging is
|
18
|
+
# enabled (ruby -d).
|
19
|
+
raise e
|
20
|
+
else
|
21
|
+
# Otherwise, just print the message.
|
22
|
+
warn "seafoam: #{e.message}"
|
52
23
|
end
|
53
24
|
end
|
data/bin/bgv2json
CHANGED
@@ -1,42 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'seafoam'
|
4
|
-
require 'json'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
graph.nodes.each_value do |node|
|
26
|
-
nodes.push({
|
27
|
-
id: node.id,
|
28
|
-
props: node.props
|
29
|
-
})
|
30
|
-
|
31
|
-
node.outputs.each do |edge|
|
32
|
-
edges.push({
|
33
|
-
from: edge.from.id,
|
34
|
-
to: edge.to.id,
|
35
|
-
props: edge.props
|
36
|
-
})
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
puts JSON.generate({name: name, props: graph.props, nodes: nodes, edges: edges})
|
5
|
+
# This is the 'bgv2json' command line entry point.
|
6
|
+
|
7
|
+
begin
|
8
|
+
# Load configuraiton.
|
9
|
+
config = Seafoam::Config.new
|
10
|
+
config.load_config
|
11
|
+
|
12
|
+
# Run the command line.
|
13
|
+
commands = Seafoam::Commands.new($stdout, config)
|
14
|
+
commands.bgv2json(*ARGV)
|
15
|
+
rescue StandardError => e
|
16
|
+
if $DEBUG
|
17
|
+
# Re-raise the exception so the user sees it, if debugging is
|
18
|
+
# enabled (ruby -d).
|
19
|
+
raise e
|
20
|
+
else
|
21
|
+
# Otherwise, just print the message.
|
22
|
+
warn "seafoam: #{e.message}"
|
41
23
|
end
|
42
24
|
end
|