Skip to content

Commit

Permalink
[Truffle] Fix PE tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Aug 23, 2015
1 parent 89b2e50 commit a221972
Showing 5 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1257,7 +1257,7 @@ public DynamicObject methodCached(VirtualFrame frame, Object self, String name)
name, getContext().getCoreLibrary().getLogicalClass(self), this));
}

return MethodNodes.createMethod(getContext().getCoreLibrary().getMethodClass(), self, method);
return Layouts.METHOD.createMethod(getContext().getCoreLibrary().getMethodFactory(), self, method);
}

}
Original file line number Diff line number Diff line change
@@ -45,10 +45,6 @@
@CoreClass(name = "Method")
public abstract class MethodNodes {

public static DynamicObject createMethod(DynamicObject rubyClass, Object receiver, InternalMethod method) {
return Layouts.METHOD.createMethod(Layouts.CLASS.getInstanceFactory(rubyClass), receiver, method);
}

@CoreMethod(names = { "==", "eql?" }, required = 1)
public abstract static class EqualNode extends CoreMethodArrayArgumentsNode {

@@ -224,7 +220,7 @@ public UnbindNode(RubyContext context, SourceSection sourceSection) {
@Specialization
public DynamicObject unbind(VirtualFrame frame, DynamicObject method) {
final DynamicObject receiverClass = classNode.executeGetClass(frame, Layouts.METHOD.getReceiver(method));
return UnboundMethodNodes.createUnboundMethod(getContext().getCoreLibrary().getUnboundMethodClass(), receiverClass, Layouts.METHOD.getMethod(method));
return Layouts.UNBOUND_METHOD.createUnboundMethod(getContext().getCoreLibrary().getUnboundMethodFactory(), receiverClass, Layouts.METHOD.getMethod(method));
}

}
Original file line number Diff line number Diff line change
@@ -1592,7 +1592,7 @@ public DynamicObject publicInstanceMethod(DynamicObject module, String name) {
throw new RaiseException(getContext().getCoreLibrary().nameErrorPrivateMethod(name, module, this));
}

return UnboundMethodNodes.createUnboundMethod(getContext().getCoreLibrary().getUnboundMethodClass(), module, method);
return Layouts.UNBOUND_METHOD.createUnboundMethod(getContext().getCoreLibrary().getUnboundMethodFactory(), module, method);
}

}
@@ -1697,7 +1697,7 @@ public DynamicObject instanceMethod(DynamicObject module, String name) {
throw new RaiseException(getContext().getCoreLibrary().nameErrorUndefinedMethod(name, module, this));
}

return UnboundMethodNodes.createUnboundMethod(getContext().getCoreLibrary().getUnboundMethodClass(), module, method);
return Layouts.UNBOUND_METHOD.createUnboundMethod(getContext().getCoreLibrary().getUnboundMethodFactory(), module, method);
}

}
Original file line number Diff line number Diff line change
@@ -36,10 +36,6 @@
@CoreClass(name = "UnboundMethod")
public abstract class UnboundMethodNodes {

public static DynamicObject createUnboundMethod(DynamicObject rubyClass, DynamicObject origin, InternalMethod method) {
return Layouts.UNBOUND_METHOD.createUnboundMethod(Layouts.CLASS.getInstanceFactory(rubyClass), origin, method);
}

@CoreMethod(names = "==", required = 1)
public abstract static class EqualNode extends CoreMethodArrayArgumentsNode {

@@ -101,7 +97,7 @@ public DynamicObject bind(VirtualFrame frame, DynamicObject unboundMethod, Objec
}
}

return MethodNodes.createMethod(getContext().getCoreLibrary().getMethodClass(), object, Layouts.UNBOUND_METHOD.getMethod(unboundMethod));
return Layouts.METHOD.createMethod(getContext().getCoreLibrary().getMethodFactory(), object, Layouts.UNBOUND_METHOD.getMethod(unboundMethod));
}

protected DynamicObject metaClass(VirtualFrame frame, Object object) {
Original file line number Diff line number Diff line change
@@ -153,7 +153,9 @@ public class CoreLibrary {
private final DynamicObject bigDecimalClass;
private final DynamicObject encodingCompatibilityErrorClass;
private final DynamicObject methodClass;
private final DynamicObjectFactory methodFactory;
private final DynamicObject unboundMethodClass;
private final DynamicObjectFactory unboundMethodFactory;
private final DynamicObject byteArrayClass;
private final DynamicObject fiberErrorClass;
private final DynamicObject threadErrorClass;
@@ -361,7 +363,8 @@ public CoreLibrary(RubyContext context) {
matchDataClass = defineClass("MatchData");
Layouts.CLASS.setInstanceFactoryUnsafe(matchDataClass, Layouts.MATCH_DATA.createMatchDataShape(matchDataClass, matchDataClass));
methodClass = defineClass("Method");
Layouts.CLASS.setInstanceFactoryUnsafe(methodClass, Layouts.METHOD.createMethodShape(methodClass, methodClass));
methodFactory = Layouts.METHOD.createMethodShape(methodClass, methodClass);
Layouts.CLASS.setInstanceFactoryUnsafe(methodClass, methodFactory);
final DynamicObject mutexClass = defineClass("Mutex");
Layouts.CLASS.setInstanceFactoryUnsafe(mutexClass, Layouts.MUTEX.createMutexShape(mutexClass, mutexClass));
nilClass = defineClass("NilClass");
@@ -393,7 +396,8 @@ public CoreLibrary(RubyContext context) {
Layouts.CLASS.setInstanceFactoryUnsafe(timeClass, Layouts.TIME.createTimeShape(timeClass, timeClass));
trueClass = defineClass("TrueClass");
unboundMethodClass = defineClass("UnboundMethod");
Layouts.CLASS.setInstanceFactoryUnsafe(unboundMethodClass, Layouts.UNBOUND_METHOD.createUnboundMethodShape(unboundMethodClass, unboundMethodClass));
unboundMethodFactory = Layouts.UNBOUND_METHOD.createUnboundMethodShape(unboundMethodClass, unboundMethodClass);
Layouts.CLASS.setInstanceFactoryUnsafe(unboundMethodClass, unboundMethodFactory);
final DynamicObject ioClass = defineClass("IO");
Layouts.CLASS.setInstanceFactoryUnsafe(ioClass, Layouts.IO.createIOShape(ioClass, ioClass));
internalBufferClass = defineClass(ioClass, objectClass, "InternalBuffer");
@@ -1477,10 +1481,18 @@ public DynamicObject getUnboundMethodClass() {
return unboundMethodClass;
}

public DynamicObjectFactory getUnboundMethodFactory() {
return unboundMethodFactory;
}

public DynamicObject getMethodClass() {
return methodClass;
}

public DynamicObjectFactory getMethodFactory() {
return methodFactory;
}

public DynamicObject getComplexClass() {
return complexClass;
}

0 comments on commit a221972

Please sign in to comment.