Permalink
Browse files

Remove the never-used metaclass-detaching logic contributed by GemSto…

…ne. If all goes according to plan and we're able to do lightweights by the end of the year, it will be unnecessary anyway.

git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7207 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
headius committed Jul 17, 2008
1 parent 2992143 commit 43ed0203cac85a54501db6a5181d35db91bb241d
Showing with 3 additions and 42 deletions.
  1. +3 −7 src/org/jruby/Ruby.java
  2. +0 −32 src/org/jruby/RubyObject.java
  3. +0 −3 src/org/jruby/internal/runtime/RubyRunnable.java
View
@@ -156,9 +156,6 @@ public static Ruby newInstance() {
public static Ruby newInstance(RubyInstanceConfig config) {
Ruby ruby = new Ruby(config);
ruby.init();
- if (RUNTIME_THREADLOCAL) {
- setCurrentInstance(ruby);
- }
return ruby;
}
@@ -582,12 +579,13 @@ public static Ruby getDefaultInstance() {
return newInstance();
}
+ @Deprecated
public static Ruby getCurrentInstance() {
- return currentRuntime.get();
+ return null;
}
+ @Deprecated
public static void setCurrentInstance(Ruby runtime) {
- currentRuntime.set(runtime);
}
public int allocSymbolId() {
@@ -2832,8 +2830,6 @@ public ExecutorService getExecutor() {
private final Set<Script> jittedMethods = Collections.synchronizedSet(new WeakHashSet<Script>());
private static ThreadLocal<Ruby> currentRuntime = new ThreadLocal<Ruby>();
- public static final boolean RUNTIME_THREADLOCAL
- = SafePropertyAccessor.getBoolean("jruby.runtime.threadlocal");
private long globalState = 1;
@@ -124,7 +124,6 @@
// The class of this object
protected transient RubyClass metaClass;
- protected String metaClassName;
/**
* The variableTable contains variables for an object, defined as:
@@ -283,7 +282,6 @@ public void finalize() {
public RubyObject(Ruby runtime, RubyClass metaClass) {
this.metaClass = metaClass;
- if (Ruby.RUNTIME_THREADLOCAL) setMetaClassName(metaClass);
if (runtime.isObjectSpaceEnabled()) addToObjectSpace(runtime);
if (runtime.getSafeLevel() >= 3) taint(runtime);
}
@@ -296,7 +294,6 @@ public RubyObject(Ruby runtime, RubyClass metaClass) {
protected RubyObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace) {
this.metaClass = metaClass;
- if (Ruby.RUNTIME_THREADLOCAL) setMetaClassName(metaClass);
if (useObjectSpace) addToObjectSpace(runtime);
if (runtime.getSafeLevel() >= 3) taint(runtime);
}
@@ -305,12 +302,6 @@ private void addToObjectSpace(Ruby runtime) {
assert runtime.isObjectSpaceEnabled();
runtime.getObjectSpace().add(this);
}
-
- private void setMetaClassName(RubyClass metaClass) {
- if (metaClass != null) {
- metaClassName = metaClass.classId;
- }
- }
/**
* Will create the Ruby class Object in the runtime
@@ -466,24 +457,6 @@ public final Ruby getRuntime() {
*
*/
public final RubyClass getMetaClass() {
- if (Ruby.RUNTIME_THREADLOCAL) {
- return lazyMetaClass();
- }
- return metaClass;
- }
-
- private final RubyClass lazyMetaClass() {
- RubyClass mc;
-
- if ((mc = metaClass) != null) {
- return mc;
- }
-
- if (metaClassName != null) {
- // this should only happen when we're persisting objects, so go after getCurrentInstance directly
- metaClass = Ruby.getCurrentInstance().getClass(metaClassName);
- }
-
return metaClass;
}
@@ -496,11 +469,6 @@ private final RubyClass lazyMetaClass() {
*/
public void setMetaClass(RubyClass metaClass) {
this.metaClass = metaClass;
- if (Ruby.RUNTIME_THREADLOCAL) {
- if (metaClass != null) {
- metaClassName = metaClass.classId;
- }
- }
}
/**
@@ -66,9 +66,6 @@ public Thread getJavaThread() {
}
public void run() {
- if (Ruby.RUNTIME_THREADLOCAL) {
- Ruby.setCurrentInstance(runtime);
- }
javaThread = Thread.currentThread();
ThreadContext context = runtime.getThreadService().registerNewThread(rubyThread);
context.preRunThread(currentFrame);

0 comments on commit 43ed020

Please sign in to comment.