2008-12-21 Rubinius

752 views
668 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
752
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2008-12-21 Rubinius

  1. 1. Rubinius
  2. 2. Rubini us
  3. 3. Rubini.us
  4. 4. rubini.us
  5. 5. http://rubini.us
  6. 6. Rubinius http://godfat.org/slide/2008-12-21-rubinius.pdf
  7. 7. History and Design Goals Architecture and Object Model
  8. 8. History and Design Goals Architecture and Object Model
  9. 9. Evan Phoenix
  10. 10. February of 2006
  11. 11. RubySpec
  12. 12. MSpec
  13. 13. Engine Yard
  14. 14. C VM Shotgun
  15. 15. C VM Shotgun
  16. 16. C++ VM
  17. 17. CxxTest
  18. 18. LLVM
  19. 19. History and Design Goals Architecture and Object Model
  20. 20. Reliable, Rock Solid Code
  21. 21. Reliable, Rock Solid Code Full Test Coverage
  22. 22. Clean, Readable Code
  23. 23. Clean, Readable Code Little Lines in Each File
  24. 24. Clean, Readable Code Macro, Code Generator, Rake Task
  25. 25. Clean, Readable Code CMake
  26. 26. Clean, Readable Code CMake
  27. 27. Clean, Readable Code C++ Object to Ruby Object 1 to 1 Mapping
  28. 28. Modern Techniques
  29. 29. Modern Techniques Pluggable Garbage Collectors
  30. 30. Modern Techniques Pluggable Garbage Collectors • Stop-and-Copy
  31. 31. Modern Techniques Pluggable Garbage Collectors • Stop-and-Copy • Mark-and-Sweep
  32. 32. Modern Techniques Optimizers
  33. 33. Modern Techniques Git, Rake, LLVM
  34. 34. Squeak the Smalltalk-80 Implementation
  35. 35. Squeak Slang
  36. 36. Squeak • Alan Kay • Dan Ingalls • Adele Goldberg
  37. 37. Smalltalk Xerox PARC
  38. 38. Smalltalk Object-Oriented (differ from Simula and C++)
  39. 39. Smalltalk GUI
  40. 40. Smalltalk MVC
  41. 41. History and Design Goals Architecture and Object Model
  42. 42. Real Machine
  43. 43. C++ Virtual Machine Real Machine
  44. 44. kernel/bootstrap C++ Virtual Machine Real Machine
  45. 45. kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  46. 46. kernel/common kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  47. 47. kernel/delta kernel/common kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  48. 48. kernel/delta Ruby kernel/common Runtime (kernel) kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  49. 49. lib/compiler kernel/delta Ruby kernel/common Runtime (kernel) kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  50. 50. lib/compiler lib/* kernel/delta Ruby kernel/common Runtime (kernel) kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  51. 51. Your App lib/compiler lib/* Your App kernel/delta Ruby kernel/common Runtime (kernel) kernel/platform kernel/bootstrap C++ Virtual Machine Real Machine
  52. 52. Your App lib/compiler lib/* Your App kernel/delta Ruby kernel/common Runtime (kernel) kernel/platform kernel/bootstrap C++ Virtual Machine Low Level Virtual Machine Real Machine
  53. 53. Outside the Ruby World
  54. 54. Outside the Ruby World C++ Primitives
  55. 55. Outside the Ruby World Foreign Function Interface - FFI
  56. 56. Outside the Ruby World Subtend
  57. 57. History and Design Goals Architecture and Object Model
  58. 58. Hello World!
  59. 59. def method_missing m; puts m; end def Object.const_missing c; print "#{c}, "; end Hello.World!
  60. 60. puts ‘Hello, World!’
  61. 61. puts ‘Hello, World!’ self.send :puts, ‘Hello, World!’
  62. 62. (TOPLEVEL_BINDING.context.receiver || TOPLEVEL MethodContext.current.receiver ) puts ‘Hello, World!’ self.send :puts, ‘Hello, World!’
  63. 63. (TOPLEVEL_BINDING.context.receiver || TOPLEVEL MethodContext.current.receiver ) def __script__ puts ‘Hello, World!’ self.send :puts, ‘Hello, World!’ end
  64. 64. CompiledMethod (method(:__script__).compiled_method) def __script__ puts ‘Hello, World!’ end
  65. 65. CompiledMethod (method(:__script__).compiled_method) def __script__ puts ‘Hello, World!’ #<SendSite:0x26 name=puts hits=0 misses=0> end
  66. 66. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ print ‘World!‘ end
  67. 67. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=0 misses=0> print ‘World!‘ #<SendSite:0x28 name=print hits=0 misses=0> end
  68. 68. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ print ‘World!‘ end
  69. 69. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=0 misses=0> print ‘World!‘ end
  70. 70. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=0 misses=0> print ‘World!‘ #<SendSite:0x28 name=print hits=0 misses=0> end
  71. 71. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ print ‘World!‘ end
  72. 72. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=1 misses=0> print ‘World!‘ end
  73. 73. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=1 misses=0> print ‘World!‘ #<SendSite:0x28 name=print hits=1 misses=0> end
  74. 74. class C def print end end
  75. 75. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ print ‘World!‘ end
  76. 76. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=0 misses=0> print ‘World!‘ end
  77. 77. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=0 misses=0> print ‘World!‘ #<SendSite:0x28 name=print hits=0 misses=0> end
  78. 78. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ print ‘World!‘ end
  79. 79. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=1 misses=0> print ‘World!‘ end
  80. 80. CompiledMethod (method(:__script__).compiled_method) def __script__ print ‘Hello,‘ #<SendSite:0x26 name=print hits=1 misses=0> print ‘World!‘ #<SendSite:0x28 name=print hits=1 misses=0> end
  81. 81. • CompiledMethod • SendSite • MethodContext • MethodTable • StaticScope • LookupTable
  82. 82. Method Dispatch
  83. 83. D C Obj
  84. 84. D C Obj Meta D
  85. 85. D C Obj Meta Meta D C
  86. 86. D C Obj Meta Meta Meta D C Obj
  87. 87. D C Obj Meta Meta Meta D C Obj
  88. 88. D C Obj Meta Meta Meta D C Obj
  89. 89. D C Obj Meta Meta Meta Class D C Obj
  90. 90. D C Obj Meta Meta Meta Class Mod D C Obj
  91. 91. D C Obj Meta Meta Meta Class Mod D C Obj
  92. 92. Meta Meta Meta Class Mod D C Obj
  93. 93. Meta Meta Meta Class Mod D C Obj MM D
  94. 94. Meta Meta Meta Class Mod D C Obj MM MM D C
  95. 95. Meta Meta Meta Class Mod D C Obj MM MM MM D C Obj
  96. 96. Meta Meta Meta Class Mod D C Obj MM MM MM Meta D C Obj Class
  97. 97. Meta Meta Meta Class Mod D C Obj MM MM MM Meta D C Obj Class
  98. 98. Meta Meta Meta Class Mod D C Obj MM MM MM Meta D C Obj Class
  99. 99. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta D C Obj Class
  100. 100. Obj Meta Class Mod Obj MM Meta Obj Class
  101. 101. Obj Meta Class Mod Obj MM Meta Obj Class Meta MC
  102. 102. Obj Meta Class Mod Obj MM Meta Meta Obj Class Class Meta MC
  103. 103. Obj Meta Class Mod Obj MM Meta Meta Meta Obj Class Class Mod Meta MC
  104. 104. Obj Meta Class Mod Obj MM Meta Meta Meta Obj Class Class Mod Meta MC
  105. 105. Class Mod Meta Meta Meta Class Class Mod Meta MC
  106. 106. Meta Class Class Mod Meta Meta Class Mod Meta MC
  107. 107. Meta Class Class Mod Meta Meta Class Mod Meta MC
  108. 108. Meta Class Mod Class Meta Meta Class Mod Meta MC
  109. 109. Meta Class Mod Class Meta Meta Class Mod Meta MC
  110. 110. Meta Class Mod Class Meta Meta Class Mod Meta MC
  111. 111. Meta Class Mod Class Meta MC Meta Meta Class Mod
  112. 112. Meta Class Mod Class Meta Meta MC Class Meta Mod
  113. 113. Meta Class Mod Class Meta Meta Meta MC Class Mod
  114. 114. Meta Class Mod Class Meta Meta Meta MC Class Mod
  115. 115. Meta Class Mod Class Meta Meta Meta MC Class Mod
  116. 116. Meta Class Mod Class Meta Meta Meta MC Class Mod
  117. 117. Meta Class Mod Class Meta Meta Meta MC Class Mod
  118. 118. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta Meta Meta D C Obj Class Class Mod Meta MC
  119. 119. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta Meta Meta D C Obj Class Class Mod Meta MC
  120. 120. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta Meta Meta D C Obj Class Class Mod Meta MC
  121. 121. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta Meta Meta D C Obj Class Class Mod Meta MC
  122. 122. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta Meta Meta D C Obj Class Class Mod Meta MC
  123. 123. D C Obj Meta Meta Meta Class Mod D C Obj MM MM MM Meta Meta Meta D C Obj Class Class Mod Meta MC
  124. 124. • BlockEnvironment • Rubinius::Task • InstructionSequence • Channel • Compiler • Actor • Breakpoint • Rubinius::VM
  125. 125. Reference: Rubinius • http://rubini.us/ • http://github.com/evanphx/rubinius/ • http://rubinius.lighthouseapp.com/ • http://groups.google.com/group/rubinius-dev/
  126. 126. Reference: Articles • http://blog.fallingsnow.net/category/rubinius/ • http://betterruby.wordpress.com/ • http://www.infoq.com/news/2007/07/rubinius-interview-part-one • http://blog.nicksieger.com/articles/2006/10/20/rubyconf-sydney-and-rubinius • http://www.klankboomklang.com/2007/10/05/the-metaclass/ • http://www.hawthorne-press.com/WebPage_RHG.html
  127. 127. Reference: Others • http://rubyspec.org/ • http://llvm.org/ • http://users.ipa.net/~dwighth/squeak/oopsla_squeak.html
  128. 128. Reference: Wikipedia • http://en.wikipedia.org/wiki/Alan_Kay • http://en.wikipedia.org/wiki/Rubinius • http://en.wikipedia.org/wiki/PARC_(company) • http://en.wikipedia.org/wiki/Squeak • http://en.wikipedia.org/wiki/Bootstrapping_(compilers) • http://en.wikipedia.org/wiki/Smalltalk • http://en.wikipedia.org/wiki/Self-hosting • http://en.wikipedia.org/wiki/Simula • http://en.wikipedia.org/wiki/PyPy • http://en.wikipedia.org/wiki/Model-view-controller
  129. 129. git clone git://github.com/evanphx/rubinius.git cd rubinius; rake build
  130. 130. ?

×