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
Loading

0 comments on commit 84edb23

Please sign in to comment.