Skip to content

Commit

Permalink
Showing 44 changed files with 138 additions and 174 deletions.
7 changes: 5 additions & 2 deletions ci.hocon
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
jt: [ruby, tool/jt.rb]

# Allow a version mismatch with truffle to prefer the language truffle version
clone_graal: [mx, --version-conflict-resolution, ignore, sclone, --kind, git]

common-setup: [
[mx, sclone, --kind, git, "https://github.com/jruby/jruby-build-pack.git", jruby-build-pack],
[cp, bin/jruby.bash, bin/jruby],
@@ -47,7 +50,7 @@ graal-core: {
[mv, mx.jruby, temp_mx],
[mkdir, graal-workspace],
[cd, graal-workspace],
[mx, sclone, --kind, git, "https://github.com/graalvm/graal-core.git", graal-core],
${clone_graal} ["https://github.com/graalvm/graal-core.git", graal-core],
[cd, graal-core],
[mx, sforceimports],
[mx, --java-home, "$JVMCI_JAVA_HOME", build],
@@ -75,7 +78,7 @@ graal-enterprise: {
[mv, mx.jruby, temp_mx],
[mkdir, graal-workspace],
[cd, graal-workspace],
[mx, sclone, --kind, git, "https://github.com/graalvm/graal-enterprise.git", graal-enterprise],
${clone_graal} ["https://github.com/graalvm/graal-enterprise.git", graal-enterprise],
[cd, graal-enterprise],
[mx, sforceimports],
[mx, --java-home, "$JVMCI_JAVA_HOME", build],
12 changes: 9 additions & 3 deletions core/src/main/java/org/jruby/RubyFixnum.java
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@
import org.jruby.util.ByteList;
import org.jruby.util.ConvertBytes;
import org.jruby.util.Numeric;
import org.jruby.util.cli.Options;

/**
* Implementation of the Fixnum class.
@@ -89,7 +90,8 @@ public static RubyClass createFixnumClass(Ruby runtime) {
public static final long MIN = -1 * MAX - 1;
public static final long MAX_MARSHAL_FIXNUM = (1L << 30) - 1; // 0x3fff_ffff
public static final long MIN_MARSHAL_FIXNUM = - (1L << 30); // -0x4000_0000
public static final int CACHE_OFFSET = 256;
public static final boolean USE_CACHE = Options.USE_FIXNUM_CACHE.load();
public static final int CACHE_OFFSET = Options.FIXNUM_CACHE_RANGE.load();

private static IRubyObject fixCoerce(IRubyObject x) {
do {
@@ -198,8 +200,8 @@ public BigInteger getBigIntegerValue() {
}

public static RubyFixnum newFixnum(Ruby runtime, long value) {
if (isInCacheRange(value)) {
return runtime.fixnumCache[(int) value + CACHE_OFFSET];
if (USE_CACHE && isInCacheRange(value)) {
return cachedFixnum(runtime, value);
}
return new RubyFixnum(runtime, value);
}
@@ -208,6 +210,10 @@ private static boolean isInCacheRange(long value) {
return value <= CACHE_OFFSET - 1 && value >= -CACHE_OFFSET;
}

private static RubyFixnum cachedFixnum(Ruby runtime, long value) {
return runtime.fixnumCache[(int) value + CACHE_OFFSET];
}

public RubyFixnum newFixnum(long newValue) {
return newFixnum(getRuntime(), newValue);
}
9 changes: 9 additions & 0 deletions core/src/main/java/org/jruby/RubyRegexp.java
Original file line number Diff line number Diff line change
@@ -329,6 +329,15 @@ public static RubyRegexp newRegexp(Ruby runtime, ByteList pattern, RegexpOptions
}
}

/**
* throws RaiseException on error so parser can pick this up and give proper line and line number
* error as opposed to any non-literal regexp creation which may raise a syntax error but will not
* have this extra source info in the error message
*/
public static RubyRegexp newRegexpParser(Ruby runtime, ByteList pattern, RegexpOptions options) {
return new RubyRegexp(runtime, pattern, (RegexpOptions)options.clone());
}

// used only by the compiler/interpreter (will set the literal flag)
public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options) {
try {
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/ext/thread/Mutex.java
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
* rights and limitations under the License.
*
* Copyright (C) 2006 MenTaLguY <mental@rydia.net>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -108,7 +108,7 @@ public synchronized IRubyObject unlock(ThreadContext context) {
if (!lock.isHeldByCurrentThread()) {
throw runtime.newThreadError("Mutex is not owned by calling thread");
}

boolean hasQueued = lock.hasQueuedThreads();
context.getThread().unlock(lock);
return hasQueued ? context.nil : this;
@@ -148,7 +148,7 @@ public IRubyObject sleep(ThreadContext context, IRubyObject timeout) {
public IRubyObject synchronize(ThreadContext context, Block block) {
lock(context);
try {
return block.yield(context, null);
return block.call(context);
} finally {
unlock(context);
}
@@ -164,5 +164,5 @@ private void checkRelocking(ThreadContext context) {
throw context.runtime.newThreadError("Mutex relocking by same thread");
}
}

}
10 changes: 8 additions & 2 deletions core/src/main/java/org/jruby/parser/ParserSupport.java
Original file line number Diff line number Diff line change
@@ -1337,7 +1337,7 @@ private char optionsEncodingChar(Encoding optionEncoding) {
public void compile_error(String message) { // mri: rb_compile_error_with_enc
String line = lexer.getCurrentLine();
ISourcePosition position = lexer.getPosition();
String errorMessage = lexer.getFile() + ":" + position.getLine() + ": ";
String errorMessage = lexer.getFile() + ":" + (position.getLine() + 1) + ": ";

if (line != null && line.length() > 5) {
boolean addNewline = message != null && ! message.endsWith("\n");
@@ -1384,7 +1384,13 @@ protected void checkRegexpSyntax(ByteList value, RegexpOptions options) {
// Joni doesn't support these modifiers - but we can fix up in some cases - let the error delay until we try that
if (stringValue.startsWith("(?u)") || stringValue.startsWith("(?a)") || stringValue.startsWith("(?d)"))
return;
RubyRegexp.newRegexp(getConfiguration().getRuntime(), value, options);

try {
// This is only for syntax checking but this will as a side-effect create an entry in the regexp cache.
RubyRegexp.newRegexpParser(getConfiguration().getRuntime(), value, (RegexpOptions)options.clone());
} catch (RaiseException re) {
compile_error(re.getMessage());
}
}

public Node newRegexpNode(ISourcePosition position, Node contents, RegexpNode end) {
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -167,6 +167,8 @@ public class Options {
public static final Option<Boolean> VOLATILE_VARIABLES = bool(MISCELLANEOUS, "volatile.variables", true, "Always ensure volatile semantics for instance variables.");
public static final Option<Boolean> RECORD_LEXICAL_HIERARCHY = bool(MISCELLANEOUS, "record.lexical.hierarchy", false, "Maintain children static scopes to support scope dumping.");
public static final Option<String> PREFERRED_PRNG = string(MISCELLANEOUS, "preferred.prng", "NativePRNGNonBlocking", "Maintain children static scopes to support scope dumping.");
public static final Option<Boolean> USE_FIXNUM_CACHE = bool(MISCELLANEOUS, "fixnum.cache", true, "Use a cache of low-valued Fixnum objects.");
public static final Option<Integer> FIXNUM_CACHE_RANGE = integer(MISCELLANEOUS, "fixnum.cache.size", 256, "Values to retrieve from Fixnum cache, in the range -X..(X-1).");

public static final Option<Boolean> DEBUG_LOADSERVICE = bool(DEBUG, "debug.loadService", false, "Log require/load file searches.");
public static final Option<Boolean> DEBUG_LOADSERVICE_TIMING = bool(DEBUG, "debug.loadService.timing", false, "Log require/load parse+evaluate times.");
2 changes: 1 addition & 1 deletion core/src/main/ruby/jruby/kernel/kernel.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ def require_relative(relative_arg)

absolute_feature = File.expand_path(relative_arg, File.dirname(File.realpath(file)))

require absolute_feature
::Kernel.require absolute_feature
end

def exec(*args)
Original file line number Diff line number Diff line change
@@ -68,6 +68,3 @@ ActionController::LiveStreamTest:
- test_exception_callback_when_committed
- test_async_stream # fails on travis
- test_abort_with_full_buffer # fails intermittently on CI
ApplicationIntegrationTest:
- test_missing_route_helper_after_controller_access
- test_missing_route_helper_before_controller_access
2 changes: 1 addition & 1 deletion lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
Original file line number Diff line number Diff line change
@@ -400,7 +400,7 @@ def initialize(argv, options = {})

def run
Dir.chdir @options[:global][:dir] do
log "executing #{@subcommand}"
log format 'executing "%s" command', @subcommand
send "subcommand_#{@subcommand}", @argv_after_subcommand
end
end
2 changes: 1 addition & 1 deletion mx.jruby/mx_jruby.py
Original file line number Diff line number Diff line change
@@ -654,7 +654,7 @@ def benchmarks(self):
return ['optcarrot']

def time(self):
return 120
return 200

synthetic_benchmarks = [
'acid'
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/read_nonblock_tags.txt
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ fails:ARGF.read_nonblock reads the contents of a special device file
fails:ARGF.read_nonblock reads up to the given amount of bytes
fails:ARGF.read_nonblock reads up to the given bytes from STDIN
fails:ARGF.read_nonblock reads up to the given bytes from a file when a file and STDIN are present
fails:ARGF.read_nonblock raises IO::EAGAINWaitReadable when STDIN is empty
fails:ARGF.read_nonblock returns :wait_readable when the :exception is set to false
fails:ARGF.read_nonblock when using multiple files reads up to the given amount of bytes from the first file
fails:ARGF.read_nonblock when using multiple files returns an empty String when reading after having read the first file in its entirety
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/readline_tags.txt
Original file line number Diff line number Diff line change
@@ -2,4 +2,3 @@ fails:ARGF.readline sets $_ global variable with each line read
fails:ARGF.readline modifies the files when in place edit mode is on
fails:ARGF.readline modifies and backups two files when in place edit mode is on
slow:ARGF.readline reads all lines of stdin
fails:ARGF.readline reads all lines of stdin
1 change: 0 additions & 1 deletion spec/truffle/tags/core/file/dirname_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:File.dirname returns all the components of filename except the last one
fails(windows):File.dirname returns all the components of filename except the last one (edge cases on windows)
fails(windows):File.dirname returns the return all the components of filename except the last one (Windows format)
fails(windows):File.dirname returns the return all the components of filename except the last one (windows unc)
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/io/close_read_tags.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
fails:IO#close_read closes the read end of a duplex I/O stream
fails:IO#close_read raises an IOError on subsequent invocations
fails:IO#close_read allows subsequent invocation of close
fails:IO#close_read raises an IOError if the stream is writable and not duplexed
fails:IO#close_read closes the stream if it is neither writable nor duplexed
fails:IO#close_read raises IOError on closed stream
fails:IO#close_read doesn't raise an IOError on subsequent invocations
fails:IO#close_read doesn't raise IOError on closed stream
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/io/close_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
fails:IO#close on an IO.popen stream clears #pid
fails:IO#close on an IO.popen stream sets $?
fails:IO#close on an IO.popen stream waits for the child to exit
fails:IO#close does not raise anything when self was already closed
fails:IO#close does nothing if already closed
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/io/close_write_tags.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
fails:IO#close_write closes the write end of a duplex I/O stream
fails:IO#close_write raises an IOError on subsequent invocations
fails:IO#close_write allows subsequent invocation of close
fails:IO#close_write raises an IOError if the stream is readable and not duplexed
fails:IO#close_write closes the stream if it is neither readable nor duplexed
fails:IO#close_write flushes and closes the write stream
fails:IO#close_write raises IOError on closed stream
fails:IO#close_write doesn't raise an IOError on subsequent invocations
fails:IO#close_write doesn't raise IOError on closed stream
25 changes: 0 additions & 25 deletions spec/truffle/tags/core/io/copy_stream_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/autoload_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
slow:Kernel#autoload when Object is frozen raises a RuntimeError before defining the constant
fails:Kernel#autoload when Object is frozen raises a RuntimeError before defining the constant
1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/binding_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/caller_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:Kernel#caller returns an Array of caller locations using a custom offset
fails:Kernel#caller returns the locations as String instances
6 changes: 0 additions & 6 deletions spec/truffle/tags/core/kernel/exec_tags.txt
Original file line number Diff line number Diff line change
@@ -64,9 +64,3 @@ slow:Kernel.exec with a command array uses the first element as the command name
slow:Kernel.exec with a command array coerces the argument using to_ary
slow:Kernel.exec with a command array raises an ArgumentError if the Array does not have exactly two elements
slow:Kernel.exec with an options Hash with Integer option keys maps the key to a file descriptor in the child that inherits the file descriptor from the parent specified by the value
fails:Kernel#exec flushes STDOUT upon exit when it's not set to sync
fails:Kernel#exec flushes STDERR upon exit when it's not set to sync
fails:Kernel#exec with multiple arguments does not subject the arguments to shell expansion
fails:Kernel.exec flushes STDOUT upon exit when it's not set to sync
fails:Kernel.exec flushes STDERR upon exit when it's not set to sync
fails:Kernel.exec with multiple arguments does not subject the arguments to shell expansion
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/kernel/extend_tags.txt

This file was deleted.

4 changes: 0 additions & 4 deletions spec/truffle/tags/core/kernel/fail_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/lambda_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:Kernel.lambda raises an ArgumentError when no block is given
fails:Kernel.lambda allows long returns to flow through it
1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/local_variables_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:Kernel#local_variables is a private method
fails:Kernel#local_variables is accessible from bindings
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/kernel/method_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
fails:Kernel#method returns a method object if we repond_to_missing? method
fails:Kernel#method will see an alias of the original method as == when in a derived class
fails:Kernel#method can be called even if we only repond_to_missing? method, true
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/kernel/open_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/kernel/p_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/printf_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:Kernel.printf writes to stdout when a string is the first argument
fails:Kernel.printf calls write on the first argument when it is not a string
18 changes: 0 additions & 18 deletions spec/truffle/tags/core/kernel/require_relative_tags.txt
Original file line number Diff line number Diff line change
@@ -4,25 +4,7 @@ fails:Kernel#require_relative with a relative path calls #to_str on non-String o
fails:Kernel#require_relative with a relative path raises a TypeError if #to_str does not return a String
fails:Kernel#require_relative with a relative path calls #to_path on non-String objects
fails:Kernel#require_relative with a relative path calls #to_str on non-String objects returned by #to_path
fails:Kernel#require_relative with a relative path when file is a symlink loads a path relative to current file
fails:Kernel#require_relative with a relative path (file extensions) loads a .rb extensioned file when passed a non-extensioned path
fails:Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a .rb extensioned file is already loaded
fails:Kernel#require_relative with a relative path (file extensions) loads a .rb extensioned file when passed a non-.rb extensioned path
fails:Kernel#require_relative with a relative path (file extensions) loads a .rb extensioned file when a complex-extensioned C-extension file of the same name is loaded
fails:Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
fails:Kernel#require_relative with an absolute path stores the missing path in a LoadError object
fails:Kernel#require_relative with an absolute path calls #to_str on non-String objects
fails:Kernel#require_relative with an absolute path raises a TypeError if #to_str does not return a String
fails:Kernel#require_relative with an absolute path calls #to_path on non-String objects
fails:Kernel#require_relative with an absolute path calls #to_str on non-String objects returned by #to_path
fails:Kernel#require_relative with an absolute path (file extensions) loads a .rb extensioned file when passed a non-extensioned path
fails:Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a .rb extensioned file is already loaded
fails:Kernel#require_relative with an absolute path (file extensions) loads a .rb extensioned file when passed a non-.rb extensioned path
fails:Kernel#require_relative with an absolute path (file extensions) loads a .rb extensioned file when a complex-extensioned C-extension file of the same name is loaded
fails:Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
fails:Kernel#require_relative with an absolute path ($LOAD_FEATURES) does not store the path if the load fails
fails:Kernel#require_relative with an absolute path ($LOAD_FEATURES) does not load an absolute path that is already stored
fails:Kernel#require_relative with an absolute path ($LOAD_FEATURES) adds the suffix of the resolved filename
fails:Kernel#require_relative with a relative path ($LOADED_FEATURES) does not store the path if the load fails
fails:Kernel#require_relative with a relative path ($LOADED_FEATURES) does not load an absolute path that is already stored
fails:Kernel#require_relative with a relative path ($LOADED_FEATURES) adds the suffix of the resolved filename
26 changes: 0 additions & 26 deletions spec/truffle/tags/core/kernel/require_tags.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,20 @@
fails:Kernel#require (path resolution) calls #to_path on non-String objects
fails:Kernel#require (path resolution) does not require file twice after $LOAD_PATH change
fails:Kernel#require (path resolution) with an unreadable file raises a LoadError
fails:Kernel#require (file extensions) loads a .rb extensioned file when a C-extension file of the same name is loaded
fails:Kernel#require (file extensions) does not load a C-extension file if a .rb extensioned file is already loaded
fails:Kernel#require (file extensions) loads a .rb extensioned file when a complex-extensioned C-extension file of the same name is loaded
fails:Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
fails:Kernel#require ($LOAD_FEATURES) does not load a ./ relative path that is already stored
fails:Kernel#require ($LOAD_FEATURES) does not load a ../ relative path that is already stored
fails:Kernel#require ($LOAD_FEATURES) does not load a non-canonical path that is already stored
fails:Kernel#require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES loads a .rb extensioned file when a non extensioned file is in $LOADED_FEATURES
fails:Kernel#require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES loads a .rb extensioned file from a subdirectory
fails:Kernel#require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES returns false if the file is not found
fails:Kernel#require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES returns false when passed a path and the file is not found
fails:Kernel#require (shell expansion) performs tilde expansion on a .rb file before storing paths in $LOADED_FEATURES
fails:Kernel#require (shell expansion) performs tilde expansion on a non-extensioned file before storing paths in $LOADED_FEATURES
fails:Kernel.require (path resolution) calls #to_path on non-String objects
fails:Kernel.require (path resolution) does not require file twice after $LOAD_PATH change
fails:Kernel.require (path resolution) with an unreadable file raises a LoadError
fails:Kernel.require (file extensions) loads a .rb extensioned file when passed a non-extensioned path
fails:Kernel.require (file extensions) loads a .rb extensioned file when a C-extension file of the same name is loaded
fails:Kernel.require (file extensions) does not load a C-extension file if a .rb extensioned file is already loaded
fails:Kernel.require (file extensions) loads a .rb extensioned file when passed a non-.rb extensioned path
fails:Kernel.require (file extensions) loads a .rb extensioned file when a complex-extensioned C-extension file of the same name is loaded
fails:Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
fails:Kernel.require ($LOAD_FEATURES) does not load a ./ relative path that is already stored
fails:Kernel.require ($LOAD_FEATURES) does not load a ../ relative path that is already stored
fails:Kernel.require ($LOAD_FEATURES) does not load a non-canonical path that is already stored
fails:Kernel.require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES loads a .rb extensioned file when a non extensioned file is in $LOADED_FEATURES
fails:Kernel.require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES loads a .rb extensioned file from a subdirectory
fails:Kernel.require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES returns false if the file is not found
fails:Kernel.require ($LOAD_FEATURES) when a non-extensioned file is in $LOADED_FEATURES returns false when passed a path and the file is not found
fails:Kernel.require (shell expansion) performs tilde expansion on a .rb file before storing paths in $LOADED_FEATURES
fails:Kernel.require (shell expansion) performs tilde expansion on a non-extensioned file before storing paths in $LOADED_FEATURES
fails:Kernel#require stores the missing path in a LoadError object
fails:Kernel.require stores the missing path in a LoadError object
fails:Kernel#require (concurrently) blocks a second thread from returning while the 1st is still requiring
fails:Kernel.require (concurrently) blocks a second thread from returning while the 1st is still requiring
fails:Kernel#require (concurrently) blocks based on the path
fails:Kernel.require (concurrently) blocks based on the path
fails:Kernel#require (concurrently) allows a 2nd require if the 1st raised an exception
fails:Kernel.require (concurrently) allows a 2nd require if the 1st raised an exception
fails:Kernel#require (concurrently) blocks a 3rd require if the 1st raises an exception and the 2nd is still running
fails:Kernel.require (concurrently) blocks a 3rd require if the 1st raises an exception and the 2nd is still running
slow:Kernel#require (concurrently) blocks based on the path
slow:Kernel.require (concurrently) blocks based on the path
2 changes: 1 addition & 1 deletion spec/truffle/tags/core/kernel/spawn_tags.txt
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ fails:Kernel.spawn with multiple arguments raises an ArgumentError if an argumen
fails:Kernel.spawn with a command array raises an ArgumentError if the Strings in the Array include a null byte
fails:Kernel.spawn when passed :chdir changes to the directory passed for :chdir
fails:Kernel.spawn when passed :chdir calls #to_path to convert the :chdir value
fails:Kernel#spawn with Integer option keys maps the key to a file descriptor in the child that inherits the file descriptor from the parent specified by the value
fails:Kernel.spawn with Integer option keys maps the key to a file descriptor in the child that inherits the file descriptor from the parent specified by the value
fails(windows):Kernel#spawn raises an ArgumentError if given :pgroup option
fails(windows):Kernel.spawn raises an ArgumentError if given :pgroup option
@@ -120,3 +119,4 @@ slow:Kernel.spawn uses the current working directory as its working directory
slow:Kernel.spawn uses the current umask by default
slow:Kernel.spawn when passed close_others: false closes file descriptors >= 3 in the child process because they are set close_on_exec by default
slow:Kernel.spawn when passed close_others: false does not close file descriptors >= 3 in the child process if fds are set close_on_exec=false
slow:Kernel#spawn with Integer option keys maps the key to a file descriptor in the child that inherits the file descriptor from the parent specified by the value
1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/syscall_tags.txt

This file was deleted.

8 changes: 4 additions & 4 deletions spec/truffle/tags/core/kernel/system_tags.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
fails:Kernel#system executes the specified command in a subprocess
fails:Kernel#system returns false when the command exits with a non-zero exit status
fails:Kernel#system returns nil when command execution fails
fails:Kernel#system does not write to stderr when command execution fails
fails:Kernel#system executes with `sh` if the command contains shell characters
fails:Kernel#system ignores SHELL env var and always uses `sh`
fails:Kernel#system expands shell variables when given a single string argument
fails:Kernel#system does not expand shell variables when given multiples arguments
fails:Kernel.system executes the specified command in a subprocess
fails:Kernel.system returns false when the command exits with a non-zero exit status
fails:Kernel.system returns nil when command execution fails
@@ -16,3 +12,7 @@ fails:Kernel.system expands shell variables when given a single string argument
fails:Kernel.system does not expand shell variables when given multiples arguments
slow:Kernel#system returns true when the command exits with a zero exit status
slow:Kernel.system returns true when the command exits with a zero exit status
slow:Kernel#system executes the specified command in a subprocess
slow:Kernel#system returns false when the command exits with a non-zero exit status
slow:Kernel#system expands shell variables when given a single string argument
slow:Kernel#system does not expand shell variables when given multiples arguments
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/kernel/test_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/untrace_var_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/kernel/warn_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/range/each_tags.txt

This file was deleted.

4 changes: 4 additions & 0 deletions test/truffle/cexts/ruby-argon2/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARGON2_HOME = ARGV[0]
ENV['TEST_CHECKS'] = '1'

require "#{ARGON2_HOME}/test/jruby+truffle/run"
54 changes: 37 additions & 17 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
JDEBUG_TEST = "-Dmaven.surefire.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=#{JDEBUG_PORT} -Xnoagent -Djava.compiler=NONE"
JEXCEPTION = "-Xtruffle.exceptions.print_java=true"
METRICS_REPS = 10
CEXTC_CONF_FILE = '.jruby-cext-build.yml'

VERBOSE = ENV.include? 'V'

@@ -314,6 +315,9 @@ def printable_cmd(args)
if Hash === args.first
env, *args = args
end
if Hash === args.last && args.last.empty?
*args, options = args
end
env = env.map { |k,v| "#{k}=#{shellescape(v)}" }.join(' ')
args = args.map { |a| shellescape(a) }.join(' ')
env.empty? ? args : "#{env} #{args}"
@@ -333,6 +337,14 @@ def shellescape(str)
end
end

def replace_env_vars(string, env = ENV)
string.gsub(/\$([A-Z_]+)/) {
var = $1
abort "You need to set $#{var}" unless env[var]
env[var]
}
end

def sh(*args)
Dir.chdir(JRUBY_DIR) do
raw_sh(*args)
@@ -651,25 +663,30 @@ def cextc(cext_dir, *clang_opts)
cextc ruby_cext_api
end

config_file = File.join(cext_dir, '.jruby-cext-build.yml')

config_file = File.join(cext_dir, CEXTC_CONF_FILE)
unless File.exist?(config_file)
abort "There is no .jruby-cext-build.yml in #{cext_dir} at the moment - I don't know how to build it"
abort "There is no #{CEXTC_CONF_FILE} in #{cext_dir} at the moment - I don't know how to build it"
end

config = YAML.load_file(config_file)
config_src = config['src']

if config_src.start_with?('$GEM_HOME/')
abort 'You need to set $GEM_HOME' unless ENV['GEM_HOME']
src = Dir[ENV['GEM_HOME'] + config_src['$GEM_HOME'.size..-1]]
else
src = Dir[File.join(cext_dir, config_src)]
end
src = replace_env_vars(config['src'])
src = File.expand_path(src, cext_dir)
src = Dir[src]

config_cflags = config['cflags'] || ''
config_cflags = `echo #{config_cflags}`.strip
config_cflags = config_cflags.split(' ')
config_cflags = replace_env_vars(config_cflags)
config_cflags = config_cflags.split
# Expand include paths
config_cflags.map! { |cflag|
if cflag.start_with? '-I'
inc = File.expand_path(cflag[2..-1], cext_dir)
"-I#{inc}"
else
cflag
end
}

out = File.expand_path(config['out'], cext_dir)

@@ -685,7 +702,7 @@ def cextc(cext_dir, *clang_opts)
end

config_libs = config['libs'] || ''
config_libs = `echo #{config_libs}`.strip
config_libs = replace_env_vars(config_libs)
config_libs = config_libs.split(' ')

if MAC
@@ -838,17 +855,20 @@ def test_cexts(*args)
[
['oily_png', ['chunky_png-1.3.6', 'oily_png-1.2.0'], ['oily_png']],
['psd_native', ['chunky_png-1.3.6', 'oily_png-1.2.0', 'bindata-2.3.1', 'hashie-3.4.4', 'psd-enginedata-1.1.1', 'psd-2.1.2', 'psd_native-1.1.3'], ['oily_png', 'psd_native']],
['nokogiri', [], ['nokogiri']]
].each do |gem_name, dependencies, libs|
['nokogiri', [], ['nokogiri']],
['ruby-argon2', [], [], "#{ENV['GEM_HOME']}/bundler/gems/ruby-argon2-5a527075e88b"]
].each do |gem_name, dependencies, libs, gem_root|
next if gem_name == 'nokogiri' # nokogiri totally excluded
next if gem_name == 'nokogiri' && no_libxml
config = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
cextc config, '-Werror=implicit-function-declaration'
unless gem_root and File.exist?(File.join(gem_root, CEXTC_CONF_FILE))
gem_root = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
end
cextc gem_root, '-Werror=implicit-function-declaration'
next if gem_name == 'psd_native' # psd_native is excluded just for running
run '--graal',
*dependencies.map { |d| "-I#{ENV['GEM_HOME']}/gems/#{d}/lib" },
*libs.map { |l| "-I#{JRUBY_DIR}/test/truffle/cexts/#{l}/lib" },
"#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}/test.rb"
"#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}/test.rb", gem_root
end
end
private :test_cexts
Original file line number Diff line number Diff line change
@@ -14,8 +14,12 @@
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.CreateCast;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.FrameInstance;
import com.oracle.truffle.api.frame.FrameInstanceVisitor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeUtil;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.Source;
@@ -37,6 +41,7 @@
import org.jruby.truffle.language.NotProvided;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyRootNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.language.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.language.dispatch.DispatchHeadNodeFactory;
@@ -47,7 +52,6 @@
import org.jruby.truffle.language.methods.InternalMethod;
import org.jruby.truffle.language.methods.UnsupportedOperationBehavior;
import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.AllocateObjectNodeGen;
import org.jruby.truffle.language.parser.ParserContext;
import org.jruby.truffle.language.supercall.SuperCallNode;
import org.jruby.truffle.language.yield.YieldNode;
@@ -311,20 +315,45 @@ private Object methodMissing(Object self, DynamicObject nameObject, Object[] arg
@TruffleBoundary
private DynamicObject buildMethodMissingException(Object self, DynamicObject nameObject, Object[] args, DynamicObject block) {
final String name = nameObject.toString();
final FrameInstance relevantCallerFrame = getRelevantCallerFrame();

if (lastCallWasSuper()) {
if (lastCallWasSuper(relevantCallerFrame)) {
return coreExceptions().noSuperMethodError(name, self, args, this);
} else if (lastCallWasCallingPrivateMethod(self, name)) {
return coreExceptions().privateMethodError(name, self, args, this);
} else if (lastCallWasVCall()) {
} else if (lastCallWasVCall(relevantCallerFrame)) {
return coreExceptions().nameErrorUndefinedLocalVariableOrMethod(name, self, this);
} else {
return coreExceptions().noMethodErrorOnReceiver(name, self, args, this);
}
}

private boolean lastCallWasSuper() {
final SuperCallNode superCallNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), SuperCallNode.class);
private FrameInstance getRelevantCallerFrame() {
return Truffle.getRuntime().iterateFrames(new FrameInstanceVisitor<FrameInstance>() {
@Override
public FrameInstance visitFrame(FrameInstance frameInstance) {
final Node callNode = frameInstance.getCallNode();
if (callNode == null) {
// skip current frame
return null;
}

final SuperCallNode superCallNode = NodeUtil.findParent(callNode, SuperCallNode.class);
final Frame frame = frameInstance.getFrame(FrameInstance.FrameAccess.READ_ONLY, true);
final String superMethodName = RubyArguments.getMethod(frame).getName();

if (superCallNode != null && superMethodName.equals("method_missing")) {
// skip super calls of method_missing itself
return null;
}

return frameInstance;
}
});
}

private boolean lastCallWasSuper(FrameInstance callerFrame) {
final SuperCallNode superCallNode = NodeUtil.findParent(callerFrame.getCallNode(), SuperCallNode.class);
return superCallNode != null;
}

@@ -337,8 +366,8 @@ private boolean lastCallWasCallingPrivateMethod(Object self, String name) {
return method != null && !method.isUndefined();
}

private boolean lastCallWasVCall() {
final RubyCallNode callNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), RubyCallNode.class);
private boolean lastCallWasVCall(FrameInstance callerFrame) {
final RubyCallNode callNode = NodeUtil.findParent(callerFrame.getCallNode(), RubyCallNode.class);
return callNode != null && callNode.isVCall();
}

Original file line number Diff line number Diff line change
@@ -186,7 +186,11 @@ private TruffleObject getInitFunction(final String expandedPath) {
final Object initFunction = getContext().getEnv().importSymbol("@Init_" + getBaseName(expandedPath));

if (!(initFunction instanceof TruffleObject)) {
throw new UnsupportedOperationException();
if (initFunction == null) {
throw new UnsupportedOperationException("initFunction was null!");
} else {
throw new UnsupportedOperationException("initFunction is not a TruffleObject but a " + initFunction.getClass());
}
}

return (TruffleObject) initFunction;
Original file line number Diff line number Diff line change
@@ -164,24 +164,29 @@ public DynamicObject translate(Throwable throwable) {
throwable.printStackTrace();
}

final String message;
final String message = throwable.getMessage();
final String reportedMessage;

if (throwable.getMessage() != null && throwable.getMessage().startsWith("LLVM error")) {
message = throwable.getMessage();
if (message != null && message.startsWith("LLVM error")) {
reportedMessage = message;
} else {
final StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(throwable.getClass().getSimpleName());
messageBuilder.append(" ");
messageBuilder.append(throwable.getMessage());
if (message != null) {
messageBuilder.append(message);
} else {
messageBuilder.append("<no message>");
}

if (throwable.getStackTrace().length > 0) {
messageBuilder.append(" ");
messageBuilder.append(throwable.getStackTrace()[0].toString());
}
message = messageBuilder.toString();
reportedMessage = messageBuilder.toString();
}

return coreExceptions().internalError(message, this, throwable);
return coreExceptions().internalError(reportedMessage, this, throwable);
}

}
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@ public SuperCallNode(RubyContext context, SourceSection sourceSection, RubyNode
this.callMethodNode = CallInternalMethodNodeGen.create(context, sourceSection, null, new RubyNode[] {});
}

@ExplodeLoop
@Override
public final Object execute(VirtualFrame frame) {
final Object self = RubyArguments.getSelf(frame);

0 comments on commit 84edb23

Please sign in to comment.