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

Virtually Instructional

Virtually Instructional

Talk on BEAM (the Erlang virtual machine) internals presented at Elixir Conf 2015.

Video available at Confreaks: http://confreaks.tv/videos/elixirconf2015-virtually-instructional

Lennart Fridén

October 03, 2015
Tweet

More Decks by Lennart Fridén

Other Decks in Programming

Transcript

  1. Hello ElixirConf d e f m o d u l

    e V i r t u a l l y d o d e f i n s t r u c t i o n a l d o " H e l l o E l i x i r C o n f " e n d e n d
  2. BEAM file $ h e x d u m p

    - C E l i x i r . V i r t u a l l y . b e a m 0 0 0 0 0 0 0 0 4 6 4 f 5 2 3 1 0 0 0 0 0 4 d c 4 2 4 5 4 1 4 d 4 5 7 8 4 4 6 3 F O R 1 . . . . B E A M E x D c 0 0 0 0 0 0 9 0 4 1 7 4 6 f 6 d A t o m 0 0 0 0 0 0 a 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 8 1 0 4 5 6 c 6 9 7 8 6 9 7 2 2 e . . . ` . . . . . E l i x i r . 0 0 0 0 0 0 b 0 5 6 6 9 7 2 7 4 7 5 6 1 6 c 6 c 7 9 0 8 5 f 5 f 6 9 6 e 6 6 6 f V i r t u a l l y . _ _ i n f o 0 0 0 0 0 0 c 0 5 f 5 f 0 9 6 6 7 5 6 e 6 3 7 4 6 9 6 f 6 e 7 3 0 6 6 d 6 1 6 3 _ _ . f u n c t i o n s . m a c 0 0 0 0 0 0 d 0 7 2 6 f 7 3 0 6 6 5 7 2 6 c 6 1 6 e 6 7 0 f 6 7 6 5 7 4 5 f 6 d r o s . e r l a n g . g e t _ m 0 0 0 0 0 0 e 0 6 f 6 4 7 5 6 c 6 5 5 f 6 9 6 e 6 6 6 f 0 d 6 9 6 e 7 3 7 4 7 2 o d u l e _ i n f o . i n s t r 0 0 0 0 0 0 f 0 7 5 6 3 7 4 6 9 6 f 6 e 6 1 6 c 0 b 6 d 6 f 6 4 7 5 6 c 6 5 5 f u c t i o n a l . m o d u l e _ 0 0 0 0 0 1 0 0 6 9 6 e 6 6 6 f i n f o 0 0 0 0 0 1 0 0 4 3 6 f 6 4 6 5 0 0 0 0 0 0 7 b 0 0 0 0 0 0 1 0 C o d e . . . { . . . . 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 9 0 0 0 0 0 0 0 c 0 0 0 0 0 0 0 4 . . . . . . . . . . . . . . . . 0 0 0 0 0 1 2 0 0 1 1 0 9 9 0 0 0 2 1 2 2 2 1 0 0 1 2 0 3 0 5 5 0 3 3 b 0 3 5 5 . . . . . . " . . 0 U . ; . U 0 0 0 0 0 1 3 0 1 7 4 0 3 2 3 5 4 2 4 5 0 1 3 0 4 0 4 7 0 0 0 3 1 3 0 1 4 0 4 0 . @ 2 5 B E . 0 @ G . . . . @ @ 0 0 0 0 0 1 4 0 0 2 0 3 1 3 0 1 5 0 4 0 0 3 1 3 4 0 1 2 0 3 9 9 0 0 4 e 2 0 0 0 . . . . P @ . . @ . . . . N . 0 0 0 0 0 1 5 0 0 1 6 0 9 9 1 0 0 2 1 2 7 2 0 0 0 1 7 0 4 0 4 7 1 0 0 3 1 3 0 1 . ` . . . . r . . p @ G . . . . 0 0 0 0 0 1 6 0 8 0 9 9 0 0 0 2 1 2 8 2 0 0 0 1 9 0 4 0 1 2 0 3 9 9 0 0 4 e 1 0 . . . . . . . . . @ . . . . N . 0 0 0 0 0 1 7 0 1 0 0 1 a 0 9 9 0 0 0 2 1 2 8 2 1 0 0 1 b 0 4 0 0 3 1 3 4 0 1 2 . . . . . . . . . . . @ . . @ . 0 0 0 0 0 1 8 0 0 3 9 9 0 0 4 e 2 0 0 0 0 3 0 0 . . . N . . .
  3. Erlang assembly excerpt $ E R L _ C O

    M P I L E R _ O P T I O N S = " ' S ' " e l i x i r c v i r t u a l l y . e x { m o v e , { l i t e r a l , { i n s t r u c t i o n a l , [ { l i n e , 2 } ] , n i l } } , { x , 3 } } . { m o v e , { a t o m , d e f } , { x , 1 } } . { m o v e , { l i t e r a l , [ { d o , < < " H e l l o E l i x i r C o n f " > > } ] } , { x , 4 } } . { m o v e , { i n t e g e r , 2 } , { x , 0 } } . { l i n e , [ { l o c a t i o n , " v i r t u a l l y . e x " , 2 } ] } . { c a l l _ e x t , 6 , { e x t f u n c , e l i x i r _ d e f , s t o r e _ d e f i n i t i o n , 6 } } . { m o v e , { l i t e r a l , < < " 0 0 0 0 0 0 0 0 1 5 7 4 C C C 0 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i n s t r { x , 0 } } . { d e a l l o c a t e , 0 } . r e t u r n .
  4. Generic BEAM instructions h t t p s : /

    / g i t h u b . c o m / e r l a n g / o t p / b l o b / m a s t e r / l i b / c o m p i l e r / s r c / g e n o p . t a b 1 : l a b e l / 1 2 : f u n c _ i n f o / 3 3 : i n t _ c o d e _ e n d / 0 4 : c a l l / 2 5 : c a l l _ l a s t / 3 6 : c a l l _ o n l y / 2 . . . 6 4 : m o v e / 2 6 5 : g e t _ l i s t / 3 6 6 : g e t _ t u p l e _ e l e m e n t / 3 6 7 : s e t _ t u p l e _ e l e m e n t / 3 . . . 1 5 4 : p u t _ m a p _ a s s o c / 5 1 5 5 : p u t _ m a p _ e x a c t / 5 1 5 6 : i s _ m a p / 2 1 5 7 : h a s _ m a p _ f i e l d s / 3 1 5 8 : g e t _ m a p _ e l e m e n t s / 3
  5. Hello ElixirConf (disassembled) i e x ( 1 ) >

    : e r t s _ d e b u g . d f V i r t u a l l y ( m e m o r y a d d r e s s ) : ( i n s t r u c t i o n ) _ ( o p e r a n d t y p e s ) a r g 0 a r g 1 . . . 0 0 0 0 0 0 0 0 1 5 7 4 C C C 0 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i n s t r u c t i o n a l 0 0 0 0 0 0 0 0 0 1 5 7 4 C C E 8 : m o v e _ r e t u r n _ c r < < " H e l l o E l i x i r C o n f " > > x ( 0 )
  6. Register? A tiny sliver of memory built into a CPU.

    Tiny. But very, very fast to access.
  7. Let's pick apart some Java p u b l i

    c c l a s s S t a c k M a c h i n e { p u b l i c i n t d o u b l e S u m O f ( i n t a , i n t b ) { r e t u r n 2 * ( a + b ) ; } } $ j a v a c S t a c k M a c h i n e . j a v a $ j a v a p - c S t a c k M a c h i n e . c l a s s C o d e : 0 : i c o n s t _ 2 / / s t a c k = [ 2 ] 1 : i l o a d _ 1 / / s t a c k = [ a , 2 ] 2 : i l o a d _ 2 / / s t a c k = [ b , a , 2 ] 3 : i a d d / / s t a c k = [ ( a + b ) , 2 ] 4 : i m u l / / s t a c k = [ 2 * ( a + b ) ] 5 : i r e t u r n / / s t a c k = [ ]
  8. Stack-based vs register-based + Easier to implement + Simpler compilers

    + Simpler interpreters + More compact bytecode + Minimal CPU state – Potentially increased memory access – No virtual registers to map to real ones Trades performance for ease of implementation
  9. Code threading d e f d e c o d

    e ( i n s t r u c t i o n , x , y ) d o i f i n s t r u c t i o n = = : a d d d o x + y e l s e i f i n s t r u c t i o n = = : s u b t r a c t d o x - y e l s e i f i n s t r u c t i o n = = : d i v i d e d o x / y e l s e r a i s e " U n k n o w n i n s t r u c t i o n " e n d e n d e n d e n d d e f d e c o d e ( : a d d , x , y ) , d o : x + y d e f d e c o d e ( : s u b t r a c t , x , y ) , d o : x - y d e f d e c o d e ( : d i v i d e , x , y ) , d o : x / y
  10. Multiple clauses, guards, floats d e f i m p

    r a c t i c a l ( x ) w h e n i s _ i n t e g e r ( x ) , d o : x + 1 d e f i m p r a c t i c a l ( x ) w h e n i s _ f l o a t ( x ) , d o : x / 2 d e f i m p r a c t i c a l ( _ ) , d o : : b a t m a n
  11. Multiple clauses, guards, floats (disassembled) 0 0 0 0 0

    0 0 0 1 5 7 4 C B C 0 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i m p r a c t i c a l 1 0 0 0 0 0 0 0 0 1 5 7 4 C B E 8 : i s _ i n t e g e r _ f r f ( 0 0 0 0 0 0 0 0 1 5 7 4 C C 2 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C B F 8 : i _ i n c r e m e n t _ r I I d x ( 0 ) 1 1 x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 1 8 : r e t u r n 0 0 0 0 0 0 0 0 1 5 7 4 C C 2 0 : i s _ f l o a t _ f r f ( 0 0 0 0 0 0 0 0 1 5 7 4 C C B 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 3 0 : t e s t _ h e a p _ I t 2 1 0 0 0 0 0 0 0 0 1 5 7 4 C C 4 0 : f m o v e _ d l x ( 0 ) f r ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 5 8 : f m o v e _ q l 2 . 0 0 0 0 0 0 e + 0 0 f r ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 7 0 : i _ f d i v _ l l l f r ( 0 ) f r ( 1 ) f r ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 9 0 : f m o v e _ l d f r ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C A 8 : r e t u r n 0 0 0 0 0 0 0 0 1 5 7 4 C C B 0 : m o v e _ r e t u r n _ c r b a t m a n x ( 0 )
  12. Multiple clauses, guards, floats (disassembled) 0 0 0 0 0

    0 0 0 1 5 7 4 C B C 0 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i m p r a c t i c a l 1 0 0 0 0 0 0 0 0 1 5 7 4 C B E 8 : i s _ i n t e g e r _ f r f ( 0 0 0 0 0 0 0 0 1 5 7 4 C C 2 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C B F 8 : i _ i n c r e m e n t _ r I I d x ( 0 ) 1 1 x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 1 8 : r e t u r n 0 0 0 0 0 0 0 0 1 5 7 4 C C 2 0 : i s _ f l o a t _ f r f ( 0 0 0 0 0 0 0 0 1 5 7 4 C C B 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 3 0 : t e s t _ h e a p _ I t 2 1 0 0 0 0 0 0 0 0 1 5 7 4 C C 4 0 : f m o v e _ d l x ( 0 ) f r ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 5 8 : f m o v e _ q l 2 . 0 0 0 0 0 0 e + 0 0 f r ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 7 0 : i _ f d i v _ l l l f r ( 0 ) f r ( 1 ) f r ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C 9 0 : f m o v e _ l d f r ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C C A 8 : r e t u r n 0 0 0 0 0 0 0 0 1 5 7 4 C C B 0 : m o v e _ r e t u r n _ c r b a t m a n x ( 0 )
  13. BEAM registers Register Purpose In code R0 - R255 general

    purpose x(n) FR0 - FR15 floating-point operations fr(n) tmpA, tmpB temporary not visible stack slots local variables y(n)
  14. Parrot registers Register Purpose I native integer type N floating-point

    numbers S strings P PMC (Polymorphic Container)
  15. Function with receive block d e f i n c

    o m m u n i c a d o d o r e c e i v e d o { : p i n g , s e n d e r } - > s e n d s e n d e r , : p o n g _ - > : i g n o r e e n d i n c o m m u n i c a d o e n d
  16. Function with receive block (disassembled) 0 0 0 0 0

    0 0 0 1 A 9 C 1 4 6 8 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i n c o m m u n i c a d o 0 0 0 0 0 0 0 0 0 1 A 9 C 1 4 9 0 : a l l o c a t e _ t t 0 0 0 0 0 0 0 0 0 0 1 A 9 C 1 4 A 0 : i _ l o o p _ r e c _ f r f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 5 8 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 4 B 0 : i s _ t u p l e _ o f _ a r i t y _ f r A f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 0 ) x ( 0 ) 2 0 0 0 0 0 0 0 0 1 A 9 C 1 4 C 8 : e x t r a c t _ n e x t _ e l e m e n t 2 _ x x ( 1 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 4 D 8 : i _ i s _ e q _ e x a c t _ i m m e d _ f x c f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 0 ) x ( 1 ) p i n g 0 0 0 0 0 0 0 0 1 A 9 C 1 4 F 8 : r e m o v e _ m e s s a g e 0 0 0 0 0 0 0 0 1 A 9 C 1 5 0 0 : m o v e _ x 1 _ c p o n g 0 0 0 0 0 0 0 0 1 A 9 C 1 5 1 0 : m o v e _ x r x ( 2 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 2 0 : c a l l _ b i f _ e e r l a n g : s e n d / 2 0 0 0 0 0 0 0 0 1 A 9 C 1 5 3 0 : i _ i s _ l t _ s p e c _ f r r f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 6 8 ) x ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 0 : r e m o v e _ m e s s a g e 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 8 : i _ i s _ l t _ s p e c _ f r r f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 6 8 ) x ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 5 8 : w a i t _ f f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 4 A 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 6 8 : i _ c a l l _ l a s t _ f P ' E l i x i r . V i r t u a l l y ' : i n c o m m u n i c a d o / 0 0
  17. Function with receive block (disassembled) 0 0 0 0 0

    0 0 0 1 A 9 C 1 4 6 8 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i n c o m m u n i c a d o 0 0 0 0 0 0 0 0 0 1 A 9 C 1 4 9 0 : a l l o c a t e _ t t 0 0 0 0 0 0 0 0 0 0 1 A 9 C 1 4 A 0 : i _ l o o p _ r e c _ f r f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 5 8 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 4 B 0 : i s _ t u p l e _ o f _ a r i t y _ f r A f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 0 ) x ( 0 ) 2 0 0 0 0 0 0 0 0 1 A 9 C 1 4 C 8 : e x t r a c t _ n e x t _ e l e m e n t 2 _ x x ( 1 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 4 D 8 : i _ i s _ e q _ e x a c t _ i m m e d _ f x c f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 0 ) x ( 1 ) p i n g 0 0 0 0 0 0 0 0 1 A 9 C 1 4 F 8 : r e m o v e _ m e s s a g e 0 0 0 0 0 0 0 0 1 A 9 C 1 5 0 0 : m o v e _ x 1 _ c p o n g 0 0 0 0 0 0 0 0 1 A 9 C 1 5 1 0 : m o v e _ x r x ( 2 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 2 0 : c a l l _ b i f _ e e r l a n g : s e n d / 2 0 0 0 0 0 0 0 0 1 A 9 C 1 5 3 0 : i _ i s _ l t _ s p e c _ f r r f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 6 8 ) x ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 0 : r e m o v e _ m e s s a g e 0 0 0 0 0 0 0 0 1 A 9 C 1 5 4 8 : i _ i s _ l t _ s p e c _ f r r f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 5 6 8 ) x ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 5 8 : w a i t _ f f ( 0 0 0 0 0 0 0 0 1 A 9 C 1 4 A 0 ) 0 0 0 0 0 0 0 0 1 A 9 C 1 5 6 8 : i _ c a l l _ l a s t _ f P ' E l i x i r . V i r t u a l l y ' : i n c o m m u n i c a d o / 0 0
  18. VM Instructions BEAM message handling (send, remove message) type checks

    (is_integer, is_tuple) Parrot trigonemetrics (sin, cos, atan) (Dynamically loaded if requested) JVM multianewarray (allocate a multi-dimensional array)
  19. 3 lines of Elixir... d e f i n t

    r a c t a b l e ( { x , y } ) d o " T h e a f t e r p a r t y w i l l b e a t # { x } , # { y } . " e n d
  20. ...becomes 31 instructions... 0 0 0 0 0 0 0

    0 1 5 7 4 C E 1 0 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . V i r t u a l l y ' i n t r a c t a b l e 1 0 0 0 0 0 0 0 0 1 5 7 4 C E 3 8 : i s _ t u p l e _ o f _ a r i t y _ f r A f ( 0 0 0 0 0 0 0 0 1 5 7 4 C E 1 0 ) x ( 0 ) 2 0 0 0 0 0 0 0 0 1 5 7 4 C E 5 0 : a l l o c a t e _ z e r o _ t t 2 1 0 0 0 0 0 0 0 0 1 5 7 4 C E 6 0 : i _ g e t _ t u p l e _ e l e m e n t _ r P x x ( 0 ) 0 x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C E 7 8 : e x t r a c t _ n e x t _ e l e m e n t _ y y ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C E 8 8 : i s _ b i n a r y _ f x f ( 0 0 0 0 0 0 0 0 1 5 7 4 C E B 8 ) x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C E A 0 : m o v e _ j u m p _ f x f ( 0 0 0 0 0 0 0 0 1 5 7 4 C E D 8 ) x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C E B 8 : m o v e _ x r x ( 1 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C E C 8 : i _ c a l l _ e x t _ e ' E l i x i r . S t r i n g . C h a r s ' : t o _ s t r i n g / 1 0 0 0 0 0 0 0 0 1 5 7 4 C E D 8 : m o v e _ r y x ( 0 ) y ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C E E 8 : i s _ b i n a r y _ f y f ( 0 0 0 0 0 0 0 0 1 5 7 4 C F 1 8 ) y ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 0 0 : m o v e _ j u m p _ f y f ( 0 0 0 0 0 0 0 0 1 5 7 4 C F 4 8 ) y ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 1 8 : m o v e _ y r y ( 1 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 2 8 : i n i t _ y y ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 3 8 : i _ c a l l _ e x t _ e ' E l i x i r . S t r i n g . C h a r s ' : t o _ s t r i n g / 1 0 0 0 0 0 0 0 0 1 5 7 4 C F 4 8 : m o v e _ x 1 _ c 0 0 0 0 0 0 0 0 0 1 5 7 4 C F 5 8 : i _ g c _ b i f 1 _ j I s I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 3 4 8 9 2 9 2 7 1 x ( 0 ) 2 x ( 2 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 8 8 : i _ f e t c h _ x x x ( 1 ) x ( 2 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 9 8 : i _ b s _ a d d _ j I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 1 x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F B 8 : i _ g c _ b i f 1 _ j I s I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 3 4 8 9 2 9 2 7 1 y ( 0 ) 2 x ( 2 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F E 8 : i _ f e t c h _ x x x ( 1 ) x ( 2 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F F 8 : i _ b s _ a d d _ j I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 1 x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 D 0 1 8 : i _ f e t c h _ x c x ( 1 ) 2 9 0 0 0 0 0 0 0 0 1 5 7 4 D 0 3 0 : i _ b s _ a d d _ j I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 1 x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 D 0 5 0 : i _ b s _ i n i t _ f a i l _ x j I d x ( 1 ) j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 1 x ( 1 ) 0 0 0 0 0 0 0 0 1 5 7 4 D 0 7 8 : b s _ p u t _ s t r i n g _ I I 2 6 3 5 9 9 7 7 9 3 6 0 0 0 0 0 0 0 0 1 5 7 4 D 0 9 0 : i _ n e w _ b s _ p u t _ b i n a r y _ a l l _ j s I j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) y ( 0 ) 8 0 0 0 0 0 0 0 0 1 5 7 4 D 0 B 0 : b s _ p u t _ s t r i n g _ I I 2 3 5 9 9 7 7 9 6 2 0 0 0 0 0 0 0 0 1 5 7 4 D 0 C 8 : i _ n e w _ b s _ p u t _ b i n a r y _ a l l _ j s I j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) x ( 0 ) 8 0 0 0 0 0 0 0 0 1 5 7 4 D 0 E 8 : b s _ p u t _ s t r i n g _ I I 1 3 5 9 9 7 7 9 6 4 0 0 0 0 0 0 0 0 1 5 7 4 D 1 0 0 : m o v e _ d e a l l o c a t e _ r e t u r n _ x r Q x ( 1 ) x ( 0 ) 2
  21. ...and up to 4 function calls. 0 0 0 0

    0 0 0 0 1 5 7 4 C E 1 0 : 0 0 0 0 0 0 0 0 1 5 7 4 C E 3 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C E 5 0 : 0 0 0 0 0 0 0 0 1 5 7 4 C E 6 0 : 0 0 0 0 0 0 0 0 1 5 7 4 C E 7 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C E 8 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C E A 0 : 0 0 0 0 0 0 0 0 1 5 7 4 C E B 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C E C 8 : i _ c a l l _ e x t _ e ' E l i x i r . S t r i n g . C h a r s ' : t o _ s t r i n g / 1 0 0 0 0 0 0 0 0 1 5 7 4 C E D 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C E E 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F 0 0 : 0 0 0 0 0 0 0 0 1 5 7 4 C F 1 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F 2 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F 3 8 : i _ c a l l _ e x t _ e ' E l i x i r . S t r i n g . C h a r s ' : t o _ s t r i n g / 1 0 0 0 0 0 0 0 0 1 5 7 4 C F 4 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F 5 8 : i _ g c _ b i f 1 _ j I s I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 3 4 8 9 2 9 2 7 1 x ( 0 ) 2 x ( 2 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F 8 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F 9 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F B 8 : i _ g c _ b i f 1 _ j I s I d j ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) 3 4 8 9 2 9 2 7 1 y ( 0 ) 2 x ( 2 ) 0 0 0 0 0 0 0 0 1 5 7 4 C F E 8 : 0 0 0 0 0 0 0 0 1 5 7 4 C F F 8 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 1 8 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 3 0 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 5 0 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 7 8 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 9 0 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 B 0 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 C 8 : 0 0 0 0 0 0 0 0 1 5 7 4 D 0 E 8 : 0 0 0 0 0 0 0 0 1 5 7 4 D 1 0 0 :
  22. ...or Erlang 0 0 0 0 0 0 0 0

    1 6 1 A 5 9 7 0 : i _ f u n c _ i n f o _ I a a I 0 e r t s _ d e b u g s i z e 3 0 0 0 0 0 0 0 0 1 6 1 A 5 9 9 8 : i s _ n o n e m p t y _ l i s t _ a l l o c a t e _ f r I t f ( 0 0 0 0 0 0 0 0 1 6 1 A 5 B 0 0 ) x ( 0 ) 4 3 0 0 0 0 0 0 0 0 1 6 1 A 5 9 B 0 : g e t _ l i s t _ r y y x ( 0 ) y ( 3 ) y ( 2 ) 0 0 0 0 0 0 0 0 1 6 1 A 5 9 C 0 : m o v e 2 _ x y x y x ( 2 ) y ( 0 ) x ( 1 ) y ( 1 ) 0 0 0 0 0 0 0 0 1 6 1 A 5 9 D 0 : i _ c a l l _ f e r t s _ d e b u g : r e m e m b e r _ t e r m / 2 . . . . . . Disassemble some Elixir... 0 0 0 0 0 0 0 0 1 4 F C 0 C A 8 : i _ f u n c _ i n f o _ I a a I 0 ' E l i x i r . E n u m ' e a c h 2 0 0 0 0 0 0 0 0 1 4 F C 0 C D 0 : i s _ l i s t _ f r f ( 0 0 0 0 0 0 0 0 1 4 F C 0 D 1 8 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 4 F C 0 C E 0 : a l l o c a t e _ t t 0 2 0 0 0 0 0 0 0 0 1 4 F C 0 C F 0 : i _ c a l l _ f ' E l i x i r . E n u m ' : ' - e a c h / 2 - l i s t s ^ f o r e a c h / 1 - 0 - ' / 2 0 0 0 0 0 0 0 0 1 4 F C 0 D 0 0 : m o v e _ d e a l l o c a t e _ r e t u r n _ c r Q o k x ( 0 ) 0 0 0 0 0 0 0 0 0 1 4 F C 0 D 1 8 : a l l o c a t e _ t t 1 2 0 0 0 0 0 0 0 0 1 4 F C 0 D 2 8 : m o v e _ r y x ( 0 ) y ( 0 ) 0 0 0 0 0 0 0 0 1 4 F C 0 D 3 8 : m o v e _ x r x ( 1 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 4 F C 0 D 4 8 : i _ m a k e _ f u n _ I t 3 4 4 6 3 9 3 5 2 1 0 0 0 0 0 0 0 0 1 4 F C 0 D 6 0 : m o v e _ x 1 _ c n i l 0 0 0 0 0 0 0 0 1 4 F C 0 D 7 0 : m o v e _ r x x ( 0 ) x ( 2 ) 0 0 0 0 0 0 0 0 1 4 F C 0 D 8 0 : m o v e _ y r y ( 0 ) x ( 0 ) 0 0 0 0 0 0 0 0 1 4 F C 0 D 9 0 : i _ t r i m _ I 1 0 0 0 0 0 0 0 0 1 4 F C 0 D A 0 : i _ c a l l _ f ' E l i x i r . E n u m ' : r e d u c e / 3 0 0 0 0 0 0 0 0 1 4 F C 0 D B 0 : m o v e _ d e a l l o c a t e _ r e t u r n _ c r Q o k x ( 0 ) 0 Yes, disassemble the function that disassemble functions and study it.
  23. "Reasonable" assumptions 1. The Erlang/OTP team will be around forever.

    2. They will always be eager to work on things that matter to Elixir.
  24. A few possibilities Contribute to the core of Erlang/OTP. Ensure

    the BEAM's future by spreading the knowledge. Ensure Elixir's future by implementing alternative, compatible VM:s.
  25. You've been virtually instructed by Lennart Fridén | | codecoupled.org

    @DevLCSC github.com/DevL ElixirConf 2015, Austin, TX