Skip to content

Commit

Permalink
Showing 48 changed files with 399 additions and 878 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.1.0.0-SNAPSHOT
9.1.0.0
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ DO NOT MODIFIY - GENERATED CODE
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.1.0.0-SNAPSHOT</version>
<version>9.1.0.0</version>
</parent>
<artifactId>jruby-core</artifactId>
<name>JRuby Core</name>
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -1530,7 +1530,7 @@ public RubyFixnum pos(ThreadContext context) {
boolean locked = fptr.lock();
try {
long pos = fptr.tell(context);
if (pos < 0 && fptr.errno() != null) throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
if (pos == -1 && fptr.errno() != null) throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
pos -= fptr.rbuf.len;
return context.runtime.newFixnum(pos);
} finally {
@@ -1550,7 +1550,7 @@ public RubyFixnum pos_set(ThreadContext context, IRubyObject offset) {
boolean locked = fptr.lock();
try {
pos = fptr.seek(context, pos, PosixShim.SEEK_SET);
if (pos < 0 && fptr.errno() != null) throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
if (pos == -1 && fptr.errno() != null) throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
} finally {
if (locked) fptr.unlock();
}
@@ -1733,7 +1733,7 @@ public RubyFixnum rewind(ThreadContext context) {
fptr = getOpenFileChecked();
boolean locked = fptr.lock();
try {
if (fptr.seek(context, 0L, 0) < 0 && fptr.errno() != null)
if (fptr.seek(context, 0L, 0) == -1 && fptr.errno() != null)
throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
RubyArgsFile.ArgsFileData data = RubyArgsFile.ArgsFileData.getDataFrom(runtime.getArgsFile());
if (this == data.currentFile) {
@@ -1887,7 +1887,7 @@ public IRubyObject initialize_copy(IRubyObject _io){
fd = orig.fd().dup();
fptr.setFD(fd);
pos = orig.tell(context);
if (0 <= pos)
if (pos == -1)
fptr.seek(context, pos, PosixShim.SEEK_SET);
} finally {
if (locked2) fptr.unlock();
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/JRubyPOSIXHandler.java
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public void error(Errno error, String methodName, String extraData) {
}

public void unimplementedError(String method) {
throw runtime.newNotImplementedError(method + " unsupported or native support failed to load");
throw runtime.newNotImplementedError(method + " unsupported or native support failed to load; see http://wiki.jruby.org/Native-Libraries");
}

public void warn(WARNING_ID id, String message, Object... data) {
26 changes: 12 additions & 14 deletions core/src/main/java/org/jruby/ir/interpreter/InterpreterContext.java
Original file line number Diff line number Diff line change
@@ -24,12 +24,12 @@ public class InterpreterContext {
protected Instr[] instructions;

// Cached computed fields
private final boolean hasExplicitCallProtocol;
private final boolean pushNewDynScope;
private final boolean reuseParentDynScope;
private final boolean popDynScope;
private final boolean receivesKeywordArguments;
private final boolean metaClassBodyScope;
private boolean hasExplicitCallProtocol;
private boolean pushNewDynScope;
private boolean reuseParentDynScope;
private boolean popDynScope;
private boolean receivesKeywordArguments;
private boolean metaClassBodyScope;

private final static InterpreterEngine BODY_INTERPRETER = new BodyInterpreterEngine();
private final static InterpreterEngine DEFAULT_INTERPRETER = new InterpreterEngine();
@@ -46,7 +46,7 @@ public InterpreterEngine getEngine() {
}
// FIXME: Hack null instructions means coming from FullInterpreterContext but this should be way cleaner
// For impl testing - engine = determineInterpreterEngine(scope);
engine = instructions == null ? DEFAULT_INTERPRETER : STARTUP_INTERPRETER;
setEngine(instructions == null ? DEFAULT_INTERPRETER : STARTUP_INTERPRETER);
}
return engine;
}
@@ -64,21 +64,17 @@ public InterpreterContext(IRScope scope, List<Instr> instructions) {
setEngine(instructions == null ? DEFAULT_INTERPRETER : STARTUP_INTERPRETER);

this.metaClassBodyScope = scope instanceof IRMetaClassBody;
this.temporaryVariablecount = scope.getTemporaryVariablesCount();
this.instructions = instructions != null ? prepareBuildInstructions(instructions) : null;
this.hasExplicitCallProtocol = scope.getFlags().contains(IRFlags.HAS_EXPLICIT_CALL_PROTOCOL);
// FIXME: Centralize this out of InterpreterContext
this.reuseParentDynScope = scope.getFlags().contains(IRFlags.REUSE_PARENT_DYNSCOPE);
this.pushNewDynScope = !scope.getFlags().contains(IRFlags.DYNSCOPE_ELIMINATED) && !reuseParentDynScope;
this.popDynScope = this.pushNewDynScope || this.reuseParentDynScope;
this.receivesKeywordArguments = scope.getFlags().contains(IRFlags.RECEIVES_KEYWORD_ARGS);
}

public InterpreterContext(IRScope scope, Callable<List<Instr>> instructions) throws Exception {
this.instructionsCallback = instructions;
this.scope = scope;

this.metaClassBodyScope = scope instanceof IRMetaClassBody;
}

private void retrieveFlags() {
this.temporaryVariablecount = scope.getTemporaryVariablesCount();
this.hasExplicitCallProtocol = scope.getFlags().contains(IRFlags.HAS_EXPLICIT_CALL_PROTOCOL);
// FIXME: Centralize this out of InterpreterContext
@@ -242,5 +238,7 @@ public String toStringInstrs() {

public void setEngine(InterpreterEngine engine) {
this.engine = engine;

retrieveFlags();
}
}
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/ir/operands/Label.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
// SSS FIXME: Should we try to enforce the canonical property that within a method,
// there is exactly one label object with the same label string?
public class Label extends Operand {
// This is for 'ensure's at the end of top-level constructs ('def foo; ensure; end' or 'class Foo; ensure; end')
public static final Label UNRESCUED_REGION_LABEL = new Label("UNRESCUED_REGION", 0);
private static final Label GLOBAL_ENSURE_BLOCK_LABEL = new Label("_GLOBAL_ENSURE_BLOCK_", 0);

2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/ir/persistence/IRDumper.java
Original file line number Diff line number Diff line change
@@ -91,6 +91,8 @@ public static ByteArrayOutputStream printIR(IRScope scope, boolean full, boolean
public void visit(IRScope scope, boolean full, boolean recurse) {
println("begin " + scope.getScopeType().name() + "<" + scope.getName() + ">");

println("flags: " + scope.getFlags());

InterpreterContext ic;

if (full) {
7 changes: 7 additions & 0 deletions core/src/main/java/org/jruby/ir/persistence/IRReader.java
Original file line number Diff line number Diff line change
@@ -65,6 +65,13 @@ public List<Instr> call() throws Exception {
});
}

// Run through all scopes again and ensure they've calculated flags.
// This also forces lazy instrs from above to eagerly decode.
for (KeyValuePair<IRScope, Integer> pair: scopes) {
final IRScope scope = pair.getKey();
scope.computeScopeFlags();
}

return scopes[0].getKey(); // topmost scope;
}

10 changes: 5 additions & 5 deletions core/src/main/java/org/jruby/util/io/OpenFile.java
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ public void ascii8bitBinmode(Ruby runtime) {
}

public void checkReopenSeek(ThreadContext context, Ruby runtime, long pos) {
if (seek(context, pos, PosixShim.SEEK_SET) < 0 && errno() != null) {
if (seek(context, pos, PosixShim.SEEK_SET) == -1 && errno() != null) {
throw runtime.newErrnoFromErrno(errno(), getPath());
}
}
@@ -1929,7 +1929,7 @@ private synchronized void unreadUnix(ThreadContext context) {
/* xxx: target position may be negative if buffer is filled by ungetc */
posix.errno = null;
r = posix.lseek(fd, -rbuf.len, PosixShim.SEEK_CUR);
if (r < 0 && posix.errno != null) {
if (r == -1 && posix.errno != null) {
if (posix.errno == Errno.ESPIPE)
mode |= DUPLEX;
return;
@@ -1977,7 +1977,7 @@ private void unreadWindows(ThreadContext context) {
// }

pos = posix.lseek(fd, 0, PosixShim.SEEK_CUR);
if (pos < 0 && posix.errno != null) {
if (pos == -1 && posix.errno != null) {
if (posix.errno == Errno.ESPIPE)
mode |= DUPLEX;
return;
@@ -2003,7 +2003,7 @@ private void unreadWindows(ThreadContext context) {
while (newlines >= 0) {
r = posix.lseek(fd, pos - rbuf.len - newlines, PosixShim.SEEK_SET);
if (newlines == 0) break;
if (r < 0) {
if (r == -1) {
newlines--;
continue;
}
@@ -2632,7 +2632,7 @@ public int remainSize() {
long pos;

if ((size = posix.size(fd)) >= 0 &&
(pos = posix.lseek(fd, 0, PosixShim.SEEK_CUR)) >= 0 &&
(pos = posix.lseek(fd, 0, PosixShim.SEEK_CUR)) != -1 &&
size > pos) {
if (siz + (size - pos) > Integer.MAX_VALUE) {
throw runtime.newIOError("file too big for single read");
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/io/PosixShim.java
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ public long lseek(ChannelFD fd, long offset, int type) {
} else if (fd.chNative != null) {
// native channel, use native lseek
int ret = posix.lseek(fd.chNative.getFD(), offset, type);
if (ret < 0) errno = Errno.valueOf(posix.errno());
if (ret == -1) errno = Errno.valueOf(posix.errno());
return ret;
}

10 changes: 7 additions & 3 deletions install/jruby.install4j
Original file line number Diff line number Diff line change
@@ -84,13 +84,15 @@
<dirEntry mountPoint="103" file="${compiler:jruby.location}" overwrite="2" shared="false" mode="644" uninstallMode="0" excludeSuffixes="" dirMode="755">
<exclude>
<entry location="bin" fileType="regular" />
<entry location="lib/jni/arm-Linux" fileType="regular" />
<entry location="lib/jni/Darwin" fileType="regular" />
<entry location="lib/jni/i386-FreeBSD" fileType="regular" />
<entry location="lib/jni/arm-Linux" fileType="regular" />
<entry location="lib/jni/i386-Linux" fileType="regular" />
<entry location="lib/jni/i386-OpenBSD" fileType="regular" />
<entry location="lib/jni/i386-SunOS" fileType="regular" />
<entry location="lib/jni/i386-FreeBSD" fileType="regular" />
<entry location="lib/jni/i386-OpenBSD" fileType="regular" />
<entry location="lib/jni/ppc-AIX" fileType="regular" />
<entry location="lib/jni/ppc64-Linux" fileType="regular" />
<entry location="lib/jni/ppc64le-Linux" fileType="regular" />
<entry location="lib/jni/ppc-Linux" fileType="regular" />
<entry location="lib/jni/s390x-Linux" fileType="regular" />
<entry location="lib/jni/sparc-SunOS" fileType="regular" />
@@ -111,6 +113,8 @@
<entry location="lib/jni/i386-OpenBSD" fileType="regular" />
<entry location="lib/jni/i386-SunOS" fileType="regular" />
<entry location="lib/jni/i386-Windows" fileType="regular" />
<entry location="lib/jni/ppc64-Linux" fileType="regular" />
<entry location="lib/jni/ppc64le-Linux" fileType="regular" />
<entry location="lib/jni/ppc-AIX" fileType="regular" />
<entry location="lib/jni/ppc-Linux" fileType="regular" />
<entry location="lib/jni/s390x-Linux" fileType="regular" />
4 changes: 2 additions & 2 deletions lib/pom.xml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ DO NOT MODIFIY - GENERATED CODE
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.1.0.0-SNAPSHOT</version>
<version>9.1.0.0</version>
</parent>
<artifactId>jruby-stdlib</artifactId>
<name>JRuby Lib Setup</name>
@@ -28,7 +28,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>9.1.0.0-SNAPSHOT</version>
<version>9.1.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
3 changes: 3 additions & 0 deletions lib/ruby/stdlib/date/format.rb
Original file line number Diff line number Diff line change
@@ -832,6 +832,9 @@ def self._parse_ddd(str, e) # :nodoc:
:_parse_year, :_parse_mon, :_parse_mday, :_parse_ddd

def self._parse(str, comp=true)
# Newer MRI version (written in C converts non-strings to strings
# and also has other checks like all ascii.
str = str.to_str if !str.kind_of?(::String) && str.respond_to?(:to_str)
str = str.dup

e = Format::Bag.new
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ DO NOT MODIFIY - GENERATED CODE
</parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.1.0.0-SNAPSHOT</version>
<version>9.1.0.0</version>
<packaging>pom</packaging>
<name>JRuby</name>
<description>JRuby is the effort to recreate the Ruby (http://www.ruby-lang.org) interpreter in Java.</description>
2 changes: 1 addition & 1 deletion spec/jrubyc/java/loading_spec.rb
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ def compile_files(files)
expect( Object.const_defined?(:HashyKwargs) ).to be true
klass = Class.new { include HashyKwargs }
res = klass.new.generic('0', 111, arg: 1) { 'block' }
pending 'FIXME if you wonder!'

expect( res[0] ).to eql [ '0', 111 ]
expect( res[1] ).to eql({ :arg => 1 })
expect( res[2].call ).to eql 'block'
4 changes: 4 additions & 0 deletions spec/ruby/core/array/initialize_spec.rb
Original file line number Diff line number Diff line change
@@ -92,6 +92,10 @@
a.send(:initialize, 2, obj).should == [obj, obj]
a[0].should equal(obj)
a[1].should equal(obj)

b = []
b.send(:initialize, 3, 14).should == [14, 14, 14]
b.should == [14, 14, 14]
end

it "sets the array to size and fills with nil when object is omitted" do
2 changes: 2 additions & 0 deletions spec/ruby/core/array/new_spec.rb
Original file line number Diff line number Diff line change
@@ -65,6 +65,8 @@
a.should == [obj, obj]
a[0].should equal(obj)
a[1].should equal(obj)

Array.new(3, 14).should == [14, 14, 14]
end

it "returns an array of size filled with nil when object is omitted" do
8 changes: 0 additions & 8 deletions spec/truffle/tags/core/kernel/String_tags.txt

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/kernel/untrusted_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/numeric/negative_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/numeric/positive_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/bytes_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/string/uminus_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/string/uplus_tags.txt

This file was deleted.

2 changes: 1 addition & 1 deletion truffle/pom.xml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ DO NOT MODIFIY - GENERATED CODE
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.1.0.0-SNAPSHOT</version>
<version>9.1.0.0</version>
</parent>
<artifactId>jruby-truffle</artifactId>
<name>JRuby Truffle</name>
Original file line number Diff line number Diff line change
@@ -219,22 +219,22 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails

if (signature.size() == 0) {
methodNode = nodeFactory.createNode();
} else if (signature.size() == 1 && signature.get(0) == RubyNode[].class) {
Object[] args = argumentsNodes.toArray(new RubyNode[argumentsNodes.size()]);
methodNode = nodeFactory.createNode(new Object[]{args});
} else if (signature.size() >= 3 && signature.get(2) == RubyNode[].class) {
Object[] args = argumentsNodes.toArray(new RubyNode[argumentsNodes.size()]);
methodNode = nodeFactory.createNode(context, sourceSection, args);
} else if (signature.get(0) != RubyContext.class) {
Object[] args = new Object[argumentsNodes.size()];
System.arraycopy(argumentsNodes.toArray(new RubyNode[argumentsNodes.size()]), 0, args, 0, argumentsNodes.size());
methodNode = nodeFactory.createNode(args);
} else {
Object[] args = new Object[2 + argumentsNodes.size()];
args[0] = context;
args[1] = sourceSection;
System.arraycopy(argumentsNodes.toArray(new RubyNode[argumentsNodes.size()]), 0, args, 2, argumentsNodes.size());
methodNode = nodeFactory.createNode(args);
final RubyNode[] argumentsArray = argumentsNodes.toArray(new RubyNode[argumentsNodes.size()]);
if (signature.size() == 1 && signature.get(0) == RubyNode[].class) {
methodNode = nodeFactory.createNode(new Object[] { argumentsArray });
} else if (signature.size() >= 3 && signature.get(2) == RubyNode[].class) {
methodNode = nodeFactory.createNode(context, sourceSection, argumentsArray);
} else if (signature.get(0) != RubyContext.class) {
Object[] args = argumentsArray;
methodNode = nodeFactory.createNode(args);
} else {
Object[] args = new Object[2 + argumentsNodes.size()];
args[0] = context;
args[1] = sourceSection;
System.arraycopy(argumentsArray, 0, args, 2, argumentsNodes.size());
methodNode = nodeFactory.createNode(args);
}
}

if (System.getenv("TRUFFLE_CHECK_AMBIGUOUS_OPTIONAL_ARGS") != null) {
Loading

0 comments on commit 442dcea

Please sign in to comment.