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: d749df2e28e9^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 40f9069c4994
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Sep 1, 2015

  1. [Truffle] When you have a Rubinius primitive implemented as a call yo…

    …u still need to handle the return issues.
    chrisseaton committed Sep 1, 2015
    Copy the full SHA
    d749df2 View commit details
  2. Copy the full SHA
    40f9069 View commit details
4 changes: 2 additions & 2 deletions truffle/pom.rb
Original file line number Diff line number Diff line change
@@ -15,10 +15,10 @@
repository( :url => 'http://lafo.ssw.uni-linz.ac.at/nexus/content/repositories/snapshots/',
:id => 'truffle' )

truffle_version = '2482183730b8eb3b0cfd38ab10cf76991526c159-SNAPSHOT'
truffle_version = '0.9-SNAPSHOT'
jar 'com.oracle.truffle:truffle-api:' + truffle_version
jar 'com.oracle.truffle:truffle-dsl-processor:' + truffle_version, :scope => 'provided'
jar 'com.oracle.truffle:truffle-tck:' + truffle_version, :scope => 'test'
jar 'com.oracle.truffle:truffle-tck:' + truffle_version#, :scope => 'test'
jar 'junit:junit', :scope => 'test'

plugin( :compiler,
7 changes: 3 additions & 4 deletions truffle/pom.xml
Original file line number Diff line number Diff line change
@@ -31,19 +31,18 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.oracle.truffle</groupId>
<artifactId>truffle-api</artifactId>
<version>2482183730b8eb3b0cfd38ab10cf76991526c159-SNAPSHOT</version>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.oracle.truffle</groupId>
<artifactId>truffle-dsl-processor</artifactId>
<version>2482183730b8eb3b0cfd38ab10cf76991526c159-SNAPSHOT</version>
<version>0.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.truffle</groupId>
<artifactId>truffle-tck</artifactId>
<version>2482183730b8eb3b0cfd38ab10cf76991526c159-SNAPSHOT</version>
<scope>test</scope>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Original file line number Diff line number Diff line change
@@ -39,11 +39,12 @@ public int getPrimitiveArity() {

@Override
public RubyNode createCallPrimitiveNode(RubyContext context, SourceSection sourceSection, ReturnID returnID) {
return CallNodeFactory.create(context, sourceSection, new RubyNode[] {
new LiteralNode(context, sourceSection, method),
new ReadAllArgumentsNode(context, sourceSection),
new ReadBlockNode(context, sourceSection, NotProvided.INSTANCE)
});
return new CallRubiniusPrimitiveNode(context, sourceSection,
CallNodeFactory.create(context, sourceSection, new RubyNode[] {
new LiteralNode(context, sourceSection, method),
new ReadAllArgumentsNode(context, sourceSection),
new ReadBlockNode(context, sourceSection, NotProvided.INSTANCE)
}), returnID);
}

@Override
Original file line number Diff line number Diff line change
@@ -126,21 +126,6 @@ public Object doCatch(VirtualFrame frame, Object tag, DynamicObject block) {
}
}

@RubiniusPrimitive(name = "vm_gc_start", needsSelf = false)
public static abstract class VMGCStartPrimitiveNode extends RubiniusPrimitiveNode {

public VMGCStartPrimitiveNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization
public DynamicObject vmGCStart() {
System.gc();
return nil();
}

}

@RubiniusPrimitive(name = "vm_get_module_name", needsSelf = false)
public static abstract class VMGetModuleNamePrimitiveNode extends RubiniusPrimitiveNode {

Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@
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.TruffleObject;
import com.oracle.truffle.api.interop.java.JavaInterop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.DynamicObjectFactory;
@@ -179,6 +181,8 @@ public class CoreLibrary {

@CompilationFinal private InternalMethod basicObjectSendMethod;

private static final TruffleObject systemObject = JavaInterop.asTruffleObject(System.class);

private static String getCoreLoadPath() {
String path = Options.TRUFFLE_CORE_LOAD_PATH.load();

@@ -624,6 +628,11 @@ private void initializeConstants() {
Layouts.MODULE.getFields(encodingConverterClass).setConstant(node, "XML_TEXT_DECORATOR", EConvFlags.XML_TEXT_DECORATOR);
Layouts.MODULE.getFields(encodingConverterClass).setConstant(node, "XML_ATTR_CONTENT_DECORATOR", EConvFlags.XML_ATTR_CONTENT_DECORATOR);
Layouts.MODULE.getFields(encodingConverterClass).setConstant(node, "XML_ATTR_QUOTE_DECORATOR", EConvFlags.XML_ATTR_QUOTE_DECORATOR);

// Java interop

final DynamicObject javaModule = defineModule(truffleModule, "Java");
Layouts.MODULE.getFields(javaModule).setConstant(null, "System", systemObject);
}

private void initializeSignalConstants() {
6 changes: 6 additions & 0 deletions truffle/src/main/ruby/core/rubinius/primitives.rb
Original file line number Diff line number Diff line change
@@ -33,5 +33,11 @@ def self.module_mirror(obj)

Truffle::Primitive.install_rubinius_primitive method(:module_mirror)

def self.vm_gc_start(obj)
Truffle::Interop.execute Truffle::Java::System.gc
end

Truffle::Primitive.install_rubinius_primitive method(:vm_gc_start)

end
end