-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into truffle-head
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
Showing
38 changed files
with
622 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rails.sh | ||
gem-testing.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
truffle/src/main/java/org/jruby/truffle/core/MethodForeignAccessFactory.java
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
truffle/src/main/java/org/jruby/truffle/core/array/ArrayForeignAccessFactory.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
truffle/src/main/java/org/jruby/truffle/core/hash/HashForeignAccessFactory.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
truffle/src/main/java/org/jruby/truffle/core/string/StringForeignAccessFactory.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
truffle/src/main/java/org/jruby/truffle/interop/ForeignExecuteNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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.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; | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
truffle/src/main/java/org/jruby/truffle/interop/ForeignGetSizeNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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 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; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
truffle/src/main/java/org/jruby/truffle/interop/ForeignHasSizeNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* 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 = "HAS_SIZE", receiverType = RubyObjectType.class, language = RubyLanguage.class) | ||
public final class ForeignHasSizeNode extends ForeignHasSizeBaseNode { | ||
|
||
@Override | ||
public Object access(VirtualFrame frame, DynamicObject object) { | ||
return RubyGuards.isRubyArray(object) || RubyGuards.isRubyHash(object) || RubyGuards.isRubyString(object); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
truffle/src/main/java/org/jruby/truffle/interop/ForeignInvokeNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
truffle/src/main/java/org/jruby/truffle/interop/ForeignIsBoxedNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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.object.DynamicObject; | ||
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.RubyObjectType; | ||
|
||
@AcceptMessage(value = "IS_BOXED", receiverType = RubyObjectType.class, language = RubyLanguage.class) | ||
public final class ForeignIsBoxedNode extends ForeignIsBoxedBaseNode { | ||
|
||
@Override | ||
public Object access(VirtualFrame frame, DynamicObject object) { | ||
return RubyGuards.isRubyString(object) && StringOperations.rope(object).byteLength() == 1; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
truffle/src/main/java/org/jruby/truffle/interop/ForeignIsExecutableNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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 org.jruby.truffle.RubyContext; | ||
import org.jruby.truffle.RubyLanguage; | ||
import org.jruby.truffle.language.RubyGuards; | ||
import org.jruby.truffle.language.RubyObjectType; | ||
|
||
@AcceptMessage(value = "IS_EXECUTABLE", receiverType = RubyObjectType.class, language = RubyLanguage.class) | ||
public final class ForeignIsExecutableNode extends ForeignIsExecutableBaseNode { | ||
|
||
@Override | ||
public Object access(VirtualFrame frame, DynamicObject object) { | ||
return RubyGuards.isRubyMethod(object); | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
truffle/src/main/java/org/jruby/truffle/interop/ForeignIsNullNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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.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; | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
truffle/src/main/java/org/jruby/truffle/interop/ForeignReadNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.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; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
truffle/src/main/java/org/jruby/truffle/interop/ForeignUnboxNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
truffle/src/main/java/org/jruby/truffle/interop/ForeignWriteNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
truffle/src/main/java/org/jruby/truffle/interop/InteropHasSize.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.ForeignAccess; | ||
import com.oracle.truffle.api.object.DynamicObject; | ||
import com.oracle.truffle.api.object.ObjectType; | ||
import com.oracle.truffle.api.source.SourceSection; | ||
import org.jruby.truffle.RubyContext; | ||
import org.jruby.truffle.core.array.ArrayLayoutImpl; | ||
import org.jruby.truffle.core.hash.HashLayoutImpl; | ||
import org.jruby.truffle.core.string.StringLayoutImpl; | ||
import org.jruby.truffle.language.RubyNode; | ||
|
||
public class InteropHasSize extends RubyNode { | ||
|
||
public InteropHasSize(RubyContext context, SourceSection sourceSection) { | ||
super(context, sourceSection); | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
final ObjectType type = ((DynamicObject) ForeignAccess.getReceiver(frame)).getShape().getObjectType(); | ||
|
||
return type instanceof ArrayLayoutImpl.ArrayType | ||
|| type instanceof HashLayoutImpl.HashType | ||
|| type instanceof StringLayoutImpl.StringType; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
truffle/src/main/java/org/jruby/truffle/interop/InteropIsExecutable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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.ForeignAccess; | ||
import com.oracle.truffle.api.object.DynamicObject; | ||
import com.oracle.truffle.api.source.SourceSection; | ||
import org.jruby.truffle.RubyContext; | ||
import org.jruby.truffle.language.RubyGuards; | ||
import org.jruby.truffle.language.RubyNode; | ||
|
||
public class InteropIsExecutable extends RubyNode { | ||
public InteropIsExecutable(RubyContext context, SourceSection sourceSection) { | ||
super(context, sourceSection); | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
return RubyGuards.isRubyMethod(ForeignAccess.getReceiver(frame)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters