Virtual Machines: Down the Rabbit Hole

Virtual Machines: Down the Rabbit Hole

Talk given at the Ruby User Group meeting in Berlin.

3db71281264f6125e764d9f3788301e0?s=128

Josep M. Bach (Txus)

June 06, 2013
Tweet

Transcript

  1. Virtual Machines DOWN THE RABBIT HOLE Ruby USER GROUP BERLIN

    6. JUNE 2013
  2. TXUSTICE

  3. None
  4. POLITICAL SCIENCE DROPOUT

  5. DON'T TRUST A WORDI SAY

  6. BARCELONA / BERLIN =>

  7. PROCESS VIRTUAL MACHINES

  8. WHY oh why

  9. WHY oh why Portability

  10. WHY oh why Portability PERFORMANCE

  11. WHY oh why PELICAN

  12. wat

  13. SOURCE CODE puts "hello world"

  14. SOURCE CODE puts "hello world" AST send self puts hello

    world
  15. SOURCE CODE puts "hello world" AST send self puts hello

    world BYTECODE PUSH_SELF PUSH "puts" PUSH "hello world" CALL 1
  16. COMPALER

  17. COMPILER

  18. BUT HOW DOES A VM LOOK LIKE?

  19. HUGE-ASS CASE STATEMENT

  20. STACK PUSH 2 PUSH 3 ADD PROGRAM IP 2 *

    3
  21. 2 STACK PUSH 2 PUSH 3 ADD PROGRAM IP 2

    * 3
  22. 3 2 STACK PUSH 2 PUSH 3 ADD PROGRAM IP

    2 * 3
  23. 5 STACK PUSH 2 PUSH 3 ADD PROGRAM IP 2

    * 3
  24. STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LIT 2 CALL 2

    PROGRAM IP puts "hello world", 42 "puts" "hello world" 42 LITERALS
  25. <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LIT 2 CALL

    2 PROGRAM IP puts "hello world", 42 "puts" "hello world" 42 LITERALS
  26. "puts" <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LIT 2

    CALL 2 PROGRAM IP puts "hello world", 42 "puts" "hello world" 42 LITERALS
  27. BABY DUCK

  28. "hello world" "puts" <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1

    PUSH_LIT 2 CALL 2 PROGRAM IP puts "hello world", 42 "puts" "hello world" 42 LITERALS
  29. 42 "hello world" "puts" <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT

    1 PUSH_LIT 2 CALL 2 PROGRAM IP puts "hello world", 42 "puts" "hello world" 42 LITERALS
  30. nil STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LIT 2 CALL

    2 PROGRAM IP puts "hello world", 42 "puts" "hello world" 42 LITERALS
  31. IT PRINTED "HELLO WORLD" HEH

  32. EVER SEEN A FUNCTION? def greet(name) puts "Hello, ", name

    end
  33. STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LOCAL 0 CALL 2

    PROGRAM IP def greet(name) puts "Hello, ", name end "puts" "Hello, " LITERALS name: "John" LOCALS
  34. <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LOCAL 0 CALL

    2 PROGRAM IP def greet(name) puts "Hello, ", name end "puts" "Hello, " LITERALS name: "John" LOCALS
  35. "puts" <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LOCAL 0

    CALL 2 PROGRAM IP def greet(name) puts "Hello, ", name end "puts" "Hello, " LITERALS name: "John" LOCALS
  36. "Hello, " "puts" <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1

    PUSH_LOCAL 0 CALL 2 PROGRAM IP def greet(name) puts "Hello, ", name end "puts" "Hello, " LITERALS name: "John" LOCALS
  37. "John" "Hello, " "puts" <SELF> STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT

    1 PUSH_LOCAL 0 CALL 2 PROGRAM IP def greet(name) puts "Hello, ", name end "puts" "Hello, " LITERALS name: "John" LOCALS
  38. nil STACK PUSH_SELF PUSH_LIT 0 PUSH_LIT 1 PUSH_LOCAL 0 CALL

    2 PROGRAM IP def greet(name) puts "Hello, ", name end "puts" "Hello, " LITERALS name: "John" LOCALS
  39. GARBAGE COLLECTION

  40. THE ALLOCATOR

  41. WHAT'S THE OPPOSITE OF AN ALLIGATOR?

  42. REFERENCE COUNTING object.refcount++ WHEN WE PUSH AN OBJECT TO THE

    STACK object.refcount-- WHEN WE POP AN OBJECT FROM THE STACK BROUGHT TO YOU BY NAIVETY
  43. COOLER ALGORITHMS GENERATIONAL BAKER'S TREADMILL BROUGHT TO YOU BY COMPUTER

    SCIENCE MASTERMINDS REAL-TIME INCREMENTAL NON-MOVING NON-COPYING MOVING COPYING CONCURRENT BITMAP MARKING TRICOLOR STOP-THE-WORLD MARK & SWEEP BACON-FLAVOURED SENTIMENTAL KEBAP
  44. JUST IN TIME

  45. JUST IN TIME COMPILING VM Bytecode MACHINE CODE x86 x86_64

    arm
  46. CHECK THIS OUT breaux: even cooler cool IF THIS TOPIC

    IS RELEVANT TO YOUR INTERESTS
  47. THANKS! txustice txus QUESTIONS?