> 
> 
> I've found a bug in processClass() (I think).  If a class X
> is a superclass and it blows up during initialization of subclass Y,
> Y's state is set to CSTATE_FAILED.  Subsequent references to Y will
> cause assert() failures where Kaffe asserts Y->state >=
> CSTATE_COMPLETE.
> 
> Bug #535 has a test case that reproduces the problem.
> 
> I changed processClass() (attached diff) so that if the superclass
> fails with "CSTATE_INIT_FAILED" the subclass is tagged with that
> failure, too.  This seems right and fixes my problem, except
> now ProcessClassTest deadlocks on test 'G'.  (Thank god for regression 
> tests!)  Perhaps something else is wrong and the failed class
> is being incorrectly looked up?
> 
> I'll continue looking into this, but any suggestions are appreciated!
> 
> -Pat
> 
> RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/classMethod.c,v
> retrieving revision 1.60
> diff -u -b -u -r1.60 classMethod.c
> --- classMethod.c     1999/07/11 00:14:26     1.60
> +++ classMethod.c     1999/08/07 00:17:14
> @@ -176,6 +176,8 @@
>                                                    class, einfo);
>                       classLock = lockMutex(class);
>                       if (class->superclass == 0) {
> +                             if (class->superclass->state == CSTATE_INIT_FAILED)
> +                                     SET_CLASS_STATE(CSTATE_INIT_FAILED);
>                               success = false;
>                               goto done;

If class->superclass is 0, you check its state 'field' (?) --- this may not 
be what you want.  It may segfault at this point, try to load
NullPointerException.class and deadlock.

>                       }
> @@ -385,6 +387,8 @@
>                                            CSTATE_COMPLETE, einfo);
>                       classLock = lockMutex(class);
>                       if (success == false) {
> +                             if (class->superclass->state == CSTATE_INIT_FAILED)
> +                                     SET_CLASS_STATE(CSTATE_INIT_FAILED);
>                               goto done;
>                       }
>               }

This looks better --- maybe try only this part of the patch(?)

        - Godmar

Reply via email to