logging in or signing up RubyTalk Davidson Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 62 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: November 28, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Ruby.NET: Ruby.NET Dr Wayne Kelly Queensland University of TechnologyRuby Implementations: Ruby Implementations Matz’s Ruby Interpreter (MRI) Yet Another Ruby VM (YARV) JRuby RubyCLR Ruby.NET IronRubyRuby.exe and RubyCompiler.exe: Ruby.exe and RubyCompiler.exe Ruby Source files Ruby Source files Ruby Source files RubyCompiler.exe Native Code Execution JIT Ruby Source file Ruby.exe .NET exe Native Code Execution JIT memory stream .NET exe or dll .NET exe or dllArchitecture: Architecture RubyRuntime.dll (Compiler Infrastructure + built-in classes and modules) Visual Studio Ruby.NET Package msbuild Task RubyCompiler.exe Ruby.exe PERWAPI.dll SymbolWriter.dllImplementation Issues: Implementation Issues Lack of Formal Specification Scanning and Parsing Interpreting vs. Compiling: Interpreting vs. Compiling Traditionally: Determine what to do Perform the action Compiling faster at runtime than Interpreting Ruby: Requires compilation at Runtime Highly dynamic semantics Consider expression: x + 2Mapping Ruby to the CIL: Mapping Ruby to the CIL Ruby has objects, classes and methods CIL has objects, classes and methods ?Dynamic Ruby Semantics: Dynamic Ruby Semantics Firstly the good news: All Ruby objects belong to a class and that class cannot change. The super class of a Ruby class cannot be changed. The bad news: The set of instance variables and methods of a class can change at runtime. Variables and expressions are not typed. Therefore don’t know type of receiver in method calls Therefore don't know which method is being called Unfortunately everything in Ruby is done via method calls!Ruby.Class vs System.Type: Ruby.Class vs System.Type Can't even create CLI classes at Runtime So, in general, Ruby class != CLI class Ruby.Class object: Points to super class object Maps method names to methods Ruby Object [instance variables] Ruby Class [class instance variables] Parent Class method method method method method methodInvoking Ruby Methods: Invoking Ruby Methods object Eval.Call(object recv, string method_name, object[] args …) Determine the Ruby class of the receiver Determine the Ruby method currently bound to the specified method name for that Ruby class Invoke the found Ruby methodRuby Objects: Ruby Objects "Most" Ruby objects inherit from CLI class Ruby.Object But we don't rely on this:Instance Variables: Instance Variables Normally fields of a specific class Since the set of instance variables is dynamic, we use a dictionary to store instance variables Don’t need objects of specific class Can use Ruby.Object in most cases Some classes such as Ruby.String are special For interop – want to create specific classes where possible. How do we allocate instances of a class? Don’t statically know super classLocal variables and blocks: Local variables and blocks Set of local variables is known statically But, they may be “captured” therefore generally can’t use CLI locals. def foo(a) b = a + 4 bar {|x| return a * x + b} endDynamic Evaluation: Dynamic Evaluation eval invokes compiler at runtime Generates a CLI assembly to a memory stream Dynamically loads it and invokes a method using reflection. eval may be evaluated in a different runtime context encapsulated by Binding objectDynamic locals: Dynamic localsNon-local control flow: Non-local control flow Blocks as loop bodies:Continuations: ContinuationsObjectSpace andWeak References: ObjectSpace and Weak ReferencesCurrent Status and Future Plans: Current Status and Future PlansTODO: TODO Extending Ruby/.NET interop Performance Optimization Threads and Continuations? Ruby on Rails Bug fixingLinks: Links ACSC08 Ruby.NET Design Paper: http://eprints.qut.edu.au/archive/00009097/01/Ruby.NET_Design_Paper.pdf Public source repository: http://code.google.com/p/rubydotnetcompiler/ Discussion email list: http://groups.google.com/group/RubyDOTNET RubyDOTNET@googlegroups.com Dr Wayne Kelly, QUT w.kelly@qut.edu.au 3138 9336 You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
RubyTalk Davidson Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 62 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: November 28, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Ruby.NET: Ruby.NET Dr Wayne Kelly Queensland University of TechnologyRuby Implementations: Ruby Implementations Matz’s Ruby Interpreter (MRI) Yet Another Ruby VM (YARV) JRuby RubyCLR Ruby.NET IronRubyRuby.exe and RubyCompiler.exe: Ruby.exe and RubyCompiler.exe Ruby Source files Ruby Source files Ruby Source files RubyCompiler.exe Native Code Execution JIT Ruby Source file Ruby.exe .NET exe Native Code Execution JIT memory stream .NET exe or dll .NET exe or dllArchitecture: Architecture RubyRuntime.dll (Compiler Infrastructure + built-in classes and modules) Visual Studio Ruby.NET Package msbuild Task RubyCompiler.exe Ruby.exe PERWAPI.dll SymbolWriter.dllImplementation Issues: Implementation Issues Lack of Formal Specification Scanning and Parsing Interpreting vs. Compiling: Interpreting vs. Compiling Traditionally: Determine what to do Perform the action Compiling faster at runtime than Interpreting Ruby: Requires compilation at Runtime Highly dynamic semantics Consider expression: x + 2Mapping Ruby to the CIL: Mapping Ruby to the CIL Ruby has objects, classes and methods CIL has objects, classes and methods ?Dynamic Ruby Semantics: Dynamic Ruby Semantics Firstly the good news: All Ruby objects belong to a class and that class cannot change. The super class of a Ruby class cannot be changed. The bad news: The set of instance variables and methods of a class can change at runtime. Variables and expressions are not typed. Therefore don’t know type of receiver in method calls Therefore don't know which method is being called Unfortunately everything in Ruby is done via method calls!Ruby.Class vs System.Type: Ruby.Class vs System.Type Can't even create CLI classes at Runtime So, in general, Ruby class != CLI class Ruby.Class object: Points to super class object Maps method names to methods Ruby Object [instance variables] Ruby Class [class instance variables] Parent Class method method method method method methodInvoking Ruby Methods: Invoking Ruby Methods object Eval.Call(object recv, string method_name, object[] args …) Determine the Ruby class of the receiver Determine the Ruby method currently bound to the specified method name for that Ruby class Invoke the found Ruby methodRuby Objects: Ruby Objects "Most" Ruby objects inherit from CLI class Ruby.Object But we don't rely on this:Instance Variables: Instance Variables Normally fields of a specific class Since the set of instance variables is dynamic, we use a dictionary to store instance variables Don’t need objects of specific class Can use Ruby.Object in most cases Some classes such as Ruby.String are special For interop – want to create specific classes where possible. How do we allocate instances of a class? Don’t statically know super classLocal variables and blocks: Local variables and blocks Set of local variables is known statically But, they may be “captured” therefore generally can’t use CLI locals. def foo(a) b = a + 4 bar {|x| return a * x + b} endDynamic Evaluation: Dynamic Evaluation eval invokes compiler at runtime Generates a CLI assembly to a memory stream Dynamically loads it and invokes a method using reflection. eval may be evaluated in a different runtime context encapsulated by Binding objectDynamic locals: Dynamic localsNon-local control flow: Non-local control flow Blocks as loop bodies:Continuations: ContinuationsObjectSpace andWeak References: ObjectSpace and Weak ReferencesCurrent Status and Future Plans: Current Status and Future PlansTODO: TODO Extending Ruby/.NET interop Performance Optimization Threads and Continuations? Ruby on Rails Bug fixingLinks: Links ACSC08 Ruby.NET Design Paper: http://eprints.qut.edu.au/archive/00009097/01/Ruby.NET_Design_Paper.pdf Public source repository: http://code.google.com/p/rubydotnetcompiler/ Discussion email list: http://groups.google.com/group/RubyDOTNET RubyDOTNET@googlegroups.com Dr Wayne Kelly, QUT w.kelly@qut.edu.au 3138 9336