Permalink
Browse files

Fixes to allow the compiler to work with the new block-passing logic

git-svn-id: http://svn.codehaus.org/jruby/branches/enebo_block@2830 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
1 parent 4f8a422 commit a190726ca60b2bf9d98caf528abbbf1908796ff5 @headius headius committed Jan 23, 2007
@@ -91,7 +91,7 @@ public RubyArray(IRuby runtime, RubyClass klass) {
}
public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchvalue, String name,
- IRubyObject[] args, CallType callType) {
+ IRubyObject[] args, CallType callType, Block block) {
switch (switchvalue) {
case OP_PLUS_SWITCHVALUE:
Arity.singleArgument().checkArity(context.getRuntime(), args);
@@ -125,7 +125,7 @@ public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte
return empty_p();
case 0:
default:
- return super.callMethod(context, rubyclass, name, args, callType, null);
+ return super.callMethod(context, rubyclass, name, args, callType, block);
}
}
@@ -37,12 +37,12 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import org.jruby.runtime.Arity;
+import org.jruby.runtime.Block;
import org.jruby.runtime.CallType;
import org.jruby.runtime.CallbackFactory;
import org.jruby.runtime.ClassIndex;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
-
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.marshal.MarshalStream;
import org.jruby.runtime.marshal.UnmarshalStream;
@@ -108,7 +108,7 @@ public RubyBignum(IRuby runtime, BigInteger value) {
}
public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchvalue, String name,
- IRubyObject[] args, CallType callType) {
+ IRubyObject[] args, CallType callType, Block block) {
switch (switchvalue) {
case OP_PLUS_SWITCHVALUE:
Arity.singleArgument().checkArity(context.getRuntime(), args);
@@ -118,7 +118,7 @@ public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte
return minus(args[0]);
case 0:
default:
- return super.callMethod(context, rubyclass, name, args, callType, null);
+ return super.callMethod(context, rubyclass, name, args, callType, block);
}
}
@@ -35,8 +35,8 @@
package org.jruby;
import java.math.BigInteger;
-
import org.jruby.runtime.Arity;
+import org.jruby.runtime.Block;
import org.jruby.runtime.CallType;
import org.jruby.runtime.CallbackFactory;
import org.jruby.runtime.ClassIndex;
@@ -125,7 +125,7 @@ public RubyFixnum(IRuby runtime, long value) {
}
public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchvalue, String name,
- IRubyObject[] args, CallType callType) {
+ IRubyObject[] args, CallType callType, Block block) {
switch (switchvalue) {
case OP_PLUS_SWITCHVALUE:
Arity.singleArgument().checkArity(context.getRuntime(), args);
@@ -138,7 +138,7 @@ public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte
return lt(args[0]);
case 0:
default:
- return super.callMethod(context, rubyclass, name, args, callType, null);
+ return super.callMethod(context, rubyclass, name, args, callType, block);
}
}
@@ -348,17 +348,17 @@ public IRubyObject callMethod(ThreadContext context, String name,
}
/**
- *
+ * Used by the compiler to ease calling indexed methods
*/
public IRubyObject callMethod(ThreadContext context, byte methodIndex, String name,
- IRubyObject[] args, CallType callType) {
+ IRubyObject[] args, CallType callType, Block block) {
RubyModule module = getMetaClass();
if (module.index != 0) {
- return callMethod(context, module, getRuntime().getSelectorTable().table[module.index][methodIndex], name, args, callType);
+ return callMethod(context, module, getRuntime().getSelectorTable().table[module.index][methodIndex], name, args, callType, block);
}
- return callMethod(context, module, name, args, callType, null);
+ return callMethod(context, module, name, args, callType, block);
}
/**
@@ -368,6 +368,14 @@ public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte
IRubyObject[] args, CallType callType) {
return callMethod(context, rubyclass, name, args, callType, null);
}
+
+ /**
+ *
+ */
+ public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchvalue, String name,
+ IRubyObject[] args, CallType callType, Block block) {
+ return callMethod(context, rubyclass, name, args, callType, block);
+ }
/**
*
@@ -98,7 +98,7 @@ private RubyString(IRuby runtime, RubyClass rubyClass, CharSequence value) {
}
public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchvalue, String name,
- IRubyObject[] args, CallType callType) {
+ IRubyObject[] args, CallType callType, Block block) {
switch (switchvalue) {
case OP_PLUS_SWITCHVALUE:
Arity.singleArgument().checkArity(context.getRuntime(), args);
@@ -129,7 +129,7 @@ public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte
return empty();
case 0:
default:
- return super.callMethod(context, rubyclass, name, args, callType, null);
+ return super.callMethod(context, rubyclass, name, args, callType, block);
}
}
@@ -442,8 +442,8 @@ public void lineNumber(ISourcePosition position) {
public void invokeDynamic(String name, boolean hasReceiver, boolean hasArgs) {
MethodVisitor mv = getMethodVisitor();
String callType = null;
- String callSig = sig(IRubyObject.class, params(ThreadContext.class, String.class, IRubyObject[].class, CallType.class));
- String callSigIndexed = sig(IRubyObject.class, params(ThreadContext.class, Byte.TYPE, String.class, IRubyObject[].class, CallType.class));
+ String callSig = sig(IRubyObject.class, params(ThreadContext.class, String.class, IRubyObject[].class, CallType.class, Block.class));
+ String callSigIndexed = sig(IRubyObject.class, params(ThreadContext.class, Byte.TYPE, String.class, IRubyObject[].class, CallType.class, Block.class));
byte index = MethodIndex.getIndex(name);
@@ -512,6 +512,7 @@ public void invokeDynamic(String name, boolean hasReceiver, boolean hasArgs) {
}
mv.visitFieldInsn(Opcodes.GETSTATIC, p(CallType.class), callType, ci(CallType.class));
+ mv.visitInsn(Opcodes.ACONST_NULL);
if (index != 0) {
invokeIRubyObject("callMethod", callSigIndexed);
@@ -61,7 +61,7 @@ public void postMethod(ThreadContext context) {
context.postCompiledMethod();
}
- public IRubyObject internalCall(ThreadContext context, IRubyObject receiver, RubyModule lastClass, String name, IRubyObject[] args, boolean noSuper) {
+ public IRubyObject internalCall(ThreadContext context, IRubyObject receiver, RubyModule lastClass, String name, IRubyObject[] args, boolean noSuper, Block block) {
assert false;
return null;
}
@@ -83,7 +83,7 @@ private IRubyObject wrap(ThreadContext context, IRuby runtime, IRubyObject recei
}
}
- public IRubyObject call(ThreadContext context, IRubyObject receiver, RubyModule lastClass, String name, IRubyObject[] args, boolean noSuper) {
+ public IRubyObject call(ThreadContext context, IRubyObject receiver, RubyModule lastClass, String name, IRubyObject[] args, boolean noSuper, Block block) {
IRuby runtime = context.getRuntime();
arity.checkArity(runtime, args);
@@ -92,14 +92,12 @@ public IRubyObject call(ThreadContext context, IRubyObject receiver, RubyModule
runtime.callTraceFunction(context, "c-call", position, receiver, name, getImplementationClass());
try {
- // FIXME: pass block when it's available
- return wrap(context, runtime, receiver, args, null);
+ return wrap(context, runtime, receiver, args, block);
} finally {
runtime.callTraceFunction(context, "c-return", position, receiver, name, getImplementationClass());
}
}
- // FIXME: pass block when it's available
- return wrap(context, runtime, receiver, args, null);
+ return wrap(context, runtime, receiver, args, block);
}
public abstract IRubyObject call(ThreadContext context, IRubyObject receiver, IRubyObject[] args, Block block);
@@ -81,7 +81,7 @@
IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, String name, IRubyObject[] args, CallType callType, Block block);
IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchvalue, String name, IRubyObject[] args, CallType callType);
- IRubyObject callMethod(ThreadContext context, byte switchValue, String name, IRubyObject[] args, CallType callType);
+ IRubyObject callMethod(ThreadContext context, byte switchValue, String name, IRubyObject[] args, CallType callType, Block block);
IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args, CallType callType);
IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args, CallType callType, Block block);
@@ -95,6 +95,25 @@
IRubyObject callMethod(ThreadContext context, String string);
IRubyObject callMethod(ThreadContext context, String string, Block aBlock);
+ /**
+ * RubyMethod funcall.
+ * @param context TODO
+ * @param string
+ * @param arg
+ * @return RubyObject
+ */
+ IRubyObject callMethod(ThreadContext context, String string, IRubyObject arg);
+
+ /**
+ * RubyMethod callMethod.
+ * @param context TODO
+ * @param method
+ * @param rubyArgs
+ * @return IRubyObject
+ */
+ IRubyObject callMethod(ThreadContext context, String method, IRubyObject[] rubyArgs);
+ IRubyObject callMethod(ThreadContext context, String method, IRubyObject[] rubyArgs, Block block);
+
/**
* RubyMethod isNil.
* @return boolean
@@ -117,15 +136,6 @@
boolean isImmediate();
- /**
- * RubyMethod funcall.
- * @param context TODO
- * @param string
- * @param arg
- * @return RubyObject
- */
- IRubyObject callMethod(ThreadContext context, String string, IRubyObject arg);
-
/**
* RubyMethod getRubyClass.
*/
@@ -170,16 +180,6 @@
*/
Class getJavaClass();
- /**
- * RubyMethod callMethod.
- * @param context TODO
- * @param method
- * @param rubyArgs
- * @return IRubyObject
- */
- IRubyObject callMethod(ThreadContext context, String method, IRubyObject[] rubyArgs);
- IRubyObject callMethod(ThreadContext context, String method, IRubyObject[] rubyArgs, Block block);
-
/**
* RubyMethod eval.
* @param iNode

0 comments on commit a190726

Please sign in to comment.