Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9ad3caa20b23
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8b68a142ed77
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Sep 10, 2015

  1. [Truffle] ObjectSpace.each_object correct filtering

    - by module
    - regarding singleton classes
    pitr-ch committed Sep 10, 2015
    Copy the full SHA
    f9d8ad8 View commit details
  2. [Truffle] code formatting

    pitr-ch committed Sep 10, 2015
    Copy the full SHA
    8b68a14 View commit details
Showing with 5 additions and 4 deletions.
  1. +5 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/ObjectSpaceNodes.java
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ public long id2RefSmallInt(long id) {

@Specialization(guards = "isBasicObjectID(id)")
public Object id2Ref(final VirtualFrame frame, final long id,
@Cached("createReadObjectIDNode()") final ReadHeadObjectFieldNode readObjectIdNode) {
@Cached("createReadObjectIDNode()") final ReadHeadObjectFieldNode readObjectIdNode) {
CompilerDirectives.transferToInterpreter();

final Memo<Object> result = new Memo<Object>(nil());
@@ -140,14 +140,15 @@ public int eachObject(VirtualFrame frame, NotProvided ofClass, DynamicObject blo
return count;
}

@Specialization(guards = {"isRubyClass(ofClass)", "isRubyProc(block)"})
@Specialization(guards = { "isRubyModule(ofClass)", "isRubyProc(block)" })
public int eachObject(VirtualFrame frame, DynamicObject ofClass, DynamicObject block) {
CompilerDirectives.transferToInterpreter();

int count = 0;

for (DynamicObject object : new ObjectGraph(getContext()).getObjects()) {
if (!isHidden(object) && ModuleOperations.assignableTo(Layouts.BASIC_OBJECT.getLogicalClass(object), ofClass)) {
final DynamicObject metaClass = Layouts.BASIC_OBJECT.getMetaClass(object);
if (!isHidden(object) && ModuleOperations.includesModule(metaClass, ofClass)) {
yield(frame, block, object);
count++;
}
@@ -176,7 +177,7 @@ public DefineFinalizerNode(RubyContext context, SourceSection sourceSection) {
public DynamicObject defineFinalizer(VirtualFrame frame, DynamicObject object, Object finalizer) {
if (respondToNode.executeBoolean(frame, finalizer)) {
getContext().getObjectSpaceManager().defineFinalizer(object, finalizer);
Object[] objects = new Object[]{0, finalizer};
Object[] objects = new Object[]{ 0, finalizer };
return Layouts.ARRAY.createArray(getContext().getCoreLibrary().getArrayFactory(), objects, objects.length);
} else {
CompilerDirectives.transferToInterpreter();