Weitere ähnliche Inhalte
Ähnlich wie Polyglot on the JVM with Graal (English) (20)
Kürzlich hochgeladen (20)
Polyglot on the JVM with Graal (English)
- 15. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Truffle
• Together with the Graal compiler, Truffle interpreters are automatically
just-in-time compiled and programs running on top of them can reach
performance of normal Java.
• Provides the basic foundation for building abstract-syntax-tree (AST)
interpreters that perform self-optimizations at runtime
– The included TruffleDSL provides a convenient way to express such optimizations.
15
Framework for implementing languages as simple interpreters
- 61. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
x + y * z
+
x *
y z
load_local x
load_local y
load_local z
call *
call +
pushq %rbp
movq %rsp, %rbp
movq %rdi, -8(%rbp)
movq %rsi, -16(%rbp)
movq %rdx, -24(%rbp)
movq -16(%rbp), %rax
movl %eax, %edx
movq -24(%rbp), %rax
imull %edx, %eax
movq -8(%rbp), %rdx
addl %edx, %eax
popq %rbp
ret
61
- 62. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
U
U U
U
U
Node Rewriting
for Profiling Feedback
AST Interpreter
Uninitialized Nodes
Node Transitions
S
U
I
D
G
Uninitialized Integer
Generic
DoubleString
T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
and M. Wolczko. One VM to rule them all. In Proceedings of Onward!, 2013.
62
- 63. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
U
U U
U
U I
I I
G
G
Node Rewriting
for Profiling Feedback
AST Interpreter
Rewritten Nodes
AST Interpreter
Uninitialized Nodes
Node Transitions
S
U
I
D
G
Uninitialized Integer
Generic
DoubleString
T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
and M. Wolczko. One VM to rule them all. In Proceedings of Onward!, 2013.
63
- 64. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
I
I I
G
G I
I I
G
G
Rewriting
ng Feedback
AST Interpreter
Rewritten Nodes
Compilation using
Partial Evaluation
Compiled Code
I
D
Uninitialized Integer
Generic
Double
T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
and M. Wolczko. One VM to rule them all. In Proceedings of Onward!, 2013.
64
- 65. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
and M. Wolczko. One VM to rule them all. In Proceedings of Onward!, 2013.
I
I I
G
G I
I I
G
G
Deoptimization
to AST Interpreter
D
I
Node Rewriting to Update
Profiling Feedback
65
- 66. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon,
and M. Wolczko. One VM to rule them all. In Proceedings of Onward!, 2013.
I
I
G
G D
I D
G
G D
I D
G
G
Node Rewriting to Update
Profiling Feedback
Recompilation using
Partial Evaluation
66