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: d0f83875206a
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3c112fb6ecff
Choose a head ref
  • 4 commits
  • 5 files changed
  • 1 contributor

Commits on Jan 30, 2015

  1. Copy the full SHA
    b45168f View commit details
  2. Copy the full SHA
    d2d4a7d View commit details
  3. [Truffle] Add necessery guards to differentiate Object args versus no…

    …t provided args.
    
    * It is also a sign they should be implemented in Ruby
      or have some better default arg mechanism.
    eregon committed Jan 30, 2015
    Copy the full SHA
    51f3880 View commit details
  4. [Truffle] Remove RubyRegexp.initialize assuming default options.

    * Also fixes Regexp#initialize_copy.
    eregon committed Jan 30, 2015
    Copy the full SHA
    3c112fb View commit details
Original file line number Diff line number Diff line change
@@ -1964,7 +1964,7 @@ public RubyArray initialize(RubyArray array, int size, double defaultValue, Unde
return array;
}

@Specialization
@Specialization(guards = "!isUndefinedPlaceholder(arguments[2])")
public RubyArray initialize(RubyArray array, int size, Object defaultValue, UndefinedPlaceholder block) {
final Object[] store = new Object[size];
Arrays.fill(store, defaultValue);
Original file line number Diff line number Diff line change
@@ -1077,7 +1077,7 @@ public Object defaultElement(VirtualFrame frame, RubyHash hash, UndefinedPlaceho
}
}

@Specialization
@Specialization(guards = "!isUndefinedPlaceholder(arguments[1])")
public Object defaultElement(VirtualFrame frame, RubyHash hash, Object key) {
Object ret = hash.getDefaultValue();

Original file line number Diff line number Diff line change
@@ -1563,28 +1563,28 @@ public RaiseNode(RaiseNode prev) {
}

@Specialization
public Object raise(VirtualFrame frame, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2, Object undefined3) {
public Object raise(VirtualFrame frame, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2, UndefinedPlaceholder undefined3) {
notDesignedForCompilation();

return raise(frame, getContext().getCoreLibrary().getRuntimeErrorClass(), getContext().makeString("re-raised - don't have the current exception yet!"), undefined1);
}

@Specialization
public Object raise(VirtualFrame frame, RubyString message, UndefinedPlaceholder undefined1, Object undefined2) {
public Object raise(VirtualFrame frame, RubyString message, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2) {
notDesignedForCompilation();

return raise(frame, getContext().getCoreLibrary().getRuntimeErrorClass(), message, undefined1);
}

@Specialization
public Object raise(VirtualFrame frame, RubyClass exceptionClass, UndefinedPlaceholder undefined1, Object undefined2) {
public Object raise(VirtualFrame frame, RubyClass exceptionClass, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2) {
notDesignedForCompilation();

return raise(frame, exceptionClass, getContext().makeString(""), undefined1);
}

@Specialization
public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString message, Object undefined1) {
public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString message, UndefinedPlaceholder undefined1) {
notDesignedForCompilation();

final Object exception = exceptionClass.allocate(this);
@@ -1599,7 +1599,7 @@ public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString mes
}

@Specialization
public Object raise(RubyException exception, UndefinedPlaceholder undefined1, Object undefined2) {
public Object raise(RubyException exception, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2) {
throw new RaiseException(exception);
}

@@ -2155,10 +2155,10 @@ public ThrowNode(ThrowNode prev) {

@Specialization
public Object doThrow(Object tag, UndefinedPlaceholder value) {
return doThrow(tag, (Object) value);
return doThrow(tag, getContext().getCoreLibrary().getNilObject());
}

@Specialization
@Specialization(guards = "!isUndefinedPlaceholder(arguments[1])")
public Object doThrow(Object tag, Object value) {
notDesignedForCompilation();

@@ -2169,11 +2169,7 @@ public Object doThrow(Object tag, Object value) {
RubyCallStack.getBacktrace(this)));
}

if (value instanceof UndefinedPlaceholder) {
throw new ThrowException(tag, getContext().getCoreLibrary().getNilObject());
} else {
throw new ThrowException(tag, value);
}
throw new ThrowException(tag, value);
}

}
Original file line number Diff line number Diff line change
@@ -198,15 +198,15 @@ public InitializeNode(InitializeNode prev) {
}

@Specialization
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarnings("unused") UndefinedPlaceholder options) {
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, UndefinedPlaceholder options) {
notDesignedForCompilation();

regexp.initialize(this, string.getBytes());
regexp.initialize(this, string.getBytes(), Option.DEFAULT);
return regexp;
}

@Specialization
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarnings("unused") RubyNilClass options) {
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, RubyNilClass options) {
notDesignedForCompilation();

return initialize(regexp, string, UndefinedPlaceholder.INSTANCE);
@@ -231,23 +231,23 @@ public RubyRegexp initialize(RubyRegexp regexp, RubyString string, int options)
return regexp;
}

@Specialization(guards = "!isRubyNilClass(arguments[2])")
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarnings("unused") Object options) {
@Specialization(guards = { "!isRubyNilClass(arguments[2])", "!isUndefinedPlaceholder(arguments[2])" })
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, Object options) {
notDesignedForCompilation();

return initialize(regexp, string, Option.IGNORECASE);
}

@Specialization
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnings("unused") UndefinedPlaceholder options) {
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, UndefinedPlaceholder options) {
notDesignedForCompilation();

regexp.initialize(this, from.getSource(), from.getRegex().getOptions()); // TODO: is copying needed?
return regexp;
}

@Specialization
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnings("unused") Object options) {
@Specialization(guards = "!isUndefinedPlaceholder(arguments[2])")
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, Object options) {
notDesignedForCompilation();

if (Options.PARSER_WARN_FLAGS_IGNORED.load()) {
@@ -277,7 +277,7 @@ public Object initializeCopy(RubyRegexp self, RubyRegexp from) {
return self;
}

self.initialize(this, from.getSource()); // TODO: is copying needed?
self.initialize(this, from.getSource(), from.getRegex().getOptions()); // TODO: is copying needed?

return self;
}
Original file line number Diff line number Diff line change
@@ -62,10 +62,6 @@ public void initialize(RubyNode currentNode, ByteList setSource, int options) {
source = setSource;
}

public void initialize(RubyNode currentNode, ByteList setSource) {
initialize(currentNode, setSource, Option.DEFAULT);
}

public void initialize(Regex setRegex, ByteList setSource) {
regex = setRegex;
source = setSource;