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</