Cache static scopes in compiled script objects for constant/variable names 
access without dynamic scope
-------------------------------------------------------------------------------------------------------

                 Key: JRUBY-2989
                 URL: http://jira.codehaus.org/browse/JRUBY-2989
             Project: JRuby
          Issue Type: Improvement
          Components: Compiler
            Reporter: Charles Oliver Nutter
            Assignee: Charles Oliver Nutter
             Fix For: JRuby 1.1.5


We could get a good optimization by having StaticScope stored in the script 
objects and used directly to access the constant scope and local variable 
names. Currently, Whenever local_variables is called in a method or a constant 
needs to be looked up, it forces the method to be heap-scoped so that there's a 
DynamicScope on the stack holding the static scope with constant information in 
it. As a result, this slows down all methods that have constants, which 
generally affects the majority of methods. By saving a reference to the scope 
in the script object, we can eliminate the requirement of a heap-based scope 
for constant lookup, allowing another class of methods to compile with 
stack-based local variables.

A few considerations for this change:

- The scope list should be weakly referenced, since it holds a reference to a 
RubyModule and a parent scope. It could represent a leak potential otherwise.
- The scope list should be a simple array allocated when the script object is 
instantiated.
- The scope created for a method definition, closure definition, or 
class/module body should be stored at the time of definition. Subsequent calls 
should re-store the scope, since it will be a new object and potentially a new 
scoped class.

This should be implemented before 1.1.5.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to