sysdepCallMethod questions

jim hopper hopperj at macconnect.com
Wed Aug 25 06:32:55 PDT 1999


below is from kaffe/kaffevm/support.h describes the argument passed 
from java to sysdepCallMethod. the thing that is interesting is it 
notes that if an arg is 64 bits it takes 2 slots in the arglist and 
implys that they are both 64 bits if i read this correctly.  can 
anyone confirm this?

also what is the field argsize used for as its never mentioned.

Thanks! jim

/*
  * The callMethodInfo structure describes the information necessary to
  * invoke a native or just-in-time compiled method.
  *
  * It is the task of the sysdepCallMethod macro, usually defined in
  * config/$arch/common.h, to generate a procedure call that conforms to
  * the calling convention of a particular architecture or set of build tools.
  *
  * The sysdepCallMethod macro takes a single argument of type callMethodInfo *
  * that describes where the parameters are, where the return value should
  * go and what the signature of the method is.
  *
  * `jvalue' is a union defined in include/jtypes.h.  It corresponds to an
  * entry on the Java stack.
  * The suffixes i,j,b,c,s,l,f,d access the corresponding element of
  * (Java) type int, long, boolean, char, short, ref, float, and double.
  *
  * `args' is an array containing the arguments passed to the function.
  * It corresponds to the Java stack and has `nrargs' valid entries with
  * the following property:
  *
  * If two adjacent slots on the Java stack are combined to a 64bit value,
  * it will also use two array entries, and not one.  However, the first
  * entry will contain the 64bit value (in j or d, depending on the type),
  * and the second entry will be undefined.  This allows for easier access,
  * while preserving indexing.  Thus, some array entries will have 0, some
  * 32 and some 64 bits of valid data in them.  The callsize array says
  * which one it is.
  *
  * callsize[i] may be 0, 1, or 2, depending on the number of valid bits
  * in args[i].  Similarly, calltype[i] contains the signature type of the
  * argument in args[i] ('J', 'F', etc.)
  *
  * To simplify 32 bit assembly code, we copy the last 32 bits of a 64
  * bit arg into the next slot.  This allows you to treat args as an
  * array of 32 bit values.  This simplification also makes a C version
  * of sysdepCallMethod more viable, and such a function is defined in
  * mi.c.
  *
  * Note that "callsize[i] == 2 iff callsize[i+1] == 0" -- this
  * property can also be exploited by a sysdepCallMethod macros.
  *
  * `function' is a pointer to the method to be invoked.
  *
  * `retsize' and `rettype' have the same value ranges as callsize[i] and
  * calltype[i],  except they correspond to the return value.  The
  * sysdepCallMethod must store the return value in the proper type at *ret.
  */
typedef struct {
	void*			function;
	jvalue*			args;
	jvalue*			ret;
	int			nrargs;
	int			argsize;
	char			retsize;
	char			rettype;
	char			callsize[MAXMARGS];
	char			calltype[MAXMARGS];
} callMethodInfo;
At a recent computer software engineering course in the US, the participants
were given an awkward question to answer.  "If you had just boarded an
airliner and discovered that your team of programmers had been responsible
for the flight control software, how many of you would disembark
immediately?"
                     unknown author


More information about the kaffe mailing list