Skip to content

Commit

Permalink
Showing 26 changed files with 365 additions and 332 deletions.
34 changes: 15 additions & 19 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -41,6 +41,8 @@

import org.jruby.compiler.Constantizable;
import org.jruby.compiler.NotCompilableException;
import org.jruby.ext.jruby.JRubyLibrary;
import org.jruby.ext.thread.ThreadLibrary;
import org.jruby.ir.IRScriptBody;
import org.jruby.parser.StaticScope;
import org.objectweb.asm.util.TraceClassVisitor;
@@ -73,7 +75,6 @@
import org.jruby.ext.ffi.FFI;
import org.jruby.ext.fiber.ThreadFiber;
import org.jruby.ext.fiber.ThreadFiberLibrary;
import org.jruby.ext.jruby.JRubyConfigLibrary;
import org.jruby.ext.tracepoint.TracePoint;
import org.jruby.internal.runtime.GlobalVariables;
import org.jruby.internal.runtime.ThreadService;
@@ -1535,12 +1536,12 @@ private void initCore() {
RubyEnumerator.defineEnumerator(this);
}

// Fiber depends on thread library, so we load it here
new ThreadLibrary().load(this, false);

new ThreadFiberLibrary().load(this, false);

TracePoint.createTracePointClass(this);

// Load the JRuby::Config module for accessing configuration settings from Ruby
new JRubyConfigLibrary().load(this, false);
}

public static final int NIL_PREFILLED_ARRAY_SIZE = RubyArray.ARRAY_DEFAULT_SIZE * 8;
@@ -1722,21 +1723,16 @@ private void initBuiltins() {
addLazyBuiltin("coverage.jar", "coverage", "org.jruby.ext.coverage.CoverageLibrary");

// TODO: implement something for these?
Library dummy = new Library() {
public void load(Ruby runtime, boolean wrap) throws IOException {
// dummy library that does nothing right now
}
};
addBuiltinIfAllowed("continuation.rb", dummy);
addBuiltinIfAllowed("io/nonblock.rb", dummy);

// rb_provide logic, in a roundabout way
addLazyBuiltin("enumerator.jar", "enumerator", "org.jruby.ext.enumerator.EnumeratorLibrary");
loadService.require("enumerator.jar");
addBuiltinIfAllowed("rational.jar", dummy);
loadService.require("rational.jar");
addBuiltinIfAllowed("complex.jar", dummy);
loadService.require("complex.jar");
addBuiltinIfAllowed("continuation.rb", Library.DUMMY);
addBuiltinIfAllowed("io/nonblock.rb", Library.DUMMY);

// for backward compatibility
loadService.provide("enumerator.jar"); // can't be in RubyEnumerator because LoadService isn't ready then
loadService.provide("rational.jar");
loadService.provide("complex.jar");

// we define the classes at boot because we need them
addBuiltinIfAllowed("thread.rb", Library.DUMMY);

if(RubyInstanceConfig.NATIVE_NET_PROTOCOL) {
addLazyBuiltin("net/protocol.rb", "net/protocol", "org.jruby.ext.net.protocol.NetProtocolBufferedIOLibrary");
292 changes: 189 additions & 103 deletions core/src/main/java/org/jruby/RubySymbol.java

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions core/src/main/java/org/jruby/RubyThread.java
Original file line number Diff line number Diff line change
@@ -730,14 +730,31 @@ public static IRubyObject pass(IRubyObject recv) {
boolean critical = ts.getCritical();

ts.setCritical(false);

Thread.yield();

ts.setCritical(critical);

try {
Thread.yield();
} finally {
ts.setCritical(critical);
}

return recv.getRuntime().getNil();
}

@JRubyMethod(meta = true)
public static IRubyObject exclusive(ThreadContext context, IRubyObject recv, Block block) {
Ruby runtime = context.runtime;
ThreadService ts = runtime.getThreadService();
boolean critical = ts.getCritical();

ts.setCritical(true);

try {
return block.yieldSpecific(context);
} finally {
ts.setCritical(critical);
}
}

@JRubyMethod(meta = true)
public static RubyArray list(IRubyObject recv) {
RubyThread[] activeThreads = recv.getRuntime().getThreadService().getActiveRubyThreads();
4 changes: 0 additions & 4 deletions core/src/main/java/org/jruby/ast/ArrayNode.java
Original file line number Diff line number Diff line change
@@ -40,10 +40,6 @@
* Represents an array. This could be an array literal, quoted words or some args stuff.
*/
public class ArrayNode extends ListNode implements ILiteralNode {
// This field is used during argument processing to avoid putting RubyArray
// instances that are purely for utility purposes into ObjectSpace.
private boolean lightweight = false;

public ArrayNode(ISourcePosition position, Node firstNode) {
super(position, firstNode);

45 changes: 0 additions & 45 deletions core/src/main/java/org/jruby/ext/enumerator/EnumeratorLibrary.java

This file was deleted.

52 changes: 0 additions & 52 deletions core/src/main/java/org/jruby/ext/jruby/JRubyConfigLibrary.java

This file was deleted.

14 changes: 12 additions & 2 deletions core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@
public class JRubyLibrary implements Library {
public void load(Ruby runtime, boolean wrap) {
ThreadContext context = runtime.getCurrentContext();

runtime.getLoadService().require("java");

// load Ruby parts of the 'jruby' library
@@ -89,8 +90,17 @@ public void load(Ruby runtime, boolean wrap) {

RubyClass fiberLocalClass = jrubyModule.defineClassUnder("FiberLocal", runtime.getObject(), JRubyFiberLocal.ALLOCATOR);
fiberLocalClass.defineAnnotatedMethods(JRubyExecutionContextLocal.class);

new JRubyConfigLibrary().load(runtime, wrap);

RubyModule config = jrubyModule.defineModuleUnder("CONFIG");
config.getSingletonClass().defineAnnotatedMethods(JRubyConfig.class);
}

public static class JRubyConfig {
@JRubyMethod(name = "rubygems_disabled?")
public static IRubyObject rubygems_disabled_p(ThreadContext context, IRubyObject self) {
return context.runtime.newBoolean(
context.runtime.getInstanceConfig().isDisableGems());
}
}

/**
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/thread/ThreadLibrary.java
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
* The 'thread' library.
*/
public class ThreadLibrary implements Library {
public void load(final Ruby runtime, boolean wrap) throws IOException {
public void load(final Ruby runtime, boolean wrap) {
Mutex.setup(runtime);
ConditionVariable.setup(runtime);
Queue.setup(runtime);
137 changes: 76 additions & 61 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -556,53 +556,68 @@ protected Variable getValueInTemporaryVariable(IRScope s, Operand val) {
return copyAndReturnValue(s, val);
}

// Return the last argument in the list -- AttrAssign needs it
protected Operand buildCallArgs(List<Operand> argsList, Node args, IRScope s) {
// Return the last argument in the list as this represents rhs of the overall attrassign expression
// e.g. 'a[1] = 2 #=> 2' or 'a[1] = 1,2,3 #=> [1,2,3]'
protected Operand buildAttrAssignCallArgs(List<Operand> argsList, Node args, IRScope s) {
switch (args.getNodeType()) {
case ARGSCATNODE: {
ArgsCatNode argsCatNode = (ArgsCatNode)args;
Operand v1 = build(argsCatNode.getFirstNode(), s);
Operand v2 = build(argsCatNode.getSecondNode(), s);
Variable res = s.createTemporaryVariable();
addInstr(s, new BuildCompoundArrayInstr(res, v1, v2, false));
argsList.add(new Splat(res, true));
return v2;
case ARRAYNODE: { // a[1] = 2; a[1,2,3] = 4,5,6
Operand last = manager.getNil();
for (Node n: args.childNodes()) {
last = build(n, s);
argsList.add(last);
}
return last;
}
case ARGSPUSHNODE: {
case ARGSPUSHNODE: { // a[1, *b] = 2
ArgsPushNode argsPushNode = (ArgsPushNode)args;
Operand v1 = build(argsPushNode.getFirstNode(), s);
Operand v2 = build(argsPushNode.getSecondNode(), s);
Operand lhs = build(argsPushNode.getFirstNode(), s);
Operand rhs = build(argsPushNode.getSecondNode(), s);
Variable res = s.createTemporaryVariable();
addInstr(s, new BuildCompoundArrayInstr(res, v1, v2, true));
addInstr(s, new BuildCompoundArrayInstr(res, lhs, rhs, true));
argsList.add(new Splat(res, true));
return v2;
return rhs;
}
case SPLATNODE: { // a[1] = *b
Splat rhs = new Splat(build(((SplatNode)args).getValue(), s), true);
argsList.add(rhs);
return rhs;
}
}

throw new NotCompilableException("Invalid node for attrassign call args: " + args.getClass().getSimpleName() + ":" + args.getPosition());
}

protected Operand[] buildCallArgs(Node args, IRScope s) {
switch (args.getNodeType()) {
case ARGSCATNODE:
case ARGSPUSHNODE:
return new Operand[] { new Splat(build(args, s), true) };
case ARRAYNODE: {
ArrayNode arrayNode = (ArrayNode)args;
List<Node> children = arrayNode.childNodes();
// explode array, it's an internal "args" array
for (Node n: children) {
argsList.add(build(n, s));
List<Node> children = args.childNodes();
int numberOfArgs = children.size();
Operand[] builtArgs = new Operand[numberOfArgs];

for (int i = 0; i < numberOfArgs; i++) {
builtArgs[i] = build(children.get(i), s);
}
break;
}
case SPLATNODE: {
Splat splat = new Splat(build(((SplatNode)args).getValue(), s), true);
argsList.add(splat);
break;
}
default: {
throw new NotCompilableException("Invalid node for callArgs: " + args.getClass().getSimpleName() + ":" + args.getPosition());
return builtArgs;
}
case SPLATNODE:
return new Operand[] { new Splat(build(((SplatNode) args).getValue(), s), true) };
}

return argsList.isEmpty() ? manager.getNil() : argsList.get(argsList.size() - 1);
throw new NotCompilableException("Invalid node for call args: " + args.getClass().getSimpleName() + ":" + args.getPosition());
}

public List<Operand> setupCallArgs(Node args, IRScope s) {
List<Operand> argsList = new ArrayList<>();
if (args != null) buildCallArgs(argsList, args, s);
return argsList;
public Operand[] setupCallArgs(Node args, IRScope s) {
return args == null ? Operand.EMPTY_ARRAY : buildCallArgs(args, s);
}

public static Operand[] addArg(Operand[] args, Operand extraArg) {
Operand[] newArgs = new Operand[args.length + 1];
System.arraycopy(args, 0, newArgs, 0, args.length);
newArgs[args.length] = extraArg;
return newArgs;
}

// Non-arg masgn (actually a nested masgn)
@@ -810,28 +825,27 @@ public Operand buildArgsCat(final ArgsCatNode argsCatNode, IRScope s) {
}

public Operand buildArgsPush(final ArgsPushNode node, IRScope s) {
Operand v1 = build(node.getFirstNode(), s);
Operand v2 = build(node.getSecondNode(), s);
Variable res = s.createTemporaryVariable();
addInstr(s, new BuildCompoundArrayInstr(res, v1, v2, true));
return res;
Operand lhs = build(node.getFirstNode(), s);
Operand rhs = build(node.getSecondNode(), s);

return addResultInstr(s, new BuildCompoundArrayInstr(s.createTemporaryVariable(), lhs, rhs, true));
}

private Operand buildAttrAssign(final AttrAssignNode attrAssignNode, IRScope s) {
Operand obj = build(attrAssignNode.getReceiverNode(), s);
List<Operand> args = new ArrayList<>();
Node argsNode = attrAssignNode.getArgsNode();
Operand lastArg = (argsNode == null) ? manager.getNil() : buildCallArgs(args, argsNode, s);
Operand lastArg = (argsNode == null) ? manager.getNil() : buildAttrAssignCallArgs(args, argsNode, s);
addInstr(s, new AttrAssignInstr(obj, attrAssignNode.getName(), args.toArray(new Operand[args.size()])));
return lastArg;
}

public Operand buildAttrAssignAssignment(Node node, IRScope s, Operand value) {
final AttrAssignNode attrAssignNode = (AttrAssignNode) node;
Operand obj = build(attrAssignNode.getReceiverNode(), s);
List<Operand> args = setupCallArgs(attrAssignNode.getArgsNode(), s);
args.add(value);
addInstr(s, new AttrAssignInstr(obj, attrAssignNode.getName(), args.toArray(new Operand[args.size()])));
Operand[] args = setupCallArgs(attrAssignNode.getArgsNode(), s);
args = addArg(args, value);
addInstr(s, new AttrAssignInstr(obj, attrAssignNode.getName(), args));
return value;
}

@@ -976,10 +990,10 @@ public Operand buildCall(CallNode callNode, IRScope s) {
// that is incorrect IR because the receiver has to be built *before* call arguments are built
// to preserve expected code execution order
Operand receiver = build(receiverNode, s);
List<Operand> args = setupCallArgs(callArgsNode, s);
Operand[] args = setupCallArgs(callArgsNode, s);
Operand block = setupCallClosure(callNode.getIterNode(), s);
Variable callResult = s.createTemporaryVariable();
CallInstr callInstr = (CallInstr)CallInstr.create(callResult, callNode.getName(), receiver, args.toArray(new Operand[args.size()]), block).specializeForInterpretation();
CallInstr callInstr = (CallInstr)CallInstr.create(callResult, callNode.getName(), receiver, args, block).specializeForInterpretation();

// This is to support the ugly Proc.new with no block, which must see caller's frame
if (
@@ -2193,10 +2207,10 @@ public Operand buildFalse() {

public Operand buildFCall(FCallNode fcallNode, IRScope s) {
Node callArgsNode = fcallNode.getArgsNode();
List<Operand> args = setupCallArgs(callArgsNode, s);
Operand[] args = setupCallArgs(callArgsNode, s);
Operand block = setupCallClosure(fcallNode.getIterNode(), s);
Variable callResult = s.createTemporaryVariable();
CallInstr callInstr = (CallInstr)CallInstr.create(CallType.FUNCTIONAL, callResult, fcallNode.getName(), s.getSelf(), args.toArray(new Operand[args.size()]), block).specializeForInterpretation();
CallInstr callInstr = (CallInstr)CallInstr.create(CallType.FUNCTIONAL, callResult, fcallNode.getName(), s.getSelf(), args, block).specializeForInterpretation();
receiveBreakException(s, block, callInstr);
return callResult;
}
@@ -2814,12 +2828,12 @@ public Operand buildOpElementAsgnWithOr(OpElementAsgnNode opElementAsgnNode, IRS
Operand array = build(opElementAsgnNode.getReceiverNode(), s);
Label l = s.getNewLabel();
Variable elt = s.createTemporaryVariable();
List<Operand> argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
addInstr(s, CallInstr.create(elt, "[]", array, argList.toArray(new Operand[argList.size()]), null));
Operand[] argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
addInstr(s, CallInstr.create(elt, "[]", array, argList, null));
addInstr(s, BEQInstr.create(elt, manager.getTrue(), l));
Operand value = build(opElementAsgnNode.getValueNode(), s);
argList.add(value);
addInstr(s, CallInstr.create(elt, "[]=", array, argList.toArray(new Operand[argList.size()]), null));
argList = addArg(argList, value);
addInstr(s, CallInstr.create(elt, "[]=", array, argList, null));
addInstr(s, new CopyInstr(elt, value));
addInstr(s, new LabelInstr(l));
return elt;
@@ -2830,12 +2844,13 @@ public Operand buildOpElementAsgnWithAnd(OpElementAsgnNode opElementAsgnNode, IR
Operand array = build(opElementAsgnNode.getReceiverNode(), s);
Label l = s.getNewLabel();
Variable elt = s.createTemporaryVariable();
List<Operand> argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
addInstr(s, CallInstr.create(elt, "[]", array, argList.toArray(new Operand[argList.size()]), null));
Operand[] argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
addInstr(s, CallInstr.create(elt, "[]", array, argList, null));
addInstr(s, BEQInstr.create(elt, manager.getFalse(), l));
Operand value = build(opElementAsgnNode.getValueNode(), s);
argList.add(value);
addInstr(s, CallInstr.create(elt, "[]=", array, argList.toArray(new Operand[argList.size()]), null));

argList = addArg(argList, value);
addInstr(s, CallInstr.create(elt, "[]=", array, argList, null));
addInstr(s, new CopyInstr(elt, value));
addInstr(s, new LabelInstr(l));
return elt;
@@ -2850,17 +2865,17 @@ public Operand buildOpElementAsgnWithAnd(OpElementAsgnNode opElementAsgnNode, IR
// val = buildCall([]=, arr, arg, val)
public Operand buildOpElementAsgnWithMethod(OpElementAsgnNode opElementAsgnNode, IRScope s) {
Operand array = build(opElementAsgnNode.getReceiverNode(), s);
List<Operand> argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
Operand[] argList = setupCallArgs(opElementAsgnNode.getArgsNode(), s);
Variable elt = s.createTemporaryVariable();
addInstr(s, CallInstr.create(elt, "[]", array, argList.toArray(new Operand[argList.size()]), null)); // elt = a[args]
addInstr(s, CallInstr.create(elt, "[]", array, argList, null)); // elt = a[args]
Operand value = build(opElementAsgnNode.getValueNode(), s); // Load 'value'
String operation = opElementAsgnNode.getOperatorName();
addInstr(s, CallInstr.create(elt, operation, elt, new Operand[] { value }, null)); // elt = elt.OPERATION(value)
// SSS: do not load the call result into 'elt' to eliminate the RAW dependency on the call
// We already know what the result is going be .. we are just storing it back into the array
Variable tmp = s.createTemporaryVariable();
argList.add(elt);
addInstr(s, CallInstr.create(tmp, "[]=", array, argList.toArray(new Operand[argList.size()]), null)); // a[args] = elt
argList = addArg(argList, elt);
addInstr(s, CallInstr.create(tmp, "[]=", array, argList, null)); // a[args] = elt
return elt;
}

@@ -3277,10 +3292,10 @@ private Operand buildSuperInstr(IRScope s, Operand block, Operand[] args) {
public Operand buildSuper(SuperNode superNode, IRScope s) {
if (s.isModuleBody()) return buildSuperInScriptBody(s);

List<Operand> args = setupCallArgs(superNode.getArgsNode(), s);
Operand[] args = setupCallArgs(superNode.getArgsNode(), s);
Operand block = setupCallClosure(superNode.getIterNode(), s);
if (block == null) block = getImplicitBlockArg(s);
return buildSuperInstr(s, block, args.toArray(new Operand[args.size()]));
return buildSuperInstr(s, block, args);
}

private Operand buildSuperInScriptBody(IRScope s) {
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -590,10 +590,10 @@ private static IRubyObject interpret(ThreadContext context, IRubyObject self,
private static void extractToMethodToAvoidC2Crash(ThreadContext context, Instr instr, Throwable t) {
if (!(t instanceof Unrescuable)) {
if (!instr.canRaiseException()) {
System.err.println("ERROR: Got exception " + t + " but instr " + instr + " is not supposed to be raising exceptions!");
System.err.println("BUG: Got exception " + t + " but instr " + instr + " is not supposed to be raising exceptions!");
}
if ((t instanceof RaiseException) && context.runtime.getGlobalVariables().get("$!") != IRRuntimeHelpers.unwrapRubyException(t)) {
System.err.println("ERROR: $! and exception are not matching up.");
System.err.println("BUG: $! and exception are not matching up.");
System.err.println("$!: " + context.runtime.getGlobalVariables().get("$!"));
System.err.println("t : " + t);
}
5 changes: 3 additions & 2 deletions core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
@@ -109,13 +109,14 @@ public class Java implements Library {
public static final boolean NEW_STYLE_EXTENSION = Options.JI_NEWSTYLEEXTENSION.load();
public static final boolean OBJECT_PROXY_CACHE = Options.JI_OBJECTPROXYCACHE.load();

public void load(Ruby runtime, boolean wrap) throws IOException {
public void load(Ruby runtime, boolean wrap) {
createJavaModule(runtime);

RubyModule jpmt = runtime.defineModule("JavaPackageModuleTemplate");
jpmt.getSingletonClass().setSuperClass(new BlankSlateWrapper(runtime, jpmt.getMetaClass().getSuperClass(), runtime.getKernel()));

runtime.getLoadService().require("jruby/java");
// load Ruby parts of the 'java' library
runtime.getLoadService().load("jruby/java.rb", false);

// rewite ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors
RubyClass ajp = runtime.getClass("ArrayJavaProxy");
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/runtime/load/Library.java
Original file line number Diff line number Diff line change
@@ -33,5 +33,10 @@
import org.jruby.Ruby;

public interface Library {
public static final Library DUMMY = new Library() {
public void load(Ruby runtime, boolean wrap) throws IOException {
// dummy library that does nothing right now
}
};
void load(Ruby runtime, boolean wrap) throws IOException;
}
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -270,6 +270,12 @@ public void addPaths(String... additionalDirectories) {
addPath(dir);
}
}

// MRI: rb_provide, roughly
public void provide(String library) {
addBuiltinLibrary(library, Library.DUMMY);
addLoadedFeature(library, library);
}

protected boolean isFeatureInIndex(String shortName) {
return loadedFeaturesIndex.containsKey(shortName);
Original file line number Diff line number Diff line change
@@ -123,7 +123,8 @@ private static RubyArray glob(final RubyContext context, String glob) {

final String prefix = absoluteGlob.substring(0, prefixLength - 1);

final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + absoluteGlob.substring(prefixLength));
// Glob patterns must always use '/', even on Windows.
final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + absoluteGlob.substring(prefixLength).replace('\\', '/'));

final RubyArray array = new RubyArray(context.getCoreLibrary().getArrayClass());

Original file line number Diff line number Diff line change
@@ -123,8 +123,10 @@ public boolean requireInPath(String path, String feature, RubyNode currentNode)
}

private boolean requireFile(String fileName, RubyNode currentNode) throws IOException {
// Loading from core:/ always just goes ahead without a proper check
// We expect '/' in various classpath URLs, so normalize Windows file paths to use '/'.
fileName = fileName.replace('\\', '/');

// Loading from core:/ always just goes ahead without a proper check
if (fileName.startsWith("core:/")) {
try {
context.getCoreLibrary().loadRubyCore(fileName.substring("core:/".length()));
11 changes: 6 additions & 5 deletions core/src/main/ruby/jruby/java.rb
Original file line number Diff line number Diff line change
@@ -33,9 +33,10 @@
# the terms of any one of the EPL, the GPL or the LGPL.
###### END LICENSE BLOCK ######

require 'jruby/java/java_module'
require 'jruby/java/java_package_module_template'
require 'jruby/java/java_utilities'
# These are loads so they don't pollute LOADED_FEATURES
load 'jruby/java/java_module.rb'
load 'jruby/java/java_package_module_template.rb'
load 'jruby/java/java_utilities.rb'

require 'jruby/java/core_ext'
require 'jruby/java/java_ext'
load 'jruby/java/core_ext.rb'
load 'jruby/java/java_ext.rb'
7 changes: 4 additions & 3 deletions core/src/main/ruby/jruby/java/core_ext.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Extensions to Ruby classes

require 'jruby/java/core_ext/module'
require 'jruby/java/core_ext/object'
require 'jruby/java/core_ext/kernel'
# These are loads so they don't pollute LOADED_FEATURES
load 'jruby/java/core_ext/module.rb'
load 'jruby/java/core_ext/object.rb'
load 'jruby/java/core_ext/kernel.rb'
11 changes: 6 additions & 5 deletions core/src/main/ruby/jruby/java/java_ext.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Extensions to Java classes

require 'jruby/java/java_ext/java.lang'
require 'jruby/java/java_ext/java.util'
require 'jruby/java/java_ext/java.util.regex'
require 'jruby/java/java_ext/java.io'
require 'jruby/java/java_ext/java.net'
# These are loads so they don't pollute LOADED_FEATURES
load 'jruby/java/java_ext/java.lang.rb'
load 'jruby/java/java_ext/java.util.rb'
load 'jruby/java/java_ext/java.util.regex.rb'
load 'jruby/java/java_ext/java.io.rb'
load 'jruby/java/java_ext/java.net.rb'
2 changes: 0 additions & 2 deletions core/src/main/ruby/jruby/java/java_ext/java.io.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'jruby' unless defined? JRuby

class java::io::InputStream
def to_io(opts = nil)
ruby_io = org.jruby.RubyIO.new(JRuby.runtime, self)
2 changes: 0 additions & 2 deletions core/src/main/ruby/jruby/jruby.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'java'

module JRuby
def self.init_asm
begin
3 changes: 0 additions & 3 deletions core/src/main/ruby/jruby/kernel.rb
Original file line number Diff line number Diff line change
@@ -20,10 +20,7 @@
end
end

require 'thread.jar'

# These are loads so they don't pollute LOADED_FEATURES
load 'jruby/kernel/thread.rb'
load 'jruby/kernel/kernel.rb'
load 'jruby/kernel/proc.rb'
load 'jruby/kernel/process.rb'
10 changes: 0 additions & 10 deletions core/src/main/ruby/jruby/kernel/thread.rb

This file was deleted.

4 changes: 0 additions & 4 deletions core/src/test/java/org/jruby/test/TestRubySymbol.java
Original file line number Diff line number Diff line change
@@ -49,16 +49,12 @@ public void setUp() {

public void testSymbolTable() throws Exception {
RubySymbol.SymbolTable st = runtime.getSymbolTable();

assertNull(st.lookup("somename"));

RubySymbol symbol = RubySymbol.newSymbol(runtime, "somename");
assertSame(symbol, st.lookup("somename"));
assertSame(symbol, st.getSymbol("somename"));
assertSame(symbol, st.fastGetSymbol("somename"));

RubySymbol another = st.fastGetSymbol("another_name");
assertSame(another, st.lookup("another_name"));
assertSame(another, st.getSymbol("another_name"));
assertSame(another, st.fastGetSymbol("another_name"));
}
1 change: 1 addition & 0 deletions rakelib/test.rake
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ end
namespace :test do
desc "Compile test code"
task :compile do
mkdir_p "test/target/test-classes"
sh "javac -cp lib/jruby.jar:test/target/junit.jar -d test/target/test-classes #{Dir['spec/java_integration/fixtures/**/*.java'].to_a.join(' ')}"
end

8 changes: 8 additions & 0 deletions spec/truffle/spec-wrapper.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@bin\jruby -X+T ^
-Xparser.warn.useless_use_of=false ^
-Xparser.warn.not_reached=false ^
-Xparser.warn.grouped_expressions=false ^
-Xparser.warn.shadowing_local=false ^
-Xparser.warn.regex_condition=false ^
-Xparser.warn.argument_prefix=false ^
-J-ea -J-Xmx2G %*
6 changes: 5 additions & 1 deletion spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
class MSpecScript

set :target, File.dirname(__FILE__) + '/spec-wrapper'
def self.windows?
ENV.key?('WINDIR') || ENV.key?('windir')
end

set :target, File.join(File.dirname(__FILE__), "spec-wrapper#{windows? ? '.bat' : ''}")

set :language, [
"spec/ruby/language"

0 comments on commit 63420d6

Please sign in to comment.