[jruby~main:ecb74ae3] Hack for the reverted fix for JRUBY-4484

  • From: nicksieger@kenai.com
  • To: commits@jruby.kenai.com
  • Subject: [jruby~main:ecb74ae3] Hack for the reverted fix for JRUBY-4484
  • Date: Wed, 17 Mar 2010 17:42:26 +0000

Project:    jruby
Repository: main
Revision:   ecb74ae3e3584819da6dc407c61b1c6c0b7e9251
Author:     nicksieger
Date:       2010-03-17 17:25:22 UTC
Link:       

Log Message:
------------
Revert "Fix for JRUBY-4484: jruby -rtracer doesn't trace"
This reverts commit 5f3de424615189193a722d754189a143b40cf6ed.
Hack for the reverted fix for JRUBY-4484


Revisions:
----------
93b1257dad9a3915c6c6374d71d7c51e1dd9c460
ecb74ae3e3584819da6dc407c61b1c6c0b7e9251


Modified Paths:
---------------
src/org/jruby/Ruby.java
src/org/jruby/runtime/ThreadContext.java
lib/ruby/1.8/tracer.rb


Diffs:
------
diff --git a/src/org/jruby/Ruby.java b/src/org/jruby/Ruby.java
index 3dc2798..0744070 100644
--- a/src/org/jruby/Ruby.java
+++ b/src/org/jruby/Ruby.java
@@ -1030,9 +1030,8 @@ public final class Ruby {
         // initialize the root of the class hierarchy completely
         initRoot();
 
-        // Modified for JRUBY-4484
-        // prepare a temporary toplevel frame during init, for consumers 
like TOPLEVEL_BINDING
-        tc.preTopLevel(objectClass, topSelf);
+        // Construct the top-level execution frame and scope for the main 
thread
+        tc.prepareTopLevel(objectClass, topSelf);
 
         // Initialize all the core classes
         bootstrap();
@@ -1049,19 +1048,11 @@ public final class Ruby {
 
         // initialize builtin libraries
         initBuiltins();
-
-        // Modified for JRUBY-4484
-        // remove the temporary toplevel frame
-        tc.postTopLevel();
         
         // Require in all libraries specified on command line
         for (String scriptName : config.requiredLibraries()) {
             loadService.smartLoad(scriptName);
         }
-
-        // Modified for JRUBY-4484
-        // Construct the final toplevel frame and scope for the main thread
-        tc.preTopLevel(objectClass, topSelf);
     }
 
     private void bootstrap() {
diff --git a/src/org/jruby/runtime/ThreadContext.java 
b/src/org/jruby/runtime/ThreadContext.java
index ea39f2b..71e8abd 100644
--- a/src/org/jruby/runtime/ThreadContext.java
+++ b/src/org/jruby/runtime/ThreadContext.java
@@ -114,6 +114,11 @@ public final class ThreadContext {
      */
     private ThreadContext(Ruby runtime) {
         this.runtime = runtime;
+        
+        // TOPLEVEL self and a few others want a top-level scope.  We create 
this one right
+        // away and then pass it into top-level parse so it ends up being 
the top level.
+        StaticScope topStaticScope = new LocalStaticScope(null);
+        pushScope(new ManyVarsDynamicScope(topStaticScope, null));
 
         Frame[] stack = frameStack;
         int length = stack.length;
@@ -1216,19 +1221,8 @@ public final class ThreadContext {
         popRubyClass();
         popScope();
     }
-
-    @Deprecated
+    
     public void prepareTopLevel(RubyClass objectClass, IRubyObject topSelf) {
-        preTopLevel(objectClass, topSelf);
-    }
-
-    /**
-     * Prepare a toplevel execution context, including a frame, scope, and 
current RubyClass
-     *
-     * @param objectClass The current RubyClass
-     * @param topSelf The "self" for the toplevel frame
-     */
-    public void preTopLevel(RubyClass objectClass, IRubyObject topSelf) {
         pushFrame();
         setCurrentVisibility(Visibility.PRIVATE);
         
@@ -1237,22 +1231,8 @@ public final class ThreadContext {
         Frame frame = getCurrentFrame();
         frame.setSelf(topSelf);
         
-        // TOPLEVEL self and a few others want a top-level scope.  We create 
this one right
-        // away and then pass it into top-level parse so it ends up being 
the top level.
-        StaticScope topStaticScope = new LocalStaticScope(null);
-        pushScope(new ManyVarsDynamicScope(topStaticScope, null));
-        
         getCurrentScope().getStaticScope().setModule(objectClass);
     }
-
-    /**
-     * Remove the elements added for the toplevel execution context.
-     */
-    public void postTopLevel() {
-        popFrame();
-        popRubyClass();
-        popScope();
-    }
     
     public void preNodeEval(RubyModule rubyClass, IRubyObject self, String 
name) {
         pushRubyClass(rubyClass);
diff --git a/lib/ruby/1.8/tracer.rb b/lib/ruby/1.8/tracer.rb
index 71aa49c..430dfcc 100644
--- a/lib/ruby/1.8/tracer.rb
+++ b/lib/ruby/1.8/tracer.rb
@@ -162,6 +162,6 @@ if $0 == __FILE__
   ARGV.shift
   Tracer.on
   require $0
-elsif caller(0).size == 1
+elsif caller(0).size == 2 # HACK for JRUBY-4484
   Tracer.on
 end




[jruby~main:ecb74ae3] Hack for the reverted fix for JRUBY-4484

nicksieger 03/17/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close