Skip to content

Commit

Permalink
Merge branch 'truffle-head'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Apr 29, 2015
2 parents edec82e + c28f4ce commit ad4ba4b
Show file tree
Hide file tree
Showing 190 changed files with 3,532 additions and 3,970 deletions.
9 changes: 0 additions & 9 deletions core/src/main/java/org/jruby/RubyInstanceConfig.java
Expand Up @@ -1814,8 +1814,6 @@ public boolean shouldPrecompileAll() {
public static String IR_JIT_PASSES = Options.IR_JIT_PASSES.load();
public static String IR_INLINE_COMPILER_PASSES = Options.IR_INLINE_COMPILER_PASSES.load();

private TruffleHooksStub truffleHooks = null;

public static final boolean COROUTINE_FIBERS = Options.FIBER_COROUTINES.load();

/**
Expand Down Expand Up @@ -1848,13 +1846,6 @@ private static int initGlobalJavaVersion() {
return Opcodes.V1_5;
}
}
public void setTruffleHooks(TruffleHooksStub truffleHooks) {
this.truffleHooks = truffleHooks;
}

public TruffleHooksStub getTruffleHooks() {
return truffleHooks;
}

@Deprecated
public void setSafeLevel(int safeLevel) {
Expand Down
Expand Up @@ -718,7 +718,7 @@ private void logScriptResolutionFailure(String path) {
public static void checkGraalVersion() {
if (Options.TRUFFLE_RUNTIME_VERSION_CHECK.load()) {
final String graalVersion = System.getProperty("graal.version", "unknown");
final String expectedGraalVersion = "0.6";
final String expectedGraalVersion = "0.7";

if (graalVersion.equals("unknown")) {
return;
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Expand Up @@ -145,6 +145,8 @@ public class Options {
public static final Option<String> TRUFFLE_TRANSLATOR_PRINT_PARSE_TREE = string(TRUFFLE, "truffle.translator.print_parse_trees", "", "Comma delimited list of method names to print the JRuby parse tree of before translation.");
public static final Option<Boolean> TRUFFLE_PANIC_ON_JAVA_ASSERT = bool(TRUFFLE, "truffle.debug.panic_on_java_assert", false, "Panic as soon as a Java assertion failure is found.");
public static final Option<Boolean> TRUFFLE_EXCEPTIONS_PRINT_JAVA = bool(TRUFFLE, "truffle.exceptions.print_java", false, "Print Java exceptions at the point of translating them to Ruby exceptions.");
public static final Option<Boolean> TRUFFLE_EXCEPTIONS_PRINT_UNCAUGHT_JAVA = bool(TRUFFLE, "truffle.exceptions.print_uncaught_java", false, "Print uncaught Java exceptions at the point of translating them to Ruby exceptions.");
public static final Option<Boolean> TRUFFLE_COVERAGE = bool(TRUFFLE, "truffle.coverage", false, "Enable coverage (will be enabled by default in the future - currently has some bugs");

public static final Option<Boolean> TRUFFLE_INLINER_ALWAYS_CLONE_YIELD = bool(TRUFFLE, "truffle.inliner.always_clone_yield", true, "Always clone yield call targets.");
public static final Option<Boolean> TRUFFLE_INLINER_ALWAYS_INLINE_YIELD = bool(TRUFFLE, "truffle.inliner.always_inline_yield", true, "Always inline yield call targets.");
Expand Down
19 changes: 19 additions & 0 deletions lib/ruby/truffle/truffle/coverage.rb
@@ -0,0 +1,19 @@
# Copyright (c) 2015 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

module Coverage

def self.start
Truffle::Primitive.coverage_start
end

def self.result
Truffle::Primitive.coverage_result
end

end
3 changes: 3 additions & 0 deletions spec/truffle/tags/core/string/strip_tags.txt
@@ -0,0 +1,3 @@
fails:String#strip returns a new string with leading and trailing whitespace removed
fails:String#strip returns a copy of self with trailing NULL bytes and whitespace
fails:String#strip taints the result when self is tainted
1 change: 0 additions & 1 deletion test/pom.rb
Expand Up @@ -309,7 +309,6 @@ def truffle_spec_config(spec_type, generate_report)
'<exec dir="${jruby.home}" executable="${jruby.home}/bin/jruby" failonerror="true">' +
'<arg value="-J-server" />' +
'<arg value="-X+T" />' +
'<arg value="-Xtruffle.debug.enable_assert_constant=true" />' +
'<arg value="test/truffle/pe/pe.rb" />' +
'</exec>' +
'</target>' ) ] )
Expand Down
1 change: 0 additions & 1 deletion test/pom.xml
Expand Up @@ -1009,7 +1009,6 @@
<exec failonerror="true" dir="${jruby.home}" executable="${jruby.home}/bin/jruby">
<arg value="-J-server" />
<arg value="-X+T" />
<arg value="-Xtruffle.debug.enable_assert_constant=true" />
<arg value="test/truffle/pe/pe.rb" />
</exec>
</target>
Expand Down
7 changes: 7 additions & 0 deletions test/truffle/cext/foo/ext/foo/add.c
@@ -0,0 +1,7 @@
#include <ruby.h>

#include "add.h"

VALUE add(VALUE self, VALUE a, VALUE b) {
return INT2NUM(NUM2INT(a) + NUM2INT(b));
}
1 change: 1 addition & 0 deletions test/truffle/cext/foo/ext/foo/add.h
@@ -0,0 +1 @@
VALUE add(VALUE self, VALUE a, VALUE b);
3 changes: 3 additions & 0 deletions test/truffle/cext/foo/ext/foo/extconf.rb
@@ -0,0 +1,3 @@
require 'mkmf'
$CFLAGS << ' -Wall'
create_makefile('foo/foo')
8 changes: 8 additions & 0 deletions test/truffle/cext/foo/ext/foo/foo.c
@@ -0,0 +1,8 @@
#include <ruby.h>

#include "add.h"

void Init_foo() {
VALUE Foo = rb_define_module("Foo");
rb_define_method(Foo, "add", add, 2);
}
7 changes: 7 additions & 0 deletions test/truffle/cext/inline.rb
@@ -0,0 +1,7 @@
p Truffle::CExt.supported?

Truffle::CExt.inline %{
#include <stdio.h>
}, %{
printf("Hello, World!\\n");
}
12 changes: 12 additions & 0 deletions test/truffle/cext/inline_capi.rb
@@ -0,0 +1,12 @@
p Truffle::CExt.supported?

Truffle::CExt.inline %{
VALUE add(VALUE self, VALUE a, VALUE b) {
return INT2NUM(NUM2INT(a) + NUM2INT(b));
}
}, %{
VALUE Test = rb_define_module("Test");
rb_define_method(Test, "add", add, 2);
}

p Test.add(14, 2)
7 changes: 7 additions & 0 deletions test/truffle/cext/inline_flags.rb
@@ -0,0 +1,7 @@
p Truffle::CExt.supported?

Truffle::CExt.inline %{
#include <stdio.h>
}, %{
printf("FOO was defined to be %d\\n", FOO);
}, %w(-DFOO=14)
5 changes: 5 additions & 0 deletions test/truffle/cext/require.rb
@@ -0,0 +1,5 @@
p Truffle::CExt.supported?

require 'foo/foo'

p Foo.add 14, 2
33 changes: 0 additions & 33 deletions test/truffle/pe/core/kernel/set_trace_func_pe.rb

This file was deleted.

4 changes: 2 additions & 2 deletions truffle/.factorypath
@@ -1,4 +1,4 @@
<factorypath>
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/truffle/0.6/truffle-0.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/truffle-dsl-processor/0.6/truffle-dsl-processor-0.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/truffle/0.7-SNAPSHOT/truffle-0.7-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/truffle-dsl-processor/0.7-SNAPSHOT/truffle-dsl-processor-0.7-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
</factorypath>
25 changes: 23 additions & 2 deletions truffle/pom.rb
Expand Up @@ -9,11 +9,17 @@
'tesla.dump.readonly' => true,

'jruby.basedir' => '${basedir}/..' )

repository( 'http://lafo.ssw.uni-linz.ac.at/nexus/content/repositories/releases/',
:id => 'truffle' ) do
releases 'true'
snapshots 'false'
end

jar 'org.jruby:jruby-core', '${project.version}', :scope => 'provided'

jar 'com.oracle:truffle:0.6'
jar 'com.oracle:truffle-dsl-processor:0.6', :scope => 'provided'
jar 'com.oracle:truffle:0.7'
jar 'com.oracle:truffle-dsl-processor:0.7', :scope => 'provided'

plugin( :compiler,
'encoding' => 'utf-8',
Expand Down Expand Up @@ -49,4 +55,19 @@
includes '**/*rb'
end
end

[ :dist, :'jruby-jars', :all, :release ].each do |name|
profile name do
plugin :shade do
execute_goals( 'shade',
:id => 'pack jruby-truffle-complete.jar',
:phase => 'verify',
:artifactSet => { :includes => [
'com.oracle:truffle',
'com.oracle:truffle-interop' ] },
:shadedArtifactAttached => 'true',
:shadedClassifierName => 'complete' )
end
end
end
end
134 changes: 132 additions & 2 deletions truffle/pom.xml
Expand Up @@ -24,15 +24,27 @@
<dependency>
<groupId>com.oracle</groupId>
<artifactId>truffle</artifactId>
<version>0.6</version>
<version>0.7</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>truffle-dsl-processor</artifactId>
<version>0.6</version>
<version>0.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>truffle</id>
<url>http://lafo.ssw.uni-linz.ac.at/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<build>
<defaultGoal>package</defaultGoal>
<resources>
Expand Down Expand Up @@ -96,4 +108,122 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dist</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
<include>com.oracle:truffle-interop</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jruby-jars</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
<include>com.oracle:truffle-interop</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>all</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
<include>com.oracle:truffle-interop</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
<include>com.oracle:truffle-interop</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

2 comments on commit ad4ba4b

@chrisseaton
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eregon @nirvdrum @bjfish

This merge updates us to the 0.7 version of the Truffle API. There are some significant changes, especially in the guard syntax and node copy constructors so you may want to browse and learn about them. There are some new features we aren't really using yet but will start to experiment with.

You may want to via the raw diff at https://github.com/jruby/jruby/commit/ad4ba4b4f8c5b54af2409314e8c8e6d582dfce40.diff rather than the GitHub UI, as it's so large.

I'm going to start a few days of big refactorings, now that we are merged and we no longer have branches with large diffs between them.

@nirvdrum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray. I should be able to finally move my JRuby src dir back to my encrypted home directory.

Please sign in to comment.