Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f806e018211f
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5897743884ab
Choose a head ref

Commits on May 29, 2015

  1. Copy the full SHA
    18a021b View commit details

Commits on May 31, 2015

  1. Copy the full SHA
    5810509 View commit details
  2. Copy the full SHA
    c6b02af View commit details

Commits on Jun 1, 2015

  1. Copy the full SHA
    e29bc9a View commit details
  2. Revert "Revert "leverage the classloader + osgi-bundle support to Scr…

    …iptingContainer""
    
    This reverts commit 7719bb2.
    mkristian committed Jun 1, 2015
    Copy the full SHA
    1f96bcf View commit details
  3. move adding a classloader to LOAD_PATH and GEM_PATH to ScriptingConta…

    …iner
    
    the IsolatedScriptingContainer comes with helper to add a bundle to LOAD_PATH and GEM_PATH
    and ensure that the GEM_PATH or GEM_HOME or JARS_HOME is set inside the classloader per default,
    i.e. do not inherit the possible environment settings.
    mkristian committed Jun 1, 2015
    Copy the full SHA
    95b5c62 View commit details
  4. keep mkdir consistent when using uri-like paths

    * there was a problem with file:////path/to/dir where the extra slashes
      did confuse the logic
    * all pathes starting with uri: can not create any directories
    
    fixes #2972
    
    Sponsored by Lookout Inc.
    
    Conflicts:
    	core/src/main/java/org/jruby/RubyDir.java
    	core/src/main/java/org/jruby/util/URLResource.java
    	test/test_dir.rb
    	test/test_file.rb
    mkristian committed Jun 1, 2015
    Copy the full SHA
    63d8376 View commit details
  5. Copy the full SHA
    8203fe7 View commit details
  6. no more emma.properties

    mkristian committed Jun 1, 2015
    Copy the full SHA
    99c8bca View commit details
  7. Copy the full SHA
    e3f2bd4 View commit details
  8. Copy the full SHA
    a6491f1 View commit details
  9. Copy the full SHA
    5741518 View commit details
  10. Copy the full SHA
    7e20916 View commit details
  11. Copy the full SHA
    85108ba View commit details
  12. [Truffle] Rename callTargetForMethods to callTargetForLambdas.

    * To stay more consistent with RubyProc.Type and general proc/block terms.
    eregon committed Jun 1, 2015
    Copy the full SHA
    dbabcff View commit details
  13. [Truffle] BigDecimal: Add special values

    - :+, :to_s, :nan?, :finite?, :zero?, :<=> adapted
    pitr-ch committed Jun 1, 2015
    Copy the full SHA
    4f757d5 View commit details
  14. [Truffle] BigDecimal: comparisons, coerce, better guards, initializat…

    …ions
    
    - special POSITIVE_ZERO removed, normal zero is used instead
    - handle big zero errors
    pitr-ch committed Jun 1, 2015
    Copy the full SHA
    172a1c5 View commit details
  15. Copy the full SHA
    6fb5805 View commit details
  16. Copy the full SHA
    7663b01 View commit details
  17. Copy the full SHA
    4628529 View commit details
  18. Copy the full SHA
    efe48bc View commit details
  19. Copy the full SHA
    7344cfc View commit details
  20. Copy the full SHA
    ff5fb68 View commit details
  21. Copy the full SHA
    be8f712 View commit details
  22. Copy the full SHA
    d0cb6db View commit details
  23. Copy the full SHA
    3719d63 View commit details
  24. Copy the full SHA
    7ac4c61 View commit details
  25. Copy the full SHA
    17279c7 View commit details
  26. Copy the full SHA
    c71f083 View commit details
  27. Copy the full SHA
    e041451 View commit details
  28. Copy the full SHA
    2384b6b View commit details
  29. Copy the full SHA
    d6eef83 View commit details
  30. Copy the full SHA
    e312c51 View commit details
  31. Copy the full SHA
    b13ceec View commit details
  32. Copy the full SHA
    b0c7a4b View commit details
  33. Copy the full SHA
    3d202ba View commit details
  34. Copy the full SHA
    f084a7b View commit details
  35. Copy the full SHA
    b0a53bb View commit details
  36. Copy the full SHA
    fc5340e View commit details
  37. Copy the full SHA
    32ac97e View commit details
  38. Copy the full SHA
    75c60c8 View commit details
  39. Copy the full SHA
    2dcb163 View commit details
  40. arity.toString() was printing extra crap and not just its value. Swit…

    …ch to using value in error message
    enebo committed Jun 1, 2015
    Copy the full SHA
    02c3dd8 View commit details
  41. Copy the full SHA
    afbea06 View commit details
  42. respond_to? dispatch should only send one argument if defined respond…

    …_to? method only expends one argument
    enebo committed Jun 1, 2015
    Copy the full SHA
    029e620 View commit details
  43. Copy the full SHA
    a5edf84 View commit details
  44. Copy the full SHA
    897155e View commit details
  45. Copy the full SHA
    33b0efc View commit details
  46. Copy the full SHA
    0ee86ae View commit details
  47. Take 2 on dedup'ing in hashes. Since we only dedup if actual String a…

    …nd not subclasses then the world will be happy
    enebo committed Jun 1, 2015
    Copy the full SHA
    ddc07f7 View commit details
Showing 771 changed files with 5,866 additions and 3,965 deletions.
1 change: 0 additions & 1 deletion core/src/main/java/emma.properties

This file was deleted.

13 changes: 10 additions & 3 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1944,8 +1944,14 @@ public DynamicMethod getDefaultMethodMissing() {
return defaultMethodMissing;
}

public void setDefaultMethodMissing(DynamicMethod method) {
public boolean isDefaultMethodMissing(DynamicMethod method) {
return defaultMethodMissing == method || defaultModuleMethodMissing == method;

}

public void setDefaultMethodMissing(DynamicMethod method, DynamicMethod moduleMethod) {
defaultMethodMissing = method;
defaultModuleMethodMissing = moduleMethod;
}

public DynamicMethod getRespondToMethod() {
@@ -4740,7 +4746,7 @@ public RubyString getThreadStatus(RubyThread.Status status) {
* @return the freeze-duped version of the string
*/
public RubyString freezeAndDedupString(RubyString string) {
if (string.getMetaClass() == stringClass) {
if (string.getMetaClass() != stringClass) {
// never cache a non-natural String
RubyString duped = string.strDup(this);
duped.setFrozen(true);
@@ -4901,7 +4907,8 @@ public FilenoUtil getFilenoUtil() {
procSysModule, precisionModule, errnoModule;

private DynamicMethod privateMethodMissing, protectedMethodMissing, variableMethodMissing,
superMethodMissing, normalMethodMissing, defaultMethodMissing, respondTo, respondToMissing;
superMethodMissing, normalMethodMissing, defaultMethodMissing, defaultModuleMethodMissing,
respondTo, respondToMissing;

// record separator var, to speed up io ops that use it
private GlobalVariable recordSeparatorVar;
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
@@ -225,7 +225,9 @@ public static RubyClass createBasicObjectClass(Ruby runtime, RubyClass objectCla
static void recacheBuiltinMethods(Ruby runtime) {
RubyModule objectClass = runtime.getBasicObject();

runtime.setDefaultMethodMissing(objectClass.searchMethod("method_missing"));
// Since method_missing is marked module we actually define two builtin versions
runtime.setDefaultMethodMissing(objectClass.searchMethod("method_missing"),
objectClass.getMetaClass().searchMethod("method_missing"));
}

@JRubyMethod(name = "initialize", visibility = PRIVATE)
16 changes: 9 additions & 7 deletions core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
@@ -657,21 +657,23 @@ private static IRubyObject checkFuncallFailed(ThreadContext context, IRubyObject
*/
private static boolean checkFuncallRespondTo(ThreadContext context, RubyClass klass, IRubyObject recv, String mid) {
Ruby runtime = context.runtime;
RubyClass defined_class;
DynamicMethod me = klass.searchMethod("respond_to?");

// NOTE: isBuiltin here would be NOEX_BASIC in MRI, a flag only added to respond_to?, method_missing, and
// respond_to_missing? Same effect, I believe.
if (me != null && !me.isUndefined() && !me.isBuiltin()) {
Arity arity = me.getArity();
int arityValue = me.getArity().getValue();

if (arity.getValue() > 2)
throw runtime.newArgumentError("respond_to? must accept 1 or 2 arguments (requires " + arity + ")");
if (arityValue > 2) throw runtime.newArgumentError("respond_to? must accept 1 or 2 arguments (requires " + arityValue + ")");

IRubyObject result = me.call(context, recv, klass, "respond_to?", runtime.newString(mid), runtime.getTrue());
if (!result.isTrue()) {
return false;
IRubyObject result;
if (arityValue == 1) {
result = me.call(context, recv, klass, "respond_to?", runtime.newSymbol(mid));
} else {
result = me.call(context, recv, klass, "respond_to?", runtime.newSymbol(mid), runtime.getTrue());
}

if (!result.isTrue()) return false;
}
return true;
}
12 changes: 9 additions & 3 deletions core/src/main/java/org/jruby/RubyComparable.java
Original file line number Diff line number Diff line change
@@ -140,15 +140,21 @@ public static IRubyObject op_equal19(ThreadContext context, IRubyObject recv, IR
return callCmpMethod(context, recv, other, context.runtime.getFalse());
}

private static IRubyObject callCmpMethod(ThreadContext context, IRubyObject recv, IRubyObject other, IRubyObject returnValueOnError) {
Ruby runtime = context.runtime;
private static IRubyObject callCmpMethod(final ThreadContext context, final IRubyObject recv, final IRubyObject other, IRubyObject returnValueOnError) {
final Ruby runtime = context.runtime;

if (recv == other) return runtime.getTrue();

IRubyObject savedError = runtime.getGlobalVariables().get("$!");

try {
IRubyObject result = invokedynamic(context, recv, OP_CMP, other);
IRubyObject result = runtime.execRecursiveOuter(new Ruby.RecursiveFunction() {
@Override
public IRubyObject call(IRubyObject obj, boolean recur) {
if (recur) return runtime.getNil();
return invokedynamic(context, recv, OP_CMP, other);
}
}, recv);

// This is only to prevent throwing exceptions by cmperr - it has poor performance
if (result.isNil()) {
30 changes: 13 additions & 17 deletions core/src/main/java/org/jruby/RubyDir.java
Original file line number Diff line number Diff line change
@@ -43,15 +43,17 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import jnr.posix.FileStat;

import jnr.posix.FileStat;
import jnr.posix.POSIX;

import org.jruby.anno.JRubyMethod;
import org.jruby.anno.JRubyClass;

import jnr.posix.util.Platform;

import org.jcodings.Encoding;
import org.jcodings.specific.UTF8Encoding;

import org.jruby.exceptions.RaiseException;
import org.jruby.javasupport.JavaUtil;
import org.jruby.runtime.Block;
@@ -310,16 +312,8 @@ public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyOb
realPath = adjustedPath;
}
else {
JRubyFile dir = getDir(runtime, adjustedPath, true);

// We get canonical path to try and flatten the path out.
// a dir '/subdir/..' should return as '/'
// cnutter: Do we want to flatten path out?
try {
realPath = dir.getCanonicalPath();
} catch (IOException e) {
realPath = dir.getAbsolutePath();
}
FileResource dir = getDir(runtime, adjustedPath, true);
realPath = dir.canonicalPath();
}

IRubyObject result = null;
@@ -457,8 +451,10 @@ public static IRubyObject mkdir19(ThreadContext context, IRubyObject recv, IRuby
}

private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
File newDir = getDir(runtime, path, false);

if (path.startsWith("uri:")) {
throw runtime.newErrnoEACCESError(path);
}
File newDir = getDir(runtime, path, false).hackyGetJRubyFile();

String name = path.replace('\\', '/');

@@ -666,10 +662,10 @@ public IRubyObject fileno(ThreadContext context) {
* @param path path for which to return the <code>File</code> object.
* @param mustExist is true the directory must exist. If false it must not.
*/
protected static JRubyFile getDir(final Ruby runtime, final String path, final boolean mustExist) {
protected static FileResource getDir(final Ruby runtime, final String path, final boolean mustExist) {
String dir = dirFromPath(path, runtime);

JRubyFile result = JRubyFile.create(runtime.getCurrentDirectory(), dir);
FileResource result = JRubyFile.createResource(runtime, dir);

if (mustExist && !result.exists()) {
throw runtime.newErrnoENOENTError(dir);
@@ -722,7 +718,7 @@ private static String dirFromPath(final String path, final Ruby runtime) throws
String dir = path;
String[] pathParts = RubyFile.splitURI(path);
if (pathParts != null) {
if (pathParts[0].equals("file:") && pathParts[1].length() > 0 && pathParts[1].indexOf("!/") == -1) {
if (pathParts[0].startsWith("file:") && pathParts[1].length() > 0 && pathParts[1].indexOf("!/") == -1) {
dir = pathParts[1];
} else {
throw runtime.newErrnoENOTDIRError(dir);
10 changes: 2 additions & 8 deletions core/src/main/java/org/jruby/RubyHash.java
Original file line number Diff line number Diff line change
@@ -1014,10 +1014,7 @@ protected void op_asetForString(Ruby runtime, RubyString key, IRubyObject value)
entry.value = value;
} else {
checkIterating();
if (!key.isFrozen()) {
key = key.strDup(runtime, key.getMetaClass().getRealClass());
key.setFrozen(true);
}
if (!key.isFrozen()) key = runtime.freezeAndDedupString(key);
internalPut(key, value, false);
}
}
@@ -1028,10 +1025,7 @@ protected void op_asetSmallForString(Ruby runtime, RubyString key, IRubyObject v
entry.value = value;
} else {
checkIterating();
if (!key.isFrozen()) {
key = key.strDup(runtime, key.getMetaClass().getRealClass());
key.setFrozen(true);
}
if (!key.isFrozen()) key = runtime.freezeAndDedupString(key);
internalPutSmall(key, value, false);
}
}
26 changes: 19 additions & 7 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -2944,29 +2944,41 @@ public IRubyObject remove_class_variable19(ThreadContext context, IRubyObject na
return remove_class_variable(context, name);
}

/** rb_mod_class_variables
*
*/
@Deprecated
public RubyArray class_variables19(ThreadContext context) {
return class_variables(context);
}

@JRubyMethod(name = "class_variables")
public RubyArray class_variables(ThreadContext context) {
return class_variables19(context);
Ruby runtime = context.runtime;
RubyArray ary = runtime.newArray();

Collection<String> names = classVariablesCommon(true);
for (String name : names) {
ary.add(runtime.newSymbol(name));
}
return ary;
}

@JRubyMethod(name = "class_variables")
public RubyArray class_variables19(ThreadContext context) {
public RubyArray class_variables(ThreadContext context, IRubyObject inherit) {
Ruby runtime = context.runtime;
RubyArray ary = runtime.newArray();

Collection<String> names = classVariablesCommon();
Collection<String> names = classVariablesCommon(inherit.isTrue());
for (String name : names) {
ary.add(runtime.newSymbol(name));
}
return ary;
}

private Collection<String> classVariablesCommon() {

private Collection<String> classVariablesCommon(boolean inherit) {
Set<String> names = new HashSet<String>();
for (RubyModule p = this; p != null; p = p.getSuperClass()) {
names.addAll(p.getClassVariableNameList());
if (!inherit) break;
}
return names;
}
Loading