seafoam 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- 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/commands.rb +48 -31
- data/lib/seafoam/graal/pi.rb +18 -0
- data/lib/seafoam/graph.rb +9 -1
- data/lib/seafoam/graphviz_writer.rb +3 -0
- 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 -13
- 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 +23 -60
- data/.github/probots.yml +0 -2
- data/.github/workflows/workflows.yml +0 -40
- data/.gitignore +0 -6
- 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/Gemfile.lock +0 -59
- 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 -294
- data/docs/getting-graphs.md +0 -63
- 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 -22
- 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 -167
- 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 -314
- 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,294 +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
|
-
sint32 blocks_count
|
61
|
-
Blocks[blocks_count] blocks
|
62
|
-
}
|
63
|
-
|
64
|
-
Node {
|
65
|
-
sint32 id
|
66
|
-
PoolObject node_class
|
67
|
-
bool has_predecessor
|
68
|
-
Pops props
|
69
|
-
Edge[node_class.inputs.size] edges_in
|
70
|
-
Edge[node_class.outputs.size] edges_out
|
71
|
-
}
|
72
|
-
|
73
|
-
Edge {
|
74
|
-
sint32[inputs_count] nodes
|
75
|
-
}
|
76
|
-
|
77
|
-
Blocks {
|
78
|
-
sint32 id
|
79
|
-
sint32 nodes_count
|
80
|
-
sint32[nodes_count] nodes
|
81
|
-
sint32 followers_count
|
82
|
-
sint32[followers_count] followers
|
83
|
-
}
|
84
|
-
|
85
|
-
Props {
|
86
|
-
sint16 props_count
|
87
|
-
Prop[props_count] props
|
88
|
-
}
|
89
|
-
|
90
|
-
Prop {
|
91
|
-
PoolObject key
|
92
|
-
PropObject value
|
93
|
-
}
|
94
|
-
|
95
|
-
PropObject {
|
96
|
-
union {
|
97
|
-
struct {
|
98
|
-
sint8 PROPERTY_POOL
|
99
|
-
PoolObject object
|
100
|
-
}
|
101
|
-
struct {
|
102
|
-
sint8 PROPERTY_INT
|
103
|
-
sint32 value
|
104
|
-
}
|
105
|
-
struct {
|
106
|
-
sint8 PROPERTY_LONG
|
107
|
-
sint64 value
|
108
|
-
}
|
109
|
-
struct {
|
110
|
-
sint8 PROPERTY_DOUBLE
|
111
|
-
float64 value
|
112
|
-
}
|
113
|
-
struct {
|
114
|
-
sint8 PROPERTY_FLOAT
|
115
|
-
float32 value
|
116
|
-
}
|
117
|
-
struct {
|
118
|
-
sint8 PROPERTY_TRUE
|
119
|
-
}
|
120
|
-
struct {
|
121
|
-
sint8 PROPERTY_FALSE
|
122
|
-
}
|
123
|
-
struct {
|
124
|
-
sint8 PROPERTY_ARRAY
|
125
|
-
union {
|
126
|
-
struct {
|
127
|
-
sint8 PROPERTY_POOL
|
128
|
-
sint32 times
|
129
|
-
PoolObject[times] values
|
130
|
-
}
|
131
|
-
}
|
132
|
-
}
|
133
|
-
struct {
|
134
|
-
sint8 PROPERTY_SUBGRAPH
|
135
|
-
GraphBody graph
|
136
|
-
}
|
137
|
-
}
|
138
|
-
}
|
139
|
-
|
140
|
-
PoolObject {
|
141
|
-
union {
|
142
|
-
POOL_NULL
|
143
|
-
struct {
|
144
|
-
sint8 token = POOL_NEW
|
145
|
-
uint16 id
|
146
|
-
union {
|
147
|
-
struct {
|
148
|
-
sint8 type = POOL_STRING
|
149
|
-
String string
|
150
|
-
}
|
151
|
-
struct {
|
152
|
-
sint8 type = POOL_ENUM
|
153
|
-
PoolObject enum_class
|
154
|
-
sint32 enum_ordinal
|
155
|
-
}
|
156
|
-
struct {
|
157
|
-
sint8 type = POOL_CLASS
|
158
|
-
String type_name
|
159
|
-
union {
|
160
|
-
struct {
|
161
|
-
sint8 type = ENUM_KLASS
|
162
|
-
sint32 values_count
|
163
|
-
PoolObject values[values_count]
|
164
|
-
}
|
165
|
-
struct {
|
166
|
-
sint8 type = KLASS
|
167
|
-
}
|
168
|
-
}
|
169
|
-
}
|
170
|
-
struct {
|
171
|
-
sint8 type = POOL_METHOD
|
172
|
-
PoolObject declaring_class
|
173
|
-
PoolObject method_name
|
174
|
-
PoolObject signature
|
175
|
-
sint32 modifiers
|
176
|
-
sint32 bytes_length
|
177
|
-
uint8[bytes_length] bytes
|
178
|
-
}
|
179
|
-
struct {
|
180
|
-
sint8 type = POOL_NODE_CLASS
|
181
|
-
PoolObject node_class
|
182
|
-
String name_template
|
183
|
-
sint16 input_count
|
184
|
-
InputEdgeInfo inputs[input_count]
|
185
|
-
sint16 output_count
|
186
|
-
OutputEdgeInfo outputs[output_count]
|
187
|
-
}
|
188
|
-
struct {
|
189
|
-
sint8 type = POOL_FIELD
|
190
|
-
PoolObject field_class
|
191
|
-
PoolObject name
|
192
|
-
PoolObject type_name
|
193
|
-
sint32 modifiers
|
194
|
-
}
|
195
|
-
struct {
|
196
|
-
sint8 type = POOL_NODE_SIGNATURE
|
197
|
-
sint16 args_count
|
198
|
-
PoolObject args[args_count]
|
199
|
-
}
|
200
|
-
struct {
|
201
|
-
sint8 type = POOL_NODE_SOURCE_POSITION
|
202
|
-
PoolObject method
|
203
|
-
sint32 bci
|
204
|
-
SourcePosition source_positions[...until SourcePosition.uri = null]
|
205
|
-
PoolObject caller
|
206
|
-
}
|
207
|
-
struct {
|
208
|
-
sint8 type = POOL_NODE
|
209
|
-
sint32 node_id
|
210
|
-
PoolObject node_class
|
211
|
-
}
|
212
|
-
}
|
213
|
-
}
|
214
|
-
struct {
|
215
|
-
sint8 token = POOL_STRING | POOL_ENUM | POOL_CLASS | POOL_METHOD | POOL_NODE_CLASS | POOL_FIELD | POOL_SIGNATURE | POOL_NODE_SOURCE_POSITION | POOL_NODE
|
216
|
-
uint16 pool_id
|
217
|
-
}
|
218
|
-
}
|
219
|
-
}
|
220
|
-
|
221
|
-
InputEdgeInfo {
|
222
|
-
sint8 indirect
|
223
|
-
PoolObject name
|
224
|
-
PoolObject type
|
225
|
-
}
|
226
|
-
|
227
|
-
OutputEdgeInfo {
|
228
|
-
sint8 indirect
|
229
|
-
PoolObject name
|
230
|
-
}
|
231
|
-
|
232
|
-
SourcePosition {
|
233
|
-
PoolObject uri
|
234
|
-
String location
|
235
|
-
sint32 line
|
236
|
-
sint32 start
|
237
|
-
sint32 end
|
238
|
-
}
|
239
|
-
|
240
|
-
String {
|
241
|
-
sint32 length
|
242
|
-
char[length] chars
|
243
|
-
}
|
244
|
-
|
245
|
-
BEGIN_GROUP = 0x00
|
246
|
-
BEGIN_GRAPH = 0x01
|
247
|
-
CLOSE_GROUP = 0x02
|
248
|
-
BEGIN_DOCUMENT = 0x03
|
249
|
-
|
250
|
-
POOL_NEW = 0x00
|
251
|
-
POOL_STRING = 0x01
|
252
|
-
POOL_ENUM = 0x02
|
253
|
-
POOL_CLASS = 0x03
|
254
|
-
POOL_METHOD = 0x04
|
255
|
-
POOL_NULL = 0x05
|
256
|
-
POOL_NODE_CLASS = 0x06
|
257
|
-
POOL_FIELD = 0x07
|
258
|
-
POOL_SIGNATURE = 0x08
|
259
|
-
POOL_NODE_SOURCE_POSITION = 0x09
|
260
|
-
POOL_NODE = 0x0a
|
261
|
-
|
262
|
-
PROPERTY_POOL = 0x00
|
263
|
-
PROPERTY_INT = 0x01
|
264
|
-
PROPERTY_LONG = 0x02
|
265
|
-
PROPERTY_DOUBLE = 0x03
|
266
|
-
PROPERTY_FLOAT = 0x04
|
267
|
-
PROPERTY_TRUE = 0x05
|
268
|
-
PROPERTY_FALSE = 0x06
|
269
|
-
PROPERTY_ARRAY = 0x07
|
270
|
-
PROPERTY_SUBGRAPH = 0x08
|
271
|
-
|
272
|
-
KLASS = 0x00
|
273
|
-
ENUM_KLASS = 0x01
|
274
|
-
```
|
275
|
-
|
276
|
-
## Seeking
|
277
|
-
|
278
|
-
The BGV format is not particularly amenable to seeking. You must read each prior
|
279
|
-
graph in order to read any subsequent graph, the length of nodes and edges
|
280
|
-
depends on values within them, and there is an object pool that is incrementally
|
281
|
-
built.
|
282
|
-
|
283
|
-
In order to 'seek' BGV files we have two code paths for reading the file, one
|
284
|
-
with loads the data and one which loads as little as possible to know just how
|
285
|
-
much further to advance in the file.
|
286
|
-
|
287
|
-
## Compression
|
288
|
-
|
289
|
-
Seafoam supports compressed BGV files in the gzip file format.
|
290
|
-
|
291
|
-
## Other information
|
292
|
-
|
293
|
-
`seafoam file.bgv debug` checks that a file can be parsed and prints information
|
294
|
-
as it does so.
|
data/docs/getting-graphs.md
DELETED
@@ -1,63 +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 basic blocks
|
58
|
-
|
59
|
-
To get the graph when scheduled, so that you can see basic blocks, use `-Dgraal.PrintGraphWithSchedule=true`. Truffle graphs beyond the initial stages have scheduling information by default.
|
60
|
-
|
61
|
-
## Getting CFG files
|
62
|
-
|
63
|
-
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 -Dgraal.PrintGraphWithSchedule=true 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
|
-
}
|