This is the mail archive of the
kawa@sourceware.cygnus.com
mailing list for the Kawa project.
Re: VerifyError re. uninitialized register
brlewis@alum.mit.edu writes:
> Error message:
> (class: atEvalLevel$lambda, method: applyN signature: ([Ljava/lang/Object;)Ljava/lang/Object;) Accessing value from uninitialized register 6
>
> Partial dump:
> Method name:80="applyN" public final Signature: 81=(java.lang.Object[])java.lang.Object
> Attribute "Code", length:591, max_stack:6, max_locals:8, code_length:403
> 0: aload 6
> 2: iconst_0
> 3: aaload
> 4: astore_1
> 5: aload 6
> 7: iconst_1
> 8: aaload
This kind of code is generated for a function only when
(a) there are more than 4 parameter (so we can't use apply0 ... apply4), but
(b) there is a mixed number of parameters. In that case the allocParameters
method of LambdaExp generates code at the start of the function to
move the parameters out of the incoming Object[] argsArray into regular
variables.
There are two other requirements:
(c) The function must reference variables from an outer scope. Thus it
needs a closureEnv. (Otherwise, the procedure "body" would be in a
regular method, not an "apply" method.) (I will probably get rid of
this kind of apply-method-doing-actual-work, just to reduce the
number of different ways Kawa generates procedures.)
(d) The function must be used as a value so it cannot be inlined.
Specifically, what is going wrong is that the incoming argArray is
assigned to local varible #6, while the real parameters are local
variables 1-5. It would be the args array in local variable #1 while
the real parameters are in variables 2-6. I.e. the problem is that
the argaArray "artifical" but incoming parameter is being assigned to
a variable *after* the real but local paramaters.
Bottom line: I'm guessing this patch will fix the problem:
Index: LambdaExp.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/LambdaExp.java,v
retrieving revision 1.32
diff -u -r1.32 LambdaExp.java
--- LambdaExp.java 2000/02/28 03:09:39 1.32
+++ LambdaExp.java 2000/02/29 20:46:00
@@ -811,6 +811,7 @@
|| child.isHandlingTailCalls())
{
child.argsArray = new Variable("argsArray", comp.objArrayType);
+ child.firstArgsArrayArg = child.firstDecl();
}
}
else if (! child.getInlineOnly())
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/