Skip to content

Commit

Permalink
Small risk...removing from 1.7.0 release.
Browse files Browse the repository at this point in the history
Revert "ObjectSpace tweaks:"

This reverts commit 4ceafef.
  • Loading branch information
headius committed Oct 17, 2012
1 parent 37bf9ac commit 8b0dda6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 30 deletions.
27 changes: 0 additions & 27 deletions src/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,6 @@ private Ruby(RubyInstanceConfig config) {
runtimeCache.initMethodCache(ClassIndex.MAX_CLASSES * MethodIndex.MAX_METHODS);

constantInvalidator = OptoFactory.newConstantInvalidator();

if (config.isObjectSpaceEnabled()) {
objectSpacer = ENABLED_OBJECTSPACE;
} else {
objectSpacer = DISABLED_OBJECTSPACE;
}
}

/**
Expand Down Expand Up @@ -4491,25 +4485,4 @@ public void secure(int level) {
private JavaProxyClassFactory javaProxyClassFactory;

private EnumMap<DefinedMessage, RubyString> definedMessages = new EnumMap<DefinedMessage, RubyString>(DefinedMessage.class);

private interface ObjectSpacer {
public void addToObjectSpace(Ruby runtime, boolean useObjectSpace, IRubyObject object);
}

private static final ObjectSpacer DISABLED_OBJECTSPACE = new ObjectSpacer() {
public void addToObjectSpace(Ruby runtime, boolean useObjectSpace, IRubyObject object) {
}
};

private static final ObjectSpacer ENABLED_OBJECTSPACE = new ObjectSpacer() {
public void addToObjectSpace(Ruby runtime, boolean useObjectSpace, IRubyObject object) {
if (useObjectSpace) runtime.objectSpace.add(object);
}
};

private final ObjectSpacer objectSpacer;

public void addToObjectSpace(boolean useObjectSpace, IRubyObject object) {
objectSpacer.addToObjectSpace(this, useObjectSpace, object);
}
}
13 changes: 11 additions & 2 deletions src/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,19 @@ public IRubyObject initialize19(ThreadContext context) {
* only if ObjectSpace is enabled.
*/
public RubyBasicObject(Ruby runtime, RubyClass metaClass) {
assert metaClass != null: "NULL Metaclass!!?!?!";

this.metaClass = metaClass;

runtime.addToObjectSpace(true, this);
if (runtime.isObjectSpaceEnabled()) addToObjectSpace(runtime);
}

/**
* Path for objects that don't taint and don't enter objectspace.
*/
public RubyBasicObject(RubyClass metaClass) {
assert metaClass != null: "NULL Metaclass!!?!?!";

this.metaClass = metaClass;
}

Expand All @@ -241,7 +245,12 @@ public RubyBasicObject(RubyClass metaClass) {
protected RubyBasicObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace) {
this.metaClass = metaClass;

runtime.addToObjectSpace(useObjectSpace, this);
if (useObjectSpace) addToObjectSpace(runtime);
}

private void addToObjectSpace(Ruby runtime) {
assert runtime.isObjectSpaceEnabled();
runtime.getObjectSpace().add(this);
}

protected void taint(Ruby runtime) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/jruby/RubyFloat.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public RubyFloat(Ruby runtime) {
}

public RubyFloat(Ruby runtime, double value) {
super(runtime.getFloat());
super(runtime, runtime.getFloat());
this.value = value;
}

Expand Down

0 comments on commit 8b0dda6

Please sign in to comment.