Skip to content

Commit

Permalink
Showing 24 changed files with 98 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ branches:
- /^ha-feature/

script: tool/travis_runner.sh
install: travis_retry ./mvnw -Pbootstrap clean install -Dinvoker.skip -Dmaven.test.skip
install: travis_retry ./mvnw -Pbootstrap clean install -B -Dinvoker.skip -Dmaven.test.skip

notifications:
irc:
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.0.5.0-SNAPSHOT
9.0.5.0
2 changes: 1 addition & 1 deletion core/pom.rb
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@

jar 'org.jruby.joni:joni:2.1.9'
jar 'org.jruby.extras:bytelist:1.0.13'
jar 'org.jruby.jcodings:jcodings:1.0.17-SNAPSHOT'
jar 'org.jruby.jcodings:jcodings:1.0.17'
jar 'org.jruby:dirgra:0.3'

jar 'com.headius:invokebinder:1.7'
4 changes: 2 additions & 2 deletions 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.0.5.0-SNAPSHOT</version>
<version>9.0.5.0</version>
</parent>
<artifactId>jruby-core</artifactId>
<name>JRuby Core</name>
@@ -184,7 +184,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>org.jruby.jcodings</groupId>
<artifactId>jcodings</artifactId>
<version>1.0.17-SNAPSHOT</version>
<version>1.0.17</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRScope.java
Original file line number Diff line number Diff line change
@@ -870,7 +870,7 @@ public TemporaryLocalVariable getNewUnboxedVariable(Class type) {
varType = TemporaryVariableType.FLOAT;
} else if (type == Fixnum.class) {
varType = TemporaryVariableType.FIXNUM;
} else if (type == Boolean.class) {
} else if (type == java.lang.Boolean.class) {
varType = TemporaryVariableType.BOOLEAN;
} else {
varType = TemporaryVariableType.LOCAL;
Original file line number Diff line number Diff line change
@@ -349,8 +349,8 @@ private boolean matchingTypes(Class c, TemporaryVariableType t) {
switch (t) {
case FLOAT: return c == Float.class;
case FIXNUM: return c == Fixnum.class;
case BOOLEAN: return c == Boolean.class;
default: return c != Float.class && c != Boolean.class && c != Fixnum.class;
case BOOLEAN: return c == java.lang.Boolean.class;
default: return c != Float.class && c != java.lang.Boolean.class && c != Fixnum.class;
}
}

@@ -387,7 +387,7 @@ public void boxVar(UnboxState state, Class reqdType, Map<Variable, TemporaryLoca

public void unboxVar(UnboxState state, Class reqdType, Map<Variable, TemporaryLocalVariable> unboxMap, Variable v, List<Instr> newInstrs) {
Variable unboxedV = getUnboxedVar(reqdType, unboxMap, v);
if (reqdType == Boolean.class) {
if (reqdType == java.lang.Boolean.class) {
newInstrs.add(new UnboxBooleanInstr(unboxedV, v));
} else if (reqdType == Float.class) { // SSS FIXME: This is broken
newInstrs.add(new UnboxFloatInstr(unboxedV, v));
28 changes: 21 additions & 7 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -463,13 +463,19 @@ public void BEQInstr(BEQInstr beqInstr) {
@Override
public void BFalseInstr(BFalseInstr bFalseInstr) {
Operand arg1 = bFalseInstr.getArg1();
visit(arg1);
// this is a gross hack because we don't have distinction in boolean instrs between boxed and unboxed
if (!(arg1 instanceof TemporaryBooleanVariable) && !(arg1 instanceof UnboxedBoolean)) {
if (arg1 instanceof TemporaryBooleanVariable || arg1 instanceof UnboxedBoolean) {
// no need to unbox
visit(arg1);
jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget()));
} else if (arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) {
// always true, don't branch
} else {
// unbox
visit(arg1);
jvmAdapter().invokeinterface(p(IRubyObject.class), "isTrue", sig(boolean.class));
jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget()));
}
jvmMethod().bfalse(getJVMLabel(bFalseInstr.getJumpTarget()));
}

@Override
@@ -721,12 +727,20 @@ public void BreakInstr(BreakInstr breakInstr) {
@Override
public void BTrueInstr(BTrueInstr btrueinstr) {
Operand arg1 = btrueinstr.getArg1();
visit(arg1);
// this is a gross hack because we don't have distinction in boolean instrs between boxed and unboxed
if (!(arg1 instanceof TemporaryBooleanVariable) && !(arg1 instanceof UnboxedBoolean)) {
jvmMethod().isTrue();
if (arg1 instanceof TemporaryBooleanVariable || arg1 instanceof UnboxedBoolean) {
// no need to unbox, just branch
visit(arg1);
jvmMethod().btrue(getJVMLabel(btrueinstr.getJumpTarget()));
} else if (arg1 instanceof UnboxedFixnum || arg1 instanceof UnboxedFloat) {
// always true, always branch
jvmMethod().goTo(getJVMLabel(btrueinstr.getJumpTarget()));
} else {
// unbox and branch
visit(arg1);
jvmAdapter().invokeinterface(p(IRubyObject.class), "isTrue", sig(boolean.class));
jvmMethod().btrue(getJVMLabel(btrueinstr.getJumpTarget()));
}
jvmMethod().btrue(getJVMLabel(btrueinstr.getJumpTarget()));
}

@Override
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/parser/ParserSupport.java
Original file line number Diff line number Diff line change
@@ -1121,7 +1121,7 @@ public ArgumentNode arg_var(String name) {
if (name == "_") {
int count = 0;
while (current.exists(name) >= 0) {
name = "_$" + count++;
name = ("_$" + count++).intern();
}
}

Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
import org.jruby.RubyFile;
import org.jruby.RubyHash;
import org.jruby.RubyString;
import org.jruby.ast.executable.Script;
import org.jruby.ir.IRScope;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.load.LoadService.SuffixType;
@@ -297,8 +296,9 @@ public void load(Ruby runtime, boolean wrap) {
}
}
runtime.getJRubyClassLoader().addURL(url);
} catch (MalformedURLException badUrl) {
runtime.newIOErrorFromException(badUrl);
}
catch (MalformedURLException badUrl) {
throw runtime.newIOErrorFromException(badUrl);
}

// If an associated Service library exists, load it as well
33 changes: 19 additions & 14 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ public LoadService(Ruby runtime) {
*
* @param prependDirectories
*/
public void init(List prependDirectories) {
public void init(List<String> prependDirectories) {
loadPath = RubyArray.newArray(runtime);

String jrubyHome = runtime.getJRubyHome();
@@ -305,7 +305,7 @@ protected void addFeatureToIndex(String shortName, String name) {
protected void addPath(String path) {
// Empty paths do not need to be added
if (path == null || path.length() == 0) return;

final RubyArray loadPath = this.loadPath;
synchronized(loadPath) {
loadPath.append(runtime.newString(path.replace('\\', '/')));
}
@@ -335,7 +335,7 @@ public void load(String file, boolean wrap) {
try {
library.load(runtime, wrap);
} catch (IOException e) {
if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
@@ -361,7 +361,7 @@ public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wr
try {
library.load(runtime, wrap);
} catch (IOException e) {
if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
debugLoadException(runtime, e);
throw newLoadErrorFromThrowable(runtime, file, e);
}
} finally {
@@ -426,7 +426,7 @@ private RequireState requireCommon(String file, boolean circularRequireWarning)
return smartLoadInternal(file, circularRequireWarning);
}

protected final RequireLocks requireLocks = new RequireLocks();
private final RequireLocks requireLocks = new RequireLocks();

private static final class RequireLocks {
private final ConcurrentHashMap<String, ReentrantLock> pool;
@@ -610,11 +610,15 @@ public static void reflectedLoad(Ruby runtime, String libraryName, String classN
} catch (RaiseException re) {
throw re;
} catch (Throwable e) {
if (runtime.getDebug().isTrue()) e.printStackTrace();
debugLoadException(runtime, e);
throw runtime.newLoadError("library `" + libraryName + "' could not be loaded: " + e, libraryName);
}
}

private static void debugLoadException(final Ruby runtime, final Throwable ex) {
if (runtime.isDebug()) ex.printStackTrace(runtime.getErr());
}

public IRubyObject getLoadPath() {
return loadPath;
}
@@ -899,12 +903,12 @@ protected boolean tryLoadingLibraryOrScript(Ruby runtime, SearchState state) {
// allow MainExitException to propagate out for exec and friends
throw mee;
} catch (Throwable e) {
if(isJarfileLibrary(state, state.searchFile)) {
if (isJarfileLibrary(state, state.searchFile)) {
return true;
}
reraiseRaiseExceptions(e);

if(runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr());
debugLoadException(runtime, e);

RaiseException re = newLoadErrorFromThrowable(runtime, state.searchFile, e);
re.initCause(e);
@@ -933,15 +937,16 @@ private static RaiseException newLoadErrorFromThrowable(Ruby runtime, String fil
protected String buildClassName(String className) {
// Remove any relative prefix, e.g. "./foo/bar" becomes "foo/bar".
className = className.replaceFirst("^\\.\\/", "");
if (className.lastIndexOf(".") != -1) {
className = className.substring(0, className.lastIndexOf("."));
final int lastDot = className.lastIndexOf('.');
if (lastDot != -1) {
className = className.substring(0, lastDot);
}
className = className.replace("-", "_minus_").replace('.', '_');
return className;
}

protected void checkEmptyLoad(String file) throws RaiseException {
if (file.equals("")) {
if (file.isEmpty()) {
throw runtime.newLoadError("no such file to load -- " + file, file);
}
}
@@ -1355,19 +1360,19 @@ private String[] splitJarUrl(String loadPathEntry) {
// Fall back to using the original string
}

int idx = unescaped.indexOf("!");
int idx = unescaped.indexOf('!');
if (idx == -1) {
return new String[]{unescaped, ""};
}

String filename = unescaped.substring(0, idx);
String entry = idx + 2 < unescaped.length() ? unescaped.substring(idx + 2) : "";

if(filename.startsWith("jar:")) {
if (filename.startsWith("jar:")) {
filename = filename.substring(4);
}

if(filename.startsWith("file:")) {
if (filename.startsWith("file:")) {
filename = filename.substring(5);
}

2 changes: 1 addition & 1 deletion lib/pom.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ def initialize( name, version, default_spec = true )

default_gems =
[
ImportedGem.new( 'jruby-openssl', '0.9.13' ),
ImportedGem.new( 'jruby-openssl', '0.9.15' ),
ImportedGem.new( 'jruby-readline', '1.0', false ),
ImportedGem.new( 'rake', '${rake.version}' ),
ImportedGem.new( 'rdoc', '${rdoc.version}' ),
6 changes: 3 additions & 3 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.0.5.0-SNAPSHOT</version>
<version>9.0.5.0</version>
</parent>
<artifactId>jruby-stdlib</artifactId>
<name>JRuby Lib Setup</name>
@@ -28,13 +28,13 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>9.0.5.0-SNAPSHOT</version>
<version>9.0.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.13</version>
<version>0.9.15</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
2 changes: 1 addition & 1 deletion maven/jruby/src/it/bouncycastle/pom.xml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bc.version>1.47</bc.version>
<bc.version>1.54</bc.version>
</properties>

<build>
Original file line number Diff line number Diff line change
@@ -23,15 +23,15 @@ public void setupProvider() throws Exception {

@Test
public void java() {
assertEquals("BouncyCastle Security Provider v1.47", new BouncyCastleProvider().getInfo());
assertEquals("BouncyCastle Security Provider v1.54", new BouncyCastleProvider().getInfo());
}

@Test
public void ruby(){
ScriptingContainer container = new ScriptingContainer();
container.setClassloaderDelegate(false);
Object result = container.parse( "require 'openssl'; Java::OrgBouncycastleJceProvider::BouncyCastleProvider.new.info").run();
assertEquals( "BouncyCastle Security Provider v1.50", result.toString() );
assertEquals( "BouncyCastle Security Provider v1.54", result.toString() );

result = container.parse("JRuby.runtime.jruby_class_loader").run();
assertEquals("org.jruby.util.SelfFirstJRubyClassLoader", result.toString().replaceFirst("@.*$", ""));
4 changes: 2 additions & 2 deletions maven/jruby/src/it/runnable/.jbundler/classpath.rb
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
JBUNDLER_TEST_CLASSPATH = []
JBUNDLER_TEST_CLASSPATH.freeze
JBUNDLER_CLASSPATH = []
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + '/org/bouncycastle/bcpkix-jdk15on/1.49/bcpkix-jdk15on-1.49.jar')
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + '/org/bouncycastle/bcpkix-jdk15on/1.54/bcpkix-jdk15on-1.54.jar')
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + '/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar')
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + '/org/bouncycastle/bcprov-jdk15on/1.49/bcprov-jdk15on-1.49.jar')
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + '/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar')
JBUNDLER_CLASSPATH << (JBUNDLER_LOCAL_REPO + '/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar')
JBUNDLER_CLASSPATH.freeze
4 changes: 2 additions & 2 deletions maven/jruby/src/it/runnable/Jarfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
:runtime:
- org.bouncycastle:bcpkix-jdk15on:jar:1.49
- org.bouncycastle:bcpkix-jdk15on:jar:1.54
- org.slf4j:slf4j-simple:jar:1.6.4
- org.bouncycastle:bcprov-jdk15on:jar:1.49
- org.bouncycastle:bcprov-jdk15on:jar:1.54
- org.slf4j:slf4j-api:jar:1.6.4
2 changes: 1 addition & 1 deletion pom.rb
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@

'jruby-launcher.version' => '1.1.1',
'ant.version' => '1.9.2',
'asm.version' => '5.0.3',
'asm.version' => '5.0.4',
'jffi.version' => '1.2.10',
'bouncy-castle.version' => '1.47',
'joda.time.version' => '2.8.2' )
4 changes: 2 additions & 2 deletions 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.0.5.0-SNAPSHOT</version>
<version>9.0.5.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>
@@ -117,7 +117,7 @@ DO NOT MODIFIY - GENERATED CODE
<rake.version>10.1.0</rake.version>
<jruby-launcher.version>1.1.1</jruby-launcher.version>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<asm.version>5.0.3</asm.version>
<asm.version>5.0.4</asm.version>
<rspec-expectations.version>3.3.1</rspec-expectations.version>
<its.osgi>osgi*/pom.xml</its.osgi>
<base.javac.version>1.7</base.javac.version>
4 changes: 2 additions & 2 deletions test/check_versions.sh
Original file line number Diff line number Diff line change
@@ -61,10 +61,10 @@ function check {

}

check lib/target/jruby-stdlib-$jar_version.jar 8
check lib/target/jruby-stdlib-$jar_version.jar 9
check maven/jruby-jars/pkg/jruby-jars-$gem_version.gem 30
check maven/jruby-jars/lib/jruby-core-$jar_version-complete.jar 13
check maven/jruby-jars/lib/jruby-stdlib-$jar_version.jar 8
check maven/jruby-jars/lib/jruby-stdlib-$jar_version.jar 9
check maven/jruby-complete/target/jruby-complete-$jar_version.jar 27
check maven/jruby/target/jruby-$jar_version.jar 9
check maven/jruby-dist/target/jruby-dist-$jar_version-bin.tar.gz 45 jruby-$jar_version
2 changes: 1 addition & 1 deletion tool/travis_runner.sh
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
set -e
set -x

./mvnw install -Dinvoker.skip=false $PHASE | egrep -v 'Download|\\[exec\\] [[:digit:]]+/[[:digit:]]+|^[[:space:]]*\\[exec\\][[:space:]]*$'
./mvnw install -B -Dinvoker.skip=false $PHASE | egrep -v 'Download|\\[exec\\] [[:digit:]]+/[[:digit:]]+|^[[:space:]]*\\[exec\\][[:space:]]*$'

MVN_STATUS=${PIPESTATUS[0]}

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.0.5.0-SNAPSHOT</version>
<version>9.0.5.0</version>
</parent>
<artifactId>jruby-truffle</artifactId>
<name>JRuby Truffle</name>
8 changes: 8 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@ public static boolean isDouble(Object value) {
return value instanceof Double;
}

public static boolean isJavaCharSequence(Object value) {
return value instanceof CharSequence;
}

// Ruby types

public static boolean isRubyBasicObject(Object object) {
@@ -223,6 +227,10 @@ public static boolean isThreadLocal(Object value) {
return value instanceof ThreadLocalObject;
}

public static boolean isTruffleObject(Object object) {
return object instanceof TruffleObject;
}

public static boolean isForeignObject(Object object) {
return object instanceof TruffleObject && !isRubyBasicObject(object);
}
Original file line number Diff line number Diff line change
@@ -113,11 +113,21 @@ public IsBoxedPrimitiveNode(RubyContext context, SourceSection sourceSection) {
this.node = Message.IS_BOXED.createNode();
}

@Specialization
public boolean isBoxedPrimitive(VirtualFrame frame, CharSequence receiver) {
return true;
}

@Specialization
public boolean isBoxedPrimitive(VirtualFrame frame, TruffleObject receiver) {
return (boolean) ForeignAccess.execute(node, frame, receiver);
}

@Specialization(guards = {"!isTruffleObject(receiver)", "!isJavaCharSequence(receiver)"})
public boolean isBoxedPrimitive(VirtualFrame frame, Object receiver) {
return false;
}

}

@CoreMethod(names = "null?", isModuleFunction = true, needsSelf = false, required = 1)
@@ -267,6 +277,13 @@ public UnboxValueNode(RubyContext context, SourceSection sourceSection) {
this.node = Message.UNBOX.createNode();
}

@Specialization
public DynamicObject executeForeign(VirtualFrame frame, CharSequence receiver) {
// TODO CS-21-Dec-15 this shouldn't be needed - we need to convert j.l.String to Ruby's String automatically

return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), ByteList.create(receiver), StringSupport.CR_UNKNOWN, null);
}

@Specialization
public Object executeForeign(VirtualFrame frame, TruffleObject receiver) {
return ForeignAccess.execute(node, frame, receiver);
@@ -337,7 +354,6 @@ protected static String rubyStringToString(DynamicObject rubyString) {
@CoreMethod(names = "import", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class ImportNode extends CoreMethodArrayArgumentsNode {


public ImportNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
Original file line number Diff line number Diff line change
@@ -241,7 +241,7 @@ public DynamicObject ensureOpen(VirtualFrame frame, DynamicObject file) {

}

@RubiniusPrimitive(name = "io_read_if_available")
@RubiniusPrimitive(name = "io_read_if_available", lowerFixnumParameters = 0)
public static abstract class IOReadIfAvailableNode extends RubiniusPrimitiveNode {

private static final FDSetFactory fdSetFactory = FDSetFactoryFactory.create();
@@ -564,7 +564,7 @@ public DynamicObject sysread(VirtualFrame frame, DynamicObject file, int length)

}

@RubiniusPrimitive(name = "io_select", needsSelf = false)
@RubiniusPrimitive(name = "io_select", needsSelf = false, lowerFixnumParameters = 3)
public static abstract class IOSelectPrimitiveNode extends RubiniusPrimitiveNode {

private static final FDSetFactory fdSetFactory = FDSetFactoryFactory.create();

0 comments on commit 718d8f2

Please sign in to comment.