Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How does TruffleRuby work

How does TruffleRuby work

2019/4/19に行われたRubyKaigi2019でのLT登壇資料です。
Truffleがどのような方針で最適化を行うかという話をしました。

Naoki Kishida

April 19, 2019
Tweet

More Decks by Naoki Kishida

Other Decks in Technology

Transcript

  1. • ( A 0 D • C A • H

    0 C G • A C 0 • 1 G D ) ( 1- ) 2 D
  2. • CA ( 22 2A , 2 , 2 2

    2 2 • .C A 2 + A C + 2 • + 2 2 • ( - 2A 2 2 • ( 22 + 2A 2 A C 2 2 • -C 2 2 A 2AA ) . 2 ( 22 • -C 2A 2 2 2 ( 22 .C A 2 +
  3. • - A • + / • A + •

    - - + - - • + @CoreMethod(names = "^", required = 1) public abstract static class BitXOrNode extends BignumCoreMethodNode { @Specialization public int bitXOr(int a, int b) { return a ^ b; } @Specialization public long bitXOr(long a, long b) { return a ^ b; } - - . / / - -
  4. • ( ( ( ( • ( + * (

    ( • ( + ( * ( * * ( ( + ( * + * () • ( ( def bar(num) a = 3 return num + a end def foo print bar(2) end def bar(num) return num + 3 end def foo print bar(2) end def foo print 2 + 3 end def foo print 5 end
  5. ) ( ( • 1 1 1 1! 1>1 -

    1 1 3- 3 1 • ( - - 1 3 • 1 3- 3 1 3 1 1 1 ! 3 1 • ( - - 1 3 • 1 3- 3 1 1 3- 3 1 ! 3 1 )1 1 - • ( - - 1 3 • 3 22 1
  6. • - : 2 A 2 • 1 E 2

    I/ A2 I • I 2 24: • A : : 2 : A • : : : A • 0 : / E A : : ./ A 2 2 2 : 4 A: : A : 2 2 : A 2 E def jump(self, space, bytecode, frame, cur_pc, target_pc): if target_pc < cur_pc: self.jitdriver.can_enter_jit( self=self, bytecode=bytecode, frame=frame, pc=target_pc, block_bytecode=self.get_block_bytecode(frame.block), w_trace_proc=space.getexecutioncontext().gettraceproc() ) return target_pc A2 : A A
  7. • • @CoreMethod(names = "^", required = 1) public abstract

    static class BitXOrNode extends BignumCoreMethodNode { @Specialization public int bitXOr(int a, int b) { return a ^ b; } @Specialization public long bitXOr(long a, long b) { return a ^ b; }
  8. • ( • > • )>- • )>- • )>-

    > • - > • > - • > • -> • ->