seafoam 0.6 → 0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/bgv2isabelle +1 -5
- data/bin/bgv2json +1 -5
- data/bin/cfg2asm +1 -5
- data/bin/seafoam +1 -5
- data/lib/seafoam/bgv/bgv_parser.rb +10 -2
- data/lib/seafoam/commands.rb +107 -32
- data/lib/seafoam/graal/pi.rb +18 -0
- data/lib/seafoam/graph.rb +33 -1
- data/lib/seafoam/graphviz_writer.rb +24 -2
- data/lib/seafoam/json_writer.rb +1 -3
- data/lib/seafoam/{annotators → passes}/fallback.rb +4 -4
- data/lib/seafoam/{annotators → passes}/graal.rb +43 -15
- data/lib/seafoam/passes/truffle.rb +58 -0
- data/lib/seafoam/passes.rb +61 -0
- data/lib/seafoam/version.rb +1 -1
- data/lib/seafoam.rb +5 -4
- metadata +26 -62
- data/.github/probots.yml +0 -2
- data/.github/workflows/workflows.yml +0 -39
- data/.gitignore +0 -7
- data/.rubocop.yml +0 -37
- data/.ruby-version +0 -1
- data/.seafoam/config +0 -1
- data/CODE_OF_CONDUCT.md +0 -128
- data/CONTRIBUTING.md +0 -5
- data/Gemfile +0 -2
- data/LICENSE.md +0 -7
- data/README.md +0 -378
- data/demos/box-unbox-stats +0 -65
- data/docs/annotators.md +0 -43
- data/docs/bgv.md +0 -293
- data/docs/getting-graphs.md +0 -59
- data/docs/images/igv.png +0 -0
- data/docs/images/seafoam.png +0 -0
- data/docs/images/spotlight-igv.png +0 -0
- data/docs/images/spotlight-seafoam.png +0 -0
- data/docs/json.md +0 -35
- data/examples/Fib.java +0 -24
- data/examples/MatMult.java +0 -39
- data/examples/fib-java.bgv.gz +0 -0
- data/examples/fib.js +0 -15
- data/examples/fib.rb +0 -15
- data/examples/identity.rb +0 -13
- data/examples/java/Irreducible.class +0 -0
- data/examples/java/Irreducible.j +0 -35
- data/examples/java/IrreducibleDecompiled.java +0 -21
- data/examples/java/JavaExamples.java +0 -418
- data/examples/matmult.rb +0 -29
- data/examples/overflow.rb +0 -13
- data/examples/ruby/clamps.rb +0 -20
- data/examples/ruby/graal.patch +0 -15
- data/examples/ruby/ruby_examples.rb +0 -278
- data/lib/seafoam/annotators.rb +0 -54
- data/lib/seafoam/config.rb +0 -34
- data/seafoam.gemspec +0 -21
- data/spec/seafoam/annotators/fallback_spec.rb +0 -69
- data/spec/seafoam/annotators/graal_spec.rb +0 -96
- data/spec/seafoam/annotators_spec.rb +0 -61
- data/spec/seafoam/bgv/bgv_parser_spec.rb +0 -157
- data/spec/seafoam/binary/io_binary_reader_spec.rb +0 -176
- data/spec/seafoam/cfg/cfg_parser_spec.rb +0 -21
- data/spec/seafoam/cfg/disassembler_spec.rb +0 -32
- data/spec/seafoam/command_spec.rb +0 -316
- data/spec/seafoam/graph_spec.rb +0 -172
- data/spec/seafoam/graphviz_writer_spec.rb +0 -63
- data/spec/seafoam/json_writer_spec.rb +0 -14
- data/spec/seafoam/spec_helpers.rb +0 -34
- data/spec/seafoam/spotlight_spec.rb +0 -38
- data/tools/render-all +0 -36
data/docs/bgv.md
DELETED
@@ -1,293 +0,0 @@
|
|
1
|
-
# BGV File Format
|
2
|
-
|
3
|
-
The BGV (*binary graph*, sometimes also called *BIGV*) file format is dumped by
|
4
|
-
Graal graphs.
|
5
|
-
|
6
|
-
The BGV parser was implemented from the [open-source writer code][graph-protocol]
|
7
|
-
in the GraalVM compiler.
|
8
|
-
|
9
|
-
[graph-protocol]: https://github.com/oracle/graal/blob/master/compiler/src/org.graalvm.graphio/src/org/graalvm/graphio/GraphProtocol.java
|
10
|
-
|
11
|
-
## Format
|
12
|
-
|
13
|
-
Seafoam supports BGV versions:
|
14
|
-
|
15
|
-
* 7.0 (GraalVM 20.1.0 and up)
|
16
|
-
* 6.1 (GraalVM 1.0.0-rc16 and up)
|
17
|
-
|
18
|
-
The BGV file format is network-endian.
|
19
|
-
|
20
|
-
```c
|
21
|
-
BGV {
|
22
|
-
char[4] = 'BIGV'
|
23
|
-
sint8 major
|
24
|
-
sint8 minor
|
25
|
-
GroupDocumentGraph*
|
26
|
-
}
|
27
|
-
|
28
|
-
GroupDocumentGraph {
|
29
|
-
BeginGroup GroupDocumentGraph* CloseGroup | Document | Graph
|
30
|
-
}
|
31
|
-
|
32
|
-
BeginGroup {
|
33
|
-
sint8 token = BEGIN_GROUP
|
34
|
-
PoolObject name
|
35
|
-
PoolObject method
|
36
|
-
sint32 bci
|
37
|
-
Props props
|
38
|
-
}
|
39
|
-
|
40
|
-
CloseGroup {
|
41
|
-
sint8 token = CLOSE_GROUP
|
42
|
-
}
|
43
|
-
|
44
|
-
Document {
|
45
|
-
sint8 token = BEGIN_DOCUMENT
|
46
|
-
Pops props
|
47
|
-
}
|
48
|
-
|
49
|
-
Graph {
|
50
|
-
sint8 token = BEGIN_GRAPH
|
51
|
-
String format
|
52
|
-
Args args
|
53
|
-
GraphBody body
|
54
|
-
}
|
55
|
-
|
56
|
-
GraphBody {
|
57
|
-
Props props
|
58
|
-
sint32 nodes_count
|
59
|
-
Node[nodes_count] nodes
|
60
|
-
Blocks blocks
|
61
|
-
}
|
62
|
-
|
63
|
-
Node {
|
64
|
-
sint32 id
|
65
|
-
PoolObject node_class
|
66
|
-
bool has_predecessor
|
67
|
-
Pops props
|
68
|
-
Edge[node_class.inputs.size] edges_in
|
69
|
-
Edge[node_class.outputs.size] edges_out
|
70
|
-
}
|
71
|
-
|
72
|
-
Edge {
|
73
|
-
sint32[inputs_count] nodes
|
74
|
-
}
|
75
|
-
|
76
|
-
Blocks {
|
77
|
-
sint32 id
|
78
|
-
sint32 nodes_count
|
79
|
-
sint32[nodes_count] nodes
|
80
|
-
sint32 followers_count
|
81
|
-
sint32[followers_count] followers
|
82
|
-
}
|
83
|
-
|
84
|
-
Props {
|
85
|
-
sint16 props_count
|
86
|
-
Prop[props_count] props
|
87
|
-
}
|
88
|
-
|
89
|
-
Prop {
|
90
|
-
PoolObject key
|
91
|
-
PropObject value
|
92
|
-
}
|
93
|
-
|
94
|
-
PropObject {
|
95
|
-
union {
|
96
|
-
struct {
|
97
|
-
sint8 PROPERTY_POOL
|
98
|
-
PoolObject object
|
99
|
-
}
|
100
|
-
struct {
|
101
|
-
sint8 PROPERTY_INT
|
102
|
-
sint32 value
|
103
|
-
}
|
104
|
-
struct {
|
105
|
-
sint8 PROPERTY_LONG
|
106
|
-
sint64 value
|
107
|
-
}
|
108
|
-
struct {
|
109
|
-
sint8 PROPERTY_DOUBLE
|
110
|
-
float64 value
|
111
|
-
}
|
112
|
-
struct {
|
113
|
-
sint8 PROPERTY_FLOAT
|
114
|
-
float32 value
|
115
|
-
}
|
116
|
-
struct {
|
117
|
-
sint8 PROPERTY_TRUE
|
118
|
-
}
|
119
|
-
struct {
|
120
|
-
sint8 PROPERTY_FALSE
|
121
|
-
}
|
122
|
-
struct {
|
123
|
-
sint8 PROPERTY_ARRAY
|
124
|
-
union {
|
125
|
-
struct {
|
126
|
-
sint8 PROPERTY_POOL
|
127
|
-
sint32 times
|
128
|
-
PoolObject[times] values
|
129
|
-
}
|
130
|
-
}
|
131
|
-
}
|
132
|
-
struct {
|
133
|
-
sint8 PROPERTY_SUBGRAPH
|
134
|
-
GraphBody graph
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
PoolObject {
|
140
|
-
union {
|
141
|
-
POOL_NULL
|
142
|
-
struct {
|
143
|
-
sint8 token = POOL_NEW
|
144
|
-
uint16 id
|
145
|
-
union {
|
146
|
-
struct {
|
147
|
-
sint8 type = POOL_STRING
|
148
|
-
String string
|
149
|
-
}
|
150
|
-
struct {
|
151
|
-
sint8 type = POOL_ENUM
|
152
|
-
PoolObject enum_class
|
153
|
-
sint32 enum_ordinal
|
154
|
-
}
|
155
|
-
struct {
|
156
|
-
sint8 type = POOL_CLASS
|
157
|
-
String type_name
|
158
|
-
union {
|
159
|
-
struct {
|
160
|
-
sint8 type = ENUM_KLASS
|
161
|
-
sint32 values_count
|
162
|
-
PoolObject values[values_count]
|
163
|
-
}
|
164
|
-
struct {
|
165
|
-
sint8 type = KLASS
|
166
|
-
}
|
167
|
-
}
|
168
|
-
}
|
169
|
-
struct {
|
170
|
-
sint8 type = POOL_METHOD
|
171
|
-
PoolObject declaring_class
|
172
|
-
PoolObject method_name
|
173
|
-
PoolObject signature
|
174
|
-
sint32 modifiers
|
175
|
-
sint32 bytes_length
|
176
|
-
uint8[bytes_length] bytes
|
177
|
-
}
|
178
|
-
struct {
|
179
|
-
sint8 type = POOL_NODE_CLASS
|
180
|
-
PoolObject node_class
|
181
|
-
String name_template
|
182
|
-
sint16 input_count
|
183
|
-
InputEdgeInfo inputs[input_count]
|
184
|
-
sint16 output_count
|
185
|
-
OutputEdgeInfo outputs[output_count]
|
186
|
-
}
|
187
|
-
struct {
|
188
|
-
sint8 type = POOL_FIELD
|
189
|
-
PoolObject field_class
|
190
|
-
PoolObject name
|
191
|
-
PoolObject type_name
|
192
|
-
sint32 modifiers
|
193
|
-
}
|
194
|
-
struct {
|
195
|
-
sint8 type = POOL_NODE_SIGNATURE
|
196
|
-
sint16 args_count
|
197
|
-
PoolObject args[args_count]
|
198
|
-
}
|
199
|
-
struct {
|
200
|
-
sint8 type = POOL_NODE_SOURCE_POSITION
|
201
|
-
PoolObject method
|
202
|
-
sint32 bci
|
203
|
-
SourcePosition source_positions[...until SourcePosition.uri = null]
|
204
|
-
PoolObject caller
|
205
|
-
}
|
206
|
-
struct {
|
207
|
-
sint8 type = POOL_NODE
|
208
|
-
sint32 node_id
|
209
|
-
PoolObject node_class
|
210
|
-
}
|
211
|
-
}
|
212
|
-
}
|
213
|
-
struct {
|
214
|
-
sint8 token = POOL_STRING | POOL_ENUM | POOL_CLASS | POOL_METHOD | POOL_NODE_CLASS | POOL_FIELD | POOL_SIGNATURE | POOL_NODE_SOURCE_POSITION | POOL_NODE
|
215
|
-
uint16 pool_id
|
216
|
-
}
|
217
|
-
}
|
218
|
-
}
|
219
|
-
|
220
|
-
InputEdgeInfo {
|
221
|
-
sint8 indirect
|
222
|
-
PoolObject name
|
223
|
-
PoolObject type
|
224
|
-
}
|
225
|
-
|
226
|
-
OutputEdgeInfo {
|
227
|
-
sint8 indirect
|
228
|
-
PoolObject name
|
229
|
-
}
|
230
|
-
|
231
|
-
SourcePosition {
|
232
|
-
PoolObject uri
|
233
|
-
String location
|
234
|
-
sint32 line
|
235
|
-
sint32 start
|
236
|
-
sint32 end
|
237
|
-
}
|
238
|
-
|
239
|
-
String {
|
240
|
-
sint32 length
|
241
|
-
char[length] chars
|
242
|
-
}
|
243
|
-
|
244
|
-
BEGIN_GROUP = 0x00
|
245
|
-
BEGIN_GRAPH = 0x01
|
246
|
-
CLOSE_GROUP = 0x02
|
247
|
-
BEGIN_DOCUMENT = 0x03
|
248
|
-
|
249
|
-
POOL_NEW = 0x00
|
250
|
-
POOL_STRING = 0x01
|
251
|
-
POOL_ENUM = 0x02
|
252
|
-
POOL_CLASS = 0x03
|
253
|
-
POOL_METHOD = 0x04
|
254
|
-
POOL_NULL = 0x05
|
255
|
-
POOL_NODE_CLASS = 0x06
|
256
|
-
POOL_FIELD = 0x07
|
257
|
-
POOL_SIGNATURE = 0x08
|
258
|
-
POOL_NODE_SOURCE_POSITION = 0x09
|
259
|
-
POOL_NODE = 0x0a
|
260
|
-
|
261
|
-
PROPERTY_POOL = 0x00
|
262
|
-
PROPERTY_INT = 0x01
|
263
|
-
PROPERTY_LONG = 0x02
|
264
|
-
PROPERTY_DOUBLE = 0x03
|
265
|
-
PROPERTY_FLOAT = 0x04
|
266
|
-
PROPERTY_TRUE = 0x05
|
267
|
-
PROPERTY_FALSE = 0x06
|
268
|
-
PROPERTY_ARRAY = 0x07
|
269
|
-
PROPERTY_SUBGRAPH = 0x08
|
270
|
-
|
271
|
-
KLASS = 0x00
|
272
|
-
ENUM_KLASS = 0x01
|
273
|
-
```
|
274
|
-
|
275
|
-
## Seeking
|
276
|
-
|
277
|
-
The BGV format is not particularly amenable to seeking. You must read each prior
|
278
|
-
graph in order to read any subsequent graph, the length of nodes and edges
|
279
|
-
depends on values within them, and there is an object pool that is incrementally
|
280
|
-
built.
|
281
|
-
|
282
|
-
In order to 'seek' BGV files we have two code paths for reading the file, one
|
283
|
-
with loads the data and one which loads as little as possible to know just how
|
284
|
-
much further to advance in the file.
|
285
|
-
|
286
|
-
## Compression
|
287
|
-
|
288
|
-
Seafoam supports compressed BGV files in the gzip file format.
|
289
|
-
|
290
|
-
## Other information
|
291
|
-
|
292
|
-
`seafoam file.bgv debug` checks that a file can be parsed and prints information
|
293
|
-
as it does so.
|
data/docs/getting-graphs.md
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# Getting Graphs
|
2
|
-
|
3
|
-
## GraalVM Compiler as a Java compiler
|
4
|
-
|
5
|
-
`-Dgraal.Dump=:2` is a simple option to enable Graal graph dumping.
|
6
|
-
|
7
|
-
The value of `Dump` is a *dump filter*. The format of dump filters is
|
8
|
-
[documented][dump-filters], but in simple cases `:2` will be enough and will
|
9
|
-
give you everything.
|
10
|
-
|
11
|
-
[dump-filters]: https://github.com/oracle/graal/blob/master/compiler/src/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/doc-files/DumpHelp.txt
|
12
|
-
|
13
|
-
You may want to combine with `-XX:CompileOnly=Foo::foo` (you can omit the class
|
14
|
-
part) to restrict compilation to a single method to give smaller dumps, and to
|
15
|
-
some extent make graphs simpler by avoiding what you want to look at being
|
16
|
-
inlined, or other things being inlined into it.
|
17
|
-
|
18
|
-
Graal tends to be quite aggressive about loop unrolling, which can produce
|
19
|
-
massive graphs with the logic repeated. I often use these flags to simplify the
|
20
|
-
graph without significantly effecting too much how the logic in it is compiled.
|
21
|
-
|
22
|
-
```
|
23
|
-
-Dgraal.FullUnroll=false \
|
24
|
-
-Dgraal.PartialUnroll=false \
|
25
|
-
-Dgraal.LoopPeeling=false \
|
26
|
-
-Dgraal.LoopUnswitch=false \
|
27
|
-
-Dgraal.OptLoopTransform=false \
|
28
|
-
-Dgraal.OptScheduleOutOfLoops=false \
|
29
|
-
-Dgraal.VectorizeLoops=false
|
30
|
-
```
|
31
|
-
|
32
|
-
## GraalVM's Native Image compiler
|
33
|
-
|
34
|
-
When using `native-image` you will want to use the `-H:` format.
|
35
|
-
|
36
|
-
```
|
37
|
-
% native-image -H:Dump=:2 -H:MethodFilter=fib Fib
|
38
|
-
```
|
39
|
-
|
40
|
-
## TruffleRuby and other Truffle languages
|
41
|
-
|
42
|
-
Use the same options as for GraalVM for Java, except they're prefixed with
|
43
|
-
`--vm.`, for example `--vm.Dgraal.Dump=Truffle:2`.
|
44
|
-
|
45
|
-
Use with `--engine.CompileOnly=foo`.
|
46
|
-
|
47
|
-
A good filter to use for Truffle languages is `--vm.Dgraal.Dump=Truffle:1`,
|
48
|
-
which will only give you Truffle compilations if you don't care about the
|
49
|
-
whole Graal compilation pipeline.
|
50
|
-
|
51
|
-
You may want to disable on-stack-replacement and inlining with
|
52
|
-
`--engine.Inlining=false` and `--engine.OSR=false` in order to make graphs
|
53
|
-
easier to understand.
|
54
|
-
|
55
|
-
You may need to use `--experimental-options`.
|
56
|
-
|
57
|
-
## Getting CFG files
|
58
|
-
|
59
|
-
To also get CFG files, add `-Dgraal.PrintBackendCFG=true`, or `--vm.Dgraal.PrintBackendCFG=true` for Truffle.
|
data/docs/images/igv.png
DELETED
Binary file
|
data/docs/images/seafoam.png
DELETED
Binary file
|
Binary file
|
Binary file
|
data/docs/json.md
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# JSON Output Format
|
2
|
-
|
3
|
-
The `bgv2json` command outputs files in [JSON Lines](https://jsonlines.org/) format - one JSON object for each graph, one per line.
|
4
|
-
|
5
|
-
Each graph is of the format:
|
6
|
-
|
7
|
-
```js
|
8
|
-
{
|
9
|
-
"name": ...,
|
10
|
-
"props": {...},
|
11
|
-
"nodes": [...],
|
12
|
-
"edges": [...]
|
13
|
-
}
|
14
|
-
```
|
15
|
-
|
16
|
-
Each node is of the format:
|
17
|
-
|
18
|
-
```js
|
19
|
-
{
|
20
|
-
"id": ...,
|
21
|
-
"props": {...}
|
22
|
-
}
|
23
|
-
```
|
24
|
-
|
25
|
-
Each edge is of the format:
|
26
|
-
|
27
|
-
```js
|
28
|
-
{
|
29
|
-
"from": ..., // node id
|
30
|
-
"to": ..., // node id
|
31
|
-
"props": {...}
|
32
|
-
}
|
33
|
-
```
|
34
|
-
|
35
|
-
Note that `bgv2json` runs annotations, so for example all nodes have a `"label"` property with an easy-to-use name.
|
data/examples/Fib.java
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* % javac Fib.java
|
3
|
-
* % java -XX:CompileOnly=::fib -Dgraal.Dump=:2 Fib 14
|
4
|
-
*/
|
5
|
-
|
6
|
-
class Fib {
|
7
|
-
|
8
|
-
public static void main(String[] args) {
|
9
|
-
while (true) {
|
10
|
-
for (String arg : args) {
|
11
|
-
fib(Integer.parseInt(args[0]));
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
public static int fib(int n) {
|
17
|
-
if (n <= 1) {
|
18
|
-
return n;
|
19
|
-
} else {
|
20
|
-
return fib(n - 1) + fib(n - 2);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
}
|
data/examples/MatMult.java
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* % javac MatMult.java
|
3
|
-
* % java -XX:CompileOnly=::matmult -Dgraal.Dump=:2 MatMult 100
|
4
|
-
*/
|
5
|
-
|
6
|
-
class MatMult {
|
7
|
-
|
8
|
-
public static void main(String[] args) {
|
9
|
-
while (true) {
|
10
|
-
for (String arg : args) {
|
11
|
-
final int size = Integer.parseInt(args[0]);
|
12
|
-
final double[][] a = new double[size][];
|
13
|
-
final double[][] b = new double[size][];
|
14
|
-
final double[][] c = new double[size][];
|
15
|
-
for (int n = 0; n < size; n++) {
|
16
|
-
a[n] = new double[size];
|
17
|
-
b[n] = new double[size];
|
18
|
-
c[n] = new double[size];
|
19
|
-
for (int m = 0; m < size; m++) {
|
20
|
-
a[n][m] = Math.random();
|
21
|
-
b[n][m] = Math.random();
|
22
|
-
}
|
23
|
-
}
|
24
|
-
matmult(size, a, b, c);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
public static void matmult(int size, double[][] a, double[][] b, double[][] c) {
|
30
|
-
for(int i = 0; i < size; i++) {
|
31
|
-
for (int j = 0; j < size; j++) {
|
32
|
-
for (int k = 0; k < size; k++) {
|
33
|
-
c[i][j] += a[i][k] * b[k][j];
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
}
|
data/examples/fib-java.bgv.gz
DELETED
Binary file
|
data/examples/fib.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
// % node --experimental-options --engine.CompileOnly=fib --engine.Inlining=false --vm.Dgraal.Dump=Truffle:2 fib.js 14
|
2
|
-
|
3
|
-
function fib(n) {
|
4
|
-
if (n <= 1) {
|
5
|
-
return n;
|
6
|
-
} else {
|
7
|
-
return fib(n - 1) + fib(n - 2);
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
while (true) {
|
12
|
-
for (let n = 2; n < process.argv.length; n++) {
|
13
|
-
fib(parseInt(process.argv[n]));
|
14
|
-
}
|
15
|
-
}
|
data/examples/fib.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# % ruby --experimental-options --engine.CompileOnly=fib --engine.Inlining=false --engine.OSR=false --vm.Dgraal.Dump=Truffle:2 fib.rb 14
|
2
|
-
|
3
|
-
def fib(n)
|
4
|
-
if n <= 1
|
5
|
-
n
|
6
|
-
else
|
7
|
-
fib(n - 1) + fib(n - 2)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
loop do
|
12
|
-
ARGV.each do |arg|
|
13
|
-
fib(Integer(arg))
|
14
|
-
end
|
15
|
-
end
|
data/examples/identity.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# % ruby --experimental-options --engine.CompileOnly=identity --engine.Inlining=false --engine.OSR=false --vm.Dgraal.Dump=Truffle:2 identity.rb 1 2 3
|
2
|
-
|
3
|
-
# The purpose of this identity function is to learn what the Truffle prelude looks like.
|
4
|
-
|
5
|
-
def identity(arg)
|
6
|
-
arg
|
7
|
-
end
|
8
|
-
|
9
|
-
loop do
|
10
|
-
ARGV.each do |arg|
|
11
|
-
identity(Integer(arg))
|
12
|
-
end
|
13
|
-
end
|
Binary file
|
data/examples/java/Irreducible.j
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
; https://github.com/Storyyeller/Krakatau
|
2
|
-
; Krakatau/assemble.py Irreducible.j
|
3
|
-
|
4
|
-
.class public Irreducible
|
5
|
-
.super java/lang/Object
|
6
|
-
.field private static volatile intField I
|
7
|
-
|
8
|
-
.method public static exampleIrreducible : (ZI)I
|
9
|
-
.code stack 1 locals 3
|
10
|
-
|
11
|
-
iload_1
|
12
|
-
istore_2
|
13
|
-
iload_0
|
14
|
-
ifeq L_start_of_loop
|
15
|
-
|
16
|
-
goto L_inside_loop
|
17
|
-
|
18
|
-
L_start_of_loop:
|
19
|
-
iload_2
|
20
|
-
ifle L_end_of_loop
|
21
|
-
iload_2
|
22
|
-
putstatic Field Irreducible intField I
|
23
|
-
|
24
|
-
L_inside_loop:
|
25
|
-
iinc 2 -1
|
26
|
-
goto L_start_of_loop
|
27
|
-
|
28
|
-
L_end_of_loop:
|
29
|
-
iload_1
|
30
|
-
ireturn
|
31
|
-
|
32
|
-
.end code
|
33
|
-
.end method
|
34
|
-
|
35
|
-
.end class
|
@@ -1,21 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// Source code recreated from a .class file by IntelliJ IDEA
|
3
|
-
// (powered by Fernflower decompiler)
|
4
|
-
//
|
5
|
-
|
6
|
-
public class IrreducibleDecompiled {
|
7
|
-
private static volatile int intField;
|
8
|
-
|
9
|
-
public static int exampleIrreducible(boolean var0, int var1) {
|
10
|
-
int var2 = var1;
|
11
|
-
if (var0) {
|
12
|
-
var2 = var1 - 1;
|
13
|
-
}
|
14
|
-
|
15
|
-
while(var2 > 0) {
|
16
|
-
intField = var2--;
|
17
|
-
}
|
18
|
-
|
19
|
-
return var1;
|
20
|
-
}
|
21
|
-
}
|