[kaffe] trampoline handling

Guilhem Lavaux guilhem at kaffe.org
Sun Aug 8 02:01:49 PDT 2004


Helmer Krämer wrote:

>Hi,
>  
>

Hi Helmer,

>the attached patch moves the handling of trampolines and method
>calls into engine-specific files, thereby further cleaning up
>the core vm:
>  
>

Great ! :)
The patch and the new behaviour looks fine to me.

I like especially the engine_callMethod. This will potentially enable us 
to mix jitted and interpreted code by chosing the right callMethod 
depending on Method (but that's just an idea).

I had written for my engine separation patch a small amount of code to 
remove the ifdef in soft.c concerning soft_multianewarray. This uses 
sysdepCallMethod that I have chosen at that time to move into its own 
include file. Here is the code:

The code is naturally for the intrp... I'll write a patch if I have some 
time.


#include "sysdepCall.h"
#include "slots.h"
#include "soft.h"

static inline void *
soft_intrp_multianewarray(Hjava_lang_Class* class, jint dims, slots *args)
{
  callMethodInfo call;
  jvalue in[MAXMARGS];
  jvalue ret;
  int i;
 
  call.function = soft_multianewarray;
  call.nrargs = 2 + dims;
  call.args = in;
  call.ret = &ret;
  call.argsize = PTR_TYPE_SIZE / SIZEOF_INT + (dims+1);
  call.retsize = PTR_TYPE_SIZE / SIZEOF_INT;
  call.rettype = 'L';
  call.callsize[0] = PTR_TYPE_SIZE / SIZEOF_INT;
  call.callsize[1] = 1;
  call.calltype[0] = 'L';
  call.calltype[1] = 'I';
  in[0].l = class;
  in[1].i = dims;
  args -= dims-1;
  for (i = 0; i < dims; i++)
    {
      call.callsize[i+2] = 1;
      call.calltype[i+2] = 'I';
      /* We are sorting them in the reverse order
       * because stack grows in the opposite direction */
      in[i+2].i = args[i].v.tint;
    }

  sysdepCallMethod(&call);

  return ret.l;
}


Cheers,

Guilhem.




More information about the kaffe mailing list