Index: include/Arrays.h =================================================================== RCS file: /home/cvspublic/kaffe/include/Arrays.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Arrays.h --- Arrays.h 1998/03/31 19:10:53 1.1.1.1 +++ Arrays.h 1999/01/20 16:56:01 @@ -12,28 +12,19 @@ #ifndef __array_h #define __array_h -#define ARRAY_FIELDS \ - unsigned int length; \ - double align[0] - -struct Array { - Hjava_lang_Object base; - ARRAY_FIELDS; -}; - /* * Define various array types */ -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jbyte body[1]; } data[1]; } HArrayOfBoolean; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jbyte body[1]; } data[1]; } HArrayOfByte; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jchar body[1]; } data[1]; } HArrayOfChar; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jdouble body[1]; } data[1]; } HArrayOfDouble; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jfloat body[1]; } data[1]; } HArrayOfFloat; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jint body[1]; } data[1]; } HArrayOfInt; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jshort body[1]; } data[1]; } HArrayOfShort; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { jlong body[1]; } data[1]; } HArrayOfLong; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { Hjava_lang_Object* body[1]; } data[1]; } HArrayOfArray; -typedef struct { Hjava_lang_Object base; ARRAY_FIELDS; struct { Hjava_lang_Object* body[1]; } data[1]; } HArrayOfObject; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jbyte body[1]; } data[1]; } HArrayOfBoolean; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jbyte body[1]; } data[1]; } HArrayOfByte; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jchar body[1]; } data[1]; } HArrayOfChar; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jdouble body[1]; } data[1]; } HArrayOfDouble; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jfloat body[1]; } data[1]; } HArrayOfFloat; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jint body[1]; } data[1]; } HArrayOfInt; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jshort body[1]; } data[1]; } HArrayOfShort; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jlong body[1]; } data[1]; } HArrayOfLong; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; Hjava_lang_Object* body[1]; } data[1]; } HArrayOfArray; +typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; Hjava_lang_Object* body[1]; } data[1]; } HArrayOfObject; /* Get length of arrays */ #define obj_length(_obj) ((_obj)->length) Index: kaffe/kaffevm/gtypes.h =================================================================== RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/gtypes.h,v retrieving revision 1.5 diff -u -r1.5 gtypes.h --- gtypes.h 1998/12/27 00:10:08 1.5 +++ gtypes.h 1999/01/20 16:56:01 @@ -77,7 +77,6 @@ typedef u2 accessFlags; typedef u2 constIndex; -typedef struct Array Array; typedef struct _fields Field; #if !defined(__DEFINED_METHOD) Index: kaffe/kaffevm/object.h =================================================================== RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/object.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 object.h --- object.h 1998/03/31 19:10:54 1.1.1.1 +++ object.h 1999/01/20 16:56:01 @@ -22,16 +22,16 @@ #define OBJECT_DATA(OBJ) ((void*)((Hjava_lang_Object*)(OBJ)+1)) /* Number of elements. */ -#define ARRAY_SIZE(ARRAY) (((Array*)(ARRAY))->length) -#define ARRAY_DATA(ARRAY) ((void*)((Array*)(ARRAY)+1)) -#define OBJARRAY_DATA(ARRAY) ((Hjava_lang_Object**)((Array*)(ARRAY)+1)) +#define ARRAY_SIZE(ARRAY) (((HArrayOfObject*)(ARRAY))->length) +#define ARRAY_DATA(ARRAY) ((void*)&(((HArrayOfObject*)(ARRAY))->data)) +#define OBJARRAY_DATA(ARRAY) ((Hjava_lang_Object**)&(((HArrayOfObject*)(ARRAY))->data)) /* * These bizzare casts provide various offset into the object structure. */ #define OBJECT_DTABLE_OFFSET ((int)&(*(Hjava_lang_Object*)0).dtable) #define ARRAY_SIZE_OFFSET ((int)&ARRAY_SIZE(0)) -#define ARRAY_DATA_OFFSET ((int)(((Array*)0)+1)) +#define ARRAY_DATA_OFFSET ((int)ARRAY_DATA(0)) struct Hjava_lang_Class; Index: kaffe/kaffevm/object.c =================================================================== RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/object.c,v retrieving revision 1.7 diff -u -r1.7 object.c --- object.c 1999/01/06 07:53:03 1.7 +++ object.c 1999/01/20 16:56:01 @@ -106,10 +106,10 @@ Hjava_lang_Object* obj; if (CLASS_IS_PRIMITIVE(elclass)) { - obj = gc_malloc((TYPE_SIZE(elclass) * count) + sizeof(Array), GC_ALLOC_PRIMARRAY); + obj = gc_malloc((TYPE_SIZE(elclass) * count) + ARRAY_DATA_OFFSET, GC_ALLOC_PRIMARRAY); } else { - obj = gc_malloc((PTR_TYPE_SIZE * count) + sizeof(Array), GC_ALLOC_REFARRAY); + obj = gc_malloc((PTR_TYPE_SIZE * count) + ARRAY_DATA_OFFSET, GC_ALLOC_REFARRAY); } class = lookupArray(elclass); obj->dtable = class->dtable; Index: kaffe/kaffevm/intrp/icode.h =================================================================== RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/intrp/icode.h,v retrieving revision 1.6 diff -u -r1.6 icode.h --- icode.h 1998/12/19 20:30:06 1.6 +++ icode.h 1999/01/20 16:56:02 @@ -291,7 +291,7 @@ #define adjustpc(a) /* Not needed for interpreter */ -#define check_array_index(O, I) if ((I)[0].v.tint >= ((struct Array*)((O)[0].v.taddr))->length) { \ +#define check_array_index(O, I) if ((I)[0].v.tint >= ARRAY_SIZE((O)[0].v.taddr)) { \ soft_badarrayindex(); \ } #define build_call_frame(SIG, OBJ, NRARGS) /* Not needed for interpreter */ Index: kaffe/kaffevm/intrp/machine.c =================================================================== RCS file: /home/cvspublic/kaffe/kaffe/kaffevm/intrp/machine.c,v retrieving revision 1.7 diff -u -r1.7 machine.c --- machine.c 1998/12/11 01:10:15 1.7 +++ machine.c 1999/01/20 16:56:02 @@ -72,7 +72,7 @@ Hjava_lang_Object* volatile mobj; vmException mjbuf; accessFlags methaccflags; - char* str; + const char* str; /* If these can be kept in registers then things will go much * better. Index: test/regression/ExecTest.java =================================================================== RCS file: /home/cvspublic/kaffe/test/regression/ExecTest.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ExecTest.java --- ExecTest.java 1998/03/31 19:10:54 1.1.1.1 +++ ExecTest.java 1999/01/20 16:56:02 @@ -6,7 +6,7 @@ { try { - String[] args = { "/bin/ls" }; + String[] args = { "/bin/echo", "Hello World" }; Runtime myRuntime = Runtime.getRuntime (); Process myProcess = myRuntime.exec ( args ); try { myProcess.waitFor (); }