Skip to content

Commit

Permalink
Showing 9 changed files with 64 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -36,10 +36,10 @@ matrix:
include:
- env: COMMAND=test/check_versions.sh
jdk: oraclejdk8
allow_failures:
- env: PHASE='-Prake -Dtask=test:mri:fullint'
- env: JT=check_ambiguous_arguments
jdk: oraclejdk8
allow_failures:
- env: PHASE='-Prake -Dtask=test:mri:fullint'
# NOTE: build seems to never start (waited for any to finish for more than a day) - probably a travis-ci bug
#- env: PHASE='-Pmain'
# sudo: required
24 changes: 14 additions & 10 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -59,8 +59,13 @@ def self.find_graal_js
raise "couldn't find trufflejs.jar - download GraalVM as described in https://github.com/jruby/jruby/wiki/Downloading-GraalVM and find it in there"
end

def self.jruby_eclipse?
# tool/jruby_eclipse only works on release currently
ENV["JRUBY_ECLIPSE"] == "true" && Utilities.git_branch == "master"
end

def self.find_jruby
if USE_JRUBY_ECLIPSE
if jruby_eclipse?
"#{JRUBY_DIR}/tool/jruby_eclipse"
elsif ENV['RUBY_BIN']
ENV['RUBY_BIN']
@@ -69,7 +74,7 @@ def self.find_jruby
end
end

def self.find_jruby_dir
def self.find_jruby_bin_dir
File.dirname(find_jruby)
end

@@ -211,7 +216,7 @@ def mspec(command, *args)
command, *args = args
end

if USE_JRUBY_ECLIPSE
if Utilities.jruby_eclipse?
args.unshift "-ttool/jruby_eclipse"
end

@@ -424,7 +429,7 @@ def test_mri(*args)
def test_compiler(*args)
env_vars = {}
env_vars["JAVACMD"] = Utilities.find_graal unless args.delete('--no-java-cmd')
env_vars["PATH"] = "#{Utilities.find_jruby_dir}:#{ENV["PATH"]}"
env_vars["PATH"] = "#{Utilities.find_jruby_bin_dir}:#{ENV["PATH"]}"
Dir["#{JRUBY_DIR}/test/truffle/compiler/*.sh"].each do |test_script|
sh env_vars, test_script
end
@@ -434,7 +439,7 @@ def test_compiler(*args)
def test_integration(*args)
no_gems = args.delete('--no-gems')
env_vars = {}
env_vars["PATH"] = "#{Utilities.find_jruby_dir}:#{ENV["PATH"]}"
env_vars["PATH"] = "#{Utilities.find_jruby_bin_dir}:#{ENV["PATH"]}"

test_names = if args.empty?
'*'
@@ -739,6 +744,8 @@ def log(tty_message, full_message)

def check_ambiguous_arguments
ENV.delete "JRUBY_ECLIPSE" # never run from the Eclipse launcher here
clean
# modify pom
pom = "#{JRUBY_DIR}/truffle/pom.rb"
contents = File.read(pom)
contents.gsub!(/^(\s+)'source'\s*=>.+'1.7'.+,\n\s+'target'\s*=>.+\s*'1.7.+,\n/) do
@@ -749,8 +756,8 @@ def check_ambiguous_arguments
"#{$1}#{$2},\n#{$1}'-parameters'#{$3}"
end
File.write pom, contents
FileUtils::Verbose.rm_r "#{JRUBY_DIR}/truffle/target/classes"
build('truffle')

build
run({ "TRUFFLE_CHECK_AMBIGUOUS_OPTIONAL_ARGS" => "true" }, '-e', 'exit')
end

@@ -825,7 +832,4 @@ def main(args)
end
end

# tool/jruby_eclipse only works on release currently
USE_JRUBY_ECLIPSE = ENV["JRUBY_ECLIPSE"] == "true" && Utilities.git_branch == "master"

JT.new.main(ARGV)
Original file line number Diff line number Diff line change
@@ -37,23 +37,21 @@ public Rope getRope() {
CompilerDirectives.transferToInterpreterAndInvalidate();
rope = createRope();
}

return rope;
}

public DynamicObject createInstance() {
return StringOperations.createString(context, getRope());
}

private Rope createRope() {
// getRope is fully synchronised and returns identically the same object for the same parameters

// RopeTable.getRope is fully synchronized and returns the same object for equivalent parameters
return context.getRopeTable().getRope(
literal.getBytes(StandardCharsets.US_ASCII),
ASCIIEncoding.INSTANCE,
CodeRange.CR_7BIT);
}

public DynamicObject createInstance() {
return StringOperations.createString(context, getRope());
}

private static boolean is7Bit(String literal) {
for (int n = 0; n < literal.length(); n++) {
if (literal.charAt(n) > 0b1111111) {
Original file line number Diff line number Diff line change
@@ -265,11 +265,4 @@ public static boolean isInfinity(double value) {
return Double.isInfinite(value);
}

// Operations

@TruffleBoundary
public static boolean updateShape(DynamicObject object) {
return object.updateShape();
}

}
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.language.objects;

import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;
@@ -19,6 +20,7 @@
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.language.RubyNode;

@ImportStatic(ShapeCachingGuards.class)
@NodeChild(value="object", type=RubyNode.class)
public abstract class LogicalClassNode extends RubyNode {

Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.language.objects;

import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;
@@ -19,6 +20,7 @@
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.language.RubyNode;

@ImportStatic(ShapeCachingGuards.class)
@NodeChild(value="object", type=RubyNode.class)
public abstract class MetaClassNode extends RubyNode {

Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyGuards;

@ImportStatic(RubyGuards.class)
@ImportStatic({ RubyGuards.class, ShapeCachingGuards.class })
public abstract class ReadObjectFieldNode extends Node {
private final RubyContext context;
private final Object defaultValue;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2015, 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.language.objects;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.Shape;
import org.jruby.truffle.core.Layouts;

public abstract class ShapeCachingGuards {

public static boolean updateShape(DynamicObject object) {
CompilerDirectives.transferToInterpreter();
return object.updateShape();
}

public static boolean isArrayShape(Shape shape) {
return Layouts.ARRAY.isArray(shape.getObjectType());
}

public static boolean isQueueShape(Shape shape) {
return Layouts.QUEUE.isQueue(shape.getObjectType());
}

public static boolean isBasicObjectShape(Shape shape) {
return shape.getObjectType().getClass().getName().endsWith(".BasicObjectType"); // FIXME
}

}
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyGuards;

@ImportStatic(RubyGuards.class)
@ImportStatic({ RubyGuards.class, ShapeCachingGuards.class })
public abstract class WriteObjectFieldNode extends Node {

private final RubyContext context;

0 comments on commit 71adf52

Please sign in to comment.