Skip to content

Instantly share code, notes, and snippets.

@bjfish
Created March 20, 2015 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjfish/25e2e6c8a35641be6dd8 to your computer and use it in GitHub Desktop.
Save bjfish/25e2e6c8a35641be6dd8 to your computer and use it in GitHub Desktop.
diff --git a/truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java b/truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
index d731818..1bb9e27 100644
--- a/truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
+++ b/truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
@@ -2427,7 +2427,7 @@ public abstract class ArrayNodes {
}
- @CoreMethod(names = "pop", raiseIfFrozenSelf = true)
+ @CoreMethod(names = "pop", needsSelf = true, raiseIfFrozenSelf = true, optional = 1)
public abstract static class PopNode extends ArrayCoreMethodNode {
public PopNode(RubyContext context, SourceSection sourceSection) {
@@ -2441,12 +2441,12 @@ public abstract class ArrayNodes {
public abstract Object executePop(RubyArray array);
@Specialization(guards = "isNull")
- public Object popNil(RubyArray array) {
+ public Object popNil(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) {
return nil();
}
@Specialization(guards = "isIntegerFixnum", rewriteOn = UnexpectedResultException.class)
- public int popIntegerFixnumInBounds(RubyArray array) throws UnexpectedResultException {
+ public int popIntegerFixnumInBounds(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) throws UnexpectedResultException {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
throw new UnexpectedResultException(nil());
} else {
@@ -2458,7 +2458,7 @@ public abstract class ArrayNodes {
}
@Specialization(contains = "popIntegerFixnumInBounds", guards = "isIntegerFixnum")
- public Object popIntegerFixnum(RubyArray array) {
+ public Object popIntegerFixnum(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
return nil();
} else {
@@ -2470,7 +2470,7 @@ public abstract class ArrayNodes {
}
@Specialization(guards = "isLongFixnum", rewriteOn = UnexpectedResultException.class)
- public long popLongFixnumInBounds(RubyArray array) throws UnexpectedResultException {
+ public long popLongFixnumInBounds(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) throws UnexpectedResultException {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
throw new UnexpectedResultException(nil());
} else {
@@ -2482,7 +2482,7 @@ public abstract class ArrayNodes {
}
@Specialization(contains = "popLongFixnumInBounds", guards = "isLongFixnum")
- public Object popLongFixnum(RubyArray array) {
+ public Object popLongFixnum(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
return nil();
} else {
@@ -2494,7 +2494,7 @@ public abstract class ArrayNodes {
}
@Specialization(guards = "isFloat", rewriteOn = UnexpectedResultException.class)
- public double popFloatInBounds(RubyArray array) throws UnexpectedResultException {
+ public double popFloatInBounds(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) throws UnexpectedResultException {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
throw new UnexpectedResultException(nil());
} else {
@@ -2506,7 +2506,7 @@ public abstract class ArrayNodes {
}
@Specialization(contains = "popFloatInBounds", guards = "isFloat")
- public Object popFloat(RubyArray array) {
+ public Object popFloat(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
return nil();
} else {
@@ -2518,7 +2518,7 @@ public abstract class ArrayNodes {
}
@Specialization(guards = "isObject")
- public Object popObject(RubyArray array) {
+ public Object popObject(RubyArray array, UndefinedPlaceholder undefinedPlaceholder) {
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.UNLIKELY_PROBABILITY, array.getSize() == 0)) {
return nil();
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment