seafoam 0.7 → 0.11
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 +11 -4
- data/lib/seafoam/commands.rb +140 -58
- data/lib/seafoam/formatters/base.rb +88 -0
- data/lib/seafoam/formatters/formatters.rb +8 -0
- data/lib/seafoam/formatters/json.rb +82 -0
- data/lib/seafoam/formatters/text.rb +70 -0
- data/lib/seafoam/graal/graph_description.rb +22 -0
- data/lib/seafoam/graal/pi.rb +18 -0
- data/lib/seafoam/graal/source.rb +5 -9
- 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 +7 -4
- metadata +34 -63
- 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 -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 -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
@@ -1,418 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* % javac JavaExamples.java
|
3
|
-
* % java -XX:-UseOnStackReplacement '-XX:CompileCommand=dontinline,*::*' -XX:+PrintCompilation -Dgraal.PrintBackendCFG=true -Dgraal.Dump=:3 JavaExamples
|
4
|
-
*/
|
5
|
-
|
6
|
-
import java.lang.reflect.Field;
|
7
|
-
import java.util.Random;
|
8
|
-
import sun.misc.Unsafe;
|
9
|
-
|
10
|
-
class JavaExamples {
|
11
|
-
|
12
|
-
private final static Random RANDOM = new Random();
|
13
|
-
private final static Unsafe UNSAFE = getUnsafe();
|
14
|
-
private final static long UNSAFE_MEMORY = UNSAFE.allocateMemory(1024);
|
15
|
-
|
16
|
-
public static void main(String[] args) {
|
17
|
-
if (args.length != 0) {
|
18
|
-
throw new UnsupportedOperationException("not expecting any arguments");
|
19
|
-
}
|
20
|
-
|
21
|
-
while (true) {
|
22
|
-
exampleLocalVariables(RANDOM.nextInt(), RANDOM.nextInt());
|
23
|
-
exampleLocalVariablesState(RANDOM.nextInt(), RANDOM.nextInt());
|
24
|
-
exampleArithOperator(RANDOM.nextInt(), RANDOM.nextInt());
|
25
|
-
exampleCompareOperator(RANDOM.nextInt(), RANDOM.nextInt());
|
26
|
-
try {
|
27
|
-
exampleExactArith(RANDOM.nextInt(), RANDOM.nextInt());
|
28
|
-
} catch (ArithmeticException e) { }
|
29
|
-
examplePhi(RANDOM.nextBoolean(), RANDOM.nextInt());
|
30
|
-
exampleSimpleCall(new ExampleObject(RANDOM.nextInt()), RANDOM.nextInt());
|
31
|
-
exampleInterfaceCallOneImpl(new OneImpl());
|
32
|
-
exampleInterfaceCallManyImpls(RANDOM.nextBoolean() ? new ManyImplsA() : new ManyImplsB());
|
33
|
-
exampleStaticCall(RANDOM.nextInt());
|
34
|
-
exampleStamp(RANDOM.nextInt());
|
35
|
-
exampleFullEscape(RANDOM.nextInt());
|
36
|
-
exampleNoEscape(RANDOM.nextInt());
|
37
|
-
examplePartialEscape(RANDOM.nextBoolean(), RANDOM.nextInt());
|
38
|
-
exampleIf(RANDOM.nextBoolean(), RANDOM.nextInt(), RANDOM.nextInt());
|
39
|
-
exampleIfNeverTaken(false, RANDOM.nextInt(), RANDOM.nextInt());
|
40
|
-
exampleIntSwitch(RANDOM.nextInt(3), RANDOM.nextInt(), RANDOM.nextInt(), RANDOM.nextInt());
|
41
|
-
exampleStringSwitch(new String[]{"foo", "bar", "baz"}[RANDOM.nextInt(3)], RANDOM.nextInt(), RANDOM.nextInt(), RANDOM.nextInt());
|
42
|
-
exampleWhile(RANDOM.nextInt(10));
|
43
|
-
exampleFor(RANDOM.nextInt(10));
|
44
|
-
exampleReducible(RANDOM.nextBoolean(), RANDOM.nextInt(10));
|
45
|
-
Irreducible.exampleIrreducible(RANDOM.nextBoolean(), RANDOM.nextInt(10));
|
46
|
-
exampleNestedWhile(RANDOM.nextInt(10));
|
47
|
-
exampleWhileBreak(RANDOM.nextInt(10));
|
48
|
-
exampleNestedWhileBreak(RANDOM.nextInt(10));
|
49
|
-
try {
|
50
|
-
exampleThrow();
|
51
|
-
} catch (RuntimeException e) { }
|
52
|
-
exampleCatch();
|
53
|
-
exampleThrowCatch();
|
54
|
-
exampleObjectAllocation(RANDOM.nextInt());
|
55
|
-
exampleArrayAllocation(RANDOM.nextInt(), RANDOM.nextInt());
|
56
|
-
exampleFieldWrite(new ExampleObject(RANDOM.nextInt()), RANDOM.nextInt());
|
57
|
-
exampleFieldRead(new ExampleObject(RANDOM.nextInt()));
|
58
|
-
exampleArrayWrite(new int[]{RANDOM.nextInt(), RANDOM.nextInt(), RANDOM.nextInt()}, RANDOM.nextInt(3), RANDOM.nextInt());
|
59
|
-
exampleArrayRead(new int[]{RANDOM.nextInt(), RANDOM.nextInt(), RANDOM.nextInt()}, RANDOM.nextInt(3));
|
60
|
-
exampleUnsafeRead(UNSAFE_MEMORY + RANDOM.nextInt(4) * 4);
|
61
|
-
exampleUnsafeWrite(UNSAFE_MEMORY + RANDOM.nextInt(4) * 4, RANDOM.nextInt());
|
62
|
-
exampleInstanceOfOneImpl(new OneImpl());
|
63
|
-
exampleInstanceOfManyImpls(RANDOM.nextBoolean() ? new ManyImplsA() : new ManyImplsB());
|
64
|
-
exampleSynchronized(new Object(), RANDOM.nextInt());
|
65
|
-
exampleDoubleSynchronized(new Object(), RANDOM.nextInt());
|
66
|
-
exampleLocalSynchronized(RANDOM.nextInt());
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
private static int exampleLocalVariables(int x, int y) {
|
71
|
-
int a = x + y;
|
72
|
-
return a * 2 + a;
|
73
|
-
}
|
74
|
-
|
75
|
-
private static int exampleLocalVariablesState(int x, int y) {
|
76
|
-
int a = x + y;
|
77
|
-
opaqueCall();
|
78
|
-
return a * 2 + a;
|
79
|
-
}
|
80
|
-
|
81
|
-
private static int exampleArithOperator(int x, int y) {
|
82
|
-
return x + y;
|
83
|
-
}
|
84
|
-
|
85
|
-
private static boolean exampleCompareOperator(int x, int y) {
|
86
|
-
return x <= y;
|
87
|
-
}
|
88
|
-
|
89
|
-
private static int exampleExactArith(int x, int y) throws ArithmeticException {
|
90
|
-
return Math.addExact(x, y);
|
91
|
-
}
|
92
|
-
|
93
|
-
private static int examplePhi(boolean condition, int x) {
|
94
|
-
final int a;
|
95
|
-
if (condition) {
|
96
|
-
a = opaqueCall();
|
97
|
-
} else {
|
98
|
-
a = opaqueCall();
|
99
|
-
}
|
100
|
-
return a + x;
|
101
|
-
}
|
102
|
-
|
103
|
-
private static int exampleSimpleCall(ExampleObject object, int x) {
|
104
|
-
return object.instanceCall(x);
|
105
|
-
}
|
106
|
-
|
107
|
-
private static int exampleInterfaceCallOneImpl(InterfaceOneImpl x) {
|
108
|
-
return x.interfaceCall();
|
109
|
-
}
|
110
|
-
|
111
|
-
private static int exampleInterfaceCallManyImpls(InterfaceManyImpls x) {
|
112
|
-
return x.interfaceCall();
|
113
|
-
}
|
114
|
-
|
115
|
-
private static int exampleStaticCall(int x) {
|
116
|
-
return staticCall(x);
|
117
|
-
}
|
118
|
-
|
119
|
-
private static int exampleStamp(int x) {
|
120
|
-
return x & 0x1234;
|
121
|
-
}
|
122
|
-
|
123
|
-
private static int exampleFullEscape(int x) {
|
124
|
-
final int[] a = new int[]{x};
|
125
|
-
objectField = a;
|
126
|
-
return a[0];
|
127
|
-
}
|
128
|
-
|
129
|
-
private static int exampleNoEscape(int x) {
|
130
|
-
final int[] a = new int[]{x};
|
131
|
-
return a[0];
|
132
|
-
}
|
133
|
-
|
134
|
-
private static int examplePartialEscape(boolean condition, int x) {
|
135
|
-
final int[] a = new int[]{x};
|
136
|
-
if (condition) {
|
137
|
-
objectField = a;
|
138
|
-
return a[0];
|
139
|
-
} else {
|
140
|
-
return a[0];
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
private static int exampleIf(boolean condition, int x, int y) {
|
145
|
-
final int a;
|
146
|
-
if (condition) {
|
147
|
-
intField = x;
|
148
|
-
a = x;
|
149
|
-
} else {
|
150
|
-
intField = y;
|
151
|
-
a = y;
|
152
|
-
}
|
153
|
-
return a;
|
154
|
-
}
|
155
|
-
|
156
|
-
private static int exampleIfNeverTaken(boolean condition, int x, int y) {
|
157
|
-
final int a;
|
158
|
-
if (condition) {
|
159
|
-
intField = x;
|
160
|
-
a = x;
|
161
|
-
} else {
|
162
|
-
intField = y;
|
163
|
-
a = y;
|
164
|
-
}
|
165
|
-
return a;
|
166
|
-
}
|
167
|
-
|
168
|
-
private static int exampleIntSwitch(int value, int x, int y, int z) {
|
169
|
-
final int a;
|
170
|
-
switch (value) {
|
171
|
-
case 0:
|
172
|
-
intField = x;
|
173
|
-
a = x;
|
174
|
-
break;
|
175
|
-
case 1:
|
176
|
-
intField = y;
|
177
|
-
a = y;
|
178
|
-
break;
|
179
|
-
default:
|
180
|
-
intField = z;
|
181
|
-
a = z;
|
182
|
-
break;
|
183
|
-
}
|
184
|
-
return a;
|
185
|
-
}
|
186
|
-
|
187
|
-
private static int exampleStringSwitch(String value, int x, int y, int z) {
|
188
|
-
final int a;
|
189
|
-
switch (value) {
|
190
|
-
case "foo":
|
191
|
-
intField = x;
|
192
|
-
a = x;
|
193
|
-
break;
|
194
|
-
case "bar":
|
195
|
-
intField = y;
|
196
|
-
a = y;
|
197
|
-
break;
|
198
|
-
default:
|
199
|
-
intField = z;
|
200
|
-
a = z;
|
201
|
-
break;
|
202
|
-
}
|
203
|
-
return a;
|
204
|
-
}
|
205
|
-
|
206
|
-
private static int exampleWhile(int count) {
|
207
|
-
int a = count;
|
208
|
-
while (a > 0) {
|
209
|
-
intField = a;
|
210
|
-
a--;
|
211
|
-
}
|
212
|
-
return count;
|
213
|
-
}
|
214
|
-
|
215
|
-
private static int exampleReducible(boolean condition, int count) {
|
216
|
-
int a = count;
|
217
|
-
if (condition) {
|
218
|
-
a = count - 1;
|
219
|
-
}
|
220
|
-
while (a > 0) {
|
221
|
-
intField = a;
|
222
|
-
inner:
|
223
|
-
a--;
|
224
|
-
}
|
225
|
-
return count;
|
226
|
-
}
|
227
|
-
|
228
|
-
private static int exampleFor(int count) {
|
229
|
-
for (int a = count; a > 0; a--) {
|
230
|
-
intField = a;
|
231
|
-
}
|
232
|
-
return count;
|
233
|
-
}
|
234
|
-
|
235
|
-
private static int exampleNestedWhile(int count) {
|
236
|
-
int a = count;
|
237
|
-
while (a > 0) {
|
238
|
-
int y = count;
|
239
|
-
while (y > 0) {
|
240
|
-
intField = a;
|
241
|
-
y--;
|
242
|
-
}
|
243
|
-
a--;
|
244
|
-
}
|
245
|
-
return count;
|
246
|
-
}
|
247
|
-
|
248
|
-
private static int exampleWhileBreak(int count) {
|
249
|
-
int a = count;
|
250
|
-
while (a > 0) {
|
251
|
-
if (a == 4) {
|
252
|
-
break;
|
253
|
-
}
|
254
|
-
intField = a;
|
255
|
-
a--;
|
256
|
-
}
|
257
|
-
return count;
|
258
|
-
}
|
259
|
-
|
260
|
-
private static int exampleNestedWhileBreak(int count) {
|
261
|
-
int a = count;
|
262
|
-
outer: while (a > 0) {
|
263
|
-
int b = count;
|
264
|
-
while (b > 0) {
|
265
|
-
if (b == 4) {
|
266
|
-
break outer;
|
267
|
-
}
|
268
|
-
intField = a;
|
269
|
-
b--;
|
270
|
-
}
|
271
|
-
a--;
|
272
|
-
}
|
273
|
-
return count;
|
274
|
-
}
|
275
|
-
|
276
|
-
private static void exampleThrow() {
|
277
|
-
throw RUNTIME_EXCEPTION;
|
278
|
-
}
|
279
|
-
|
280
|
-
private static void exampleCatch() {
|
281
|
-
try {
|
282
|
-
exampleThrow();
|
283
|
-
} catch (RuntimeException e) {
|
284
|
-
objectField = e;
|
285
|
-
}
|
286
|
-
}
|
287
|
-
|
288
|
-
private static void exampleThrowCatch() {
|
289
|
-
try {
|
290
|
-
throw RUNTIME_EXCEPTION;
|
291
|
-
} catch (RuntimeException e) {
|
292
|
-
}
|
293
|
-
}
|
294
|
-
|
295
|
-
private static ExampleObject exampleObjectAllocation(int x) {
|
296
|
-
return new ExampleObject(x);
|
297
|
-
}
|
298
|
-
|
299
|
-
private static int[] exampleArrayAllocation(int x, int y) {
|
300
|
-
return new int[]{x, y};
|
301
|
-
}
|
302
|
-
|
303
|
-
private static void exampleFieldWrite(ExampleObject object, int x) {
|
304
|
-
object.x = x;
|
305
|
-
}
|
306
|
-
|
307
|
-
private static int exampleFieldRead(ExampleObject object) {
|
308
|
-
assert object != null; // otherwise this is a 'trivial' method and won't go past tier 1
|
309
|
-
return object.x;
|
310
|
-
}
|
311
|
-
|
312
|
-
private static void exampleArrayWrite(int[] array, int n, int x) {
|
313
|
-
array[n] = x;
|
314
|
-
}
|
315
|
-
|
316
|
-
private static int exampleArrayRead(int[] array, int n) {
|
317
|
-
return array[n];
|
318
|
-
}
|
319
|
-
|
320
|
-
private static int exampleUnsafeRead(long unsafeMemory) {
|
321
|
-
return UNSAFE.getInt(unsafeMemory);
|
322
|
-
}
|
323
|
-
|
324
|
-
private static void exampleUnsafeWrite(long unsafeMemory, int x) {
|
325
|
-
UNSAFE.putInt(unsafeMemory, x);
|
326
|
-
}
|
327
|
-
|
328
|
-
private static boolean exampleInstanceOfOneImpl(Object x) {
|
329
|
-
return x instanceof InterfaceOneImpl;
|
330
|
-
}
|
331
|
-
|
332
|
-
private static boolean exampleInstanceOfManyImpls(Object x) {
|
333
|
-
return x instanceof InterfaceManyImpls;
|
334
|
-
}
|
335
|
-
|
336
|
-
private static void exampleSynchronized(Object object, int x) {
|
337
|
-
synchronized (object) {
|
338
|
-
intField = x;
|
339
|
-
}
|
340
|
-
}
|
341
|
-
|
342
|
-
private static void exampleDoubleSynchronized(Object object, int x) {
|
343
|
-
synchronized (object) {
|
344
|
-
intField = x;
|
345
|
-
}
|
346
|
-
synchronized (object) {
|
347
|
-
intField = x;
|
348
|
-
}
|
349
|
-
}
|
350
|
-
|
351
|
-
private static void exampleLocalSynchronized(int x) {
|
352
|
-
final Object object = new Object();
|
353
|
-
synchronized (object) {
|
354
|
-
intField = x;
|
355
|
-
}
|
356
|
-
}
|
357
|
-
|
358
|
-
private static int opaqueCall() {
|
359
|
-
return RANDOM.nextInt();
|
360
|
-
}
|
361
|
-
|
362
|
-
private static int staticCall(int x) {
|
363
|
-
return x;
|
364
|
-
}
|
365
|
-
|
366
|
-
private static final RuntimeException RUNTIME_EXCEPTION = new RuntimeException();
|
367
|
-
private static volatile int intField;
|
368
|
-
private static volatile Object objectField;
|
369
|
-
|
370
|
-
private static class ExampleObject {
|
371
|
-
public int x;
|
372
|
-
|
373
|
-
public ExampleObject(int x) {
|
374
|
-
this.x = x;
|
375
|
-
}
|
376
|
-
|
377
|
-
public int instanceCall(int y) {
|
378
|
-
return x + y;
|
379
|
-
}
|
380
|
-
}
|
381
|
-
|
382
|
-
private interface InterfaceOneImpl {
|
383
|
-
int interfaceCall();
|
384
|
-
}
|
385
|
-
|
386
|
-
private static class OneImpl implements InterfaceOneImpl {
|
387
|
-
public int interfaceCall() {
|
388
|
-
return 14;
|
389
|
-
}
|
390
|
-
}
|
391
|
-
|
392
|
-
private interface InterfaceManyImpls {
|
393
|
-
int interfaceCall();
|
394
|
-
}
|
395
|
-
|
396
|
-
private static class ManyImplsA implements InterfaceManyImpls {
|
397
|
-
public int interfaceCall() {
|
398
|
-
return 14;
|
399
|
-
}
|
400
|
-
}
|
401
|
-
|
402
|
-
private static class ManyImplsB implements InterfaceManyImpls {
|
403
|
-
public int interfaceCall() {
|
404
|
-
return 14;
|
405
|
-
}
|
406
|
-
}
|
407
|
-
|
408
|
-
private static Unsafe getUnsafe() {
|
409
|
-
try {
|
410
|
-
final Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
|
411
|
-
theUnsafe.setAccessible(true);
|
412
|
-
return (Unsafe) theUnsafe.get(null);
|
413
|
-
} catch (NoSuchFieldException | IllegalAccessException e) {
|
414
|
-
throw new RuntimeException(e);
|
415
|
-
}
|
416
|
-
}
|
417
|
-
|
418
|
-
}
|
data/examples/matmult.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# % ruby --experimental-options --engine.CompileOnly=matmult --engine.Inlining=false --engine.OSR=false --vm.Dgraal.Dump=Truffle:2 matmult.rb 100
|
2
|
-
|
3
|
-
def matmult(size, a, b, c)
|
4
|
-
# Normally we'd write a loop with blocks, but then we'd be reliant on
|
5
|
-
# inlining.
|
6
|
-
i = 0
|
7
|
-
while i < size
|
8
|
-
j = 0
|
9
|
-
while j < size
|
10
|
-
k = 0
|
11
|
-
while k < size
|
12
|
-
c[i][j] += a[i][k] * b[k][j]
|
13
|
-
k += 1
|
14
|
-
end
|
15
|
-
j += 1
|
16
|
-
end
|
17
|
-
i += 1
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
loop do
|
22
|
-
ARGV.each do |arg|
|
23
|
-
size = Integer(arg)
|
24
|
-
a = size.times.map { size.times.map { rand } }
|
25
|
-
b = size.times.map { size.times.map { rand } }
|
26
|
-
c = size.times.map { size.times.map { 0.0 } }
|
27
|
-
matmult size, a, b, c
|
28
|
-
end
|
29
|
-
end
|
data/examples/overflow.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# % ruby --experimental-options --engine.CompileOnly=add --engine.Inlining=false --engine.OSR=false --vm.Dgraal.Dump=Truffle:2 overflow.rb 1 2 3
|
2
|
-
|
3
|
-
# The purpose of this add function is to show what Ruby arithmetic with overflow looks like.
|
4
|
-
|
5
|
-
def add(a, b)
|
6
|
-
a + b
|
7
|
-
end
|
8
|
-
|
9
|
-
loop do
|
10
|
-
ARGV.each do |arg|
|
11
|
-
add(Integer(arg), Integer(arg))
|
12
|
-
end
|
13
|
-
end
|
data/examples/ruby/clamps.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# ruby --experimental-options --engine.CompileOnly=clamp_low,clamp_high --vm.Dgraal.Dump=Truffle:2 --vm.Dgraal.PrintBackendCFG=true clamps.rb
|
2
|
-
|
3
|
-
def clamp_high(min, max, value)
|
4
|
-
[min, max, value].sort[1]
|
5
|
-
end
|
6
|
-
|
7
|
-
def clamp_low(min, max, value)
|
8
|
-
if value > max
|
9
|
-
max
|
10
|
-
elsif value < min
|
11
|
-
min
|
12
|
-
else
|
13
|
-
value
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
loop do
|
18
|
-
clamp_high(10, 90, rand(100))
|
19
|
-
clamp_low(10, 90, rand(100))
|
20
|
-
end
|
data/examples/ruby/graal.patch
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
diff --git a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/inlining/DefaultInliningPolicy.java b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/inlining/DefaultInliningPolicy.java
|
2
|
-
index ffe01c1688f..d662a7096c4 100644
|
3
|
-
--- a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/inlining/DefaultInliningPolicy.java
|
4
|
-
+++ b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/inlining/DefaultInliningPolicy.java
|
5
|
-
@@ -114,6 +114,10 @@ final class DefaultInliningPolicy implements InliningPolicy {
|
6
|
-
final PriorityQueue<CallNode> inlineQueue = getQueue(tree, CallNode.State.Expanded);
|
7
|
-
CallNode candidate;
|
8
|
-
while ((candidate = inlineQueue.poll()) != null) {
|
9
|
-
+ if (candidate.getName().startsWith("Object#opaque_") || candidate.getName().equals("Object#static_call") || candidate.getName().equals("ExampleObject#instance_call")) {
|
10
|
-
+ continue;
|
11
|
-
+ }
|
12
|
-
+
|
13
|
-
if (candidate.isTrivial()) {
|
14
|
-
candidate.inline();
|
15
|
-
continue;
|