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: b088a3267959
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8d8640d716c9
Choose a head ref
  • 4 commits
  • 22 files changed
  • 1 contributor

Commits on Mar 22, 2016

  1. [Truffle] Use the foreign access DSL.

    Just use the existing nodes in a sloppy way for now.
    chrisseaton committed Mar 22, 2016
    Copy the full SHA
    c9116b2 View commit details
  2. Copy the full SHA
    03c783b View commit details
  3. Copy the full SHA
    a845578 View commit details
  4. Copy the full SHA
    8d8640d View commit details
Showing with 359 additions and 384 deletions.
  1. +0 −24 truffle/src/main/java/org/jruby/truffle/interop/AbstractExecuteMethodNode.java
  2. +2 −5 truffle/src/main/java/org/jruby/truffle/interop/ExecuteMethodNode.java
  3. +44 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignExecuteNode.java
  4. +49 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignGetSizeNode.java
  5. +9 −10 truffle/src/main/java/org/jruby/truffle/interop/{InteropIsExecutable.java → ForeignHasSizeNode.java}
  6. +45 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignInvokeNode.java
  7. +11 −16 ...e/src/main/java/org/jruby/truffle/interop/{InteropStringUnboxNode.java → ForeignIsBoxedNode.java}
  8. +11 −11 ...rc/main/java/org/jruby/truffle/interop/{InteropStringIsBoxed.java → ForeignIsExecutableNode.java}
  9. +44 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignIsNullNode.java
  10. +48 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignReadNode.java
  11. +32 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignUnboxNode.java
  12. +45 −0 truffle/src/main/java/org/jruby/truffle/interop/ForeignWriteNode.java
  13. +0 −30 truffle/src/main/java/org/jruby/truffle/interop/InteropArgumentNode.java
  14. +0 −47 truffle/src/main/java/org/jruby/truffle/interop/InteropArgumentsNode.java
  15. +0 −33 truffle/src/main/java/org/jruby/truffle/interop/InteropGetSizeProperty.java
  16. +0 −37 truffle/src/main/java/org/jruby/truffle/interop/InteropHasSize.java
  17. +0 −27 truffle/src/main/java/org/jruby/truffle/interop/InteropIsNull.java
  18. +5 −5 truffle/src/main/java/org/jruby/truffle/interop/ResolvedInteropExecuteAfterReadNode.java
  19. +0 −99 truffle/src/main/java/org/jruby/truffle/interop/RubyForeignAccessFactory.java
  20. +0 −36 truffle/src/main/java/org/jruby/truffle/interop/RubyInteropRootNode.java
  21. +6 −3 truffle/src/main/java/org/jruby/truffle/language/RubyObjectType.java
  22. +8 −1 truffle/src/main/java/org/jruby/truffle/om/dsl/processor/OMProcessor.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
import java.util.List;

@NodeChild(value="method", type = RubyNode.class)
public abstract class ExecuteMethodNode extends AbstractExecuteMethodNode {
public abstract class ExecuteMethodNode extends RubyNode {
@Child private IndirectCallNode callNode;
public ExecuteMethodNode(RubyContext context,
SourceSection sourceSection) {
@@ -74,10 +74,6 @@ protected Object doCall(VirtualFrame frame, DynamicObject method) {
return callNode.call(frame, internalMethod.getCallTarget(), RubyArguments.pack(null, null, internalMethod, DeclarationContext.METHOD, null, Layouts.METHOD.getReceiver(method), null, args));
}

protected InternalMethod getMethodFromProc(DynamicObject proc) {
return Layouts.PROC.getMethod(proc);
}

protected CallTarget getCallTarget(DynamicObject proc) {
return Layouts.PROC.getCallTargetForType(proc);
}
@@ -86,4 +82,5 @@ protected InternalMethod getMethod(DynamicObject method) {
return Layouts.METHOD.getMethod(method);
}

public abstract Object executeWithTarget(VirtualFrame frame, Object method);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyObjectType;

@AcceptMessage(value = "EXECUTE", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignExecuteNode extends ForeignExecuteBaseNode {

@Child private Node findContextNode;
@Child private InteropExecute interopNode;

@Override
public Object access(VirtualFrame frame, DynamicObject object, Object[] args) {
return getInteropNode().execute(frame);
}

private InteropExecute getInteropNode() {
if (interopNode == null) {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
interopNode = insert(new InteropExecute(context, null));
}

return interopNode;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyObjectType;
import org.jruby.truffle.language.dispatch.DispatchAction;
import org.jruby.truffle.language.dispatch.DispatchHeadNode;
import org.jruby.truffle.language.dispatch.MissingBehavior;

@AcceptMessage(value = "GET_SIZE", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignGetSizeNode extends ForeignGetSizeBaseNode {

@Child private Node findContextNode;
@Child private DispatchHeadNode dispatchNode;

@Override
public Object access(VirtualFrame frame, DynamicObject object) {
return getDispatchNode().dispatch(frame, object, "size", null, new Object[] {});
}

private DispatchHeadNode getDispatchNode() {
if (dispatchNode == null) {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
dispatchNode = insert(new DispatchHeadNode(context, true, MissingBehavior.CALL_METHOD_MISSING, DispatchAction.CALL_METHOD));
}

return dispatchNode;
}

}
Original file line number Diff line number Diff line change
@@ -10,20 +10,19 @@
package org.jruby.truffle.interop;

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyObjectType;

public class InteropIsExecutable extends RubyNode {
public InteropIsExecutable(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
@AcceptMessage(value = "HAS_SIZE", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignHasSizeNode extends ForeignHasSizeBaseNode {

@Override
public Object execute(VirtualFrame frame) {
return RubyGuards.isRubyMethod(ForeignAccess.getReceiver(frame));
public Object access(VirtualFrame frame, DynamicObject object) {
return RubyGuards.isRubyArray(object) || RubyGuards.isRubyHash(object) || RubyGuards.isRubyString(object);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyObjectType;

@AcceptMessage(value = "INVOKE", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignInvokeNode extends ForeignInvokeBaseNode {

@Child private Node findContextNode;
@Child private RubyNode interopNode;

@Override
public Object access(VirtualFrame frame, DynamicObject object, String name, Object[] args) {
return getInteropNode().execute(frame);
}

private RubyNode getInteropNode() {
if (interopNode == null) {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
interopNode = insert(new UnresolvedInteropExecuteAfterReadNode(context, null, 0));
}

return interopNode;
}

}
Original file line number Diff line number Diff line change
@@ -9,29 +9,24 @@
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyObjectType;

public class InteropStringUnboxNode extends RubyNode {

public InteropStringUnboxNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
@AcceptMessage(value = "IS_BOXED", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignIsBoxedNode extends ForeignIsBoxedBaseNode {

@Override
public Object execute(VirtualFrame frame) {
final DynamicObject receiver = (DynamicObject) ForeignAccess.getReceiver(frame);

if (RubyGuards.isRubyString(receiver)) {
return StringOperations.getByteListReadOnly(receiver).get(0);
} else {
return receiver;
}
public Object access(VirtualFrame frame, DynamicObject object) {
return RubyGuards.isRubyString(object) && StringOperations.rope(object).byteLength() == 1;
}

}
Original file line number Diff line number Diff line change
@@ -9,24 +9,24 @@
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyObjectType;

public class InteropStringIsBoxed extends RubyNode {

public InteropStringIsBoxed(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
@AcceptMessage(value = "IS_EXECUTABLE", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignIsExecutableNode extends ForeignIsExecutableBaseNode {

@Override
public Object execute(VirtualFrame frame) {
Object o = ForeignAccess.getReceiver(frame);
return RubyGuards.isRubyString(o) && StringOperations.rope((DynamicObject) o).byteLength() == 1;
public Object access(VirtualFrame frame, DynamicObject object) {
return RubyGuards.isRubyMethod(object);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyObjectType;

@AcceptMessage(value = "IS_NULL", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignIsNullNode extends ForeignIsNullBaseNode {

@Child private Node findContextNode;
@CompilationFinal RubyContext context;

@Override
public Object access(VirtualFrame frame, DynamicObject object) {
return object == getContext().getCoreLibrary().getNilObject();
}

private RubyContext getContext() {
if (context == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
}

return context;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyObjectType;
import org.jruby.truffle.language.dispatch.DispatchAction;
import org.jruby.truffle.language.dispatch.DispatchHeadNode;
import org.jruby.truffle.language.dispatch.MissingBehavior;

@AcceptMessage(value = "READ", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignReadNode extends ForeignReadBaseNode {

@Child private Node findContextNode;
@Child private RubyNode interopNode;

@Override
public Object access(VirtualFrame frame, DynamicObject object, Object name) {
return getInteropNode().execute(frame);
}

private RubyNode getInteropNode() {
if (interopNode == null) {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
interopNode = insert(new UnresolvedInteropReadNode(context, null));
}

return interopNode;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyObjectType;

@AcceptMessage(value = "UNBOX", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignUnboxNode extends ForeignUnboxBaseNode {

@Override
public Object access(VirtualFrame frame, DynamicObject object) {
if (RubyGuards.isRubyString(object)) {
return StringOperations.getByteListReadOnly(object).get(0);
} else {
return object;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.AcceptMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.Node.Child;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyObjectType;

@AcceptMessage(value = "WRITE", receiverType = RubyObjectType.class, language = RubyLanguage.class)
public final class ForeignWriteNode extends ForeignWriteBaseNode {

@Child private Node findContextNode;
@Child private RubyNode interopNode;

@Override
public Object access(VirtualFrame frame, DynamicObject object, Object name, Object value) {
return getInteropNode().execute(frame);
}

private RubyNode getInteropNode() {
if (interopNode == null) {
CompilerDirectives.transferToInterpreter();
findContextNode = insert(RubyLanguage.INSTANCE.unprotectedCreateFindContextNode());
final RubyContext context = RubyLanguage.INSTANCE.unprotectedFindContext(findContextNode);
interopNode = insert(new UnresolvedInteropWriteNode(context, null));
}

return interopNode;
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions truffle/src/main/java/org/jruby/truffle/interop/InteropIsNull.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -11,17 +11,19 @@

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.dispatch.DispatchAction;
import org.jruby.truffle.language.dispatch.DispatchHeadNode;
import org.jruby.truffle.language.dispatch.MissingBehavior;

import java.util.List;

public class ResolvedInteropExecuteAfterReadNode extends RubyNode {

@Child private DispatchHeadNode head;
@Child private InteropArgumentsNode arguments;
private final String name;
private final int labelIndex;
private final int receiverIndex;
@@ -30,17 +32,15 @@ public ResolvedInteropExecuteAfterReadNode(RubyContext context, SourceSection so
super(context, sourceSection);
this.name = name;
this.head = new DispatchHeadNode(context, true, MissingBehavior.CALL_METHOD_MISSING, DispatchAction.CALL_METHOD);
this.arguments = new InteropArgumentsNode(context, sourceSection, arity); // [0] is receiver, [1] is the label
this.labelIndex = 1;
this.receiverIndex = 0;
}

@Override
public Object execute(VirtualFrame frame) {
if (name.equals(frame.getArguments()[labelIndex])) {
Object[] args = new Object[arguments.getCount(frame)];
arguments.executeFillObjectArray(frame, args);
return head.dispatch(frame, frame.getArguments()[receiverIndex], frame.getArguments()[labelIndex], null, args);
final List<Object> arguments = ForeignAccess.getArguments(frame);
return head.dispatch(frame, frame.getArguments()[receiverIndex], frame.getArguments()[labelIndex], null, arguments.subList(1, arguments.size()).toArray());
} else {
CompilerDirectives.transferToInterpreter();
throw new IllegalStateException("Name changed");

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -11,11 +11,11 @@

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.ObjectType;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.interop.RubyForeignAccessFactory;
import org.jruby.truffle.core.rope.RopeOperations;
import org.jruby.truffle.core.string.StringOperations;

@@ -41,8 +41,11 @@ public String toString(DynamicObject object) {

@Override
public ForeignAccess getForeignAccessFactory(DynamicObject object) {
CompilerAsserts.neverPartOfCompilation();
return ForeignAccess.create(DynamicObject.class, new RubyForeignAccessFactory(getContext()));
return RubyObjectTypeForeign.ACCESS;
}

public static boolean isInstance(TruffleObject object) {
return RubyGuards.isRubyBasicObject(object);
}

private RubyContext getContext() {
Original file line number Diff line number Diff line change
@@ -35,7 +35,14 @@ public class OMProcessor extends AbstractProcessor {
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment) {
for (Element element : roundEnvironment.getElementsAnnotatedWith(Layout.class)) {
// assert element.getKind() == ElementKind.INTERFACE : element.getKind();
processLayout((TypeElement) element);

if (!(element instanceof TypeElement)) {
throw new UnsupportedOperationException(element.toString());
}

if (element instanceof TypeElement) {
processLayout((TypeElement) element);
}
}

return true;