Skip to content

Commit

Permalink
Showing 139 changed files with 910 additions and 1,144 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/Main.java
Original file line number Diff line number Diff line change
@@ -438,6 +438,7 @@ private boolean checkFileSyntax(Ruby runtime, String filename) {
}

private boolean checkStreamSyntax(Ruby runtime, InputStream in, String filename) {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
runtime.parseFromMain(in, filename);
config.getOutput().println("Syntax OK");
@@ -448,6 +449,7 @@ private boolean checkStreamSyntax(Ruby runtime, InputStream in, String filename)
} else {
throw re;
}
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
return false;
}
}
3 changes: 3 additions & 0 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -3228,6 +3228,7 @@ public void tearDown(boolean systemExit) {

while (!atExitBlocks.empty()) {
RubyProc proc = atExitBlocks.pop();
// IRubyObject oldExc = context.runtime.getGlobalVariables().get("$!"); // Save $!
try {
proc.call(getCurrentContext(), IRubyObject.NULL_ARRAY);
} catch (RaiseException rj) {
@@ -3242,6 +3243,8 @@ public void tearDown(boolean systemExit) {
status = RubyNumeric.fix2int(statusObj);
}
}
// Reset $! now that rj has been handled
// context.runtime.getGlobalVariables().set("$!", oldExc);
}
}

5 changes: 2 additions & 3 deletions core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
@@ -1150,8 +1150,7 @@ public IRubyObject op_not_equal(ThreadContext context, IRubyObject other) {
*/
@Override
public int compareTo(IRubyObject other) {
// SSS FIXME: How do we get access to the runtime here?
// IRubyObject oldExc = runtime.getGlobalVariables().get("$!");
IRubyObject oldExc = getRuntime().getGlobalVariables().get("$!");
try {
IRubyObject cmp = invokedynamic(getRuntime().getCurrentContext(),
this, OP_CMP, other);
@@ -1161,7 +1160,7 @@ public int compareTo(IRubyObject other) {
return (int) cmp.convertToInteger().getLongValue();
}
} catch (RaiseException ex) {
// runtime.getGlobalVariables().set("$!", oldExc);
getRuntime().getGlobalVariables().set("$!", oldExc);
}

/* We used to raise an error if two IRubyObject were not comparable, but
7 changes: 4 additions & 3 deletions core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
@@ -684,12 +684,13 @@ private static IRubyObject checkFuncallMissing(ThreadContext context, RubyClass
return null;
}
else {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
return checkFuncallExec(context, self, method, args);
} catch (RaiseException e) {
// clear $!
context.setErrorInfo(context.nil);
return checkFuncallFailed(context, self, method, runtime.getNoMethodError(), args);
IRubyObject ret = checkFuncallFailed(context, self, method, runtime.getNoMethodError(), args);
runtime.getGlobalVariables().set("$!", oldExc); // restore $!
return ret;
}
}
}
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/RubyComparable.java
Original file line number Diff line number Diff line change
@@ -149,7 +149,6 @@ private static IRubyObject callCmpMethod(ThreadContext context, IRubyObject recv
if (e.getException().kind_of_p(context, runtime.getStandardError()).isTrue()) {
// clear error info resulting from failure to compare (JRUBY-3292)
runtime.getGlobalVariables().set("$!", savedError);
context.setErrorInfo(runtime.getNil()); // SSS FIXME: Is this correct?
return returnValueOnError;
} else {
throw e;
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyEnumerator.java
Original file line number Diff line number Diff line change
@@ -756,7 +756,7 @@ public void run() {
IRubyObject finalObject = NEVER;

try {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!");
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
final TerminateEnumeration terminateEnumeration = new TerminateEnumeration();
try {
object.callMethod(context, method, methodArgs, CallBlock.newCallClosure(object, object.getMetaClass(), Arity.OPTIONAL, new BlockCallback() {
@@ -784,9 +784,9 @@ public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block)
}
// ignore, we're shutting down
} catch (RaiseException re) {
runtime.getGlobalVariables().set("$!", oldExc);
if (DEBUG) System.out.println(Thread.currentThread().getName() + ": exception at toplevel: " + re.getException());
finalObject = re.getException();
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
} catch (Throwable t) {
if (DEBUG) {
System.out.println(Thread.currentThread().getName() + ": exception at toplevel: " + t);
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyFileTest.java
Original file line number Diff line number Diff line change
@@ -277,7 +277,7 @@ public static IRubyObject sticky_p(IRubyObject recv, IRubyObject filename) {
@JRubyMethod(name = "symlink?", required = 1, module = true)
public static RubyBoolean symlink_p(IRubyObject recv, IRubyObject filename) {
Ruby runtime = recv.getRuntime();
IRubyObject oldExc = runtime.getGlobalVariables().get("$!");
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!

try {
// Note: We can't use file.exists() to check whether the symlink
@@ -291,7 +291,7 @@ public static RubyBoolean symlink_p(IRubyObject recv, IRubyObject filename) {
} catch (SecurityException re) {
return runtime.getFalse();
} catch (RaiseException re) {
runtime.getGlobalVariables().set("$!", oldExc);
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
return runtime.getFalse();
}
}
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -1942,13 +1942,13 @@ protected static IRubyObject ioClose(Ruby runtime, IRubyObject io) {
ThreadContext context = runtime.getCurrentContext();
IRubyObject closed = io.checkCallMethod(context, "closed?");
if (closed != null && closed.isTrue()) return io;
IRubyObject oldExc = context.getErrorInfo();
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
return io.checkCallMethod(context, "close");
} catch (RaiseException re) {
if (re.getMessage().contains(CLOSED_STREAM_MSG)) {
// ignore
context.setErrorInfo(oldExc);
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
return context.nil;
} else {
throw re;
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1309,7 +1309,7 @@ public static IRubyObject loop(ThreadContext context, IRubyObject recv, Block bl
}
IRubyObject nil = runtime.getNil();
RubyClass stopIteration = runtime.getStopIteration();
IRubyObject oldExc = runtime.getGlobalVariables().get("$!");
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
while (true) {
block.yieldSpecific(context);
@@ -1320,7 +1320,7 @@ public static IRubyObject loop(ThreadContext context, IRubyObject recv, Block bl
if (!stopIteration.op_eqq(context, ex.getException()).isTrue()) {
throw ex;
} else {
runtime.getGlobalVariables().set("$!", oldExc);
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
}
}
return nil;
@@ -1678,7 +1678,7 @@ private static IRubyObject execCommon(Ruby runtime, IRubyObject env, IRubyObject
System.setProperty("user.dir", runtime.getCurrentDirectory());

if (nativeExec) {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!");
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
ShellLauncher.LaunchConfig cfg = new ShellLauncher.LaunchConfig(runtime, args, true);

@@ -1716,7 +1716,7 @@ private static IRubyObject execCommon(Ruby runtime, IRubyObject env, IRubyObject
// Only here because native exec could not exec (always -1)
nativeFailed = true;
} catch (RaiseException e) {
runtime.getGlobalVariables().set("$!", oldExc);
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
} catch (Exception e) {
throw runtime.newErrnoENOENTError("cannot execute: " + e.getLocalizedMessage());
}
6 changes: 4 additions & 2 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -859,12 +859,14 @@ public void undef(ThreadContext context, String name) {
}

if (name.equals("method_missing")) {

IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
removeMethod(context, name);
} catch (RaiseException t) {
if(!(t.getException() instanceof RubyNameError)) {
if (!(t.getException() instanceof RubyNameError)) {
throw t;
} else {
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
}
}
return;
9 changes: 4 additions & 5 deletions core/src/main/java/org/jruby/RubyNumeric.java
Original file line number Diff line number Diff line change
@@ -409,15 +409,15 @@ public double yield(RubyString arg, boolean strict) {
protected IRubyObject[] getCoerced(ThreadContext context, IRubyObject other, boolean error) {
IRubyObject result;

IRubyObject savedError = context.runtime.getGlobalVariables().get("$!");
IRubyObject savedError = context.runtime.getGlobalVariables().get("$!"); // Save $!
try {
result = other.callMethod(context, "coerce", this);
} catch (RaiseException e) {
if (error) {
throw getRuntime().newTypeError(
other.getMetaClass().getName() + " can't be coerced into " + getMetaClass().getName());
} else {
context.runtime.getGlobalVariables().set("$!", savedError);
context.runtime.getGlobalVariables().set("$!", savedError); // Restore $!
}

return null;
@@ -461,7 +461,7 @@ protected final IRubyObject coerceBody(ThreadContext context, IRubyObject other)
protected final RubyArray doCoerce(ThreadContext context, IRubyObject other, boolean err) {
IRubyObject result;

IRubyObject savedError = context.runtime.getGlobalVariables().get("$!");
IRubyObject savedError = context.runtime.getGlobalVariables().get("$!"); // Svae $!
try {
result = coerceBody(context, other);
} catch (RaiseException e) {
@@ -470,9 +470,8 @@ protected final RubyArray doCoerce(ThreadContext context, IRubyObject other, boo
warnings.warn("in the next release. Return nil in #coerce if the coercion is impossible.");
if (err) {
coerceFailed(context, other);
} else {
context.runtime.getGlobalVariables().set("$!", savedError);
}
context.runtime.getGlobalVariables().set("$!", savedError); // Restore $!
return null;
}

22 changes: 15 additions & 7 deletions core/src/main/java/org/jruby/RubyTime.java
Original file line number Diff line number Diff line change
@@ -832,17 +832,21 @@ public RubyBoolean isdst() {

@JRubyMethod
public IRubyObject zone() {
Ruby runtime = getRuntime();
if (isTzRelative) return runtime.getNil();

String envTZ = getEnvTimeZone(runtime).toString();
final String zone = RubyTime.zoneHelper(getEnvTimeZone(getRuntime()).toString(), dt, isTzRelative);
if (zone == null) return getRuntime().getNil();
return getRuntime().newString(zone);
}

public static String zoneHelper(String envTZ, DateTime dt, boolean isTzRelative) {
if (isTzRelative) return null;

// see declaration of SHORT_TZNAME
if (SHORT_STD_TZNAME.containsKey(envTZ) && ! dt.getZone().toTimeZone().inDaylightTime(dt.toDate())) {
return runtime.newString(SHORT_STD_TZNAME.get(envTZ));
return SHORT_STD_TZNAME.get(envTZ);
}

if (SHORT_DL_TZNAME.containsKey(envTZ) && dt.getZone().toTimeZone().inDaylightTime(dt.toDate())) {
return runtime.newString(SHORT_DL_TZNAME.get(envTZ));
return SHORT_DL_TZNAME.get(envTZ);
}

String zone = dt.getZone().getShortName(dt.getMillis());
@@ -865,7 +869,7 @@ public IRubyObject zone() {
}
}

return runtime.newString(zone);
return zone;
}

public void setDateTime(DateTime dt) {
@@ -1216,17 +1220,21 @@ protected static RubyTime s_mload(IRubyObject recv, RubyTime time, IRubyObject f

int offset = 0;
if (offsetVar != null && offsetVar.respondsTo("to_int")) {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
offset = offsetVar.convertToInteger().getIntValue() * 1000;
} catch (RaiseException typeError) {
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
}
}

String zone = "";
if (zoneVar != null && zoneVar.respondsTo("to_str")) {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
zone = zoneVar.convertToString().toString();
} catch (RaiseException typeError) {
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
}
}

2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/ext/etc/RubyEtc.java
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ private static IRubyObject intoStringArray(Ruby runtime, String[] members) {
public static IRubyObject getpwuid(IRubyObject recv, IRubyObject[] args) {
Ruby runtime = recv.getRuntime();
POSIX posix = runtime.getPosix();
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
int uid = args.length == 0 ? posix.getuid() : RubyNumeric.fix2int(args[0]);
Passwd pwd = posix.getpwuid(uid);
@@ -128,6 +129,7 @@ public static IRubyObject getpwuid(IRubyObject recv, IRubyObject[] args) {
return setupPasswd(runtime, pwd);
} catch (RaiseException re) {
if (runtime.getNotImplementedError().isInstance(re.getException())) {
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
return runtime.getNil();
}
throw re;
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/ext/pathname/RubyPathname.java
Original file line number Diff line number Diff line change
@@ -394,12 +394,14 @@ public IRubyObject each_entry(ThreadContext context, Block block) {

@JRubyMethod(name = {"unlink", "delete"})
public IRubyObject unlink(ThreadContext context) {
IRubyObject oldExc = context.runtime.getGlobalVariables().get("$!"); // Save $!
try {
return context.runtime.getDir().callMethod(context, "unlink", getPath());
} catch (RaiseException ex) {
if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) {
throw ex;
}
context.runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
return context.runtime.getFile().callMethod(context, "unlink", getPath());
}
}
5 changes: 3 additions & 2 deletions core/src/main/java/org/jruby/ext/tempfile/Tempfile.java
Original file line number Diff line number Diff line change
@@ -203,17 +203,18 @@ public IRubyObject unlink(ThreadContext context) {
POSIX posix = runtime.getPosix();

if (posix.isNative() && !Platform.IS_WINDOWS) {
IRubyObject oldExc = context.runtime.getGlobalVariables().get("$!"); // Save $!
try {
RubyFile.unlink(context, this);
} catch (RaiseException re) {
RubyException excp = re.getException();
if (!(excp instanceof RubySystemCallError)) throw re;

int errno = (int)((RubySystemCallError)excp).errno().convertToInteger().getLongValue();
if (errno != Errno.ENOENT.intValue() &&
errno != Errno.EACCES.intValue()) {
if (errno != Errno.ENOENT.intValue() && errno != Errno.EACCES.intValue()) {
throw re;
}
context.runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
}
openFile.setPath(null);
tmpname = context.nil;
Original file line number Diff line number Diff line change
@@ -199,10 +199,7 @@ public IRubyObject interpret(ThreadContext context, IRubyObject self, Interprete
ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc);
} else {
Object result = instr.interpret(context, currScope, currDynScope, self, temp);

if (instr instanceof ResultInstr) {
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), result);
}
setResult(temp, currDynScope, instr, result);
}
}
} catch (Throwable t) {
14 changes: 2 additions & 12 deletions core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java
Original file line number Diff line number Diff line change
@@ -496,23 +496,13 @@ private static void processOtherOp(ThreadContext context, Instr instr, Operation
}
}



/*
* If you put this code into the method above it will hard crash some production builds of C2 in Java 8. We aren't
* sure exactly which builds, but it seems to appear more often in Linux builds than Mac. - Chris Seaton
*/

private static void extractToMethodToAvoidC2Crash(ThreadContext context, Instr instr, Throwable t) {
if (!(t instanceof Unrescuable)) {
if (!instr.canRaiseException()) {
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("BUG: $! and exception are not matching up.");
System.err.println("$!: " + context.runtime.getGlobalVariables().get("$!"));
System.err.println("t : " + t);
}
if (!(t instanceof Unrescuable) && !instr.canRaiseException()) {
System.err.println("BUG: Got exception " + t + " but instr " + instr + " is not supposed to be raising exceptions!");
}
}

2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/java/proxies/MapJavaProxy.java
Original file line number Diff line number Diff line change
@@ -86,10 +86,12 @@ private RubyHashMap getOrCreateRubyHashMap() {
}
// (JavaProxy)recv).getObject() might raise exception when
// wrong number of args are given to the constructor.
IRubyObject oldExc = getRuntime().getGlobalVariables().get("$!"); // Save $!
try {
wrappedMap.setSize(((Map)((JavaProxy)this).getObject()).size());
} catch (RaiseException e) {
wrappedMap.setSize(0);
getRuntime().getGlobalVariables().set("$!", oldExc); // Restore $!
}
return wrappedMap;
}
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
@@ -953,6 +953,7 @@ private static RubyModule getProxyOrPackageUnderPackage(ThreadContext context, f
} catch (RaiseException re) { /* expected */
RubyException rubyEx = re.getException();
if (rubyEx.kind_of_p(context, runtime.getStandardError()).isTrue()) {
// SSS FIXME: Why is this being done conditionally??
Helpers.setErrorInfo(runtime, previousErrorInfo);
}
} catch (Exception e) { /* expected */ }
@@ -1019,6 +1020,7 @@ private static RubyModule getTopLevelProxyOrPackage(ThreadContext context, final
} catch (RaiseException re) { /* not primitive or lc class */
RubyException rubyEx = re.getException();
if (rubyEx.kind_of_p(context, runtime.getStandardError()).isTrue()) {
// SSS FIXME: Why is this being set to nil??
Helpers.setErrorInfo(runtime, runtime.getNil());
}
} catch (Exception e) { /* not primitive or lc class */ }
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/management/Runtime.java
Original file line number Diff line number Diff line change
@@ -109,10 +109,12 @@ public String executeRuby(final String code) {

@Override
public void run() {
// IRubyObject oldExc = ruby.get().getGlobalVariables().get("$!"); // Save $!
try {
result[0] = ruby.get().evalScriptlet(code).toString();
} catch (RaiseException re) {
result[0] = ruby.get().getInstanceConfig().getTraceType().printBacktrace(re.getException(), false);
// ruby.get().getGlobalVariables().set("$!", oldExc); // Restore $!
} catch (Throwable t) {
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/SunSignalFacade.java
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ private JRubySignalHandler(Ruby runtime, IRubyObject block, BlockCallback callba

public void handle(Signal signal) {
ThreadContext context = runtime.getCurrentContext();
IRubyObject oldExc = runtime.getGlobalVariables().get("$!"); // Save $!
try {
if (block != null) {
block.callMethod(context, "call");
@@ -92,6 +93,7 @@ public void handle(Signal signal) {
runtime.getThread().callMethod(context, "main")
.callMethod(context, "raise", e.getException());
} catch(Exception ignored) {}
runtime.getGlobalVariables().set("$!", oldExc); // Restore $!
} catch (MainExitException mee) {
runtime.getThreadService().getMainThread().kill();
} finally {
2 changes: 1 addition & 1 deletion spec/truffle/tags/core/class/inherited_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fails:Class.inherited is invoked with the child Class when self is subclassed
fails(windows bug):Class.inherited is invoked only once per subclass
windows:Class.inherited is invoked only once per subclass
6 changes: 3 additions & 3 deletions spec/truffle/tags/core/encoding/default_internal_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fails(windows bug):Encoding.default_internal with command line options returns Encoding::UTF_8 if ruby was invoked with -U
fails(windows bug):Encoding.default_internal with command line options uses the encoding specified when ruby is invoked with an '-E :internal' argument
fails(windows bug):Encoding.default_internal with command line options uses the encoding specified when ruby is invoked with an '-E external:internal' argument
windows:Encoding.default_internal with command line options returns Encoding::UTF_8 if ruby was invoked with -U
windows:Encoding.default_internal with command line options uses the encoding specified when ruby is invoked with an '-E :internal' argument
windows:Encoding.default_internal with command line options uses the encoding specified when ruby is invoked with an '-E external:internal' argument
2 changes: 1 addition & 1 deletion spec/truffle/tags/core/encoding/dummy_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fails(inherited):Encoding#dummy? returns true for dummy encodings
fails(windows bug):Encoding#dummy? returns true for dummy encodings
windows:Encoding#dummy? returns true for dummy encodings
10 changes: 10 additions & 0 deletions spec/truffle/tags/core/enumerable/find_index_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fails:Enumerable#find_index passes each entry in enum to block while block when block is false
fails:Enumerable#find_index returns nil when the block is false
fails:Enumerable#find_index returns the first index for which the block is not false
fails:Enumerable#find_index returns the first index found
fails:Enumerable#find_index returns nil when the element not found
fails:Enumerable#find_index ignores the block if an argument is given
fails:Enumerable#find_index returns an Enumerator if no block given
fails:Enumerable#find_index without block gathers whole arrays as elements when each yields multiple
fails:Enumerable#find_index with block given a single yield parameter passes first element to the parameter
fails:Enumerable#find_index with block given a greedy yield parameter passes a gathered array to the parameter
3 changes: 3 additions & 0 deletions spec/truffle/tags/core/enumerable/to_a_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
fails:Enumerable#to_a returns a tainted array if self is tainted
fails:Enumerable#to_a returns an untrusted array if self is untrusted
fails:Enumerable#to_a returns an array containing the elements
fails:Enumerable#to_a passes through the values yielded by #each_with_index
fails:Enumerable#to_a passes arguments to each
7 changes: 7 additions & 0 deletions spec/truffle/tags/core/enumerable/to_h_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fails:Enumerable#to_h converts empty enumerable to empty hash
fails:Enumerable#to_h converts yielded [key, value] pairs to a hash
fails:Enumerable#to_h uses the last value of a duplicated key
fails:Enumerable#to_h calls #to_ary on contents
fails:Enumerable#to_h forwards arguments to #each
fails:Enumerable#to_h raises TypeError if an element is not an array
fails:Enumerable#to_h raises ArgumentError if an element is not a [key, value] pair
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/file/dirname_tags.txt
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@ fails(windows):File.dirname returns all the components of filename except the la
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)
fails(windows):File.dirname returns the return all the components of filename except the last one (forward_slash)
fails(windows bug):File.dirname ignores a trailing /
fails(windows bug):File.dirname returns the return all the components of filename except the last one (unix format)
windows:File.dirname ignores a trailing /
windows:File.dirname returns the return all the components of filename except the last one (unix format)
10 changes: 5 additions & 5 deletions spec/truffle/tags/core/file/expand_path_tags.txt
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ fails:File.expand_path when HOME is not set raises an ArgumentError when passed
fails:File.expand_path when HOME is not set raises an ArgumentError when passed '~' if HOME == ''
fails(windows):File.expand_path does not return a frozen string
fails(windows):File.expand_path expands C:/./dir to C:/dir
fails(windows bug):File.expand_path converts a pathname to an absolute pathname, Ruby-Talk:18512
fails(windows bug):File.expand_path converts a pathname to an absolute pathname, using a complete path
fails(windows bug):File.expand_path raises a TypeError if not passed a String type
fails(windows bug):File.expand_path does not modify the string argument
fails(windows bug):File.expand_path returns a String when passed a String subclass
windows:File.expand_path converts a pathname to an absolute pathname, Ruby-Talk:18512
windows:File.expand_path converts a pathname to an absolute pathname, using a complete path
windows:File.expand_path raises a TypeError if not passed a String type
windows:File.expand_path does not modify the string argument
windows:File.expand_path returns a String when passed a String subclass
6 changes: 3 additions & 3 deletions spec/truffle/tags/core/file/file_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fails:File includes File::Constants
fails:File.file? accepts an object that has a #to_path method
fails(windows bug):File.file? returns true if the named file exists and is a regular file.
fails(windows bug):File.file? raises an ArgumentError if not passed one argument
fails(windows bug):File.file? raises a TypeError if not passed a String type
windows:File.file? returns true if the named file exists and is a regular file.
windows:File.file? raises an ArgumentError if not passed one argument
windows:File.file? raises a TypeError if not passed a String type
2 changes: 1 addition & 1 deletion spec/truffle/tags/core/file/path_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fails:File#path returns the pathname used to create file as a string
fails(windows bug):File.path returns the full path for the given file
windows:File.path returns the full path for the given file
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/file/readable_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fails:File.readable? accepts an object that has a #to_path method
fails(windows bug):File.readable? returns true if named file is readable by the effective user id of the process, otherwise false
fails(windows bug):File.readable? returns false if the file does not exist
windows:File.readable? returns true if named file is readable by the effective user id of the process, otherwise false
windows:File.readable? returns false if the file does not exist
6 changes: 3 additions & 3 deletions spec/truffle/tags/core/file/size_tags.txt
Original file line number Diff line number Diff line change
@@ -17,6 +17,6 @@ fails:File#size returns the file's current size even if modified
fails:File#size raises an IOError on a closed file
fails:File#size follows symlinks if necessary
fails:File#size for an empty file returns 0
fails(windows bug):File.size? returns the size of the file if it exists and is not empty
fails(windows bug):File.size? returns nil if file_name doesn't exist or has 0 size
fails(windows bug):File.size? returns nil if file_name is empty
windows:File.size? returns the size of the file if it exists and is not empty
windows:File.size? returns nil if file_name doesn't exist or has 0 size
windows:File.size? returns nil if file_name is empty
2 changes: 1 addition & 1 deletion spec/truffle/tags/core/file/stat/file_tags.txt
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@ fails:File::Stat#file? returns true if the named file exists and is a regular fi
fails:File::Stat#file? accepts an object that has a #to_path method
fails:File::Stat#file? returns true if the null device exists and is a regular file.
fails:File::Stat#file? raises a TypeError if not passed a String type
fails(windows bug):File::Stat#file? raises an ArgumentError if not passed one argument
windows:File::Stat#file? raises an ArgumentError if not passed one argument
3 changes: 3 additions & 0 deletions spec/truffle/tags/core/file/stat/sticky_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fails:File::Stat#sticky? returns true if the named file has the sticky bit, otherwise false
fails:File::Stat#sticky? accepts an object that has a #to_path method
fails:File::Stat#sticky? needs to be reviewed for spec completeness
3 changes: 3 additions & 0 deletions spec/truffle/tags/core/file/sticky_tags.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,6 @@ fails:File.sticky? returns false if the file dies not exist
fails:File.sticky? returns false if file does not exist
fails:File.sticky? returns false if the file has not sticky bit set
fails:File.sticky? returns true if the file has sticky bit set
fails:File.sticky? returns true if the named file has the sticky bit, otherwise false
fails:File.sticky? accepts an object that has a #to_path method
fails:File.sticky? cannot set sticky bit to a normal file
5 changes: 5 additions & 0 deletions spec/truffle/tags/core/filetest/file_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
fails:File.file? accepts an object that has a #to_path method
fails:File.file? returns true if the named file exists and is a regular file.
fails:File.file? returns true if the null device exists and is a regular file.
fails:File.file? raises an ArgumentError if not passed one argument
fails:File.file? raises a TypeError if not passed a String type
fails:FileTest.file? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/owned_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:FileTest.owned? accepts an object that has a #to_path method
fails:FileTest.owned? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/pipe_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:FileTest.pipe? accepts an object that has a #to_path method
fails:FileTest.pipe? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/setgid_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:FileTest.setgid? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/setuid_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:FileTest.setuid? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/socket_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:FileTest.socket? accepts an object that has a #to_path method
fails:FileTest.socket? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/symlink_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fails:FileTest.symlink? returns true if the file is a link
fails:FileTest.symlink? accepts an object that has a #to_path method
fails:FileTest.symlink? returns false if the file does not exist
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/world_readable_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:FileTest.world_readable? needs to be reviewed for spec completeness
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/world_writable_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:FileTest.world_writable? needs to be reviewed for spec completeness
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/io/readlines_tags.txt
Original file line number Diff line number Diff line change
@@ -45,5 +45,5 @@ fails:IO.readlines when passed name, separator, limit, options calls #to_hash to
fails:IO.readlines encodes lines using the default external encoding
fails:IO.readlines encodes lines using the default internal encoding, when set
fails:IO.readlines ignores the default internal encoding if the external encoding is ASCII-8BIT
fails(windows bug):IO.readlines does not change $_
fails(windows bug):IO.readlines raises TypeError if the first parameter is nil
windows:IO.readlines does not change $_
windows:IO.readlines raises TypeError if the first parameter is nil
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/kernel/eval_tags.txt
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ fails:Kernel#eval returns from the scope calling #eval when evaluating 'return'
fails:Kernel#eval unwinds through a Proc-style closure and returns from a lambda-style closure in the closure chain
slow:Kernel#eval raises a LocalJumpError if there is no lambda-style closure in the chain
slow:Kernel#eval does not share locals across eval scopes
fails(windows bug):Kernel#eval does not share locals across eval scopes
fails(windows bug):Kernel#eval raises a LocalJumpError if there is no lambda-style closure in the chain
windows:Kernel#eval does not share locals across eval scopes
windows:Kernel#eval raises a LocalJumpError if there is no lambda-style closure in the chain
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/kernel/load_tags.txt
Original file line number Diff line number Diff line change
@@ -24,6 +24,6 @@ fails:Kernel.load (path resolution) with an unreadable file raises a LoadError
fails:Kernel.load loads file even after $LOAD_PATH change
fails:Kernel.load sets the enclosing scope to an anonymous module if passed true for 'wrap'
fails:Kernel.load (shell expansion) expands a tilde to the HOME environment variable as the path to load
fails(windows bug):Kernel#load loads a file that recursively requires itself
fails(windows bug):Kernel.load loads a file that recursively requires itself
windows:Kernel#load loads a file that recursively requires itself
windows:Kernel.load loads a file that recursively requires itself

2 changes: 1 addition & 1 deletion spec/truffle/tags/core/method/source_location_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fails:Method#source_location works for methods defined with an UnboundMethod
fails:Method#source_location for a Method generated by respond_to_missing? returns nil
fails(windows bug):Method#source_location sets the first value to the path of the file in which the method was defined
windows:Method#source_location sets the first value to the path of the file in which the method was defined
1 change: 1 addition & 0 deletions spec/truffle/tags/core/range/each_tags.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@ fails:Range#each passes each element to the given block by using #succ
fails:Range#each raises a TypeError if the first element does not respond to #succ
fails:Range#each returns an enumerator when no block given
fails:Range#each passes each Symbol element by using #succ
fails:Range#each raises a TypeError if the first element is a Time object
1 change: 1 addition & 0 deletions spec/truffle/tags/core/rational/abs_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Rational#abs returns self's absolute value
4 changes: 4 additions & 0 deletions spec/truffle/tags/core/rational/exponent_tags.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,7 @@ fails:Rational#** when passed Rational returns self raised to the argument as a
fails:Rational#** when passed Rational returns a complex number when self is negative and the passed argument is not 0
fails:Rational#** when passed Float returns a complex number if self is negative and the passed argument is not 0
fails:Rational#** when passed Float returns Complex(1.0) when the passed argument is 0.0
fails:Rational#** when passed Bignum returns 0.0 when self is > 1 and the exponent is negative
fails:Rational#** when passed Bignum returns 0.0 when self is < -1 and the exponent is negative
fails:Rational#** when passed Bignum returns 0.0 when self is > 1
fails:Rational#** when passed Bignum returns 0.0 when self is < -1 and the exponent is negative
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/signal/list_tags.txt

This file was deleted.

32 changes: 16 additions & 16 deletions spec/truffle/tags/core/signal/trap_tags.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
fails:Signal.trap the special EXIT signal code accepts the EXIT code
fails:Signal.trap the special EXIT signal code runs the proc before at_exit handlers
fails(windows bug):Signal.trap returns the previous handler
fails(windows bug):Signal.trap accepts a block in place of a proc/command argument
fails(windows bug):Signal.trap ignores the signal when passed nil
fails(windows bug):Signal.trap accepts 'DEFAULT' as a symbol in place of a proc
fails(windows bug):Signal.trap accepts 'SIG_DFL' as a symbol in place of a proc
fails(windows bug):Signal.trap accepts 'SIG_IGN' as a symbol in place of a proc
fails(windows bug):Signal.trap accepts 'IGNORE' as a symbol in place of a proc
fails(windows bug):Signal.trap accepts long names as Strings
fails(windows bug):Signal.trap acceps short names as Strings
fails(windows bug):Signal.trap accepts long names as Symbols
fails(windows bug):Signal.trap accepts short names as Symbols
fails(windows bug):Signal.trap accepts 'SIG_DFL' in place of a proc
fails(windows bug):Signal.trap accepts 'DEFAULT' in place of a proc
fails(windows bug):Signal.trap accepts 'SIG_IGN' in place of a proc
fails(windows bug):Signal.trap accepts 'IGNORE' in place of a proc
fails(windows bug):Signal.trap the special EXIT signal code can unset the handler
windows:Signal.trap returns the previous handler
windows:Signal.trap accepts a block in place of a proc/command argument
windows:Signal.trap ignores the signal when passed nil
windows:Signal.trap accepts 'DEFAULT' as a symbol in place of a proc
windows:Signal.trap accepts 'SIG_DFL' as a symbol in place of a proc
windows:Signal.trap accepts 'SIG_IGN' as a symbol in place of a proc
windows:Signal.trap accepts 'IGNORE' as a symbol in place of a proc
windows:Signal.trap accepts long names as Strings
windows:Signal.trap acceps short names as Strings
windows:Signal.trap accepts long names as Symbols
windows:Signal.trap accepts short names as Symbols
windows:Signal.trap accepts 'SIG_DFL' in place of a proc
windows:Signal.trap accepts 'DEFAULT' in place of a proc
windows:Signal.trap accepts 'SIG_IGN' in place of a proc
windows:Signal.trap accepts 'IGNORE' in place of a proc
windows:Signal.trap the special EXIT signal code can unset the handler
1 change: 1 addition & 0 deletions spec/truffle/tags/core/string/crypt_tags.txt
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@ fails:String#crypt calls #to_str to converts the salt arg to a String
fails:String#crypt raises a type error when the salt arg can't be converted to a string
fails:String#crypt taints the result if either salt or self is tainted
fails:String#crypt doesn't return subclass instances
fails:String#crypt returns NULL bytes prepended to the string when the salt contains NULL bytes
5 changes: 5 additions & 0 deletions spec/truffle/tags/core/string/gsub_tags.txt
Original file line number Diff line number Diff line change
@@ -63,3 +63,8 @@ fails:String#gsub! with pattern and block uses the compatible encoding if they a
fails:String#gsub! with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible
fails:String#gsub! with pattern and block replaces the incompatible part properly even if the encodings are not compatible
fails:String#gsub! with pattern and block raises an ArgumentError if encoding is not valid
fails:String#gsub with pattern and replacement respects $KCODE when the pattern collapses
fails:String#gsub with pattern and replacement handles pattern collapse without $KCODE
fails:String#gsub with pattern and block returns a copy of self with all occurrences of pattern replaced with the block's return value
fails:String#gsub with pattern and block doesn't interpolate special sequences like \1 for the block's return value
fails:String#gsub with pattern and block converts the block's return value to a string using to_s
6 changes: 6 additions & 0 deletions spec/truffle/tags/core/string/modulo_tags.txt
Original file line number Diff line number Diff line change
@@ -95,3 +95,9 @@ fails:String#% when format string contains %{} sections should raise ArgumentErr
fails:String#% when format string contains %<> formats uses the named argument for the format's value
fails:String#% when format string contains %<> formats raises KeyError if key is missing from passed-in hash
fails:String#% when format string contains %<> formats should raise ArgumentError if no hash given
fails:String#% raises an error if NULL or \n appear anywhere else in the format string
fails:String#% calls #to_ary to convert the argument
fails:String#% wraps the object in an Array if #to_ary returns nil
fails:String#% raises a TypeError if #to_ary does not return an Array
fails:String#% supports float formats using %e, but Inf, -Inf, and NaN are not floats
fails:String#% supports float formats using %E, but Inf, -Inf, and NaN are not floats
2 changes: 1 addition & 1 deletion spec/truffle/tags/core/struct/to_s_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fails(windows bug):Struct#to_s is a synonym for inspect
windows:Struct#to_s is a synonym for inspect
5 changes: 1 addition & 4 deletions spec/truffle/tags/core/time/_dump_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
fails:Time#_dump preserves the GMT flag
fails:Time#_dump dumps a Time object to a bytestring
fails:Time#_dump dumps an array with a date as first element
fails:Time#_dump dumps an array with a time as second element
fails:Time#_dump dumps like MRI's marshaled time format
fails:Time#_dump preserves the GMT flag
1 change: 0 additions & 1 deletion spec/truffle/tags/core/time/_load_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:Time._load loads a time object in the new format
fails:Time._load loads a time object in the old UNIX timestamp based format
fails:Time._load loads MRI's marshaled time format
fails:Time._load treats the data as binary data
3 changes: 1 addition & 2 deletions spec/truffle/tags/core/time/at_tags.txt
Original file line number Diff line number Diff line change
@@ -2,6 +2,5 @@ fails:Time.at passed Numeric returns a Time object representing the given number
fails:Time.at passed Numeric returns a subclass instance on a Time subclass
fails:Time.at passed Time returns a non-UTC time if the argument is non-UTC
fails:Time.at passed Time returns a subclass instance
fails:Time.at passed non-Time, non-Numeric with an argument that responds to #to_r coerces using #to_r
fails:Time.at passed [Integer, Numeric] returns a Time object representing the given number of seconds and Integer microseconds since 1970-01-01 00:00:00 UTC
fails:Time.at passed Numeric returns a non-UTC Time
fails:Time.at passed [Integer, Numeric] returns a Time object representing the given number of seconds and Float microseconds since 1970-01-01 00:00:00 UTC
4 changes: 4 additions & 0 deletions spec/truffle/tags/core/time/comparison_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fails:Time#<=> returns 1 if the first argument is a point in time after the second argument
fails:Time#<=> returns -1 if the first argument is a point in time before the second argument
fails:Time#<=> returns 1 if the first argument is a fraction of a microsecond after the second argument
fails:Time#<=> returns -1 if the first argument is a fraction of a microsecond before the second argument
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/day_tags.txt

This file was deleted.

2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/eql_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Time#eql? returns false if self and other have differing numbers of microseconds
fails:Time#eql? returns false if self and other have differing fractional microseconds
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/friday_tags.txt

This file was deleted.

38 changes: 0 additions & 38 deletions spec/truffle/tags/core/time/gm_tags.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,4 @@
fails:Time.gm creates a time based on given values, interpreted as UTC (GMT)
fails:Time.gm creates a time based on given C-style gmtime arguments, interpreted as UTC (GMT)
fails:Time.gm interprets pre-Gregorian reform dates using Gregorian proleptic calendar
fails:Time.gm interprets Julian-Gregorian gap dates using Gregorian proleptic calendar
fails:Time.gm interprets post-Gregorian reform dates using Gregorian calendar
fails:Time.gm accepts 1 argument (year)
fails:Time.gm accepts 2 arguments (year, month)
fails:Time.gm accepts 3 arguments (year, month, day)
fails:Time.gm accepts 4 arguments (year, month, day, hour)
fails:Time.gm accepts 5 arguments (year, month, day, hour, minute)
fails:Time.gm accepts nil month, day, hour, minute, and second
fails:Time.gm handles a String year
fails:Time.gm coerces the year with #to_int
fails:Time.gm handles a String month given as a numeral
fails:Time.gm handles a String month given as a short month name
fails:Time.gm coerces the month with #to_str
fails:Time.gm coerces the month with #to_int
fails:Time.gm handles a String day
fails:Time.gm coerces the day with #to_int
fails:Time.gm handles a String hour
fails:Time.gm coerces the hour with #to_int
fails:Time.gm handles a String minute
fails:Time.gm coerces the minute with #to_int
fails:Time.gm handles a String second
fails:Time.gm coerces the second with #to_int
fails:Time.gm interprets all numerals as base 10
fails:Time.gm handles fractional seconds as a Float
fails:Time.gm handles fractional seconds as a Rational
fails:Time.gm handles years from 0 as such
fails:Time.gm accepts various year ranges
fails:Time.gm raises an ArgumentError for out of range month
fails:Time.gm raises an ArgumentError for out of range day
fails:Time.gm raises an ArgumentError for out of range hour
fails:Time.gm raises an ArgumentError for out of range minute
fails:Time.gm raises an ArgumentError for out of range second
fails:Time.gm returns subclass instances
fails:Time.gm handles string arguments
fails:Time.gm handles float arguments
fails:Time.gm raises an ArgumentError for out of range values
fails:Time.gm handles microseconds
fails:Time.gm handles fractional microseconds as a Float
fails:Time.gm handles fractional microseconds as a Rational
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/time/gmt_offset_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fails:Time#gmt_offset returns the offset in seconds between the timezone of time and UTC
fails:Time#gmt_offset returns the correct offset for US Eastern time zone around daylight savings time change
fails:Time#gmt_offset returns the correct offset for Hawaii around daylight savings time change
fails:Time#gmt_offset returns the correct offset for New Zealand around daylight savings time change
fails:Time#gmt_offset returns offset as Rational
fails:Time#gmt_offset given positive offset returns a positive offset
fails:Time#gmt_offset given negative offset returns a negative offset
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/time/gmtoff_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fails:Time#gmtoff returns the offset in seconds between the timezone of time and UTC
fails:Time#gmtoff returns the correct offset for US Eastern time zone around daylight savings time change
fails:Time#gmtoff returns the correct offset for Hawaii around daylight savings time change
fails:Time#gmtoff returns the correct offset for New Zealand around daylight savings time change
fails:Time#gmtoff returns offset as Rational
fails:Time#gmtoff given positive offset returns a positive offset
fails:Time#gmtoff given negative offset returns a negative offset
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/hour_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/inspect_tags.txt

This file was deleted.

36 changes: 0 additions & 36 deletions spec/truffle/tags/core/time/local_tags.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,8 @@
fails:Time.local creates a time based on given values, interpreted in the local time zone
fails:Time.local respects rare old timezones
fails:Time.local creates a time based on given C-style gmtime arguments, interpreted in the local time zone
fails:Time.local creates the correct time just before dst change
fails:Time.local creates the correct time just after dst change
fails:Time.local accepts 1 argument (year)
fails:Time.local accepts 2 arguments (year, month)
fails:Time.local accepts 3 arguments (year, month, day)
fails:Time.local accepts 4 arguments (year, month, day, hour)
fails:Time.local accepts 5 arguments (year, month, day, hour, minute)
fails:Time.local accepts nil month, day, hour, minute, and second
fails:Time.local handles a String year
fails:Time.local coerces the year with #to_int
fails:Time.local handles a String month given as a numeral
fails:Time.local handles a String month given as a short month name
fails:Time.local coerces the month with #to_str
fails:Time.local coerces the month with #to_int
fails:Time.local handles a String day
fails:Time.local coerces the day with #to_int
fails:Time.local handles a String hour
fails:Time.local coerces the hour with #to_int
fails:Time.local handles a String minute
fails:Time.local coerces the minute with #to_int
fails:Time.local handles a String second
fails:Time.local coerces the second with #to_int
fails:Time.local interprets all numerals as base 10
fails:Time.local handles fractional seconds as a Float
fails:Time.local handles fractional seconds as a Rational
fails:Time.local handles years from 0 as such
fails:Time.local accepts various year ranges
fails:Time.local raises an ArgumentError for out of range month
fails:Time.local raises an ArgumentError for out of range day
fails:Time.local raises an ArgumentError for out of range hour
fails:Time.local raises an ArgumentError for out of range minute
fails:Time.local raises an ArgumentError for out of range second
fails:Time.local raises ArgumentError when given 9 arguments
fails:Time.local raises ArgumentError when given 11 arguments
fails:Time.local returns subclass instances
fails:Time.local handles string arguments
fails:Time.local handles float arguments
fails:Time.local raises an ArgumentError for out of range values
fails:Time.local handles microseconds
fails:Time.local handles fractional microseconds as a Float
fails:Time.local handles fractional microseconds as a Rational
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/mday_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/min_tags.txt

This file was deleted.

2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/minus_tags.txt
Original file line number Diff line number Diff line change
@@ -10,3 +10,5 @@ fails:Time#- returns a non-UTC time if self is non-UTC
fails:Time#- returns a time with the same fixed offset as self
fails:Time#- returns a time with nanoseconds precision between two time objects
fails:Time#- maintains precision
fails:Time#- decrements the time by the specified amount
fails:Time#- does not return a subclass instance
36 changes: 0 additions & 36 deletions spec/truffle/tags/core/time/mktime_tags.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,8 @@
fails:Time.mktime creates a time based on given values, interpreted in the local time zone
fails:Time.mktime respects rare old timezones
fails:Time.mktime creates a time based on given C-style gmtime arguments, interpreted in the local time zone
fails:Time.mktime creates the correct time just before dst change
fails:Time.mktime creates the correct time just after dst change
fails:Time.mktime accepts 1 argument (year)
fails:Time.mktime accepts 2 arguments (year, month)
fails:Time.mktime accepts 3 arguments (year, month, day)
fails:Time.mktime accepts 4 arguments (year, month, day, hour)
fails:Time.mktime accepts 5 arguments (year, month, day, hour, minute)
fails:Time.mktime accepts nil month, day, hour, minute, and second
fails:Time.mktime handles a String year
fails:Time.mktime coerces the year with #to_int
fails:Time.mktime handles a String month given as a numeral
fails:Time.mktime handles a String month given as a short month name
fails:Time.mktime coerces the month with #to_str
fails:Time.mktime coerces the month with #to_int
fails:Time.mktime handles a String day
fails:Time.mktime coerces the day with #to_int
fails:Time.mktime handles a String hour
fails:Time.mktime coerces the hour with #to_int
fails:Time.mktime handles a String minute
fails:Time.mktime coerces the minute with #to_int
fails:Time.mktime handles a String second
fails:Time.mktime coerces the second with #to_int
fails:Time.mktime interprets all numerals as base 10
fails:Time.mktime handles fractional seconds as a Float
fails:Time.mktime handles fractional seconds as a Rational
fails:Time.mktime handles years from 0 as such
fails:Time.mktime accepts various year ranges
fails:Time.mktime raises an ArgumentError for out of range month
fails:Time.mktime raises an ArgumentError for out of range day
fails:Time.mktime raises an ArgumentError for out of range hour
fails:Time.mktime raises an ArgumentError for out of range minute
fails:Time.mktime raises an ArgumentError for out of range second
fails:Time.mktime raises ArgumentError when given 9 arguments
fails:Time.mktime raises ArgumentError when given 11 arguments
fails:Time.mktime returns subclass instances
fails:Time.mktime handles string arguments
fails:Time.mktime handles float arguments
fails:Time.mktime raises an ArgumentError for out of range values
fails:Time.mktime handles microseconds
fails:Time.mktime handles fractional microseconds as a Float
fails:Time.mktime handles fractional microseconds as a Rational
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/mon_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/monday_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/month_tags.txt

This file was deleted.

50 changes: 0 additions & 50 deletions spec/truffle/tags/core/time/new_tags.txt

This file was deleted.

4 changes: 2 additions & 2 deletions spec/truffle/tags/core/time/nsec_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fails:Time#nsec returns the nanoseconds part of a Time constructed with a Float number of seconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with an Integer number of microseconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with an Float number of microseconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with a Rational number of seconds
fails:Time#nsec returns the nanoseconds part of a Time constructed with an Rational number of microseconds
4 changes: 3 additions & 1 deletion spec/truffle/tags/core/time/plus_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:Time#+ increments the time by the specified amount as rational numbers
fails:Time#+ is a commutative operator
fails:Time#+ adds a negative Float
fails:Time#+ accepts arguments that can be coerced into Rational
@@ -11,3 +10,6 @@ fails:Time#+ maintains microseconds precision
fails:Time#+ maintains nanoseconds precision
fails:Time#+ maintains subseconds precision
fails:Time#+ maintains precision
fails:Time#+ increments the time by the specified amount as rational numbers
fails:Time#+ increments the time by the specified amount
fails:Time#+ does not return a subclass instance
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/saturday_tags.txt

This file was deleted.

34 changes: 0 additions & 34 deletions spec/truffle/tags/core/time/strftime_tags.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,6 @@
fails:Time#strftime supports week of year format with %U and %W
fails:Time#strftime supports 12-hr formatting with %l
fails:Time#strftime supports AM/PM formatting with %p
fails:Time#strftime returns the abbreviated weekday with %a
fails:Time#strftime returns the full weekday with %A
fails:Time#strftime returns the abbreviated month with %b
fails:Time#strftime returns the full month with %B
fails:Time#strftime returns the day of the month with %d
fails:Time#strftime returns the 24-based hour with %H
fails:Time#strftime returns the 12-based hour with %I
fails:Time#strftime returns the Julian date with %j
fails:Time#strftime returns the month with %m
fails:Time#strftime returns the minute with %M
fails:Time#strftime returns the second with %S
fails:Time#strftime returns the enumerated day of the week with %w
fails:Time#strftime returns the date alone with %x
fails:Time#strftime returns the time alone with %X
fails:Time#strftime returns the year wihout a century with %y
fails:Time#strftime returns the year with %Y
fails:Time#strftime returns the timezone with %Z
fails:Time#strftime supports am/pm formatting with %P
fails:Time#strftime returns the fractional seconds digits, default is 9 digits (nanosecond) with %N
fails:Time#strftime supports GNU modificators
fails:Time#strftime supports the '-' modifier to drop leading zeros
fails:Time#strftime supports the '-' modifier for padded format directives
fails:Time#strftime passes the format string's encoding to the result string
fails:Time#strftime with %L formats the milliseconds of a second
fails:Time#strftime with %N formats the nanoseconds of of the second with %N
fails:Time#strftime with %N formats the milliseconds of of the second with %3N
fails:Time#strftime with %N formats the microseconds of of the second with %6N
fails:Time#strftime with %N formats the nanoseconds of of the second with %9N
fails:Time#strftime with %N formats the picoseconds of of the second with %12N
fails:Time#strftime with %z formats a UTC time offset as '+0000'
fails:Time#strftime with %z formats a local time with positive UTC offset as '+HHMM'
fails:Time#strftime with %z formats a local time with negative UTC offset as '-HHMM'
fails:Time#strftime with %z formats a time with fixed positive offset as '+HHMM'
fails:Time#strftime with %z formats a time with fixed negative offset as '-HHMM'
fails:Time#strftime with %z formats a time with fixed offset as '+/-HH:MM' with ':' specifier
fails:Time#strftime with %z formats a time with fixed offset as '+/-HH:MM:SS' with '::' specifier
fails:Time#strftime with %z rounds fixed offset to the nearest second
4 changes: 2 additions & 2 deletions spec/truffle/tags/core/time/subsec_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with a Rational number of seconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with a Float number of seconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Integer number of microseconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Rational number of microseconds
fails:Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Float number of microseconds
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/time/succ_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Time#succ returns a new time one second later than time
fails:Time#succ returns a new instance
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/sunday_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/thursday_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/time/to_a_tags.txt

This file was deleted.

1 change: 1 addition & 0 deletions spec/truffle/tags/core/time/to_f_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Time#to_f returns the float number of seconds + usecs since the epoch
1 change: 0 additions & 1 deletion spec/truffle/tags/core/time/to_r_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/to_s_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/tuesday_tags.txt

This file was deleted.

5 changes: 0 additions & 5 deletions spec/truffle/tags/core/time/usec_tags.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
fails:Time#usec returns the microseconds part of a Time constructed with a Float number of seconds
fails:Time#usec returns the microseconds part of a Time constructed with an Integer number of microseconds
fails:Time#usec returns the microseconds part of a Time constructed with an Float number of microseconds > 1
fails:Time#usec returns 0 for a Time constructed with an Float number of microseconds < 1
fails:Time#usec returns the microseconds part of a Time constructed with a Rational number of seconds
fails:Time#usec returns the microseconds part of a Time constructed with an Rational number of microseconds > 1
fails:Time#usec returns 0 for a Time constructed with an Rational number of microseconds < 1
fails:Time#usec returns the microseconds for time created by Time#local
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/time/utc_offset_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fails:Time#utc_offset returns the offset in seconds between the timezone of time and UTC
fails:Time#utc_offset returns the correct offset for US Eastern time zone around daylight savings time change
fails:Time#utc_offset returns the correct offset for Hawaii around daylight savings time change
fails:Time#utc_offset returns the correct offset for New Zealand around daylight savings time change
fails:Time#utc_offset returns offset as Rational
fails:Time#utc_offset given positive offset returns a positive offset
fails:Time#utc_offset given negative offset returns a negative offset
40 changes: 0 additions & 40 deletions spec/truffle/tags/core/time/utc_tags.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,5 @@
fails:Time#utc? returns true if time represents a time in UTC (GMT)
fails:Time.utc creates a time based on given values, interpreted as UTC (GMT)
fails:Time.utc creates a time based on given C-style gmtime arguments, interpreted as UTC (GMT)
fails:Time.utc interprets pre-Gregorian reform dates using Gregorian proleptic calendar
fails:Time.utc interprets Julian-Gregorian gap dates using Gregorian proleptic calendar
fails:Time.utc interprets post-Gregorian reform dates using Gregorian calendar
fails:Time.utc accepts 1 argument (year)
fails:Time.utc accepts 2 arguments (year, month)
fails:Time.utc accepts 3 arguments (year, month, day)
fails:Time.utc accepts 4 arguments (year, month, day, hour)
fails:Time.utc accepts 5 arguments (year, month, day, hour, minute)
fails:Time.utc accepts nil month, day, hour, minute, and second
fails:Time.utc handles a String year
fails:Time.utc coerces the year with #to_int
fails:Time.utc handles a String month given as a numeral
fails:Time.utc handles a String month given as a short month name
fails:Time.utc coerces the month with #to_str
fails:Time.utc coerces the month with #to_int
fails:Time.utc handles a String day
fails:Time.utc coerces the day with #to_int
fails:Time.utc handles a String hour
fails:Time.utc coerces the hour with #to_int
fails:Time.utc handles a String minute
fails:Time.utc coerces the minute with #to_int
fails:Time.utc handles a String second
fails:Time.utc coerces the second with #to_int
fails:Time.utc interprets all numerals as base 10
fails:Time.utc handles fractional seconds as a Float
fails:Time.utc handles fractional seconds as a Rational
fails:Time.utc handles years from 0 as such
fails:Time.utc accepts various year ranges
fails:Time.utc raises an ArgumentError for out of range month
fails:Time.utc raises an ArgumentError for out of range day
fails:Time.utc raises an ArgumentError for out of range hour
fails:Time.utc raises an ArgumentError for out of range minute
fails:Time.utc raises an ArgumentError for out of range second
fails:Time.utc raises ArgumentError when given 9 arguments
fails:Time.utc raises ArgumentError when given 11 arguments
fails:Time.utc returns subclass instances
fails:Time.utc handles string arguments
fails:Time.utc handles float arguments
fails:Time.utc raises an ArgumentError for out of range values
fails:Time.utc handles microseconds
fails:Time.utc handles fractional microseconds as a Float
fails:Time.utc handles fractional microseconds as a Rational
1 change: 0 additions & 1 deletion spec/truffle/tags/core/time/wday_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/time/wednesday_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/time/year_tags.txt

This file was deleted.

4 changes: 0 additions & 4 deletions spec/truffle/tags/core/time/zone_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fails:Time#zone returns the time zone used for time
fails:Time#zone returns nil for a Time with a fixed offset
fails:Time#zone returns the correct timezone for a local time
fails:Time#zone returns nil when getting the local time with a fixed offset
fails:Time#zone returns UTC when called on a UTC time
fails:Time#zone Encoding.default_internal is set returns the string with the default internal encoding
fails:Time#zone Encoding.default_internal is set doesn't raise errors for a Time with a fixed offset
6 changes: 3 additions & 3 deletions spec/truffle/tags/language/break_tags.txt
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@ fails:Executing break from within a block returns from the original invoking met
slow:The break statement in a lambda created at the toplevel returns a value when invoking from a method
slow:The break statement in a lambda created at the toplevel returns a value when invoking from a block
slow:The break statement in a lambda created at the toplevel returns a value when invoking from the toplevel
fails(windows bug):The break statement in a lambda created at the toplevel returns a value when invoking from the toplevel
fails(windows bug):The break statement in a lambda created at the toplevel returns a value when invoking from a method
fails(windows bug):The break statement in a lambda created at the toplevel returns a value when invoking from a block
windows:The break statement in a lambda created at the toplevel returns a value when invoking from the toplevel
windows:The break statement in a lambda created at the toplevel returns a value when invoking from a method
windows:The break statement in a lambda created at the toplevel returns a value when invoking from a block
4 changes: 2 additions & 2 deletions spec/truffle/tags/language/file_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fails(windows bug):The __FILE__ pseudo-variable equals the absolute path of a file loaded by an absolute path
fails(windows bug):The __FILE__ pseudo-variable equals the absolute path of a file loaded by a relative path
windows:The __FILE__ pseudo-variable equals the absolute path of a file loaded by an absolute path
windows:The __FILE__ pseudo-variable equals the absolute path of a file loaded by a relative path
10 changes: 5 additions & 5 deletions spec/truffle/tags/language/predefined/data_tags.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
fails(inherited):The DATA constant succeeds in locking the file DATA came from
fails:The DATA constant does not change when an included files also has a __END__
fails:The DATA constant is included in an otherwise empty file
slow:The DATA constant exists when the main script contains __END__
slow:The DATA constant does not exist when the main script contains no __END__
slow:The DATA constant does not exist when an included file has a __END__
slow:The DATA constant does not change when an included files also has a __END__
slow:The DATA constant is included in an otherwise empty file
fails(windows bug):The DATA constant exists when the main script contains __END__
fails(windows bug):The DATA constant does not exist when the main script contains no __END__
fails(windows bug):The DATA constant does not exist when an included file has a __END__
fails(windows bug):The DATA constant does not change when an included files also has a __END__
fails(windows bug):The DATA constant is included in an otherwise empty file
windows:The DATA constant exists when the main script contains __END__
windows:The DATA constant does not exist when the main script contains no __END__
windows:The DATA constant does not change when an included files also has a __END__
10 changes: 5 additions & 5 deletions spec/truffle/tags/language/predefined_tags.txt
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ slow:The predefined global constant STDERR has the encodings set by #set_encodin
slow:The predefined global constant STDIN retains the encoding set by #set_encoding when Encoding.default_external is changed
slow:The predefined global constant STDIN has the encodings set by #set_encoding
slow:The predefined global constant STDOUT has the encodings set by #set_encoding
fails(windows bug):Execution variable $: does not include '.' when the taint check level > 1
fails(windows bug):The predefined global constant STDIN has the encodings set by #set_encoding
fails(windows bug):The predefined global constant STDIN retains the encoding set by #set_encoding when Encoding.default_external is changed
fails(windows bug):The predefined global constant STDOUT has the encodings set by #set_encoding
fails(windows bug):The predefined global constant STDERR has the encodings set by #set_encoding
windows:Execution variable $: does not include '.' when the taint check level > 1
windows:The predefined global constant STDIN has the encodings set by #set_encoding
windows:The predefined global constant STDIN retains the encoding set by #set_encoding when Encoding.default_external is changed
windows:The predefined global constant STDOUT has the encodings set by #set_encoding
windows:The predefined global constant STDERR has the encodings set by #set_encoding
113 changes: 69 additions & 44 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -16,72 +16,92 @@ class MSpecScript
"spec/ruby/language"
]

set :core, [
core = [
"spec/ruby/core",

# Can't load these - so tags aren't enough to exclude them. The problem is
# either fixtures or syntax. Some of them are probably easy fixes.

"^spec/ruby/core/enumerable/find_index_spec.rb",
"^spec/ruby/core/enumerable/to_a_spec.rb",
"^spec/ruby/core/enumerable/to_h_spec.rb",
# as_superuser, as_user, Process.euid
"^spec/ruby/core/file/chown_spec.rb",
"^spec/ruby/core/file/lchown_spec.rb",
"^spec/ruby/core/process/euid_spec.rb",
"^spec/ruby/core/process/kill_spec.rb",
"^spec/ruby/core/process/setpriority_spec.rb",
"^spec/ruby/core/process/uid_spec.rb",

# require 'socket'
"^spec/ruby/core/file/socket_spec.rb",
"^spec/ruby/core/file/stat/sticky_spec.rb",
"^spec/ruby/core/file/sticky_spec.rb",

# FileTest in describe
"^spec/ruby/core/filetest",

# STDOUT.tty?
"^spec/ruby/core/io/tty_spec.rb",
"^spec/ruby/core/io/isatty_spec.rb",

# require 'fcntl'
"^spec/ruby/core/io/reopen_spec.rb",
"^spec/ruby/core/io/tty_spec.rb",

# __method__ in fixtures
"^spec/ruby/core/kernel/__method___spec.rb",

# autoload in describe
"^spec/ruby/core/kernel/autoload_spec.rb",

# seem side-effecting when not run in isolation
"^spec/ruby/core/marshal/dump_spec.rb",
"^spec/ruby/core/marshal/float_spec.rb",
"^spec/ruby/core/marshal/load_spec.rb",
"^spec/ruby/core/marshal/restore_spec.rb",
"^spec/ruby/core/method/source_location_spec.rb", # Windows
"^spec/ruby/core/numeric/denominator_spec.rb",
"^spec/ruby/core/numeric/numerator_spec.rb",
"^spec/ruby/core/numeric/to_c_spec.rb",

# require 'timeout'
"^spec/ruby/core/process/detach_spec.rb",
"^spec/ruby/core/process/euid_spec.rb",
"^spec/ruby/core/process/kill_spec.rb",
"^spec/ruby/core/process/setpriority_spec.rb",
"^spec/ruby/core/process/uid_spec.rb",

# problems with comparing special characters and tags
"^spec/ruby/core/regexp/compile_spec.rb",
"^spec/ruby/core/string/chomp_spec.rb",
"^spec/ruby/core/string/modulo_spec.rb",

# NullPointerException on load
"^spec/ruby/core/regexp/encoding_spec.rb",

# error compiling regex on load
"^spec/ruby/core/regexp/source_spec.rb",
"^spec/ruby/core/signal/list_spec.rb",
"^spec/ruby/core/string/chomp_spec.rb",
"^spec/ruby/core/string/crypt_spec.rb",
"^spec/ruby/core/string/gsub_spec.rb",
"^spec/ruby/core/string/match_spec.rb",
"^spec/ruby/core/string/modulo_spec.rb",
"^spec/ruby/core/struct/each_spec.rb", # Windows
"^spec/ruby/core/struct/element_reference_spec.rb", # Windows
"^spec/ruby/core/struct/element_set_spec.rb", # Windows
"^spec/ruby/core/struct/eql_spec.rb", # Windows
"^spec/ruby/core/struct/equal_value_spec.rb", # Windows
"^spec/ruby/core/struct/hash_spec.rb", # Windows
"^spec/ruby/core/struct/initialize_copy_spec.rb", # Windows
"^spec/ruby/core/struct/initialize_spec.rb", # Windows
"^spec/ruby/core/struct/inspect_spec.rb", # Windows
"^spec/ruby/core/struct/instance_variables_spec.rb", # Windows
"^spec/ruby/core/struct/length_spec.rb", # Windows
"^spec/ruby/core/struct/members_spec.rb", # Windows
"^spec/ruby/core/struct/new_spec.rb", # Windows
"^spec/ruby/core/struct/select_spec.rb", # Windows
"^spec/ruby/core/struct/size_spec.rb", # Windows
"^spec/ruby/core/struct/struct_spec.rb", # Windows
"^spec/ruby/core/struct/to_a_spec.rb", # Windows
"^spec/ruby/core/struct/to_h_spec.rb", # Windows
"^spec/ruby/core/struct/to_s_spec.rb", # Windows
"^spec/ruby/core/struct/values_at_spec.rb", # Windows
"^spec/ruby/core/struct/values_spec.rb", # Windows
"^spec/ruby/core/symbol/versions/encoding_1.9_spec.rb", # Windows
"^spec/ruby/core/unboundmethod/source_location_spec.rb" # Windows
]

# infinite loop on some examples
# "^spec/ruby/core/string/gsub_spec.rb",
]

core += [
# Windows
"^spec/ruby/core/method/source_location_spec.rb",
"^spec/ruby/core/struct/each_spec.rb",
"^spec/ruby/core/struct/element_reference_spec.rb",
"^spec/ruby/core/struct/element_set_spec.rb",
"^spec/ruby/core/struct/eql_spec.rb",
"^spec/ruby/core/struct/equal_value_spec.rb",
"^spec/ruby/core/struct/hash_spec.rb",
"^spec/ruby/core/struct/initialize_copy_spec.rb",
"^spec/ruby/core/struct/initialize_spec.rb",
"^spec/ruby/core/struct/inspect_spec.rb",
"^spec/ruby/core/struct/instance_variables_spec.rb",
"^spec/ruby/core/struct/length_spec.rb",
"^spec/ruby/core/struct/members_spec.rb",
"^spec/ruby/core/struct/new_spec.rb",
"^spec/ruby/core/struct/select_spec.rb",
"^spec/ruby/core/struct/size_spec.rb",
"^spec/ruby/core/struct/struct_spec.rb",
"^spec/ruby/core/struct/to_a_spec.rb",
"^spec/ruby/core/struct/to_h_spec.rb",
"^spec/ruby/core/struct/to_s_spec.rb",
"^spec/ruby/core/struct/values_at_spec.rb",
"^spec/ruby/core/struct/values_spec.rb",
"^spec/ruby/core/symbol/versions/encoding_1.9_spec.rb",
"^spec/ruby/core/unboundmethod/source_location_spec.rb",
] if windows?
set :core, core

set :rubysl, [
"spec/truffle/spec/rubysl/rubysl-erb/spec",
@@ -99,6 +119,11 @@ class MSpecScript
[/_spec.rb$/, '_tags.txt']
]

if windows?
# exclude specs tagged with 'windows'
set :xtags, (get(:xtags) || []) + ['windows']
end

MSpec.enable_feature :encoding
MSpec.enable_feature :fiber
MSpec.disable_feature :fork
7 changes: 7 additions & 0 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -169,9 +169,16 @@ def test_pe
private :test_pe

def tag(path, *args)
return tag_all(*args) if path == 'all'
mspec 'tag', '--add', 'fails', '--fail', path, *args
end

# Add tags to all given examples without running them. Useful to avoid file exclusions.
def tag_all(*args)
mspec('tag', *%w[--unguarded --all --dry-run --add fails], *args)
end
private :tag_all

def untag(path, *args)
puts
puts "WARNING: untag is currently not very reliable - run `jt test #{path} #{args * ' '}` after and manually annotate any new failures"
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ public void init() {
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, UnboundMethodNodesFactory.getFactories());
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, ByteArrayNodesFactory.getFactories());
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, TruffleNodesFactory.getFactories());
CoreMethodNodeManager.addCoreMethodNodes(rubyObjectClass, TimeNodesFactory.getFactories());

// Give the core library manager a chance to tweak some of those methods

13 changes: 3 additions & 10 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.TypeSystemReference;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrument.Probe;
import com.oracle.truffle.api.instrument.ProbeNode;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.nodes.Node;
@@ -256,16 +257,8 @@ public boolean isTrue(boolean value) {
return value;
}

public RubyBignum bignum(int value) {
return bignum((long) value);
}

public RubyBignum bignum(long value) {
return bignum(BigInteger.valueOf(value));
}

public RubyBignum bignum(BigInteger value) {
return new RubyBignum(getContext().getCoreLibrary().getBignumClass(), value);
public RubyNode getNonWrapperNode() {
return this;
}

public boolean isRational(RubyBasicObject o) {
Original file line number Diff line number Diff line change
@@ -443,8 +443,8 @@ public Object append(Object store, int index, RubyArray array) {
if (otherStore instanceof int[]) {
// TODO CS 5-Feb-15 hack to get things working with empty int[] store

if (((int[]) otherStore).length > 0) {
throw new UnsupportedOperationException();
for (int n = 0; n < array.getSize(); n++) {
((Object[]) store)[index + n] = ((int[]) otherStore)[n];
}

return store;
Original file line number Diff line number Diff line change
@@ -125,80 +125,6 @@ public boolean equal(VirtualFrame frame, Object a, Object b) {

}

@CoreMethod(names = "__id__")
public abstract static class IDNode extends CoreMethodNode {

public IDNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public IDNode(IDNode prev) {
super(prev);
}

public abstract Object executeObjectID(VirtualFrame frame, Object value);

@Specialization
public int objectID(RubyNilClass nil) {
return ObjectIDOperations.NIL;
}

@Specialization(guards = "isTrue(value)")
public int objectIDTrue(boolean value) {
return ObjectIDOperations.TRUE;
}

@Specialization(guards = "!isTrue(value)")
public int objectIDFalse(boolean value) {
return ObjectIDOperations.FALSE;
}

@Specialization
public long objectID(int value) {
return ObjectIDOperations.smallFixnumToID(value);
}

@Specialization(rewriteOn = ArithmeticException.class)
public long objectIDSmallFixnumOverflow(long value) {
return ObjectIDOperations.smallFixnumToIDOverflow(value);
}

/* TODO: Ideally we would have this instead of the code below to speculate better. [GRAAL-903]
@Specialization(guards = "isSmallFixnum")
public long objectIDSmallFixnum(long value) {
return ObjectIDOperations.smallFixnumToID(value);
}

@Specialization(guards = "!isSmallFixnum")
public Object objectIDLargeFixnum(long value) {
return ObjectIDOperations.largeFixnumToID(getContext(), value);
} */

@Specialization
public Object objectID(long value) {
if (isSmallFixnum(value)) {
return ObjectIDOperations.smallFixnumToID(value);
} else {
return ObjectIDOperations.largeFixnumToID(getContext(), value);
}
}

@Specialization
public RubyBignum objectID(double value) {
return ObjectIDOperations.floatToID(getContext(), value);
}

@Specialization
public long objectID(RubyBasicObject object) {
return object.getObjectID();
}

protected boolean isSmallFixnum(long fixnum) {
return ObjectIDOperations.isSmallFixnum(fixnum);
}

}

@CoreMethod(names = "equal?", required = 1)
public abstract static class ReferenceEqualNode extends BinaryCoreMethodNode {

129 changes: 66 additions & 63 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -86,6 +86,24 @@ public RubyHash aliases() {
}
}

@CoreMethod(names = "ascii_compatible?")
public abstract static class AsciiCompatibleNode extends CoreMethodNode {

public AsciiCompatibleNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public AsciiCompatibleNode(AsciiCompatibleNode prev) {
super(prev);
}

@Specialization
public Object isCompatible(RubyEncoding encoding) {
notDesignedForCompilation();
return encoding.getEncoding().isAsciiCompatible();
}
}

@CoreMethod(names = "compatible?", needsSelf = false, onSingleton = true, required = 2)
public abstract static class CompatibleQueryNode extends CoreMethodNode {

97 changes: 53 additions & 44 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java
Original file line number Diff line number Diff line change
@@ -42,12 +42,15 @@ public abstract class FixnumNodes {
@CoreMethod(names = "-@")
public abstract static class NegNode extends CoreMethodNode {

@Child private FixnumOrBignumNode fixnumOrBignumNode;

public NegNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public NegNode(NegNode prev) {
super(prev);
fixnumOrBignumNode = prev.fixnumOrBignumNode;
}

@Specialization(rewriteOn = ArithmeticException.class)
@@ -66,8 +69,13 @@ public long neg(long value) {
}

@Specialization
public RubyBignum negWithOverflow(long value) {
return bignum(value).negate();
public Object negWithOverflow(long value) {
if (fixnumOrBignumNode == null) {
CompilerDirectives.transferToInterpreter();
fixnumOrBignumNode = insert(new FixnumOrBignumNode(getContext(), getSourceSection()));
}

return fixnumOrBignumNode.fixnumOrBignum(BigInteger.valueOf(value).negate());
}

}
@@ -107,12 +115,12 @@ public long add(int a, long b) {

@Specialization
public Object addWithOverflow(int a, long b) {
return fixnumOrBignum(bignum(a).add(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).add(BigInteger.valueOf(b)));
}

@Specialization
public Object add(int a, RubyBignum b) {
return fixnumOrBignum(bignum(a).add(b));
return fixnumOrBignum(BigInteger.valueOf(a).add(b.bigIntegerValue()));
}

@Specialization(guards = "isRational(b)")
@@ -132,7 +140,7 @@ public long add(long a, int b) {

@Specialization
public Object addWithOverflow(long a, int b) {
return fixnumOrBignum(bignum(a).add(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).add(BigInteger.valueOf(b)));
}

@Specialization(rewriteOn = ArithmeticException.class)
@@ -142,7 +150,7 @@ public long add(long a, long b) {

@Specialization
public Object addWithOverflow(long a, long b) {
return fixnumOrBignum(bignum(a).add(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).add(BigInteger.valueOf(b)));
}

@Specialization
@@ -152,7 +160,7 @@ public double add(long a, double b) {

@Specialization
public Object add(long a, RubyBignum b) {
return fixnumOrBignum(bignum(a).add(b));
return fixnumOrBignum(BigInteger.valueOf(a).add(b.bigIntegerValue()));
}

@Specialization(guards = "isRational(b)")
@@ -201,12 +209,12 @@ public long sub(int a, long b) {

@Specialization
public Object subWithOverflow(int a, long b) {
return fixnumOrBignum(bignum(a).subtract(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).subtract(BigInteger.valueOf(b)));
}

@Specialization
public Object sub(int a, RubyBignum b) {
return fixnumOrBignum(bignum(a).subtract(b));
return fixnumOrBignum(BigInteger.valueOf(a).subtract(b.bigIntegerValue()));
}

@Specialization
@@ -234,7 +242,7 @@ public long sub(long a, int b) {

@Specialization
public Object subWithOverflow(long a, int b) {
return fixnumOrBignum(bignum(a).subtract(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).subtract(BigInteger.valueOf(b)));
}

@Specialization(rewriteOn = ArithmeticException.class)
@@ -244,7 +252,7 @@ public long sub(long a, long b) {

@Specialization
public Object subWithOverflow(long a, long b) {
return fixnumOrBignum(bignum(a).subtract(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).subtract(BigInteger.valueOf(b)));
}

@Specialization
@@ -254,7 +262,7 @@ public double sub(long a, double b) {

@Specialization
public Object sub(long a, RubyBignum b) {
return fixnumOrBignum(bignum(a).subtract(b));
return fixnumOrBignum(BigInteger.valueOf(a).subtract(b.bigIntegerValue()));
}

}
@@ -290,7 +298,7 @@ public Object mul(int a, long b) {

@Specialization
public Object mulWithOverflow(int a, long b) {
return fixnumOrBignum(bignum(a).multiply(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).multiply(BigInteger.valueOf(b)));
}

@Specialization
@@ -300,7 +308,7 @@ public double mul(int a, double b) {

@Specialization
public Object mul(int a, RubyBignum b) {
return fixnumOrBignum(bignum(a).multiply(b));
return fixnumOrBignum(BigInteger.valueOf(a).multiply(b.bigIntegerValue()));
}

@Specialization(rewriteOn = ArithmeticException.class)
@@ -310,7 +318,7 @@ public long mul(long a, int b) {

@Specialization
public Object mulWithOverflow(long a, int b) {
return fixnumOrBignum(bignum(a).multiply(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).multiply(BigInteger.valueOf(b)));
}

@Specialization(rewriteOn = ArithmeticException.class)
@@ -320,7 +328,7 @@ public long mul(long a, long b) {

@Specialization
public Object mulWithOverflow(long a, long b) {
return fixnumOrBignum(bignum(a).multiply(bignum(b)));
return fixnumOrBignum(BigInteger.valueOf(a).multiply(BigInteger.valueOf(b)));
}

@Specialization
@@ -330,15 +338,15 @@ public double mul(long a, double b) {

@Specialization
public Object mul(long a, RubyBignum b) {
return fixnumOrBignum(bignum(a).multiply(b));
return fixnumOrBignum(BigInteger.valueOf(a).multiply(b.bigIntegerValue()));
}

@Specialization(guards = "isRational(arguments[1])")
@Specialization(guards = "isRational(b)")
public Object mul(VirtualFrame frame, int a, RubyBasicObject b) {
return mulRational(frame, (long) a, b);
}

@Specialization(guards = "isRational(arguments[1])")
@Specialization(guards = "isRational(b)")
public Object mulRational(VirtualFrame frame, long a, RubyBasicObject b) {
if (rationalMulNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -393,7 +401,7 @@ public int div(int a, int b) throws UnexpectedResultException {
bMinusOne.enter();
if (a == Integer.MIN_VALUE) {
bMinusOneAMinimum.enter();
throw new UnexpectedResultException(bignum(a).negate());
throw new UnexpectedResultException(BigInteger.valueOf(a).negate());
} else {
bMinusOneANotMinimum.enter();
return -a;
@@ -422,7 +430,7 @@ public Object divEdgeCase(int a, int b) {
bMinusOne.enter();
if (a == Integer.MIN_VALUE) {
bMinusOneAMinimum.enter();
return bignum(a).negate();
return BigInteger.valueOf(a).negate();
} else {
bMinusOneANotMinimum.enter();
return -a;
@@ -482,7 +490,7 @@ public long div(long a, long b) throws UnexpectedResultException {
bMinusOne.enter();
if (a == Long.MIN_VALUE) {
bMinusOneAMinimum.enter();
throw new UnexpectedResultException(bignum(a).negate());
throw new UnexpectedResultException(BigInteger.valueOf(a).negate());
} else {
bMinusOneANotMinimum.enter();
return -a;
@@ -511,7 +519,7 @@ public Object divEdgeCase(long a, long b) {
bMinusOne.enter();
if (a == Long.MIN_VALUE) {
bMinusOneAMinimum.enter();
return bignum(a).negate();
return BigInteger.valueOf(a).negate();
} else {
bMinusOneANotMinimum.enter();
return -a;
@@ -533,7 +541,7 @@ public int div(@SuppressWarnings("unused") long a, @SuppressWarnings("unused") R
return 0;
}

@Specialization(guards = "isRational(arguments[1])")
@Specialization(guards = "isRational(b)")
public Object div(VirtualFrame frame, int a, RubyBasicObject b) {
if (rationalConvertNode == null) {
CompilerDirectives.transferToInterpreter();
@@ -724,7 +732,7 @@ public boolean less(int a, double b) {

@Specialization
public boolean less(int a, RubyBignum b) {
return bignum(a).compare(b) < 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) < 0;
}

@Specialization
@@ -744,7 +752,7 @@ public boolean less(long a, double b) {

@Specialization
public boolean less(long a, RubyBignum b) {
return bignum(a).compare(b) < 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) < 0;
}
}

@@ -776,7 +784,7 @@ public boolean lessEqual(int a, double b) {

@Specialization
public boolean lessEqual(int a, RubyBignum b) {
return bignum(a).compare(b) <= 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) <= 0;
}

@Specialization
@@ -796,7 +804,7 @@ public boolean lessEqual(long a, double b) {

@Specialization
public boolean lessEqual(long a, RubyBignum b) {
return bignum(a).compare(b) <= 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) <= 0;
}
}

@@ -832,7 +840,7 @@ public boolean equal(int a, double b) {

@Specialization
public boolean equal(int a, RubyBignum b) {
return bignum(a).equals(b);
return BigInteger.valueOf(a).equals(b.bigIntegerValue());
}

@Specialization
@@ -852,7 +860,7 @@ public boolean equal(long a, double b) {

@Specialization
public boolean equal(long a, RubyBignum b) {
return bignum(a).equals(b);
return BigInteger.valueOf(a).equals(b.bigIntegerValue());
}

@Specialization(guards = {
@@ -894,7 +902,7 @@ public int compare(int a, double b) {

@Specialization
public int compare(int a, RubyBignum b) {
return bignum(a).compare(b);
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue());
}

@Specialization
@@ -914,7 +922,7 @@ public int compare(long a, double b) {

@Specialization
public int compare(long a, RubyBignum b) {
return bignum(a).compare(b);
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue());
}

@Specialization(guards = {
@@ -956,7 +964,7 @@ public boolean greaterEqual(int a, double b) {

@Specialization
public boolean greaterEqual(int a, RubyBignum b) {
return bignum(a).compare(b) >= 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) >= 0;
}

@Specialization
@@ -976,7 +984,7 @@ public boolean greaterEqual(long a, double b) {

@Specialization
public boolean greaterEqual(long a, RubyBignum b) {
return bignum(a).compare(b) >= 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) >= 0;
}
}

@@ -1008,7 +1016,8 @@ public boolean greater(int a, double b) {

@Specialization
public boolean greater(int a, RubyBignum b) {
return bignum(a).compare(b) > 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()
) > 0;
}

@Specialization
@@ -1028,7 +1037,7 @@ public boolean greater(long a, double b) {

@Specialization
public boolean greater(long a, RubyBignum b) {
return bignum(a).compare(b) > 0;
return BigInteger.valueOf(a).compareTo(b.bigIntegerValue()) > 0;
}

}
@@ -1079,7 +1088,7 @@ public long bitAnd(int a, long b) {

@Specialization
public Object bitAnd(int a, RubyBignum b) {
return fixnumOrBignum(bignum(a).and(b));
return fixnumOrBignum(BigInteger.valueOf(a).and(b.bigIntegerValue()));
}

@Specialization
@@ -1094,7 +1103,7 @@ public long bitAnd(long a, long b) {

@Specialization
public Object bitAnd(long a, RubyBignum b) {
return fixnumOrBignum(bignum(a).and(b));
return fixnumOrBignum(BigInteger.valueOf(a).and(b.bigIntegerValue()));
}
}

@@ -1121,7 +1130,7 @@ public long bitOr(int a, long b) {

@Specialization
public Object bitOr(int a, RubyBignum b) {
return fixnumOrBignum(bignum(a).or(b));
return fixnumOrBignum(BigInteger.valueOf(a).or(b.bigIntegerValue()));
}

@Specialization
@@ -1136,7 +1145,7 @@ public long bitOr(long a, long b) {

@Specialization
public Object bitOr(long a, RubyBignum b) {
return fixnumOrBignum(bignum(a).or(b));
return fixnumOrBignum(BigInteger.valueOf(a).or(b.bigIntegerValue()));
}
}

@@ -1163,7 +1172,7 @@ public long bitXOr(int a, long b) {

@Specialization
public Object bitXOr(int a, RubyBignum b) {
return fixnumOrBignum(bignum(a).xor(b));
return fixnumOrBignum(BigInteger.valueOf(a).xor(b.bigIntegerValue()));
}

@Specialization
@@ -1178,7 +1187,7 @@ public long bitXOr(long a, long b) {

@Specialization
public Object bitXOr(long a, RubyBignum b) {
return fixnumOrBignum(bignum(a).xor(b));
return fixnumOrBignum(BigInteger.valueOf(a).xor(b.bigIntegerValue()));
}
}

@@ -1196,7 +1205,7 @@ public LeftShiftNode(LeftShiftNode prev) {
fallbackCallNode = prev.fallbackCallNode;
}

protected Object lower(RubyBignum value) {
protected Object lower(BigInteger value) {
return fixnumOrBignum(value);
}

@@ -1241,7 +1250,7 @@ public Object leftShiftWithOverflow(long a, int b) {
if (canShiftIntoLong(a, b)) {
return leftShiftToLong(a, b);
} else {
return lower(bignum(a).shiftLeft(b));
return lower(BigInteger.valueOf(a).shiftLeft(b));
}
}

Original file line number Diff line number Diff line change
@@ -36,8 +36,8 @@ public FixnumOrBignumNode(RubyContext context, SourceSection sourceSection) {
private final BranchProfile bignumProfile = BranchProfile.create();
private final BranchProfile checkLongProfile = BranchProfile.create();

public Object fixnumOrBignum(RubyBignum value) {
if (value.compare(Long.MIN_VALUE) >= 0 && value.compare(Long.MAX_VALUE) <= 0) {
public Object fixnumOrBignum(BigInteger value) {
if (value.compareTo(BigInteger.valueOf(Long.MIN_VALUE)) >= 0 && value.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) <= 0) {
lowerProfile.enter();

final long longValue = value.longValue();
@@ -50,7 +50,7 @@ public Object fixnumOrBignum(RubyBignum value) {
return longValue;
}
} else {
return value;
return new RubyBignum(getContext().getCoreLibrary().getBignumClass(), value);
}
}

@@ -69,7 +69,7 @@ public Object fixnumOrBignum(double value) {

bignumProfile.enter();

return new RubyBignum(getContext().getCoreLibrary().getBignumClass(), doubleToBigInteger(value));
return fixnumOrBignum(doubleToBigInteger(value));
}

@CompilerDirectives.TruffleBoundary
24 changes: 12 additions & 12 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ public double add(double a, double b) {

@Specialization
public double add(double a, RubyBignum b) {
return a + b.doubleValue();
return a + b.bigIntegerValue().doubleValue();
}

}
@@ -106,7 +106,7 @@ public double sub(double a, double b) {

@Specialization
public double sub(double a, RubyBignum b) {
return a - b.doubleValue();
return a - b.bigIntegerValue().doubleValue();
}

}
@@ -144,7 +144,7 @@ public double mul(double a, double b) {

@Specialization
public double mul(double a, RubyBignum b) {
return a * b.doubleValue();
return a * b.bigIntegerValue().doubleValue();
}

@Specialization(guards = "isRational(b)")
@@ -210,7 +210,7 @@ public Object pow(VirtualFrame frame, double a, double b) {

@Specialization
public double pow(double a, RubyBignum b) {
return Math.pow(a, b.doubleValue());
return Math.pow(a, b.bigIntegerValue().doubleValue());
}

@Specialization(guards = "isRational(b)")
@@ -256,7 +256,7 @@ public double div(double a, double b) {

@Specialization
public double div(double a, RubyBignum b) {
return a / b.doubleValue();
return a / b.bigIntegerValue().doubleValue();
}

@Specialization(guards = {
@@ -316,7 +316,7 @@ public double mod(double a, double b) {

@Specialization
public double mod(double a, RubyBignum b) {
return mod(a, b.doubleValue());
return mod(a, b.bigIntegerValue().doubleValue());
}

}
@@ -386,7 +386,7 @@ public boolean less(double a, double b) {

@Specialization
public boolean less(double a, RubyBignum b) {
return a < b.doubleValue();
return a < b.bigIntegerValue().doubleValue();
}

@Specialization(guards = "!isRubyBignum(other)")
@@ -427,7 +427,7 @@ public boolean lessEqual(double a, double b) {

@Specialization
public boolean lessEqual(double a, RubyBignum b) {
return a <= b.doubleValue();
return a <= b.bigIntegerValue().doubleValue();
}

@Specialization(guards = "!isRubyBignum(other)")
@@ -470,7 +470,7 @@ public boolean equal(double a, double b) {

@Specialization
public boolean equal(double a, RubyBignum b) {
return a == b.doubleValue();
return a == b.bigIntegerValue().doubleValue();
}

@Specialization(guards = "!isRubyBignum(b)")
@@ -526,7 +526,7 @@ public int compareInfinity(double a, RubyBignum b) {

@Specialization(guards = {"!isNaN(a)", "!isInfinity(a)"})
public int compare(double a, RubyBignum b) {
return Double.compare(a, b.doubleValue());
return Double.compare(a, b.bigIntegerValue().doubleValue());
}

@Specialization(guards = {"!isNaN(a)", "!isNaN(b)"})
@@ -569,7 +569,7 @@ public boolean greaterEqual(double a, double b) {

@Specialization
public boolean greaterEqual(double a, RubyBignum b) {
return a >= b.doubleValue();
return a >= b.bigIntegerValue().doubleValue();
}

@Specialization(guards = "!isRubyBignum(other)")
@@ -610,7 +610,7 @@ public boolean equal(double a, double b) {

@Specialization
public boolean equal(double a, RubyBignum b) {
return a > b.doubleValue();
return a > b.bigIntegerValue().doubleValue();
}

@Specialization(guards = "!isRubyBignum(other)")
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ public RubyArray execute(double a, long b) {
}

public RubyArray execute(double a, RubyBignum b) {
return divMod(a, b.doubleValue());
return divMod(a, b.bigIntegerValue().doubleValue());
}

public RubyArray execute(double a, double b) {
@@ -142,7 +142,7 @@ private RubyArray divMod(long a, long b) {
} else {
useObjectPairProfile.enter();
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), new Object[]{
fixnumOrBignumQuotient.fixnumOrBignum(create((BigInteger) integerDiv)),
fixnumOrBignumQuotient.fixnumOrBignum((BigInteger) integerDiv),
mod}, 2);
}
}
@@ -188,8 +188,8 @@ private RubyArray divMod(BigInteger a, BigInteger b) {
}

return new RubyArray(getContext().getCoreLibrary().getArrayClass(), new Object[]{
fixnumOrBignumQuotient.fixnumOrBignum(create(bigIntegerResults[0])),
fixnumOrBignumRemainder.fixnumOrBignum(create(bigIntegerResults[1]))}, 2);
fixnumOrBignumQuotient.fixnumOrBignum(bigIntegerResults[0]),
fixnumOrBignumRemainder.fixnumOrBignum(bigIntegerResults[1])}, 2);
}

public RubyBignum create(BigInteger value) {
Original file line number Diff line number Diff line change
@@ -25,6 +25,8 @@
import org.jruby.truffle.runtime.core.RubyProc;
import org.jruby.truffle.runtime.core.RubyString;

import java.math.BigInteger;

@CoreClass(name = "Integer")
public abstract class IntegerNodes {

@@ -89,6 +91,8 @@ public Object downto(VirtualFrame frame, int from, double to, RubyProc block) {
@CoreMethod(names = "times", needsBlock = true)
public abstract static class TimesNode extends YieldingCoreMethodNode {

@Child private FixnumOrBignumNode fixnumOrBignum;

private final BranchProfile breakProfile = BranchProfile.create();
private final BranchProfile nextProfile = BranchProfile.create();
private final BranchProfile redoProfile = BranchProfile.create();
@@ -99,6 +103,7 @@ public TimesNode(RubyContext context, SourceSection sourceSection) {

public TimesNode(TimesNode prev) {
super(prev);
fixnumOrBignum = prev.fixnumOrBignum;
}

@Specialization
@@ -186,10 +191,15 @@ public Object times(VirtualFrame frame, long n, RubyProc block) {
public Object times(VirtualFrame frame, RubyBignum n, RubyProc block) {
notDesignedForCompilation();

outer: for (RubyBignum i = bignum(0); i.compare(n) < 0; i = i.add(1)) {
if (fixnumOrBignum == null) {
CompilerDirectives.transferToInterpreter();
fixnumOrBignum = insert(new FixnumOrBignumNode(getContext(), getSourceSection()));
}

outer: for (BigInteger i = BigInteger.ZERO; i.compareTo(n.bigIntegerValue()) < 0; i = i.add(BigInteger.ONE)) {
while (true) {
try {
yield(frame, block, i);
yield(frame, block, fixnumOrBignum.fixnumOrBignum(i));
continue outer;
} catch (BreakException e) {
breakProfile.enter();
Original file line number Diff line number Diff line change
@@ -1062,6 +1062,7 @@ public abstract static class IntegerNode extends CoreMethodNode {

@Child private DoesRespondDispatchHeadNode toIntRespondTo;
@Child private CallDispatchHeadNode toInt;
@Child private FixnumOrBignumNode fixnumOrBignum;

public IntegerNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
@@ -1073,6 +1074,7 @@ public IntegerNode(IntegerNode prev) {
super(prev);
toIntRespondTo = prev.toIntRespondTo;
toInt = prev.toInt;
fixnumOrBignum = prev.fixnumOrBignum;
}

@Specialization
@@ -1106,7 +1108,12 @@ public Object integer(RubyString value) {
try {
return Integer.parseInt(value.toString());
} catch (NumberFormatException e) {
return bignum(new BigInteger(value.toString()));
if (fixnumOrBignum == null) {
CompilerDirectives.transferToInterpreter();
fixnumOrBignum = insert(new FixnumOrBignumNode(getContext(), getSourceSection()));
}

return fixnumOrBignum.fixnumOrBignum(new BigInteger(value.toString()));
}
}

@@ -2151,7 +2158,7 @@ public String toHexString(long value) {

@Specialization
public String toHexString(RubyBignum value) {
return value.toHexString();
return value.bigIntegerValue().toString(16);
}

}
28 changes: 14 additions & 14 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/MathNodes.java
Original file line number Diff line number Diff line change
@@ -389,7 +389,7 @@ public RubyArray frexp(long a) {

@Specialization
public RubyArray frexp(RubyBignum a) {
return frexp(a.doubleValue());
return frexp(a.bigIntegerValue().doubleValue());
}

@Specialization
@@ -564,17 +564,17 @@ public double function(long a, double b) {

@Specialization
public double function(RubyBignum a, int b) {
return function(a.doubleValue(), b);
return function(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
public double function(RubyBignum a, long b) {
return function(a.doubleValue(), b);
return function(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
public double function(RubyBignum a, double b) {
return function(a.doubleValue(), b);
return function(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
@@ -650,7 +650,7 @@ public RubyArray lgamma(long a) {

@Specialization
public RubyArray lgamma(RubyBignum a) {
return lgamma(a.doubleValue());
return lgamma(a.bigIntegerValue().doubleValue());
}

@Specialization
@@ -709,7 +709,7 @@ public double function(long a, UndefinedPlaceholder b) {

@Specialization
public double function(RubyBignum a, UndefinedPlaceholder b) {
return doFunction(a.doubleValue());
return doFunction(a.bigIntegerValue().doubleValue());
}

@Specialization
@@ -929,7 +929,7 @@ public double function(long a) {

@Specialization
public double function(RubyBignum a) {
return doFunction(a.doubleValue());
return doFunction(a.bigIntegerValue().doubleValue());
}

@Specialization
@@ -994,7 +994,7 @@ public double function(int a, long b) {

@Specialization
public double function(int a, RubyBignum b) {
return doFunction(a, b.doubleValue());
return doFunction(a, b.bigIntegerValue().doubleValue());
}

@Specialization
@@ -1014,7 +1014,7 @@ public double function(long a, long b) {

@Specialization
public double function(long a, RubyBignum b) {
return doFunction(a, b.doubleValue());
return doFunction(a, b.bigIntegerValue().doubleValue());
}

@Specialization
@@ -1024,22 +1024,22 @@ public double function(long a, double b) {

@Specialization
public double function(RubyBignum a, int b) {
return doFunction(a.doubleValue(), b);
return doFunction(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
public double function(RubyBignum a, long b) {
return doFunction(a.doubleValue(), b);
return doFunction(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
public double function(RubyBignum a, RubyBignum b) {
return doFunction(a.doubleValue(), b.doubleValue());
return doFunction(a.bigIntegerValue().doubleValue(), b.bigIntegerValue().doubleValue());
}

@Specialization
public double function(RubyBignum a, double b) {
return doFunction(a.doubleValue(), b);
return doFunction(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
@@ -1054,7 +1054,7 @@ public double function(double a, long b) {

@Specialization
public double function(double a, RubyBignum b) {
return doFunction(a, b.doubleValue());
return doFunction(a, b.bigIntegerValue().doubleValue());
}

@Specialization
Original file line number Diff line number Diff line change
@@ -1435,7 +1435,7 @@ public Object removeConst(RubyModule module, RubySymbol name) {
return removeConstant(module, name.toString());
}

@Specialization(guards = "!isRubySymbol(arguments[1])")
@Specialization(guards = "!isRubySymbol(name)")
public Object removeConst(VirtualFrame frame, RubyModule module, Object name) {
notDesignedForCompilation();

Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@
import org.jruby.truffle.runtime.core.RubyNilClass;
import org.jruby.truffle.runtime.core.RubyProc;

import java.math.BigInteger;

@CoreClass(name = "Numeric")
public abstract class NumericNodes {

@@ -84,7 +86,7 @@ public Object nonZero(long value) {

@Specialization
public Object nonZero(RubyBignum value) {
if (value.isZero()) {
if (value.bigIntegerValue().equals(BigInteger.ZERO)) {
return false;
} else {
return value;
Original file line number Diff line number Diff line change
@@ -78,11 +78,11 @@ public double id2RefFloat(RubyBignum id) {
}

protected boolean isLargeFixnumID(RubyBignum id) {
return ObjectIDOperations.isLargeFixnumID(id);
return ObjectIDOperations.isLargeFixnumID(id.bigIntegerValue());
}

protected boolean isFloatID(RubyBignum id) {
return ObjectIDOperations.isFloatID(id);
return ObjectIDOperations.isFloatID(id.bigIntegerValue());
}

}
Original file line number Diff line number Diff line change
@@ -1678,12 +1678,16 @@ public double toF(RubyString string) {
@CoreMethod(names = "to_i")
public abstract static class ToINode extends CoreMethodNode {

@Child private FixnumOrBignumNode fixnumOrBignum;

public ToINode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
fixnumOrBignum = new FixnumOrBignumNode(context, sourceSection);
}

public ToINode(ToINode prev) {
super(prev);
fixnumOrBignum = prev.fixnumOrBignum;
}

@Specialization
@@ -1697,7 +1701,7 @@ public Object toI(RubyString string) {
try {
return Integer.parseInt(string.toString());
} catch (NumberFormatException e) {
return bignum(new BigInteger(string.toString()));
return fixnumOrBignum.fixnumOrBignum(new BigInteger(string.toString()));
}
}
}
90 changes: 90 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/TimeNodes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;
import org.joda.time.DateTimeZone;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyTime;

@CoreClass(name = "Time")
public abstract class TimeNodes {

@CoreMethod(names = "_gmt?")
public abstract static class InternalGMTNode extends CoreMethodNode {

public InternalGMTNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InternalGMTNode(InternalGMTNode prev) {
super(prev);
}

@Specialization
public boolean internalGMT(RubyTime time) {
// TODO CS 15-Feb-15 we've ended up with both null and nil here - should simplify
return (time.getOffset() == null || time.getOffset() == getContext().getCoreLibrary().getNilObject()) && (time.getDateTime().getZone().equals(DateTimeZone.UTC) || time.getDateTime().getZone().getOffset(time.getDateTime().getMillis()) == 0);
}
}

@CoreMethod(names = "_set_gmt", required = 1)
public abstract static class InternalSetGMTNode extends CoreMethodNode {

public InternalSetGMTNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InternalSetGMTNode(InternalSetGMTNode prev) {
super(prev);
}

@Specialization
public boolean internalSetGMT(RubyTime time, Object setGMT) {
throw new UnsupportedOperationException("_set_gmt" + setGMT.getClass());
}
}

@CoreMethod(names = "_offset")
public abstract static class InternalOffsetNode extends CoreMethodNode {

public InternalOffsetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InternalOffsetNode(InternalOffsetNode prev) {
super(prev);
}

@Specialization
public Object internalOffset(RubyTime time) {
throw new UnsupportedOperationException("_offset");
}
}

@CoreMethod(names = "_set_offset", required = 1)
public abstract static class InternalSetOffsetNode extends CoreMethodNode {

public InternalSetOffsetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InternalSetOffsetNode(InternalSetOffsetNode prev) {
super(prev);
}

@Specialization
public boolean internalSetGMT(RubyTime time, Object setOffset) {
throw new UnsupportedOperationException("_set_offset " + setOffset.getClass());
}
}

}
Original file line number Diff line number Diff line change
@@ -151,14 +151,13 @@ public RubyException translate(Throwable throwable) {
throwable.printStackTrace();
}
} catch (NullPointerException e) {

}

if (Options.TRUFFLE_PANIC_ON_JAVA_ASSERT.load() && throwable instanceof AssertionError) {
DebugOperations.panic(getContext(), this, throwable.toString());
}

return getContext().getCoreLibrary().internalError(String.format("%s %s", throwable.getClass().getSimpleName(), throwable.getMessage()), this);
return getContext().getCoreLibrary().internalError(String.format("%s %s %s", throwable.getClass().getSimpleName(), throwable.getMessage(), throwable.getStackTrace()[0].toString()), this);
}

}
Original file line number Diff line number Diff line change
@@ -34,12 +34,12 @@ public MetaClassNode(MetaClassNode prev) {

public abstract RubyClass executeMetaClass(VirtualFrame frame, Object value);

@Specialization(guards = "isTrue")
@Specialization(guards = "isTrue(value)")
protected RubyClass singletonClassTrue(boolean value) {
return getContext().getCoreLibrary().getTrueClass();
}

@Specialization(guards = "!isTrue")
@Specialization(guards = "!isTrue(value)")
protected RubyClass singletonClassFalse(boolean value) {
return getContext().getCoreLibrary().getFalseClass();
}
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@

import org.jruby.truffle.runtime.core.*;

import java.math.BigInteger;

/**
* Rubinius primitives associated with the Ruby {@code Bignum} class.
*/
@@ -45,18 +47,19 @@ public RubyBignum pow(RubyBignum a, long b) {
if (negativeProfile.profile(b < 0)) {
return null; // Primitive failure
} else {
return a.pow(b);
// TODO CS 15-Feb-15 what about this cast?
return new RubyBignum(getContext().getCoreLibrary().getBignumClass(), a.bigIntegerValue().pow((int) b));
}
}

@Specialization
public double pow(RubyBignum a, double b) {
return Math.pow(a.doubleValue(), b);
return Math.pow(a.bigIntegerValue().doubleValue(), b);
}

@Specialization
public RubyBignum pow(RubyBignum a, RubyBignum b) {
return a.pow(b);
throw new UnsupportedOperationException();
}

}
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@
import org.jruby.truffle.runtime.core.RubyBignum;
import org.jruby.truffle.runtime.core.RubyString;

import java.math.BigInteger;

/**
* Rubinius primitives associated with the Ruby {@code Fixnum} class.
*/
@@ -95,12 +97,12 @@ public FixnumPowPrimitiveNode(FixnumPowPrimitiveNode prev) {
super(prev);
}

@Specialization(guards = "canShiftIntoInt")
@Specialization(guards = "canShiftIntoInt(a, b)")
public int powTwo(int a, int b) {
return 1 << b;
}

@Specialization(guards = "canShiftIntoInt")
@Specialization(guards = "canShiftIntoInt(a, b)")
public int powTwo(int a, long b) {
return 1 << b;
}
@@ -125,12 +127,12 @@ public Object pow(int a, RubyBignum b) {
return pow((long) a, b);
}

@Specialization(guards = "canShiftIntoLong")
@Specialization(guards = "canShiftIntoLong(a, b)")
public long powTwo(long a, int b) {
return 1 << b;
}

@Specialization(guards = "canShiftIntoLong")
@Specialization(guards = "canShiftIntoLong(a, b)")
public long powTwo(long a, long b) {
return 1 << b;
}
@@ -145,7 +147,8 @@ public Object pow(long a, long b) {
if (negativeProfile.profile(b < 0)) {
return null; // Primitive failure
} else {
return fixnumOrBignum(bignum(a).pow(b));
// TODO CS 15-Feb-15 - what to do about this cast?
return fixnumOrBignum(BigInteger.valueOf(a).pow((int) b));
}
}

@@ -178,13 +181,13 @@ public Object pow(long a, RubyBignum b) {
}
}

if (b.compare(0) < 0) {
if (b.bigIntegerValue().compareTo(BigInteger.ZERO) < 0) {
return null; // Primitive failure
}

if (b.isEqualTo(b.longValue())) {
if (b.bigIntegerValue().equals(b)) {
// This is a bug of course
return pow(a, b.longValue());
return pow(a, b.bigIntegerValue().longValue());
}

getContext().getRuntime().getWarnings().warn("in a**b, b may be too big");
@@ -193,12 +196,12 @@ public Object pow(long a, RubyBignum b) {
return Double.POSITIVE_INFINITY;
}

@Specialization(guards = "!isRubyBignum(arguments[1])")
@Specialization(guards = "!isRubyBignum(b)")
public Object pow(int a, RubyBasicObject b) {
return null; // Primitive failure
}

@Specialization(guards = "!isRubyBignum(arguments[1])")
@Specialization(guards = "!isRubyBignum(b)")
public Object pow(long a, RubyBasicObject b) {
return null; // Primitive failure
}
Loading

0 comments on commit b9af305

Please sign in to comment.