JRuby+Truffle. Why it s important to optimise the tricky parts. Chris Seaton Research Manager Oracle Labs 2 June 2016

Size: px
Start display at page:

Download "JRuby+Truffle. Why it s important to optimise the tricky parts. Chris Seaton Research Manager Oracle Labs 2 June 2016"

Transcription

1

2 The Ruby Logo is Copyright (c) 2006, Yukihiro Matsumoto. It is licensed under the terms of the Creative Commons Attribution-ShareAlike 2.5 agreement. JRuby+Truffle Why it s important to optimise the tricky parts Chris Seaton Research Manager Oracle Labs 2 June 2016 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

3 Safe Harbor Statement The following is intended to provide some insight into a line of research in Oracle Labs. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. Oracle reserves the right to alter its development plans and practices at any time, and the development, release, and timing of any features or functionality described in connection with any Oracle product or service remains at the sole discretion of Oracle. Any views expressed in this presentation are my own and do not necessarily reflect the views of Oracle. Copyright 2016, Oracle and/or its affiliates. All rights reserved.

4 Ruby Imperative Scripting (Perl) Object-oriented (Smalltalk) Batteries included Copyright 2016, Oracle and/or its affiliates. All rights reserved.

5 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

6 MRI Simple bytecode interpreter Implemented in C Core library implemented in C Copyright 2016, Oracle and/or its affiliates. All rights reserved.

7 The JRuby logo is copyright (c) Tony Price 2011, licensed under the terms of Creative Commons Attribution-NoDerivs 3.0 Unported (CC BY-ND 3.0) JRuby JITs by emitting JVM bytecode VM in Java Core library mostly in Java Copyright 2016, Oracle and/or its affiliates. All rights reserved.

8 The Rubinius logo is copyright 2011 Shane Becker, licensed under the terms of Creative Commons Attribution-NoDerivatives 4.0 International CC BY-ND 4.0 Rubinius JITs by emitting LLVM IR VM in C++ Core library mostly in Ruby Copyright 2016, Oracle and/or its affiliates. All rights reserved.

9 + Truffle and Graal Copyright 2016, Oracle and/or its affiliates. All rights reserved.

10 Lexer Parser Intermediate rep. Bytecode generator Core library Lexer Parser Lexer AST Core library Core library Lexer Parser Bytecode JIT Primitives Core library Copyright 2016, Oracle and/or its affiliates. All rights reserved.

11 100% language Compatibility with the (spec/ruby) Copyright 2016, Oracle and/or its affiliates. All rights reserved.

12 90% core Compatibility with the library (spec/ruby) Copyright 2016, Oracle and/or its affiliates. All rights reserved.

13 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

14 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

15 ? Why aren t you using more of JRuby? Such as the existing Java implementation of the core library? Copyright 2016, Oracle and/or its affiliates. All rights reserved.

16 What makes Ruby difficult to optimise? Copyright 2016, Oracle and/or its affiliates. All rights reserved.

17 How do people want to write Ruby? Copyright 2016, Oracle and/or its affiliates. All rights reserved.

18 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

19 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

20 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 20

21 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 21

22 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

23 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 23

24 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 24

25 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 25

26 Why can t a conventional VM optimise this? Why can t JRuby make this as fast as we want? Copyright 2016, Oracle and/or its affiliates. All rights reserved.

27 First problem: JRuby s core library is megamorphic Copyright 2016, Oracle and/or its affiliates. All rights reserved.

28 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

29 Second problem: JRuby s core library is stateless Copyright 2016, Oracle and/or its affiliates. All rights reserved.

30 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

31 Third problem: JRuby s core library is very deep Copyright 2016, Oracle and/or its affiliates. All rights reserved.

32 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

33 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

34 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

35 Fourth problem: JRuby s core library isn t amenable to optimisations Copyright 2016, Oracle and/or its affiliates. All rights reserved.

36 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

37 The same problems apply to Rubinius, even though the core library is mostly written in Ruby Copyright 2016, Oracle and/or its affiliates. All rights reserved.

38 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

39 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

40 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

41 Interlude: Truffle and Graal Copyright 2016, Oracle and/or its affiliates. All rights reserved.

42 Hotspot Copyright 2016, Oracle and/or its affiliates. All rights reserved.

43 Hotspot Copyright 2016, Oracle and/or its affiliates. All rights reserved.

44 Hotspot JIT Copyright 2016, Oracle and/or its affiliates. All rights reserved.

45 Hotspot JIT Copyright 2016, Oracle and/or its affiliates. All rights reserved.

46 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 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

47 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 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

48 JIT Hotspot JIT Copyright 2016, Oracle and/or its affiliates. All rights reserved.

49 Truffle JIT Hotspot JIT Copyright 2016, Oracle and/or its affiliates. All rights reserved.

50 U U U U U AST Interpreter Uninitialized Nodes 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

51 U Node Rewriting for Profiling Feedback U U Node Transitions U U U Uninitialized Integer I AST Interpreter Uninitialized Nodes S String G D Double Generic 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

52 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

53 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

54 G Compilation using Partial Evaluation G I G I G I I I I AST Interpreter Rewritten Nodes Compiled Code 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

55 codon.com/compilers-for-free Presentation, by Tom Stuart, licensed under a Creative Commons Attribution ShareAlike 3.0 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 55

56 U Node Rewriting for Profiling Feedback G Compilation using Partial Evaluation G U U Node Transitions I G I G U U U Uninitialized Integer I I I I I AST Interpreter Uninitialized Nodes S String G D Double Generic AST Interpreter Rewritten Nodes Compiled Code 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

57 Deoptimization to AST Interpreter G Node P G I G I G I I I I 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!, /06/2016 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

58 Node Rewriting to Update Profiling Feedback G Recompilation using Partial Evaluation G D G D G I D I D 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!, /06/2016 Copyright 2016, Oracle and/or its affiliates. All rights reserved. Oracle Confidential Internal/Restricted/Highly Restricted

59 Deoptimization to AST Interpreter G Node Rewriting to Update Profiling Feedback G Recompilation using Partial Evaluation G G I G I G D G D G I I I D I I I D 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!, /06/2016 Copyright 2016, Oracle and/or its affiliates. All rights reserved. Oracle Confidential Internal/Restricted/Highly Restricted

60 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 60

61 Frequently executed call Copyright 2016, Oracle and/or its affiliates. All rights reserved. 61

62 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 62

63 double BigInteger int Copyright 2016, Oracle and/or its affiliates. All rights reserved. 63

64 double BigInteger int Copyright 2016, Oracle and/or its affiliates. All rights reserved. 64

65 double BigInteger int Copyright 2016, Oracle and/or its affiliates. All rights reserved. 65

66 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 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

67 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 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

68 Will I be able to use Truffle and Graal for real? Copyright 2016, Oracle and/or its affiliates. All rights reserved.

69 JS R Ruby Truffle Java JVMCI (JVM Compiler Interface) Graal Hotspot C++ Copyright 2016, Oracle and/or its affiliates. All rights reserved.

70 JS R Ruby Truffle via Maven etc Graal Hotspot Java 9 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

71 otn graal 03/06/2016 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

72 How Truffle solves the problem of optimising Ruby Copyright 2016, Oracle and/or its affiliates. All rights reserved.

73 First problem: JRuby s core library is megamorphic Copyright 2016, Oracle and/or its affiliates. All rights reserved.

74 U Node Rewriting for Profiling Feedback G U U Node Transitions I G U U U Uninitialized Integer I I I AST Interpreter Uninitialized Nodes S String G D Double Generic AST Interpreter Rewritten Nodes 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

75 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

76 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

77 Second problem: JRuby s core library is stateless Copyright 2016, Oracle and/or its affiliates. All rights reserved.

78 G I G I I 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!, Copyright 2016, Oracle and/or its affiliates. All rights reserved.

79 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

80 send :bar send :foo Copyright 2016, Oracle and/or its affiliates. All rights reserved. 80

81 send :bar send :foo Copyright 2016, Oracle and/or its affiliates. All rights reserved. 81

82 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

83 Third problem: JRuby s core library is very deep Copyright 2016, Oracle and/or its affiliates. All rights reserved.

84 send :bar send :foo Copyright 2016, Oracle and/or its affiliates. All rights reserved. 84

85 Fourth problem: JRuby s core library isn t amenable to optimisations Copyright 2016, Oracle and/or its affiliates. All rights reserved.

86 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

87 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

88 A simple example Copyright 2016, Oracle and/or its affiliates. All rights reserved.

89 def min(a, b) [a, b].sort[0] end puts min(2, 8) Copyright 2016, Oracle and/or its affiliates. All rights reserved. 89

90 def min(a, b) [a, b].sort[0] end puts [2, 8].sort[0] Copyright 2016, Oracle and/or its affiliates. All rights reserved. 90

91 t0 = 2 <=> 8 t1 = t0 < 0? 2 : 8 t2 = t0 > 0? 8 : 2 t3 = [t1, t2] puts t3[0] Copyright 2016, Oracle and/or its affiliates. All rights reserved. 91

92 t0 = 2 <=> 8 t1 = t0 < 0? 2 : 8 t2 = t0 > 0? 8 : 2 t3 = [t1, t2] puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 92

93 t0 = -1 t1 = t0 < 0? 2 : 8 puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 93

94 t0 = -1 t1 = -1 < 0? 2 : 8 puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 94

95 t1 = true? 2 : 8 puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 95

96 t1 = 2 puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 96

97 t1 = 2 puts 2 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 97

98 puts 2 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 98

99 t0 = a <=> b t1 = t0 < 0? a : b puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 99

100 t0 = a <=> b t1 = (a <=> b) < 0? a : b puts t1 Copyright 2016, Oracle and/or its affiliates. All rights reserved. 100

101 t1 = (a <=> b) < 0? a : b puts (a <=> b) < 0? a : b Copyright 2016, Oracle and/or its affiliates. All rights reserved. 101

102 puts (a <=> b) < 0? a : b Copyright 2016, Oracle and/or its affiliates. All rights reserved. 102

103 A deliberately extreme example Copyright 2016, Oracle and/or its affiliates. All rights reserved.

104 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

105 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

106 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

107 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

108 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

109 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

110 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

111 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

112 Copyright 2016, Oracle and/or its affiliates. All rights reserved. = 22!

113 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

114 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

115 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

116 Node Copyright 2016, Oracle and/or its affiliates. All rights reserved.

117 Control flow Data flow Node Copyright 2016, Oracle and/or its affiliates. All rights reserved.

118 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

119 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

120 C extensions Copyright 2016, Oracle and/or its affiliates. All rights reserved.

121 C extensions are a hack to workaround performance, but now they stop us really fixing performance Copyright 2016, Oracle and/or its affiliates. All rights reserved.

122 A lot of this has been about removing barriers to the excellent optimisations we already have Copyright 2016, Oracle and/or its affiliates. All rights reserved.

123 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

124 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

125 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

126 cmyk_to_rgb psd_native_util_clamp FIX2INT Copyright 2016, Oracle and/or its affiliates. All rights reserved. 126

127 cmyk_to_rgb psd_native_util_clamp FIX2INT Copyright 2016, Oracle and/or its affiliates. All rights reserved. 127

128 35 C Extension Performance for psd_native and oily_png Average Speedup Relative to MRI Without C Extension (s/s) Matthias Grimmer, Chris Seaton, Thomas Wuerthinger, Hanspeter Moessenboeck: Dynamically Composing Languages in a Modular Way: Supporting C Extensions for Dynamic Languages Modularity '14 Proceedings of the 14th International Conference on Modularity Copyright 2016, Oracle and/or its affiliates. All rights reserved.

129 Conclusions Copyright 2016, Oracle and/or its affiliates. All rights reserved.

130 The blocker for performance of idiomatic Ruby code is the core library, not basic language features Copyright 2016, Oracle and/or its affiliates. All rights reserved.

131 This extends to everything that forms a barrier including C extensions Copyright 2016, Oracle and/or its affiliates. All rights reserved.

132 Specialisation, splitting, inlining, partial evaluation, inline caching are all solutions to this problem Copyright 2016, Oracle and/or its affiliates. All rights reserved.

133 Truffle makes it easy to add these to a language implementation Copyright 2016, Oracle and/or its affiliates. All rights reserved.

134 Can result in an order of magnitude performance increase with reasonable effort Copyright 2016, Oracle and/or its affiliates. All rights reserved.

135 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

136 Acknowledgements Benoit Daloze Kevin Menard Petr Chalupa Oracle Labs Danilo Ansaloni Stefan Anzinger Daniele Bonetta Matthias Brantner Laurent Daynès Gilles Duboscq Michael Haupt Christian Humer Mick Jordan Peter Kessler Hyunjin Lee David Leibs Tom Rodriguez Roland Schatz Chris Seaton Doug Simon Lukas Stadler Oracle Labs (continued) Michael Van de Vanter Adam Welc Till Westmann Christian Wimmer Christian Wirth Paul Wögerer Mario Wolczko Andreas Wöß Thomas Würthinger Oracle Labs Interns Shams Imam Stephen Kell Gero Leinemann Julian Lettner Gregor Richards Robert Seilbeck Rifat Shariyar Oracle Labs Alumni Erik Eckstein Christos Kotselidi JKU Linz Prof. Hanspeter Mössenböck Josef Eisl Thomas Feichtinger Matthias Grimmer Christian Häub Josef Haider Christian Hube David Leopoltsederr Manuel Rigger Stefan Rumzucker Bernhard Urban University of California, Irvine Prof. Michael Franz Codrut Stancu Gulfem Savrun Yeniceri Wei Zhang University of Edinburgh Christophe Dubach Juan José Fumero Alfonso Ranjeet Singh Toomas Remmelg T. U. Dortmund Prof. Peter Marwedel Helena Kotthaus Ingo Korb LaBRI Floréal Morandat Copyright 2016, Oracle and/or its affiliates. All rights reserved. Purdue University Prof. Jan Vitek Tomas Kalibera Romand Tsegelskyi Prahlad Joshi Petr Maj Lei Zhao University of California, Davis Prof. Duncan Temple Lang Nicholas Ulle 136

137 Safe Harbor Statement The preceding is intended to provide some insight into a line of research in Oracle Labs. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. Oracle reserves the right to alter its development plans and practices at any time, and the development, release, and timing of any features or functionality described in connection with any Oracle product or service remains at the sole discretion of Oracle. Any views expressed in this presentation are my own and do not necessarily reflect the views of Oracle. Copyright 2016, Oracle and/or its affiliates. All rights reserved.

138 Copyright 2016, Oracle and/or its affiliates. All rights reserved.

139

Faster Ruby and JS with Graal/Truffle

Faster Ruby and JS with Graal/Truffle The Ruby Logo is Copyright (c) 2006, Yukihiro Matsumoto. It is licensed under the terms of the Creative Commons Attribution-ShareAlike 2.5 agreement. Faster Ruby and JS with Graal/Truffle Chris Seaton

More information

Guilt Free Ruby on the JVM

Guilt Free Ruby on the JVM The Ruby logo is Copyright 2006, Yukihiro Matsumoto. It is licensed under the terms of the Creative Commons Attribution-ShareAlike 2.5 License agreement. Guilt Free Ruby on the JVM Forgetting Conventional

More information

R as a in a Polyglot World

R as a in a Polyglot World R as a Ci@zen in a Polyglot World The promise of the Truffle framework Lukas Stadler, VM Research Group, Oracle Labs user! 2015 2 Safe Harbor Statement The following is intended to provide some insight

More information

Using LLVM and Sulong for Language C Extensions

Using LLVM and Sulong for Language C Extensions Using LLVM and Sulong for Language C Extensions Chris Seaton Research Manager VM Research Group Oracle Labs Manuel Rigger, Matthias Grimmer JKU Linz Copyright 2016, Oracle and/or its affiliates. All rights

More information

What*Language* Would*You*Like*to*Run?*

What*Language* Would*You*Like*to*Run?* What*Language* Would*You*Like*to*Run?* Michael*Haupt* Oracle*Labs* March*2015* Safe*Harbor*Statement* The*following*is*intended*to*provide*some*insight*into*a*line*of*research*in*Oracle*Labs.*It* is*intended*for*informaoon*purposes*only,*and*may*not*be*incorporated*into*any*

More information

Dynamic Compilation with Truffle

Dynamic Compilation with Truffle Dynamic Compilation with Truffle Thomas Wuerthinger @thomaswue Oracle Labs Christian Humer @grashalm_ Oracle Labs DSLDI Summer School 2015 Copyright 2015 Oracle and/or its affiliates. All rights reserved.

More information

Understanding How Graal Works

Understanding How Graal Works Understanding How Graal Works a Java JIT Compiler Written in Java Chris Seaton Research Manager Oracle Labs chris.seaton@oracle.com @ChrisGSeaton Copyright 2017, Oracle and/or its affiliates. All rights

More information

JRuby+Truffle. Kevin Menard. Chris Seaton. Benoit Daloze. A tour through a new Ruby Oracle Oracle Labs

JRuby+Truffle. Kevin Menard. Chris Seaton. Benoit Daloze. A tour through a new Ruby Oracle Oracle Labs JRuby+Truffle A tour through a new Ruby implementahon Chris Seaton @ChrisGSeaton Oracle Labs Benoit Daloze @eregontp JKU Linz Kevin Menard @nirvdrum Oracle Labs Ruby logo copyright (c) 2006, Yukihiro Matsumoto,

More information

1 Copyright 2012, Oracle and/or its affiliates. All rights reserved.

1 Copyright 2012, Oracle and/or its affiliates. All rights reserved. 1 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Truffle: A Self-Optimizing Runtime System Thomas Wuerthinger Oracle Labs JVM Language Summit, July 31, 2012 2 Copyright 2012, Oracle

More information

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Copyright 2012, Oracle and/or its affiliates. All rights reserved. 1 Truffle: A Self-Optimizing Runtime System Christian Wimmer, Thomas Würthinger Oracle Labs Write Your Own Language Current situation How it should be Prototype a new language Parser and language work

More information

Copyright 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12!

Copyright 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12! Insert Information Protection Policy Classification from Slide 12!1 VMs I Have Known and/or Loved! A subjective history Mario Wolczko Architect Virtual Machine Research Group Oracle Labs! http://labs.oracle.com

More information

FastR: Status and Outlook

FastR: Status and Outlook FastR: Status and Outlook Michael Haupt Tech Lead, FastR Project Virtual Machine Research Group, Oracle Labs June 2014 Copyright 2014 Oracle and/or its affiliates. All rights reserved. CMYK 0/100/100/20

More information

CURRICULUM VITAE. DI Dr. Matthias Grimmer Michael-Hainisch-Straße Linz

CURRICULUM VITAE. DI Dr. Matthias Grimmer Michael-Hainisch-Straße Linz CURRICULUM VITAE Full Name Address Date of Birth Citizenship Phone Email Website GitHub DI Dr. Michael-Hainisch-Straße 18 4040 Linz March 2, 1989 Austria (+43) 664 784 21 52 contact@matthiasgrimmer.com

More information

Debugging at Full Speed

Debugging at Full Speed Oracle Labs Document 2014-0221 Debugging at Full Speed Instrumen)ng Truffle- implemented Programs Michael L. Van De Vanter Oracle Labs, VM Research Group July 30, 2014 2014 JVM Language Summit Santa Clara,

More information

<Insert Picture Here> Maxine: A JVM Written in Java

<Insert Picture Here> Maxine: A JVM Written in Java Maxine: A JVM Written in Java Michael Haupt Oracle Labs Potsdam, Germany The following is intended to outline our general product direction. It is intended for information purposes

More information

Copyright 2014 Oracle and/or its affiliates. All rights reserved.

Copyright 2014 Oracle and/or its affiliates. All rights reserved. Copyright 2014 Oracle and/or its affiliates. All rights reserved. On the Quest Towards Fastest (Java) Virtual Machine on the Planet! @JaroslavTulach Oracle Labs Copyright 2015 Oracle and/or its affiliates.

More information

Truffle A language implementation framework

Truffle A language implementation framework Truffle A language implementation framework Boris Spasojević Senior Researcher VM Research Group, Oracle Labs Slides based on previous talks given by Christian Wimmer, Christian Humer and Matthias Grimmer.

More information

Ruby. JRuby+Truffle and the to JITs. Chris Oracle Labs

Ruby. JRuby+Truffle and the to JITs. Chris Oracle Labs John Tenniel illustra@ons public domain in the UK and US Deop@mizing Ruby JRuby+Truffle and the an@dote to JITs Chris Seaton @ChrisGSeaton Oracle Labs Copyright 2014, Oracle and/or its affiliates. All

More information

One VM to Rule Them All

One VM to Rule Them All One VM to Rule Them All Christian Wimmer VM Research Group, Oracle Labs Safe Harbor Statement The following is intended to provide some insight into a line of research in Oracle Labs. It is intended for

More information

<Insert Picture Here>

<Insert Picture Here> 1 2010-0237 The Maxine Inspector: A Specialized Tool for VM Development, Santa Clara, CA Michael L. Van De Vanter Researcher, Oracle Sun Labs The Maxine Project at Oracle Sun Labs:

More information

Copyright 2014, Oracle and/or its affiliates. All rights reserved.

Copyright 2014, Oracle and/or its affiliates. All rights reserved. 1 One VM to Rule Them All Christian Wimmer VM Research Group, Oracle Labs The following is intended to provide some insight into a line of research in Oracle Labs. It is intended for information purposes

More information

Modern Stored Procedures Using GraalVM

Modern Stored Procedures Using GraalVM Modern Stored Procedures Using raalvm Oracle Labs Matthias Brantner Safe Harbor Statement The following is intended to outline our general product direction. t is intended

More information

<Insert Picture Here> Graal: A quest for the JVM to leverage its own J Doug Simon - Oracle Labs

<Insert Picture Here> Graal: A quest for the JVM to leverage its own J Doug Simon - Oracle Labs Graal: A quest for the JVM to leverage its own J Doug Simon - Oracle Labs JVM Language Summit, 30th July 2012 The following is intended to outline our general product direction. It

More information

Accelerating Interpreted Programming Languages on GPUs with Just-In-Time Compilation and Runtime Optimisations

Accelerating Interpreted Programming Languages on GPUs with Just-In-Time Compilation and Runtime Optimisations This thesis has been submitted in fulfilment of the requirements for a postgraduate degree (e.g. PhD, MPhil, DClinPsychol) at the University of Edinburgh. Please note the following terms and conditions

More information

SPECIALISING DYNAMIC TECHNIQUES FOR IMPLEMENTING THE RUBY PROGRAMMING LANGUAGE

SPECIALISING DYNAMIC TECHNIQUES FOR IMPLEMENTING THE RUBY PROGRAMMING LANGUAGE SPECIALISING DYNAMIC TECHNIQUES FOR IMPLEMENTING THE RUBY PROGRAMMING LANGUAGE A thesis submitted to the University of Manchester for the degree of Doctor of Philosophy in the Faculty of Engineering and

More information

A Fast Abstract Syntax Tree Interpreter for R

A Fast Abstract Syntax Tree Interpreter for R A Fast Abstract Syntax Tree Interpreter for R Java cup Petr Maj Jan Vitek Tomas Kalibera Floréal Morandat Thesis Runtime information can be leveraged to create simple, fast, easy to maintain interpreters

More information

Machine Program: Procedure. Zhaoguo Wang

Machine Program: Procedure. Zhaoguo Wang Machine Program: Procedure Zhaoguo Wang Requirements of procedure calls? P() { y = Q(x); y++; 1. Passing control int Q(int i) { int t, z; return z; Requirements of procedure calls? P() { y = Q(x); y++;

More information

How Software Executes

How Software Executes How Software Executes CS-576 Systems Security Instructor: Georgios Portokalidis Overview Introduction Anatomy of a program Basic assembly Anatomy of function calls (and returns) Memory Safety Programming

More information

Oracle R Technologies

Oracle R Technologies Oracle R Technologies R for the Enterprise Mark Hornick, Director, Oracle Advanced Analytics @MarkHornick mark.hornick@oracle.com Safe Harbor Statement The following is intended to outline our general

More information

One VM to Rule Them All

One VM to Rule Them All One VM to Rule Them All Christian Wimmer VM Research Group, Oracle Labs Safe Harbor Statement The following is intended to provide some insight into a line of research in Oracle Labs. It is intended for

More information

Self-Optimizing AST Interpreters

Self-Optimizing AST Interpreters Self-Optimizing AST Interpreters Thomas Würthinger Andreas Wöß Lukas Stadler Gilles Duboscq Doug Simon Christian Wimmer Oracle Labs Institute for System Software, Johannes Kepler University Linz, Austria

More information

Princeton University Computer Science 217: Introduction to Programming Systems. Assembly Language: Function Calls

Princeton University Computer Science 217: Introduction to Programming Systems. Assembly Language: Function Calls Princeton University Computer Science 217: Introduction to Programming Systems Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems x86-64 solutions Pertinent

More information

Java and C II. CSE 351 Spring Instructor: Ruth Anderson

Java and C II. CSE 351 Spring Instructor: Ruth Anderson Java and C II CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Lab 5 Due TONIGHT! Fri 6/2

More information

Credits and Disclaimers

Credits and Disclaimers Credits and Disclaimers 1 The examples and discussion in the following slides have been adapted from a variety of sources, including: Chapter 3 of Computer Systems 3 nd Edition by Bryant and O'Hallaron

More information

Machine-level Programs Procedure

Machine-level Programs Procedure Computer Systems Machine-level Programs Procedure Han, Hwansoo Mechanisms in Procedures Passing control To beginning of procedure code Back to return point Passing data Procedure arguments Return value

More information

A Cost Model for a Graph-Based Intermediate-Representation in a Dynamic Compiler

A Cost Model for a Graph-Based Intermediate-Representation in a Dynamic Compiler A Cost Model for a Graph-Based Intermediate-Representation in a Dynamic Compiler David Leopoldseder Johannes Kepler University Linz Austria david.leopoldseder@jku.at Lukas Stadler Oracle Labs Linz, Austria

More information

Practical Partial Evaluation for High-Performance Dynamic Language Runtimes

Practical Partial Evaluation for High-Performance Dynamic Language Runtimes Practical Partial Evaluation for High-Performance Dynamic Language Runtimes Thomas Würthinger Christian Wimmer Christian Humer Andreas Wöß Lukas Stadler Chris Seaton Gilles Duboscq Doug Simon Matthias

More information

Just-In-Time GPU Compilation for Interpreted Languages with Partial Evaluation

Just-In-Time GPU Compilation for Interpreted Languages with Partial Evaluation Just-In-Time GPU Compilation for Interpreted Languages with Partial Evaluation Juan Fumero Michel Steuwer Lukas Stadler Christophe Dubach The University of Edinburgh, Oracle Labs, AT juan.fumero@ed.ac.uk

More information

The C2 Register Allocator. Niclas Adlertz

The C2 Register Allocator. Niclas Adlertz The C2 Register Allocator Niclas Adlertz 1 1 Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated

More information

JVM Continuations. Lukas Stadler. Johannes Kepler University Linz, Austria

JVM Continuations. Lukas Stadler. Johannes Kepler University Linz, Austria JVM Continuations Lukas Stadler Johannes Kepler University Linz, Austria Agenda Continuations Uses for continuations Common implementation techniques Our lazy approach Implementation Summary Continuations

More information

SYSTEMS PROGRAMMING AND COMPUTER ARCHITECTURE Assignment 5: Assembly and C

SYSTEMS PROGRAMMING AND COMPUTER ARCHITECTURE Assignment 5: Assembly and C Fall Term 2016 SYSTEMS PROGRAMMING AND COMPUTER ARCHITECTURE Assignment 5: Assembly and C Assigned on: 20th Oct 2016 Due by: 27th Oct 2016 Pen & Paper exercise Assembly Code Fragments Consider the following

More information

Zero-Overhead Metaprogramming

Zero-Overhead Metaprogramming Zero-Overhead Metaprogramming Reflection and Metaobject Protocols Fast and without Compromises * PLDI * Artifact Consistent * Complete * Well Documented * Easy to Reuse * Evaluated * AEC * Stefan Marr

More information

Tracing vs. Partial Evaluation

Tracing vs. Partial Evaluation Tracing vs. Partial Evaluation Comparing Meta-Compilation Approaches for Self-Optimizing nterpreters Abstract Tracing and partial evaluation have been proposed as metacompilation techniques for interpreters.

More information

EXAMINATIONS 2014 TRIMESTER 1 SWEN 430. Compiler Engineering. This examination will be marked out of 180 marks.

EXAMINATIONS 2014 TRIMESTER 1 SWEN 430. Compiler Engineering. This examination will be marked out of 180 marks. T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON EXAMINATIONS 2014 TRIMESTER 1 SWEN 430 Compiler Engineering Time Allowed: THREE HOURS Instructions:

More information

Safe Harbor Statement

Safe Harbor Statement Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment

More information

Machine/Assembler Language Putting It All Together

Machine/Assembler Language Putting It All Together COMP 40: Machine Structure and Assembly Language Programming Fall 2015 Machine/Assembler Language Putting It All Together Noah Mendelsohn Tufts University Email: noah@cs.tufts.edu Web: http://www.cs.tufts.edu/~noah

More information

Machine-Level Programming III: Procedures

Machine-Level Programming III: Procedures Machine-Level Programming III: Procedures CSE 238/2038/2138: Systems Programming Instructor: Fatma CORUT ERGİN Slides adapted from Bryant & O Hallaron s slides Mechanisms in Procedures Passing control

More information

Assembly Language: Function Calls

Assembly Language: Function Calls Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems x86-64 solutions Pertinent instructions and conventions 2 Function Call Problems (1) Calling and returning

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: February 28, 2018 at 06:32 CS429 Slideset 9: 1 Mechanisms in Procedures

More information

FTL WebKit s LLVM based JIT

FTL WebKit s LLVM based JIT FTL WebKit s LLVM based JIT Andrew Trick, Apple Juergen Ributzka, Apple LLVM Developers Meeting 2014 San Jose, CA WebKit JS Execution Tiers OSR Entry LLInt Baseline JIT DFG FTL Interpret bytecode Profiling

More information

Are We There Yet? Simple Language-Implementation Techniques for the 21st Century

Are We There Yet? Simple Language-Implementation Techniques for the 21st Century Are We There Yet? Simple Language-Implementation Techniques for the 21st Century Stefan Marr, Tobias Pape, Wolfgang De Meuter To cite this version: Stefan Marr, Tobias Pape, Wolfgang De Meuter. Are We

More information

What is concurrency? Concurrency. What is parallelism? concurrency vs parallelism. Concurrency: (the illusion of) happening at the same time.

What is concurrency? Concurrency. What is parallelism? concurrency vs parallelism. Concurrency: (the illusion of) happening at the same time. What is concurrency? Concurrency Johan Montelius KTH 2017 Concurrency: (the illusion of) happening at the same time. A property of the programing model. Why would we want to do things concurrently? What

More information

Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon

Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon Carnegie Mellon Machine-Level Programming III: Procedures 15-213/18-213/14-513/15-513: Introduction to Computer Systems 7 th Lecture, September 18, 2018 Today Procedures Mechanisms Stack Structure Calling

More information

Arrays. CSE 351 Autumn Instructor: Justin Hsia

Arrays. CSE 351 Autumn Instructor: Justin Hsia rrays CSE 351 utumn 2017 Instructor: Justin Hsia Teaching ssistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/1270/ dministrivia

More information

Machine Programming 3: Procedures

Machine Programming 3: Procedures Machine Programming 3: Procedures CS61, Lecture 5 Prof. Stephen Chong September 15, 2011 Announcements Assignment 2 (Binary bomb) due next week If you haven t yet please create a VM to make sure the infrastructure

More information

Trace Compilation. Christian Wimmer September 2009

Trace Compilation. Christian Wimmer  September 2009 Trace Compilation Christian Wimmer cwimmer@uci.edu www.christianwimmer.at September 2009 Department of Computer Science University of California, Irvine Background Institute for System Software Johannes

More information

The Stack & Procedures

The Stack & Procedures The Stack & Procedures CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/648/

More information

Ahead of Time (AOT) Compilation

Ahead of Time (AOT) Compilation Ahead of Time (AOT) Compilation Vaibhav Choudhary (@vaibhav_c) Java Platforms Team https://blogs.oracle.com/vaibhav Copyright 2018, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement

More information

6.1. CS356 Unit 6. x86 Procedures Basic Stack Frames

6.1. CS356 Unit 6. x86 Procedures Basic Stack Frames 6.1 CS356 Unit 6 x86 Procedures Basic Stack Frames 6.2 Review of Program Counter (Instruc. Pointer) PC/IP is used to fetch an instruction PC/IP contains the address of the next instruction The value in

More information

The Stack & Procedures

The Stack & Procedures The Stack & Procedures CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Homework 2 due

More information

Function Calls and Stack

Function Calls and Stack Function Calls and Stack Philipp Koehn 16 April 2018 1 functions Another Example 2 C code with an undefined function int main(void) { int a = 2; int b = do_something(a); urn b; } This can be successfully

More information

6.035 Project 3: Unoptimized Code Generation. Jason Ansel MIT - CSAIL

6.035 Project 3: Unoptimized Code Generation. Jason Ansel MIT - CSAIL 6.035 Project 3: Unoptimized Code Generation Jason Ansel MIT - CSAIL Quiz Monday 50 minute quiz Monday Covers everything up to yesterdays lecture Lexical Analysis (REs, DFAs, NFAs) Syntax Analysis (CFGs,

More information

How Software Executes

How Software Executes How Software Executes CS-576 Systems Security Instructor: Georgios Portokalidis Overview Introduction Anatomy of a program Basic assembly Anatomy of function calls (and returns) Memory Safety Programming

More information

Efficient Layered Method Execution in ContextAmber

Efficient Layered Method Execution in ContextAmber Efficient Layered Method Execution in ContextAmber Matthias Springer Hasso Plattner Institute University of Potsdam matthias.springer@hpi.de Jens Lincke Hasso Plattner Institute University of Potsdam jens.lincke@hpi.de

More information

1. A student is testing an implementation of a C function; when compiled with gcc, the following x86-64 assembly code is produced:

1. A student is testing an implementation of a C function; when compiled with gcc, the following x86-64 assembly code is produced: This assignment refers to concepts discussed in sections 2.1.1 2.1.3, 2.1.8, 2.2.1 2.2.6, 3.2, 3.4, and 3.7.1of csapp; see that material for discussions of x86 assembly language and its relationship to

More information

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 1 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 Towards JVM Dynamic Languages Toolchain Insert Picture Here Attila

More information

Credits and Disclaimers

Credits and Disclaimers Credits and Disclaimers 1 The examples and discussion in the following slides have been adapted from a variety of sources, including: Chapter 3 of Computer Systems 3 nd Edition by Bryant and O'Hallaron

More information

Safe Harbor Statement

Safe Harbor Statement Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment

More information

Optimizing Communicating Event-Loop Languages with Truffle

Optimizing Communicating Event-Loop Languages with Truffle Optimizing Communicating Event-Loop Languages with Truffle [Work In Progress Paper] Stefan Marr Johannes Kepler University Linz, Austria stefan.marr@jku.at ABSTRACT Communicating Event-Loop Languages similar

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp

More information

Arrays. CSE 351 Autumn Instructor: Justin Hsia

Arrays. CSE 351 Autumn Instructor: Justin Hsia rrays CSE 351 utumn 2016 Instructor: Justin Hsia Teaching ssistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/1513/

More information

Compilers and computer architecture: introduction

Compilers and computer architecture: introduction 1 / 41 Compilers and computer architecture: introduction Martin Berger September 2018 2 / 41 Administrative matters: lecturer Name: Martin Berger Email: M.F.Berger@sussex.ac.uk Web: http://users.sussex.ac.uk/~mfb21/compilers

More information

Generation. representation to the machine

Generation. representation to the machine Unoptimized i Code Generation From the intermediate representation to the machine code 5 Outline Introduction Machine Language Overview of a modern processor Memory Layout Procedure Abstraction Procedure

More information

1 Number Representation(10 points)

1 Number Representation(10 points) Name: Sp15 Midterm Q1 1 Number Representation(10 points) 1 NUMBER REPRESENTATION(10 POINTS) Let x=0xe and y=0x7 be integers stored on a machine with a word size of 4bits. Show your work with the following

More information

Compiler Design Spring 2017

Compiler Design Spring 2017 Compiler Design Spring 2017 6.0 Runtime system and object layout Dr. Zoltán Majó Compiler Group Java HotSpot Virtual Machine Oracle Corporation 1 Runtime system Some open issues from last time Handling

More information

Concurrency. Johan Montelius KTH

Concurrency. Johan Montelius KTH Concurrency Johan Montelius KTH 2017 1 / 32 What is concurrency? 2 / 32 What is concurrency? Concurrency: (the illusion of) happening at the same time. 2 / 32 What is concurrency? Concurrency: (the illusion

More information

C++ Named Return Value Optimization

C++ Named Return Value Optimization C++ Named Return Value Optimization post. Robert.Schneider@hotmail.de meetup.com/c-user-group-karlsruhe auto create() -> T { T castor /* initialize */; //... return castor; } void use() { T pollux = create();

More information

Substrate VM. Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Substrate VM. Copyright 2017, Oracle and/or its affiliates. All rights reserved. Substrate VM 1 Safe Harbor Statement The following is intended to provide some insight into a line of research in Oracle Labs. It is intended for information purposes only, and may not be incorporated

More information

The von Neumann Machine

The von Neumann Machine The von Neumann Machine 1 1945: John von Neumann Wrote a report on the stored program concept, known as the First Draft of a Report on EDVAC also Alan Turing Konrad Zuse Eckert & Mauchly The basic structure

More information

Chapter 2 A Quick Tour

Chapter 2 A Quick Tour Chapter 2 A Quick Tour 2.1 The Compiler Toolchain A compiler is one component in a toolchain of programs used to create executables from source code. Typically, when you invoke a single command to compile

More information

University of Washington

University of Washington Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq %rbp movq %rsp, %rbp... popq %rbp

More information

How Software Executes

How Software Executes How Software Executes CS-576 Systems Security Instructor: Georgios Portokalidis Overview Introduction Anatomy of a program Basic assembly Anatomy of function calls (and returns) Memory Safety Intel x86

More information

x86-64 Programming III & The Stack

x86-64 Programming III & The Stack x86-64 Programming III & The Stack CSE 351 Winter 2018 Instructor: Mark Wyse Teaching Assistants: Kevin Bi Parker DeWilde Emily Furst Sarah House Waylon Huang Vinny Palaniappan http://xkcd.com/1652/ Administrative

More information

Mechanisms in Procedures. CS429: Computer Organization and Architecture. x86-64 Stack. x86-64 Stack Pushing

Mechanisms in Procedures. CS429: Computer Organization and Architecture. x86-64 Stack. x86-64 Stack Pushing CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: February 28, 2018 at 06:32 Mechanisms in Procedures Passing Control

More information

Procedures and the Call Stack

Procedures and the Call Stack Procedures and the Call Stack Topics Procedures Call stack Procedure/stack instructions Calling conventions Register-saving conventions Why Procedures? Why functions? Why methods? int contains_char(char*

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp

More information

x86 Programming I CSE 351 Winter

x86 Programming I CSE 351 Winter x86 Programming I CSE 351 Winter 2017 http://xkcd.com/409/ Administrivia Lab 2 released! Da bomb! Go to section! No Luis OH Later this week 2 Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals

More information

Stack Frame Components. Using the Stack (4) Stack Structure. Updated Stack Structure. Caller Frame Arguments 7+ Return Addr Old %rbp

Stack Frame Components. Using the Stack (4) Stack Structure. Updated Stack Structure. Caller Frame Arguments 7+ Return Addr Old %rbp Stack Frame Components Frame pointer %rbp Stack pointer Caller Frame rguments 7+ Return ddr Old %rbp Saved Registers + Local Variables rgument Build 1 Using the Stack (4) Stack Structure long call_incr()

More information

Lecture 1: Introduction

Lecture 1: Introduction Lecture 1: Introduction Staff Lecturer Prof. Michael Carbin mcarbin@mit.edu 253-5881 32-G782 Prof. Martin Rinard rinard@mit.edu 258-6922 32-G828 Rooms MWF 3-370 TH 4-149 Course Secretary Cree Bruins cbruins@csail.mit.edu

More information

Structs and Alignment CSE 351 Spring

Structs and Alignment CSE 351 Spring Structs and Alignment CSE 351 Spring 2018 http://xkcd.com/1168/ Administrivia Homework 3 due Wednesday Lab 3 released, due next week Lab 2 and midterm will be graded this week [in that order] 2 Roadmap

More information

%r8 %r8d. %r9 %r9d. %r10 %r10d. %r11 %r11d. %r12 %r12d. %r13 %r13d. %r14 %r14d %rbp. %r15 %r15d. Sean Barker

%r8 %r8d. %r9 %r9d. %r10 %r10d. %r11 %r11d. %r12 %r12d. %r13 %r13d. %r14 %r14d %rbp. %r15 %r15d. Sean Barker Procedure Call Registers Return %rax %eax %r8 %r8d Arg 5 %rbx %ebx %r9 %r9d Arg 6 Arg 4 %rcx %ecx %r10 %r10d Arg 3 %rdx %edx %r11 %r11d Arg 2 %rsi %esi %r12 %r12d Arg 1 %rdi %edi %r13 %r13d ptr %esp %r14

More information

ECE 2400 / ENGRD 2140 Computer Systems Programming Course Overview

ECE 2400 / ENGRD 2140 Computer Systems Programming Course Overview ECE 2400 / ENGRD 2140 Computer Systems Programming Course Overview Christopher Batten School of Electrical and Computer Engineering Cornell University http://www.csl.cornell.edu/courses/ece2400 What is

More information

Efficient and Thread-Safe Objects for Dynamically-Typed Languages

Efficient and Thread-Safe Objects for Dynamically-Typed Languages *Evaluated*OOPSLA*Artifact*AEC Efficient and Thread-Safe Objects for Dynamically-Typed Languages toreuse* Consistent*Complete*WellDocumented*Easy Benoit Daloze Johannes Kepler University Linz, Austria

More information

Registers. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth

Registers. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth Registers Ray Seyfarth September 8, 2011 Outline 1 Register basics 2 Moving a constant into a register 3 Moving a value from memory into a register 4 Moving values from a register into memory 5 Moving

More information

UC Irvine UC Irvine Electronic Theses and Dissertations

UC Irvine UC Irvine Electronic Theses and Dissertations UC Irvine UC Irvine Electronic Theses and Dissertations Title Safe and Efficient Hybrid Memory Management for Java Permalink https://escholarship.org/uc/item/2kv6w8m4 Author Stancu, Liviu Codrut Publication

More information

Fusion Product Hub Training Data Governance: Business Rules and Impact Analysis. July 2014

Fusion Product Hub Training Data Governance: Business Rules and Impact Analysis. July 2014 Fusion Product Hub Training Data Governance: Business Rules and Impact Analysis July 2014 Copyright 2014 Oracle and/or its affiliates. All rights reserved. Oracle Confidential Internal/Restricted/Highly

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 7

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 7 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2017 Lecture 7 LAST TIME Dynamic memory allocation and the heap: A run-time facility that satisfies multiple needs: Programs can use widely varying, possibly

More information

Binghamton University. CS-220 Spring X86 Debug. Computer Systems Section 3.11

Binghamton University. CS-220 Spring X86 Debug. Computer Systems Section 3.11 X86 Debug Computer Systems Section 3.11 GDB is a Source Level debugger We have learned how to debug at the C level But the machine is executing X86 object code! How does GDB play the shell game? Makes

More information

Machine-Level Programming (2)

Machine-Level Programming (2) Machine-Level Programming (2) Yanqiao ZHU Introduction to Computer Systems Project Future (Fall 2017) Google Camp, Tongji University Outline Control Condition Codes Conditional Branches and Conditional

More information

Exploiting High-Performance Heterogeneous Hardware for Java Programs using Graal

Exploiting High-Performance Heterogeneous Hardware for Java Programs using Graal Exploiting High-Performance Heterogeneous Hardware for Java Programs using Graal James Clarkson ±, Juan Fumero, Michalis Papadimitriou, Foivos S. Zakkak, Christos Kotselidis and Mikel Luján ± Dyson, The

More information