From: Godmar Back (gback@cs.utah.edu)
Date: Mon Dec 21 1998 - 15:37:42 EST
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------ =_NextPart_000_01BE2D13.450888BF
> Content-Type: text/plain
>
> Hi,
>
> The new interface index is broken for static
> methods of an interface (aka <clinit>).
>
> The following patch don't count ACC_STATIC methods
> in buildInterfaceDispatchTable().
>
> It also use class->msize in place of CLASS_NMETHODS() as
> the number of entries in the array class->itable2dtable.
>
Was the old scheme indeed broken or was it simply a waste of
one slot per static method in the dispatch table?
Btw, do you have a test case that we could add to the regression
suite?
I'll be out of touch for the next week.
Happy holidays,
- Godmar
>
> Edouard.
> ---
> <<kaffe-clinit.diff>>
>
> ------ =_NextPart_000_01BE2D13.450888BF
> Content-Type: application/octet-stream;
> name="kaffe-clinit.diff"
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: attachment;
> filename="kaffe-clinit.diff"
>
> Index: classMethod.c=0A=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
> RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/classMethod.c,v=0A=
> retrieving revision 1.27=0A=
> diff -p -u -r1.27 classMethod.c=0A=
> --- classMethod.c 1998/12/20 17:42:39 1.27=0A=
> +++ classMethod.c 1998/12/21 13:26:38=0A=
> @@ -1309,7 +1309,7 @@ buildDispatchTable(Hjava_lang_Class* cla=0A=
> j =3D 0;=0A=
> for (i =3D 0; i < class->total_interface_len; i++) {=0A=
> class->if2itable[i] =3D j;=0A=
> - j +=3D CLASS_NMETHODS(class->interfaces[i]);=0A=
> + j +=3D class->interfaces[i]->msize;=0A=
> }=0A=
> if (j =3D=3D 0) { /* this means only pseudo interfaces without =
> methods=0A=
> * are implemented, such as Serializable or Cloneable=0A=
> @@ -1396,21 +1396,27 @@ buildInterfaceDispatchTable(Hjava_lang_C=0A=
> int i;=0A=
> =0A=
> meth =3D CLASS_METHODS(class);=0A=
> + class->msize =3D 0;=0A=
> =0A=
> /* enumerate indices and store them in meth->idx */=0A=
> for (i =3D 0; i < CLASS_NMETHODS(class); i++, meth++) {=0A=
> - meth->idx =3D i;=0A=
> + if (meth->accflags & ACC_STATIC) {=0A=
> + meth->idx =3D -1;=0A=
> #if defined(TRANSLATOR)=0A=
> - /* Handle <clinit> */=0A=
> - if (equalUtf8Consts(meth->name, init_name) && =0A=
> - METHOD_NEEDS_TRAMPOLINE(meth)) =0A=
> - {=0A=
> - methodTrampoline* tramp =3D =
> (methodTrampoline*)gc_malloc(sizeof(methodTrampoline), =
> GC_ALLOC_DISPATCHTABLE);=0A=
> - FILL_IN_TRAMPOLINE(tramp, meth);=0A=
> - METHOD_NATIVECODE(meth) =3D (nativecode*)tramp;=0A=
> - FLUSH_DCACHE(tramp, tramp+1);=0A=
> - }=0A=
> + /* Handle <clinit> */=0A=
> + if (equalUtf8Consts(meth->name, init_name) && =0A=
> + METHOD_NEEDS_TRAMPOLINE(meth)) =0A=
> + {=0A=
> + methodTrampoline* tramp =3D =
> (methodTrampoline*)gc_malloc(sizeof(methodTrampoline), =
> GC_ALLOC_DISPATCHTABLE);=0A=
> + FILL_IN_TRAMPOLINE(tramp, meth);=0A=
> + METHOD_NATIVECODE(meth) =3D (nativecode*)tramp;=0A=
> + FLUSH_DCACHE(tramp, tramp+1);=0A=
> + }=0A=
> #endif=0A=
> + }=0A=
> + else {=0A=
> + meth->idx =3D class->msize++;=0A=
> + }=0A=
> }=0A=
> return;=0A=
> =0A=
>
> ------ =_NextPart_000_01BE2D13.450888BF--
>
This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:27 EDT