dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 8056 2007-06-10 14:49:57Z michi $
+dnl $Id: configure.ac 8123 2007-06-20 23:50:55Z michi $
dnl Process this file with autoconf to produce a configure script.
AC_FUNC_MMAP
dnl keep them alpha-sorted!
+AC_CHECK_FUNCS([atoi])
+AC_CHECK_FUNCS([atol])
AC_CHECK_FUNCS([calloc])
AC_CHECK_FUNCS([confstr])
+AC_CHECK_FUNCS([fflush])
+AC_CHECK_FUNCS([fopen])
+AC_CHECK_FUNCS([fprintf])
AC_CHECK_FUNCS([free])
AC_CHECK_FUNCS([fstat])
AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([open])
AC_CHECK_FUNCS([scandir])
AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
+AC_CHECK_FUNCS([strncmp])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([time])
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: cacaoh.c 7246 2007-01-29 18:49:05Z twisti $
+ $Id: cacaoh.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vmcore/suck.h"
-/* define heap sizes **********************************************************/
-
-#define HEAP_MAXSIZE 2 * 1024 * 1024 /* default 2MB */
-#define HEAP_STARTSIZE 100 * 1024 /* default 100kB */
-
-
/* define cacaoh options ******************************************************/
enum {
char *classpath;
char *cp;
s4 cplen;
- u4 heapmaxsize;
- u4 heapstartsize;
if (argc < 2)
usage();
opt_verbose = false;
opt_directory = NULL;
- heapmaxsize = HEAP_MAXSIZE;
- heapstartsize = HEAP_STARTSIZE;
-
/* parse the options ******************************************************/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: headers.c 6286 2007-01-10 10:03:38Z twisti $
+ $Id: dummy.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
+#include <assert.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
-
-#if defined(ENABLE_THREADS)
-# include <pthread.h>
-#endif
#include "toolbox/logging.h"
-#include "vm/types.h"
-
#include "vm/global.h"
#include "vm/vm.h"
}
bool access_is_accessible_member(classinfo *referer, classinfo *declarer,
- s4 memberflags)
+ int32_t memberflags)
{
vm_abort("access_is_accessible_member");
return NULL;
}
-s4 builtin_isanysubclass(classinfo *sub, classinfo *super)
+int32_t builtin_isanysubclass(classinfo *sub, classinfo *super)
{
abort();
return NULL;
}
-java_objectarray *builtin_anewarray(s4 size, classinfo *componentclass)
+java_objectarray *builtin_anewarray(int32_t size, classinfo *componentclass)
{
abort();
abort();
}
-void exceptions_throw_nullpointerexception(void)
+void exceptions_throw_classnotfoundexception(utf *name)
{
- fprintf(stderr, "java.lang.NullPointerException\n");
+ fprintf(stderr, "java.lang.ClassNotFoundException: ");
+ utf_fprint_printable_ascii(stderr, name);
+ fputc('\n', stderr);
abort();
}
-void classnotfoundexception_to_noclassdeffounderror(void)
+void exceptions_throw_nullpointerexception(void)
{
- /* Can that one happen? */
+ fprintf(stderr, "java.lang.NullPointerException\n");
abort();
}
{
}
-s8 gc_get_heap_size(void)
+int64_t gc_get_heap_size(void)
{
return 0;
}
-s8 gc_get_free_bytes(void)
+int64_t gc_get_free_bytes(void)
{
return 0;
}
-s8 gc_get_total_bytes(void)
+int64_t gc_get_total_bytes(void)
{
return 0;
}
-s8 gc_get_max_heap_size(void)
+int64_t gc_get_max_heap_size(void)
{
return 0;
}
/* heap ***********************************************************************/
-void *heap_alloc_uncollectable(u4 bytelength)
+void *heap_alloc_uncollectable(uint32_t bytelength)
{
return calloc(bytelength, 1);
}
/* memory *********************************************************************/
-void *mem_alloc(s4 size)
+void *mem_alloc(int32_t size)
{
/* real implementation in src/mm/memory.c clears memory */
return calloc(size, 1);
}
-void *mem_realloc(void *src, s4 len1, s4 len2)
+void *mem_realloc(void *src, int32_t len1, int32_t len2)
{
return realloc(src, len2);
}
-void mem_free(void *m, s4 size)
+void mem_free(void *m, int32_t size)
{
free(m);
}
-void *dump_alloc(s4 size)
+void *dump_alloc(int32_t size)
{
return malloc(size);
}
-void dump_release(s4 size)
+void dump_release(int32_t size)
{
}
-s4 dump_size(void)
+int32_t dump_size(void)
{
return 0;
}
/* threads ********************************************************************/
-pthread_key_t threads_current_threadobject_key;
-
-ptrint threads_get_current_tid(void)
+intptr_t threads_get_current_tid(void)
{
return 0;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: headers.c 7483 2007-03-08 13:17:40Z michi $
+ $Id: headers.c 8123 2007-06-20 23:50:55Z michi $
*/
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include "vm/types.h"
-
#if defined(ENABLE_THREADS)
# if defined(__DARWIN__)
# include <signal.h>
chain *ident_chain; /* chain with method and field names in current class */
FILE *file = NULL;
-static u4 outputsize;
+static uint32_t outputsize;
static bool dopadding;
}
-static void addoutputsize (int len)
+static void addoutputsize(int len)
{
- u4 newsize,i;
- if (!dopadding) return;
+ uint32_t newsize;
+ int32_t i;
+
+ if (!dopadding)
+ return;
newsize = MEMORY_ALIGN(outputsize, len);
- for (i = outputsize; i < newsize; i++) fprintf(file, " u1 pad%d\n", (int) i);
+ for (i = outputsize; i < newsize; i++)
+ fprintf(file, " uint8_t pad%d\n", (int) i);
+
outputsize = newsize;
}
void printOverloadPart(utf *desc)
{
char *utf_ptr=desc->text;
- u2 c;
+ uint16_t c;
fprintf(file, "__");
static char *printtype(char *utf_ptr)
{
- u2 c;
+ uint16_t c;
switch (utf_nextu2(&utf_ptr)) {
- case 'V': fprintf (file, "void");
+ case 'V':
+ fprintf(file, "void");
break;
case 'I':
case 'S':
case 'B':
case 'C':
- case 'Z': addoutputsize (4);
- fprintf (file, "s4");
+ case 'Z':
+ addoutputsize(4);
+ fprintf(file, "int32_t");
break;
- case 'J': addoutputsize (8);
- fprintf (file, "s8");
+ case 'J':
+ addoutputsize(8);
+ fprintf(file, "int64_t");
break;
- case 'F': addoutputsize (4);
- fprintf (file, "float");
+ case 'F':
+ addoutputsize(4);
+ fprintf(file, "float");
break;
- case 'D': addoutputsize (8);
- fprintf (file, "double");
+ case 'D':
+ addoutputsize(8);
+ fprintf(file, "double");
break;
case '[':
addoutputsize ( sizeof(java_arrayheader*) );
static void printfields(classinfo *c)
{
- u4 i;
+ int32_t i;
fieldinfo *f;
int ident_count;
void printmethod(methodinfo *m)
{
char *utf_ptr;
- u2 paramnum = 1;
+ int32_t paramnum = 1;
/* search for return-type in descriptor */
utf_ptr = m->descriptor->text;
void gen_header_filename(char *buffer, utf *u)
{
- s4 i;
+ int32_t i;
for (i = 0; i < utf_get_number_of_u2s(u); i++) {
if ((u->text[i] == '/') || (u->text[i] == '$')) {
char header_filename[1024] = "";
char classname[1024];
char uclassname[1024];
- u2 i;
+ int32_t i;
methodinfo *m;
- u2 j;
+ int32_t j;
methodinfo *m2;
bool nativelyoverloaded;
utf *u = clazz->name;
char *endpos = u->text + u->blength;
char *utf_ptr = u->text;
- u2 c;
+ uint16_t c;
while (utf_ptr < endpos) {
if ((c = utf_nextu2(&utf_ptr)) == '_')
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: memory.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: memory.c 8123 2007-06-20 23:50:55Z michi $
*/
#if defined(ENABLE_THREADS) && !defined(NDEBUG)
static void memory_thread(void)
{
+ int32_t seconds;
+
+ /* If both arguments are specified, use the value of
+ ProfileMemoryUsage. */
+
+ if (opt_ProfileGCMemoryUsage)
+ seconds = opt_ProfileGCMemoryUsage;
+
+ if (opt_ProfileMemoryUsage)
+ seconds = opt_ProfileMemoryUsage;
+
while (true) {
- /* sleep thread for 2 seconds */
+ /* sleep thread */
- threads_sleep(2 * 1000, 0);
+ threads_sleep(seconds * 1000, 0);
# if defined(ENABLE_STATISTICS)
- /* print current date and time */
+ /* Print current date and time (only when we print to the
+ stdout). */
- statistics_print_date();
+ if (!opt_ProfileMemoryUsageGNUPlot)
+ statistics_print_date();
/* print memory usage */
- statistics_print_memory_usage();
+ if (opt_ProfileMemoryUsage)
+ statistics_print_memory_usage();
/* print GC memory usage */
- statistics_print_gc_memory_usage();
+ if (opt_ProfileGCMemoryUsage)
+ statistics_print_gc_memory_usage();
# endif
}
}
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
-## $Id: Makefile.am 7940 2007-05-23 09:42:08Z michi $
+## $Id: Makefile.am 8123 2007-06-20 23:50:55Z michi $
## Process this file with automake to produce Makefile.in
java_nio_Buffer.h \
java_nio_DirectByteBufferImpl.h \
java_security_ProtectionDomain.h \
+ java_util_concurrent_atomic_AtomicLong.h \
sun_misc_Unsafe.h
JAVAME_CLDC1_1_HEADER_FILES = \
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: jni.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
#include <assert.h>
+#include <stdint.h>
#include <string.h>
#include "vm/types.h"
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
}
-/* _Jv_jni_vmargs_from_objectarray *********************************************
-
- XXX
-
-*******************************************************************************/
-
-static bool _Jv_jni_vmargs_from_objectarray(java_objectheader *o,
- methoddesc *descr,
- vm_arg *vmargs,
- java_objectarray *params)
-{
- java_objectheader *param;
- s4 paramcount;
- typedesc *paramtypes;
- classinfo *c;
- s4 i;
- s4 j;
- s8 value;
-
- paramcount = descr->paramcount;
- paramtypes = descr->paramtypes;
-
- /* if method is non-static fill first block and skip `this' pointer */
-
- i = 0;
-
- if (o != NULL) {
- /* this pointer */
- vmargs[0].type = TYPE_ADR;
- vmargs[0].data.l = (u8) (ptrint) o;
-
- paramtypes++;
- paramcount--;
- i++;
- }
-
- for (j = 0; j < paramcount; i++, j++, paramtypes++) {
- switch (paramtypes->type) {
- /* primitive types */
- case TYPE_INT:
- case TYPE_LNG:
- case TYPE_FLT:
- case TYPE_DBL:
- param = params->data[j];
-
- if (param == NULL)
- goto illegal_arg;
-
- /* internally used data type */
- vmargs[i].type = paramtypes->type;
-
- /* convert the value according to its declared type */
-
- c = param->vftbl->class;
-
- switch (paramtypes->decltype) {
- case PRIMITIVETYPE_BOOLEAN:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- value = (s8) ((java_lang_Boolean *) param)->value;
- else
- goto illegal_arg;
-
- vmargs[i].data.l = value;
- break;
-
- case PRIMITIVETYPE_BYTE:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- value = (s8) ((java_lang_Byte *) param)->value;
- else
- goto illegal_arg;
-
- vmargs[i].data.l = value;
- break;
-
- case PRIMITIVETYPE_CHAR:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- value = (s8) ((java_lang_Character *) param)->value;
- else
- goto illegal_arg;
-
- vmargs[i].data.l = value;
- break;
-
- case PRIMITIVETYPE_SHORT:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- value = (s8) ((java_lang_Short *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
- value = (s8) ((java_lang_Byte *) param)->value;
- else
- goto illegal_arg;
-
- vmargs[i].data.l = value;
- break;
-
- case PRIMITIVETYPE_INT:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- value = (s8) ((java_lang_Integer *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_SHORT].class_wrap)
- value = (s8) ((java_lang_Short *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
- value = (s8) ((java_lang_Byte *) param)->value;
- else
- goto illegal_arg;
-
- vmargs[i].data.l = value;
- break;
-
- case PRIMITIVETYPE_LONG:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- value = (s8) ((java_lang_Long *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_INT].class_wrap)
- value = (s8) ((java_lang_Integer *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_SHORT].class_wrap)
- value = (s8) ((java_lang_Short *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
- value = (s8) ((java_lang_Byte *) param)->value;
- else
- goto illegal_arg;
-
- vmargs[i].data.l = value;
- break;
-
- case PRIMITIVETYPE_FLOAT:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
- else
- goto illegal_arg;
- break;
-
- case PRIMITIVETYPE_DOUBLE:
- if (c == primitivetype_table[paramtypes->decltype].class_wrap)
- vmargs[i].data.d = (jdouble) ((java_lang_Double *) param)->value;
- else if (c == primitivetype_table[PRIMITIVETYPE_FLOAT].class_wrap)
- vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
- else
- goto illegal_arg;
- break;
-
- default:
- goto illegal_arg;
- }
- break;
-
- case TYPE_ADR:
- if (!resolve_class_from_typedesc(paramtypes, true, true, &c))
- return false;
-
- if (params->data[j] != 0) {
- if (paramtypes->arraydim > 0) {
- if (!builtin_arrayinstanceof(params->data[j], c))
- goto illegal_arg;
-
- } else {
- if (!builtin_instanceof(params->data[j], c))
- goto illegal_arg;
- }
- }
-
- vmargs[i].type = TYPE_ADR;
- vmargs[i].data.l = (u8) (ptrint) params->data[j];
- break;
-
- default:
- goto illegal_arg;
- }
- }
-
-/* if (rettype) */
-/* *rettype = descr->returntype.decltype; */
-
- return true;
-
-illegal_arg:
- exceptions_throw_illegalargumentexception();
- return false;
-}
-
-
/* _Jv_jni_CallObjectMethod ****************************************************
Internal function to call Java Object methods.
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
java_objectarray *params)
{
vmargs = MNEW(vm_arg, argcount);
- if (!_Jv_jni_vmargs_from_objectarray(o, resm->parseddesc, vmargs, params)) {
+ if (!vm_vmargs_from_objectarray(resm, o, vmargs, params)) {
MFREE(vmargs, vm_arg, argcount);
return NULL;
}
return ro;
}
+#else
+java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
+ java_objectarray *params)
+{
+ methodinfo *resm;
+ java_objectheader *ro;
+ s4 argcount;
+ s4 paramcount;
+ java_objectheader *xptr;
+ int32_t dumpsize;
+ uint64_t *array;
+
+ if (m == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ argcount = m->parseddesc->paramcount;
+ paramcount = argcount;
+
+ /* if method is non-static, remove the `this' pointer */
+
+ if (!(m->flags & ACC_STATIC))
+ paramcount--;
+
+ /* For instance methods the object has to be an instance of the
+ class the method belongs to. For static methods the obj
+ parameter is ignored. */
+
+ if (!(m->flags & ACC_STATIC) && o && (!builtin_instanceof(o, m->class))) {
+ exceptions_throw_illegalargumentexception();
+ return NULL;
+ }
+
+ /* check if we got the right number of arguments */
+
+ if (((params == NULL) && (paramcount != 0)) ||
+ (params && (params->header.size != paramcount)))
+ {
+ exceptions_throw_illegalargumentexception();
+ return NULL;
+ }
+
+ /* for instance methods we need an object */
+
+ if (!(m->flags & ACC_STATIC) && (o == NULL)) {
+ /* XXX not sure if that is the correct exception */
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ /* for static methods, zero object to make subsequent code simpler */
+ if (m->flags & ACC_STATIC)
+ o = NULL;
+
+ if (o != NULL) {
+ /* for instance methods we must do a vftbl lookup */
+ resm = method_vftbl_lookup(o->vftbl, m);
+ }
+ else {
+ /* for static methods, just for convenience */
+ resm = m;
+ }
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a object-array */
+
+ array = vm_array_from_objectarray(resm, o, params);
+
+ if (array == NULL) {
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return NULL;
+ }
+
+ switch (resm->parseddesc->returntype.decltype) {
+ case TYPE_VOID:
+ (void) vm_call_array(resm, array);
+
+ ro = NULL;
+ break;
+
+ case PRIMITIVETYPE_BOOLEAN: {
+ s4 i;
+ java_lang_Boolean *bo;
+
+ i = vm_call_int_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Boolean);
+
+ /* setting the value of the object direct */
+
+ bo = (java_lang_Boolean *) ro;
+ bo->value = i;
+ }
+ break;
+
+ case PRIMITIVETYPE_BYTE: {
+ s4 i;
+ java_lang_Byte *bo;
+
+ i = vm_call_int_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Byte);
+
+ /* setting the value of the object direct */
+
+ bo = (java_lang_Byte *) ro;
+ bo->value = i;
+ }
+ break;
+
+ case PRIMITIVETYPE_CHAR: {
+ s4 i;
+ java_lang_Character *co;
+
+ i = vm_call_int_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Character);
+
+ /* setting the value of the object direct */
+
+ co = (java_lang_Character *) ro;
+ co->value = i;
+ }
+ break;
+
+ case PRIMITIVETYPE_SHORT: {
+ s4 i;
+ java_lang_Short *so;
+
+ i = vm_call_int_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Short);
+
+ /* setting the value of the object direct */
+
+ so = (java_lang_Short *) ro;
+ so->value = i;
+ }
+ break;
+
+ case PRIMITIVETYPE_INT: {
+ s4 i;
+ java_lang_Integer *io;
+
+ i = vm_call_int_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Integer);
+
+ /* setting the value of the object direct */
+
+ io = (java_lang_Integer *) ro;
+ io->value = i;
+ }
+ break;
+
+ case PRIMITIVETYPE_LONG: {
+ s8 l;
+ java_lang_Long *lo;
+
+ l = vm_call_long_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Long);
+
+ /* setting the value of the object direct */
+
+ lo = (java_lang_Long *) ro;
+ lo->value = l;
+ }
+ break;
+
+ case PRIMITIVETYPE_FLOAT: {
+ float f;
+ java_lang_Float *fo;
+
+ f = vm_call_float_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Float);
+
+ /* setting the value of the object direct */
+
+ fo = (java_lang_Float *) ro;
+ fo->value = f;
+ }
+ break;
+
+ case PRIMITIVETYPE_DOUBLE: {
+ double d;
+ java_lang_Double *_do;
+
+ d = vm_call_double_array(resm, array);
+
+ ro = builtin_new(class_java_lang_Double);
+
+ /* setting the value of the object direct */
+
+ _do = (java_lang_Double *) ro;
+ _do->value = d;
+ }
+ break;
+
+ case TYPE_ADR:
+ ro = vm_call_array(resm, array);
+ break;
+
+ default:
+ /* if this happens the exception has already been set by
+ fill_callblock_from_objectarray */
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return NULL;
+ }
+
+ xptr = exceptions_get_exception();
+
+ if (xptr != NULL) {
+ /* clear exception pointer, we are calling JIT code again */
+
+ exceptions_clear_exception();
+
+ exceptions_throw_invocationtargetexception(xptr);
+ }
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return ro;
+}
+#endif
/* GetVersion ******************************************************************
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: native.c 8123 2007-06-20 23:50:55Z michi $
*/
/* no function was found, throw exception */
- *exceptionptr =
- new_exception_utfmessage(string_java_lang_UnsatisfiedLinkError,
- mname);
+ exceptions_throw_unsatisfiedlinkerror(mname);
return NULL;
}
/* find initializer */
- m = class_resolveclassmethod(c,
- utf_init,
- utf_java_lang_String__void,
- NULL,
- true);
+ m = class_findmethod(c, utf_init, utf_java_lang_String__void);
/* initializer not found */
}
-java_objectheader *native_new_and_init_throwable(classinfo *c, java_objectheader *t)
-{
- java_objectheader *o;
- methodinfo *m;
-
- if (c == NULL)
- vm_abort("native_new_and_init_throwable: c == NULL");
-
- /* create object */
-
- o = builtin_new(c);
-
- if (o == NULL)
- return NULL;
-
- /* find initializer */
-
- m = class_findmethod(c, utf_init, utf_java_lang_Throwable__void);
-
- /* initializer not found */
-
- if (m == NULL)
- return NULL;
-
- /* call initializer */
-
- (void) vm_call_method(m, o, t);
-
- return o;
-}
-
-
-java_objectheader *native_new_and_init_exception(classinfo *c, java_objectheader *e)
-{
- java_objectheader *o;
- methodinfo *m;
-
- if (c == NULL)
- vm_abort("native_new_and_init_exception: c == NULL");
-
- /* create object */
-
- o = builtin_new(c);
-
- if (o == NULL)
- return NULL;
-
- /* find initializer */
-
- m = class_findmethod(c, utf_init, utf_java_lang_Exception__V);
-
- /* initializer not found */
-
- if (m == NULL)
- return NULL;
-
- /* call initializer */
-
- (void) vm_call_method(m, o, e);
-
- return o;
-}
-
-
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.h 8056 2007-06-10 14:49:57Z michi $
+ $Id: native.h 8123 2007-06-20 23:50:55Z michi $
*/
java_objectheader *native_new_and_init_string(classinfo *c,
java_objectheader *s);
-java_objectheader *native_new_and_init_throwable(classinfo *c,
- java_objectheader *t);
-
-java_objectheader *native_new_and_init_exception(classinfo *c,
- java_objectheader *e);
-
#endif /* _NATIVE_H */
java_lang_reflect_Constructor.c \
java_lang_reflect_Constructor.h
+JAVA_LANG_REFLECT_METHOD_SOURCES = \
+ java_lang_reflect_Method.c \
+ java_lang_reflect_Method.h
+
+JAVA_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_SOURCES = \
+ java_util_concurrent_atomic_AtomicLong.c \
+ java_util_concurrent_atomic_AtomicLong.h
+
SUN_MISC_UNSAFE_SOURCES = \
sun_misc_Unsafe.c
endif
java_lang_Thread.c \
java_lang_Thread.h \
$(JAVA_LANG_REFLECT_CONSTRUCTOR_SOURCES) \
+ $(JAVA_LANG_REFLECT_METHOD_SOURCES) \
+ $(JAVA_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_SOURCES) \
$(SUN_MISC_UNSAFE_SOURCES)
libnativevm_la_LIBADD = \
##
## Authors: Christian Thalinger
##
-## $Id: Makefile.am 8027 2007-06-07 10:30:33Z michi $
+## $Id: Makefile.am 8123 2007-06-20 23:50:55Z michi $
## Process this file with automake to produce Makefile.in
java_lang_reflect_Field.c \
java_lang_reflect_Method.c \
java_lang_reflect_VMProxy.c \
- java_security_VMAccessController.c
+ java_security_VMAccessController.c \
+ java_util_concurrent_atomic_AtomicLong.c
if ENABLE_JVMTI
libjdwp_la_SOURCES = \
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "mm/gc-common.h"
#include "vm/vm.h"
#include "vmcore/classcache.h"
+#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "getLoadedClassCount", "()I", (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount },
- { "getUnloadedClassCount", "()J", (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount },
- { "isVerbose", "()Z", (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose },
- { "setVerbose", "(Z)V", (void *) (ptrint) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose },
+ { "getLoadedClassCount", "()I", (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount },
+ { "getUnloadedClassCount", "()J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount },
+ { "isVerbose", "()Z", (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose },
+ { "setVerbose", "(Z)V", (void *) (intptr_t) &Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose },
};
* Method: getLoadedClassCount
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getLoadedClassCount(JNIEnv *env, jclass clazz)
{
- s4 count;
+ int32_t count;
count = classcache_get_loaded_class_count();
* Method: getUnloadedClassCount
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount(JNIEnv *env, jclass clazz)
{
log_println("Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_getUnloadedClassCount: IMPLEMENT ME!");
* Method: isVerbose
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_isVerbose(JNIEnv *env, jclass clazz)
{
return _Jv_jvm->Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose;
}
* Method: setVerbose
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose(JNIEnv *env, jclass clazz, s4 verbose)
+JNIEXPORT void JNICALL Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_setVerbose(JNIEnv *env, jclass clazz, int32_t verbose)
{
_Jv_jvm->Java_gnu_java_lang_management_VMClassLoadingMXBeanImpl_verbose = verbose;
}
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "native/jni.h"
#include "native/native.h"
#include "vm/vm.h"
#include "vmcore/class.h"
+#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "getInputArguments", "()[Ljava/lang/String;", (void *) (ptrint) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getInputArguments },
- { "getStartTime", "()J", (void *) (ptrint) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime },
+ { "getInputArguments", "()[Ljava/lang/String;", (void *) (intptr_t) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getInputArguments },
+ { "getStartTime", "()J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime },
};
* Method: getStartTime
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMRuntimeMXBeanImpl_getStartTime(JNIEnv *env, jclass clazz)
{
return _Jv_jvm->starttime;
}
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "mm/gc-common.h"
#include "vm/vm.h"
#include "vmcore/classcache.h"
+#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "findMonitorDeadlockedThreads", "()[J", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_findMonitorDeadlockedThreads },
- { "getCurrentThreadCpuTime", "()J", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime },
- { "getCurrentThreadUserTime", "()J", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime },
- { "getPeakThreadCount", "()I", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount },
- { "getThreadCpuTime", "(J)J", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime },
- { "getThreadInfoForId", "(JI)Ljava/lang/management/ThreadInfo;", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId },
- { "getThreadUserTime", "(J)J", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime },
- { "getTotalStartedThreadCount", "()J", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount },
- { "resetPeakThreadCount", "()V", (void *) (ptrint) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_resetPeakThreadCount },
+ { "findMonitorDeadlockedThreads", "()[J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_findMonitorDeadlockedThreads },
+ { "getCurrentThreadCpuTime", "()J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime },
+ { "getCurrentThreadUserTime", "()J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime },
+ { "getPeakThreadCount", "()I", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount },
+ { "getThreadCpuTime", "(J)J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime },
+ { "getThreadInfoForId", "(JI)Ljava/lang/management/ThreadInfo;", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId },
+ { "getThreadUserTime", "(J)J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime },
+ { "getTotalStartedThreadCount", "()J", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount },
+ { "resetPeakThreadCount", "()V", (void *) (intptr_t) &Java_gnu_java_lang_management_VMThreadMXBeanImpl_resetPeakThreadCount },
};
* Method: getCurrentThreadCpuTime
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime(JNIEnv *env, jclass clazz)
{
log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadCpuTime: IMPLEMENT ME!");
* Method: getCurrentThreadUserTime
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime(JNIEnv *env, jclass clazz)
{
log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getCurrentThreadUserTime: IMPLEMENT ME!");
* Method: getPeakThreadCount
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getPeakThreadCount(JNIEnv *env, jclass clazz)
{
return _Jv_jvm->java_lang_management_ThreadMXBean_PeakThreadCount;
}
* Method: getThreadCpuTime
* Signature: (J)J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime(JNIEnv *env, jclass clazz, s8 id)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime(JNIEnv *env, jclass clazz, int64_t id)
{
log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadCpuTime: IMPLEMENT ME!");
* Method: getThreadInfoForId
* Signature: (JI)Ljava/lang/management/ThreadInfo;
*/
-JNIEXPORT java_lang_management_ThreadInfo* JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId(JNIEnv *env, jclass clazz, s8 id, s4 maxDepth)
+JNIEXPORT java_lang_management_ThreadInfo* JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId(JNIEnv *env, jclass clazz, int64_t id, int32_t maxDepth)
{
log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadInfoForId: IMPLEMENT ME!");
* Method: getThreadUserTime
* Signature: (J)J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime(JNIEnv *env, jclass clazz, s8 par1)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime(JNIEnv *env, jclass clazz, int64_t par1)
{
log_println("Java_gnu_java_lang_management_VMThreadMXBeanImpl_getThreadUserTime: IMPLEMENT ME!");
* Method: getTotalStartedThreadCount
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_gnu_java_lang_management_VMThreadMXBeanImpl_getTotalStartedThreadCount(JNIEnv *env, jclass clazz)
{
return _Jv_jvm->java_lang_management_ThreadMXBean_TotalStartedThreadCount;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMClassLoader.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: java_lang_VMClassLoader.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vmcore/linker.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
+#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
#include "vmcore/suck.h"
#include "vmcore/zip.h"
JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClassLoader_getPrimitiveClass(JNIEnv *env, jclass clazz, s4 type)
{
classinfo *c;
- s4 index;
-
- /* get primitive class */
-
- switch (type) {
- case 'I':
- index = PRIMITIVETYPE_INT;
- break;
- case 'J':
- index = PRIMITIVETYPE_LONG;
- break;
- case 'F':
- index = PRIMITIVETYPE_FLOAT;
- break;
- case 'D':
- index = PRIMITIVETYPE_DOUBLE;
- break;
- case 'B':
- index = PRIMITIVETYPE_BYTE;
- break;
- case 'C':
- index = PRIMITIVETYPE_CHAR;
- break;
- case 'S':
- index = PRIMITIVETYPE_SHORT;
- break;
- case 'Z':
- index = PRIMITIVETYPE_BOOLEAN;
- break;
- case 'V':
- index = PRIMITIVETYPE_VOID;
- break;
- default:
- exceptions_throw_noclassdeffounderror(utf_null);
+
+ c = primitive_class_get_by_char(type);
+
+ if (c == NULL) {
+ exceptions_throw_classnotfoundexception(utf_null);
return NULL;
}
- c = primitivetype_table[index].class_primitive;
-
return (java_lang_Class *) c;
}
*/
JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClassLoader_loadClass(JNIEnv *env, jclass clazz, java_lang_String *name, s4 resolve)
{
- classinfo *c;
- utf *u;
- java_objectheader *xptr;
+ classinfo *c;
+ utf *u;
if (name == NULL) {
exceptions_throw_nullpointerexception();
c = load_class_bootstrap(u);
if (c == NULL)
- goto exception;
+ return NULL;
/* resolve class -- if requested */
/* if (resolve) */
if (!link_class(c))
- goto exception;
+ return NULL;
return (java_lang_Class *) c;
-
- exception:
- xptr = exceptions_get_exception();
-
- c = xptr->vftbl->class;
-
- /* if the exception is a NoClassDefFoundError, we replace it with a
- ClassNotFoundException, otherwise return the exception */
-
- if (c == class_java_lang_NoClassDefFoundError) {
- /* clear exceptionptr, because builtin_new checks for
- ExceptionInInitializerError */
- exceptions_clear_exception();
-
- exceptions_throw_classnotfoundexception(u);
- }
-
- return NULL;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMObject.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: java_lang_VMObject.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "native/jni.h"
#include "native/native.h"
#include "native/vm/java_lang_Object.h"
+#include "vmcore/utf8.h"
+
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "getClass", "(Ljava/lang/Object;)Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_VMObject_getClass },
- { "clone", "(Ljava/lang/Cloneable;)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_VMObject_clone },
- { "notify", "(Ljava/lang/Object;)V", (void *) (ptrint) &Java_java_lang_VMObject_notify },
- { "notifyAll", "(Ljava/lang/Object;)V", (void *) (ptrint) &Java_java_lang_VMObject_notifyAll },
- { "wait", "(Ljava/lang/Object;JI)V", (void *) (ptrint) &Java_java_lang_VMObject_wait },
+ { "getClass", "(Ljava/lang/Object;)Ljava/lang/Class;", (void *) (intptr_t) &Java_java_lang_VMObject_getClass },
+ { "clone", "(Ljava/lang/Cloneable;)Ljava/lang/Object;", (void *) (intptr_t) &Java_java_lang_VMObject_clone },
+ { "notify", "(Ljava/lang/Object;)V", (void *) (intptr_t) &Java_java_lang_VMObject_notify },
+ { "notifyAll", "(Ljava/lang/Object;)V", (void *) (intptr_t) &Java_java_lang_VMObject_notifyAll },
+ { "wait", "(Ljava/lang/Object;JI)V", (void *) (intptr_t) &Java_java_lang_VMObject_wait },
};
* Method: wait
* Signature: (Ljava/lang/Object;JI)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMObject_wait(JNIEnv *env, jclass clazz, java_lang_Object *o, s8 ms, s4 ns)
+JNIEXPORT void JNICALL Java_java_lang_VMObject_wait(JNIEnv *env, jclass clazz, java_lang_Object *o, int64_t ms, int32_t ns)
{
_Jv_java_lang_Object_wait(o, ms, ns);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMRuntime.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: java_lang_VMRuntime.c 8123 2007-06-20 23:50:55Z michi $
*/
#include <assert.h>
#include <string.h>
+#include <stdint.h>
#include <stdlib.h>
#include <sys/utsname.h>
# include <mach/mach.h>
#endif
-#include "vm/types.h"
-
#include "mm/gc-common.h"
#include "mm/memory.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
+#include "vmcore/utf8.h"
+
/* this should work on BSD */
/*
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "exit", "(I)V", (void *) (ptrint) &Java_java_lang_VMRuntime_exit },
- { "freeMemory", "()J", (void *) (ptrint) &Java_java_lang_VMRuntime_freeMemory },
- { "totalMemory", "()J", (void *) (ptrint) &Java_java_lang_VMRuntime_totalMemory },
- { "maxMemory", "()J", (void *) (ptrint) &Java_java_lang_VMRuntime_maxMemory },
- { "gc", "()V", (void *) (ptrint) &Java_java_lang_VMRuntime_gc },
- { "runFinalization", "()V", (void *) (ptrint) &Java_java_lang_VMRuntime_runFinalization },
- { "runFinalizersOnExit", "(Z)V", (void *) (ptrint) &Java_java_lang_VMRuntime_runFinalizersOnExit },
- { "runFinalizationForExit", "()V", (void *) (ptrint) &Java_java_lang_VMRuntime_runFinalizationForExit },
- { "traceInstructions", "(Z)V", (void *) (ptrint) &Java_java_lang_VMRuntime_traceInstructions },
- { "traceMethodCalls", "(Z)V", (void *) (ptrint) &Java_java_lang_VMRuntime_traceMethodCalls },
- { "availableProcessors", "()I", (void *) (ptrint) &Java_java_lang_VMRuntime_availableProcessors },
- { "nativeLoad", "(Ljava/lang/String;Ljava/lang/ClassLoader;)I", (void *) (ptrint) &Java_java_lang_VMRuntime_nativeLoad },
- { "mapLibraryName", "(Ljava/lang/String;)Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_VMRuntime_mapLibraryName },
+ { "exit", "(I)V", (void *) (intptr_t) &Java_java_lang_VMRuntime_exit },
+ { "freeMemory", "()J", (void *) (intptr_t) &Java_java_lang_VMRuntime_freeMemory },
+ { "totalMemory", "()J", (void *) (intptr_t) &Java_java_lang_VMRuntime_totalMemory },
+ { "maxMemory", "()J", (void *) (intptr_t) &Java_java_lang_VMRuntime_maxMemory },
+ { "gc", "()V", (void *) (intptr_t) &Java_java_lang_VMRuntime_gc },
+ { "runFinalization", "()V", (void *) (intptr_t) &Java_java_lang_VMRuntime_runFinalization },
+ { "runFinalizersOnExit", "(Z)V", (void *) (intptr_t) &Java_java_lang_VMRuntime_runFinalizersOnExit },
+ { "runFinalizationForExit", "()V", (void *) (intptr_t) &Java_java_lang_VMRuntime_runFinalizationForExit },
+ { "traceInstructions", "(Z)V", (void *) (intptr_t) &Java_java_lang_VMRuntime_traceInstructions },
+ { "traceMethodCalls", "(Z)V", (void *) (intptr_t) &Java_java_lang_VMRuntime_traceMethodCalls },
+ { "availableProcessors", "()I", (void *) (intptr_t) &Java_java_lang_VMRuntime_availableProcessors },
+ { "nativeLoad", "(Ljava/lang/String;Ljava/lang/ClassLoader;)I", (void *) (intptr_t) &Java_java_lang_VMRuntime_nativeLoad },
+ { "mapLibraryName", "(Ljava/lang/String;)Ljava/lang/String;", (void *) (intptr_t) &Java_java_lang_VMRuntime_mapLibraryName },
};
* Method: exit
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, s4 status)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_exit(JNIEnv *env, jclass clazz, int32_t status)
{
_Jv_java_lang_Runtime_exit(status);
}
* Method: freeMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_java_lang_VMRuntime_freeMemory(JNIEnv *env, jclass clazz)
{
return _Jv_java_lang_Runtime_freeMemory();
}
* Method: totalMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_java_lang_VMRuntime_totalMemory(JNIEnv *env, jclass clazz)
{
return _Jv_java_lang_Runtime_totalMemory();
}
* Method: maxMemory
* Signature: ()J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz)
+JNIEXPORT int64_t JNICALL Java_java_lang_VMRuntime_maxMemory(JNIEnv *env, jclass clazz)
{
return gc_get_max_heap_size();
}
* Method: runFinalizersOnExit
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_runFinalizersOnExit(JNIEnv *env, jclass clazz, int32_t value)
{
_Jv_java_lang_Runtime_runFinalizersOnExit(value);
}
* Method: traceInstructions
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceInstructions(JNIEnv *env, jclass clazz, int32_t par1)
{
/* not supported */
}
* Method: traceMethodCalls
* Signature: (Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, s4 par1)
+JNIEXPORT void JNICALL Java_java_lang_VMRuntime_traceMethodCalls(JNIEnv *env, jclass clazz, int32_t par1)
{
/* not supported */
}
* Method: availableProcessors
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMRuntime_availableProcessors(JNIEnv *env, jclass clazz)
{
#if defined(_SC_NPROC_ONLN)
- return (s4) sysconf(_SC_NPROC_ONLN);
+ return (int32_t) sysconf(_SC_NPROC_ONLN);
#elif defined(_SC_NPROCESSORS_ONLN)
- return (s4) sysconf(_SC_NPROCESSORS_ONLN);
+ return (int32_t) sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__DARWIN__)
/* this should work in BSD */
len = sizeof(ncpu);
rc = sysctl(mib, 2, &ncpu, &len, NULL, 0);
- return (s4) ncpu;
+ return (int32_t) ncpu;
*/
host_basic_info_data_t hinfo;
return -1;
}
- return (s4) hinfo.avail_cpus;
+ return (int32_t) hinfo.avail_cpus;
#else
return 1;
* Method: nativeLoad
* Signature: (Ljava/lang/String;Ljava/lang/ClassLoader;)I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, java_lang_String *libname, java_lang_ClassLoader *loader)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMRuntime_nativeLoad(JNIEnv *env, jclass clazz, java_lang_String *libname, java_lang_ClassLoader *loader)
{
java_objectheader *cl;
{
utf *u;
char *buffer;
- s4 buffer_len;
- s4 dumpsize;
+ int32_t buffer_len;
+ int32_t dumpsize;
java_objectheader *o;
if (libname == NULL) {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMThread.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: java_lang_VMThread.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "native/jni.h"
#include "native/native.h"
#include "native/vm/java_lang_Thread.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
+#include "threads/threads-common.h"
+
+#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "countStackFrames", "()I", (void *) (ptrint) &Java_java_lang_VMThread_countStackFrames },
- { "start", "(J)V", (void *) (ptrint) &Java_java_lang_VMThread_start },
- { "interrupt", "()V", (void *) (ptrint) &Java_java_lang_VMThread_interrupt },
- { "isInterrupted", "()Z", (void *) (ptrint) &Java_java_lang_VMThread_isInterrupted },
- { "suspend", "()V", (void *) (ptrint) &Java_java_lang_VMThread_suspend },
- { "resume", "()V", (void *) (ptrint) &Java_java_lang_VMThread_resume },
- { "nativeSetPriority", "(I)V", (void *) (ptrint) &Java_java_lang_VMThread_nativeSetPriority },
- { "nativeStop", "(Ljava/lang/Throwable;)V", (void *) (ptrint) &Java_java_lang_VMThread_nativeStop },
- { "currentThread", "()Ljava/lang/Thread;", (void *) (ptrint) &Java_java_lang_VMThread_currentThread },
- { "yield", "()V", (void *) (ptrint) &Java_java_lang_VMThread_yield },
- { "interrupted", "()Z", (void *) (ptrint) &Java_java_lang_VMThread_interrupted },
- { "holdsLock", "(Ljava/lang/Object;)Z", (void *) (ptrint) &Java_java_lang_VMThread_holdsLock },
- { "getState", "()Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_VMThread_getState },
+ { "countStackFrames", "()I", (void *) (intptr_t) &Java_java_lang_VMThread_countStackFrames },
+ { "start", "(J)V", (void *) (intptr_t) &Java_java_lang_VMThread_start },
+ { "interrupt", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_interrupt },
+ { "isInterrupted", "()Z", (void *) (intptr_t) &Java_java_lang_VMThread_isInterrupted },
+ { "suspend", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_suspend },
+ { "resume", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_resume },
+ { "nativeSetPriority", "(I)V", (void *) (intptr_t) &Java_java_lang_VMThread_nativeSetPriority },
+ { "nativeStop", "(Ljava/lang/Throwable;)V", (void *) (intptr_t) &Java_java_lang_VMThread_nativeStop },
+ { "currentThread", "()Ljava/lang/Thread;", (void *) (intptr_t) &Java_java_lang_VMThread_currentThread },
+ { "yield", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_yield },
+ { "interrupted", "()Z", (void *) (intptr_t) &Java_java_lang_VMThread_interrupted },
+ { "holdsLock", "(Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_java_lang_VMThread_holdsLock },
+ { "getState", "()Ljava/lang/String;", (void *) (intptr_t) &Java_java_lang_VMThread_getState },
};
* Method: countStackFrames
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
{
return _Jv_java_lang_Thread_countStackFrames(this->thread);
}
* Method: start
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 stacksize)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, int64_t stacksize)
{
_Jv_java_lang_Thread_start(this->thread, stacksize);
}
* Method: isInterrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
{
return _Jv_java_lang_Thread_isInterrupted(this->thread);
}
* Method: nativeSetPriority
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 priority)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, int32_t priority)
{
_Jv_java_lang_Thread_setPriority(this->thread, priority);
}
* Method: interrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
{
return _Jv_java_lang_Thread_interrupted();
}
* Method: holdsLock
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
{
return _Jv_java_lang_Thread_holdsLock(o);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Constructor.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: java_lang_reflect_Constructor.c 8123 2007-06-20 23:50:55Z michi $
*/
*/
JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_constructNative(JNIEnv *env, java_lang_reflect_Constructor *this, java_objectarray *args, java_lang_Class *declaringClass, s4 slot)
{
+ /* just to be sure */
+
+ assert(this->clazz == declaringClass);
+ assert(this->slot == slot);
+
return _Jv_java_lang_reflect_Constructor_newInstance(env, this, args);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Field.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: java_lang_reflect_Field.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
#include <assert.h>
-
-#include "vm/types.h"
+#include <stdint.h>
#include "native/jni.h"
#include "native/native.h"
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vm/jit/stacktrace.h"
#include "vmcore/loader.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "getModifiersInternal", "()I", (void *) (ptrint) &Java_java_lang_reflect_Field_getModifiersInternal },
- { "getType", "()Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Field_getType },
- { "get", "(Ljava/lang/Object;)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Field_get },
- { "getBoolean", "(Ljava/lang/Object;)Z", (void *) (ptrint) &Java_java_lang_reflect_Field_getBoolean },
- { "getByte", "(Ljava/lang/Object;)B", (void *) (ptrint) &Java_java_lang_reflect_Field_getByte },
- { "getChar", "(Ljava/lang/Object;)C", (void *) (ptrint) &Java_java_lang_reflect_Field_getChar },
- { "getShort", "(Ljava/lang/Object;)S", (void *) (ptrint) &Java_java_lang_reflect_Field_getShort },
- { "getInt", "(Ljava/lang/Object;)I", (void *) (ptrint) &Java_java_lang_reflect_Field_getInt },
- { "getLong", "(Ljava/lang/Object;)J", (void *) (ptrint) &Java_java_lang_reflect_Field_getLong },
- { "getFloat", "(Ljava/lang/Object;)F", (void *) (ptrint) &Java_java_lang_reflect_Field_getFloat },
- { "getDouble", "(Ljava/lang/Object;)D", (void *) (ptrint) &Java_java_lang_reflect_Field_getDouble },
- { "set", "(Ljava/lang/Object;Ljava/lang/Object;)V", (void *) (ptrint) &Java_java_lang_reflect_Field_set },
- { "setBoolean", "(Ljava/lang/Object;Z)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setBoolean },
- { "setByte", "(Ljava/lang/Object;B)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setByte },
- { "setChar", "(Ljava/lang/Object;C)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setChar },
- { "setShort", "(Ljava/lang/Object;S)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setShort },
- { "setInt", "(Ljava/lang/Object;I)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setInt },
- { "setLong", "(Ljava/lang/Object;J)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setLong },
- { "setFloat", "(Ljava/lang/Object;F)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setFloat },
- { "setDouble", "(Ljava/lang/Object;D)V", (void *) (ptrint) &Java_java_lang_reflect_Field_setDouble },
- { "getSignature", "()Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_reflect_Field_getSignature },
+ { "getModifiersInternal", "()I", (void *) (intptr_t) &Java_java_lang_reflect_Field_getModifiersInternal },
+ { "getType", "()Ljava/lang/Class;", (void *) (intptr_t) &Java_java_lang_reflect_Field_getType },
+ { "get", "(Ljava/lang/Object;)Ljava/lang/Object;", (void *) (intptr_t) &Java_java_lang_reflect_Field_get },
+ { "getBoolean", "(Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_java_lang_reflect_Field_getBoolean },
+ { "getByte", "(Ljava/lang/Object;)B", (void *) (intptr_t) &Java_java_lang_reflect_Field_getByte },
+ { "getChar", "(Ljava/lang/Object;)C", (void *) (intptr_t) &Java_java_lang_reflect_Field_getChar },
+ { "getShort", "(Ljava/lang/Object;)S", (void *) (intptr_t) &Java_java_lang_reflect_Field_getShort },
+ { "getInt", "(Ljava/lang/Object;)I", (void *) (intptr_t) &Java_java_lang_reflect_Field_getInt },
+ { "getLong", "(Ljava/lang/Object;)J", (void *) (intptr_t) &Java_java_lang_reflect_Field_getLong },
+ { "getFloat", "(Ljava/lang/Object;)F", (void *) (intptr_t) &Java_java_lang_reflect_Field_getFloat },
+ { "getDouble", "(Ljava/lang/Object;)D", (void *) (intptr_t) &Java_java_lang_reflect_Field_getDouble },
+ { "set", "(Ljava/lang/Object;Ljava/lang/Object;)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_set },
+ { "setBoolean", "(Ljava/lang/Object;Z)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setBoolean },
+ { "setByte", "(Ljava/lang/Object;B)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setByte },
+ { "setChar", "(Ljava/lang/Object;C)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setChar },
+ { "setShort", "(Ljava/lang/Object;S)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setShort },
+ { "setInt", "(Ljava/lang/Object;I)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setInt },
+ { "setLong", "(Ljava/lang/Object;J)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setLong },
+ { "setFloat", "(Ljava/lang/Object;F)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setFloat },
+ { "setDouble", "(Ljava/lang/Object;D)V", (void *) (intptr_t) &Java_java_lang_reflect_Field_setDouble },
+ { "getSignature", "()Ljava/lang/String;", (void *) (intptr_t) &Java_java_lang_reflect_Field_getSignature },
};
}
if (builtin_instanceof((java_objectheader *) o, c))
- return (void *) ((ptrint) o + f->offset);
+ return (void *) ((intptr_t) o + f->offset);
}
/* exception path */
* Method: getModifiersInternal
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getModifiersInternal(JNIEnv *env, java_lang_reflect_Field *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getModifiersInternal(JNIEnv *env, java_lang_reflect_Field *this)
{
classinfo *c;
fieldinfo *f;
/* set the object value */
- bo->value = *((s4 *) addr);
+ bo->value = *((int32_t *) addr);
/* return the wrapped object */
if (!(bo = (java_lang_Byte *) builtin_new(class_java_lang_Byte)))
return NULL;
- bo->value = *((s4 *) addr);
+ bo->value = *((int32_t *) addr);
return (java_lang_Object *) bo;
}
if (!(co = (java_lang_Character *) builtin_new(class_java_lang_Character)))
return NULL;
- co->value = *((s4 *) addr);
+ co->value = *((int32_t *) addr);
return (java_lang_Object *) co;
}
if (!(so = (java_lang_Short *) builtin_new(class_java_lang_Short)))
return NULL;
- so->value = (s4) *((s4 *) addr);
+ so->value = (int32_t) *((int32_t *) addr);
return (java_lang_Object *) so;
}
if (!(io = (java_lang_Integer *) builtin_new(class_java_lang_Integer)))
return NULL;
- io->value = *((s4 *) addr);
+ io->value = *((int32_t *) addr);
return (java_lang_Object *) io;
}
if (!(lo = (java_lang_Long *) builtin_new(class_java_lang_Long)))
return NULL;
- lo->value = *((s8 *) addr);
+ lo->value = *((int64_t *) addr);
return (java_lang_Object *) lo;
}
* Method: getBoolean
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_BOOLEAN:
- return (s4) *((s4 *) addr);
+ return (int32_t) *((int32_t *) addr);
default:
exceptions_throw_illegalargumentexception();
return 0;
* Method: getByte
* Signature: (Ljava/lang/Object;)B
*/
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_BYTE:
- return (s4) *((s4 *) addr);
+ return (int32_t) *((int32_t *) addr);
default:
exceptions_throw_illegalargumentexception();
return 0;
* Method: getChar
* Signature: (Ljava/lang/Object;)C
*/
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_CHAR:
- return (s4) *((s4 *) addr);
+ return (int32_t) *((int32_t *) addr);
default:
exceptions_throw_illegalargumentexception();
return 0;
* Method: getShort
* Signature: (Ljava/lang/Object;)S
*/
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_BYTE:
case PRIMITIVETYPE_SHORT:
- return (s4) *((s4 *) addr);
+ return (int32_t) *((int32_t *) addr);
default:
exceptions_throw_illegalargumentexception();
return 0;
* Method: getInt
* Signature: (Ljava/lang/Object;)I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int32_t JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang_reflect_Field *this, java_lang_Object *o)
{
classinfo *c;
fieldinfo *f;
case PRIMITIVETYPE_CHAR:
case PRIMITIVETYPE_SHORT:
case PRIMITIVETYPE_INT:
- return (s4) *((s4 *) addr);
+ return (int32_t) *((int32_t *) addr);
default:
exceptions_throw_illegalargumentexception();
return 0;
* Method: getLong
* Signature: (Ljava/lang/Object;)J
*/
-JNIEXPORT s8 JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
+JNIEXPORT int64_t JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o)
{
classinfo *c;
fieldinfo *f;
case PRIMITIVETYPE_CHAR:
case PRIMITIVETYPE_SHORT:
case PRIMITIVETYPE_INT:
- return (s8) *((s4 *) addr);
+ return (int64_t) *((int32_t *) addr);
case PRIMITIVETYPE_LONG:
- return (s8) *((s8 *) addr);
+ return (int64_t) *((int64_t *) addr);
default:
exceptions_throw_illegalargumentexception();
return 0;
case PRIMITIVETYPE_CHAR:
case PRIMITIVETYPE_SHORT:
case PRIMITIVETYPE_INT:
- return (float) *((s4 *) addr);
+ return (float) *((int32_t *) addr);
case PRIMITIVETYPE_LONG:
- return (float) *((s8 *) addr);
+ return (float) *((int64_t *) addr);
case PRIMITIVETYPE_FLOAT:
return (float) *((float *) addr);
default:
case PRIMITIVETYPE_CHAR:
case PRIMITIVETYPE_SHORT:
case PRIMITIVETYPE_INT:
- return (double) *((s4 *) addr);
+ return (double) *((int32_t *) addr);
case PRIMITIVETYPE_LONG:
- return (double) *((s8 *) addr);
+ return (double) *((int64_t *) addr);
case PRIMITIVETYPE_FLOAT:
return (double) *((float *) addr);
case PRIMITIVETYPE_DOUBLE:
switch (df->parseddesc->decltype) {
case PRIMITIVETYPE_BOOLEAN: {
- s4 val;
+ int32_t val;
/* determine the field to read the value */
return;
}
- *((s4 *) faddr) = val;
+ *((int32_t *) faddr) = val;
return;
}
case PRIMITIVETYPE_BYTE: {
- s4 val;
+ int32_t val;
if ((sc == NULL) || !(sf = class_findfield(sc, utf_value, utf_B)))
break;
return;
}
- *((s4 *) faddr) = val;
+ *((int32_t *) faddr) = val;
return;
}
case PRIMITIVETYPE_CHAR: {
- s4 val;
+ int32_t val;
if ((sc == NULL) || !(sf = class_findfield(sc, utf_value, utf_C)))
break;
return;
}
- *((s4 *) faddr) = val;
+ *((int32_t *) faddr) = val;
return;
}
case PRIMITIVETYPE_SHORT: {
- s4 val;
+ int32_t val;
/* get field only by name, it can be one of B, S */
return;
}
- *((s4 *) faddr) = val;
+ *((int32_t *) faddr) = val;
return;
}
case PRIMITIVETYPE_INT: {
- s4 val;
+ int32_t val;
/* get field only by name, it can be one of B, S, C, I */
return;
}
- *((s4 *) faddr) = val;
+ *((int32_t *) faddr) = val;
return;
}
case PRIMITIVETYPE_LONG: {
- s8 val;
+ int64_t val;
/* get field only by name, it can be one of B, S, C, I, J */
return;
}
- *((s8 *) faddr) = val;
+ *((int64_t *) faddr) = val;
return;
}
* Method: setBoolean
* Signature: (Ljava/lang/Object;Z)V
*/
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_BOOLEAN:
- *((s4 *) addr) = value;
+ *((int32_t *) addr) = value;
break;
default:
exceptions_throw_illegalargumentexception();
* Method: setByte
* Signature: (Ljava/lang/Object;B)V
*/
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
{
classinfo *c;
fieldinfo *f;
case PRIMITIVETYPE_BYTE:
case PRIMITIVETYPE_SHORT:
case PRIMITIVETYPE_INT:
- *((s4 *) addr) = value;
+ *((int32_t *) addr) = value;
break;
case PRIMITIVETYPE_LONG:
- *((s8 *) addr) = value;
+ *((int64_t *) addr) = value;
break;
case PRIMITIVETYPE_FLOAT:
*((float *) addr) = value;
* Method: setChar
* Signature: (Ljava/lang/Object;C)V
*/
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_CHAR:
case PRIMITIVETYPE_INT:
- *((s4 *) addr) = value;
+ *((int32_t *) addr) = value;
break;
case PRIMITIVETYPE_LONG:
- *((s8 *) addr) = value;
+ *((int64_t *) addr) = value;
break;
case PRIMITIVETYPE_FLOAT:
*((float *) addr) = value;
* Method: setShort
* Signature: (Ljava/lang/Object;S)V
*/
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_SHORT:
case PRIMITIVETYPE_INT:
- *((s4 *) addr) = value;
+ *((int32_t *) addr) = value;
break;
case PRIMITIVETYPE_LONG:
- *((s8 *) addr) = value;
+ *((int64_t *) addr) = value;
break;
case PRIMITIVETYPE_FLOAT:
*((float *) addr) = value;
* Method: setInt
* Signature: (Ljava/lang/Object;I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s4 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int32_t value)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_INT:
- *((s4 *) addr) = value;
+ *((int32_t *) addr) = value;
break;
case PRIMITIVETYPE_LONG:
- *((s8 *) addr) = value;
+ *((int64_t *) addr) = value;
break;
case PRIMITIVETYPE_FLOAT:
*((float *) addr) = value;
* Method: setLong
* Signature: (Ljava/lang/Object;J)V
*/
-JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, s8 value)
+JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *o, int64_t value)
{
classinfo *c;
fieldinfo *f;
switch (f->parseddesc->decltype) {
case PRIMITIVETYPE_LONG:
- *((s8 *) addr) = value;
+ *((int64_t *) addr) = value;
break;
case PRIMITIVETYPE_FLOAT:
*((float *) addr) = value;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Method.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: java_lang_reflect_Method.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "native/include/java_lang_reflect_Method.h"
+#include "native/vm/java_lang_reflect_Method.h"
+
#include "vm/access.h"
#include "vm/global.h"
#include "vm/builtin.h"
#include "vm/resolve.h"
#include "vm/stringlocal.h"
+#include "vmcore/method.h"
+
/* native methods implemented by this file ************************************/
{
classinfo *c;
methodinfo *m;
- typedesc *td;
+ classinfo *result;
c = (classinfo *) this->declaringClass;
m = &(c->methods[this->slot]);
- td = &(m->parseddesc->returntype);
+ result = method_returntype_get(m);
- if (!resolve_class_from_typedesc(td, true, false, &c))
- return NULL;
-
- return (java_lang_Class *) c;
+ return (java_lang_Class *) result;
}
*/
JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(JNIEnv *env, java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args, java_lang_Class *declaringClass, s4 slot)
{
- classinfo *c;
- methodinfo *m;
-
- c = (classinfo *) declaringClass;
- m = &(c->methods[slot]);
-
- /* check method access */
-
- /* check if we should bypass security checks (AccessibleObject) */
-
- if (this->flag == false) {
- if (!access_check_method(m, 1))
- return NULL;
- }
-
- /* check if method class is initialized */
-
- if (!(c->state & CLASS_INITIALIZED))
- if (!initialize_class(c))
- return NULL;
+ /* just to be sure */
- /* call the Java method via a helper function */
+ assert(this->declaringClass == declaringClass);
+ assert(this->slot == slot);
- return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+ return _Jv_java_lang_reflect_Method_invoke(this, o, args);
}
--- /dev/null
+/* src/native/vm/gnu/java_util_concurrent_atomic_AtomicLong.c
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: java_lang_VMString.c 8017 2007-06-05 23:46:59Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/jni.h"
+#include "native/native.h"
+
+#include "native/vm/java_util_concurrent_atomic_AtomicLong.h"
+
+#include "vmcore/utf8.h"
+
+
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+ { "VMSupportsCS8", "()Z", (void *) (intptr_t) &_Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8 },
+};
+
+
+/* _Jv_java_util_concurrent_atomic_AtomicLong_init *****************************
+
+ Register native functions.
+
+*******************************************************************************/
+
+void _Jv_java_util_concurrent_atomic_AtomicLong_init(void)
+{
+ utf *u;
+
+ u = utf_new_char("java/util/concurrent/atomic/AtomicLong");
+
+ native_method_register(u, methods, NATIVE_METHODS_COUNT);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMClass.c 6131 2006-12-06 22:15:57Z twisti $
+ $Id: java_lang_Class.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vmcore/class.h"
#include "vmcore/loader.h"
+#include "vmcore/primitive.h"
/*
utf *ufile;
utf *uname;
classinfo *c;
- java_objectheader *xptr;
- classinfo *xclass;
u2 *pos;
s4 i;
c = load_class_bootstrap(ufile);
#endif
- if (c == NULL) {
- xptr = exceptions_get_exception();
-
- xclass = xptr->vftbl->class;
-
- /* if the exception is a NoClassDefFoundError, we replace it with a
- ClassNotFoundException, otherwise return the exception */
-
- if (xclass == class_java_lang_NoClassDefFoundError) {
- /* clear exceptionptr, because builtin_new checks for
- ExceptionInInitializerError */
- exceptions_clear_exception();
-
- exceptions_throw_classnotfoundexception(uname);
- }
-
+ if (c == NULL)
return NULL;
- }
/* link, ... */
c = (classinfo *) klass;
- result = class_is_primitive(c);
+ result = primitive_class_is_primitive(c);
return result;
}
if (desc->arraytype == ARRAYTYPE_OBJECT)
comp = desc->componentvftbl->class;
else
- comp = primitivetype_table[desc->arraytype].class_primitive;
+ comp = primitive_class_get_by_type(desc->arraytype);
return (java_lang_Class *) comp;
}
c = (classinfo *) klass;
- if (!class_is_primitive(c) && (c->name->text[0] != '[')) {
+ if (!primitive_class_is_primitive(c) && (c->name->text[0] != '[')) {
if (c->innerclasscount == 0) /* no innerclasses exist */
return NULL;
c = (classinfo *) klass;
declaredclasscount = 0;
- if (!class_is_primitive(c) && (c->name->text[0] != '[')) {
+ if (!primitive_class_is_primitive(c) && (c->name->text[0] != '[')) {
/* determine number of declared classes */
for (i = 0; i < c->innerclasscount; i++) {
--- /dev/null
+/* src/native/vm/java_lang_reflect_Method.c
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: java_lang_reflect_Method.c 8063 2007-06-11 14:44:58Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+
+#include "vm/types.h"
+
+#include "native/jni.h"
+#include "native/native.h"
+
+#include "native/include/java_lang_Object.h"
+
+#include "native/include/java_lang_reflect_Method.h"
+
+#include "vm/access.h"
+#include "vm/builtin.h"
+#include "vm/initialize.h"
+
+#include "vmcore/class.h"
+#include "vmcore/method.h"
+
+
+/*
+ * Class: java/lang/reflect/Method
+ * Method: invoke
+ * Signature: (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
+ */
+java_lang_Object *_Jv_java_lang_reflect_Method_invoke(java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args)
+{
+ classinfo *c;
+ methodinfo *m;
+
+ c = (classinfo *) this->declaringClass;
+ m = &(c->methods[this->slot]);
+
+ /* check method access */
+
+ /* check if we should bypass security checks (AccessibleObject) */
+
+ if (this->flag == false) {
+ if (!access_check_method(m, 1))
+ return NULL;
+ }
+
+ /* check if method class is initialized */
+
+ if (!(c->state & CLASS_INITIALIZED))
+ if (!initialize_class(c))
+ return NULL;
+
+ /* call the Java method via a helper function */
+
+ return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
--- /dev/null
+/* src/native/vm/java_lang_reflect_Method.h
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
+
+*/
+
+
+#ifndef _JV_JAVA_LANG_REFLECT_METHOD_H
+#define _JV_JAVA_LANG_REFLECT_METHOD_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "native/jni.h"
+
+#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_reflect_Method.h"
+
+#include "native/vm/java_lang_reflect_Method.h"
+
+#include "vm/global.h"
+
+
+/* function prototypes ********************************************************/
+
+java_lang_Object *_Jv_java_lang_reflect_Method_invoke(java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args);
+
+#endif /* _JV_JAVA_LANG_REFLECT_METHOD_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
--- /dev/null
+/* src/native/vm/java_util_concurrent_atomic_AtomicLong.c
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/jni.h"
+
+
+/*
+ * Class: java/util/concurrent/atomic/AtomicLong
+ * Method: VMSupportsCS8
+ * Signature: ()Z
+ */
+JNIEXPORT int32_t JNICALL _Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8(JNIEnv *env, jclass clazz)
+{
+ /* IMPLEMENT ME */
+
+ return 0;
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
--- /dev/null
+/* src/native/vm/java_util_concurrent_atomic_AtomicLong.h
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
+
+*/
+
+
+#ifndef _JV_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_H
+#define _JV_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_H
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/jni.h"
+
+
+/* function prototypes ********************************************************/
+
+int32_t _Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8(JNIEnv *env, jclass clazz);
+
+#endif /* _JV_UTIL_CONCURRENT_ATOMIC_ATOMICLONG_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
_Jv_java_lang_reflect_Method_init();
_Jv_java_lang_reflect_VMProxy_init();
_Jv_java_security_VMAccessController_init();
+ _Jv_java_util_concurrent_atomic_AtomicLong_init();
_Jv_sun_misc_Unsafe_init();
# else
void _Jv_java_lang_reflect_Method_init();
void _Jv_java_lang_reflect_VMProxy_init();
void _Jv_java_security_VMAccessController_init();
+void _Jv_java_util_concurrent_atomic_AtomicLong_init();
void _Jv_sun_misc_Unsafe_init();
# else
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "native/jni.h"
#include "native/native.h"
#include "native/include/sun_misc_Unsafe.h"
+#include "vmcore/utf8.h"
+
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "objectFieldOffset", "(Ljava/lang/reflect/Field;)J", (void *) (ptrint) &Java_sun_misc_Unsafe_objectFieldOffset },
- { "compareAndSwapInt", "(Ljava/lang/Object;JII)Z", (void *) (ptrint) &Java_sun_misc_Unsafe_compareAndSwapInt },
+ { "objectFieldOffset", "(Ljava/lang/reflect/Field;)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_objectFieldOffset },
+ { "compareAndSwapInt", "(Ljava/lang/Object;JII)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapInt },
#if 0
- { "compareAndSwapLong", "(Ljava/lang/Object;JJJ)Z", (void *) (ptrint) &Java_sun_misc_Unsafe_compareAndSwapLong },
- { "compareAndSwapObject", "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void *) (ptrint) &Java_sun_misc_Unsafe_compareAndSwapObject },
- { "putOrderedInt", "(Ljava/lang/Object;JI)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putOrderedInt },
- { "putOrderedLong", "(Ljava/lang/Object;JJ)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putOrderedLong },
- { "putOrderedObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putOrderedObject },
- { "putIntVolatile", "(Ljava/lang/Object;JI)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putIntVolatile },
- { "getIntVolatile", "(Ljava/lang/Object;J)I", (void *) (ptrint) &Java_sun_misc_Unsafe_getIntVolatile },
- { "putLongVolatile", "(Ljava/lang/Object;JJ)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putLongVolatile },
- { "putLong", "(Ljava/lang/Object;JJ)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putLong },
- { "getLongVolatile", "(Ljava/lang/Object;J)J", (void *) (ptrint) &Java_sun_misc_Unsafe_getLongVolatile },
- { "getLong", "(Ljava/lang/Object;J)J", (void *) (ptrint) &Java_sun_misc_Unsafe_getLong },
- { "putObjectVolatile", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putObjectVolatile },
- { "putObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (ptrint) &Java_sun_misc_Unsafe_putObject },
- { "getObjectVolatile", "(Ljava/lang/Object;J)Ljava/lang/Object;", (void *) (ptrint) &Java_sun_misc_Unsafe_getObjectVolatile },
- { "arrayBaseOffset", "(Ljava/lang/Class;)I", (void *) (ptrint) &Java_sun_misc_Unsafe_arrayBaseOffset },
- { "arrayIndexScale", "(Ljava/lang/Class;)I", (void *) (ptrint) &Java_sun_misc_Unsafe_arrayIndexScale },
- { "unpark", "(Ljava/lang/Thread;)V", (void *) (ptrint) &Java_sun_misc_Unsafe_unpark },
- { "park", "(ZJ)V", (void *) (ptrint) &Java_sun_misc_Unsafe_park },
+ { "compareAndSwapLong", "(Ljava/lang/Object;JJJ)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapLong },
+ { "compareAndSwapObject", "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapObject },
+ { "putOrderedInt", "(Ljava/lang/Object;JI)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedInt },
+ { "putOrderedLong", "(Ljava/lang/Object;JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedLong },
+ { "putOrderedObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedObject },
+ { "putIntVolatile", "(Ljava/lang/Object;JI)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putIntVolatile },
+ { "getIntVolatile", "(Ljava/lang/Object;J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getIntVolatile },
+ { "putLongVolatile", "(Ljava/lang/Object;JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putLongVolatile },
+ { "putLong", "(Ljava/lang/Object;JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putLong },
+ { "getLongVolatile", "(Ljava/lang/Object;J)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_getLongVolatile },
+ { "getLong", "(Ljava/lang/Object;J)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_getLong },
+ { "putObjectVolatile", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putObjectVolatile },
+ { "putObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putObject },
+ { "getObjectVolatile", "(Ljava/lang/Object;J)Ljava/lang/Object;", (void *) (intptr_t) &Java_sun_misc_Unsafe_getObjectVolatile },
+ { "arrayBaseOffset", "(Ljava/lang/Class;)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayBaseOffset },
+ { "arrayIndexScale", "(Ljava/lang/Class;)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayIndexScale },
+ { "unpark", "(Ljava/lang/Thread;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_unpark },
+ { "park", "(ZJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_park },
#endif
};
* Method: objectFieldOffset
* Signature: (Ljava/lang/reflect/Field;)J
*/
-JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe* this, java_lang_reflect_Field* field)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe* this, java_lang_reflect_Field* field)
{
classinfo *c;
fieldinfo *f;
c = (classinfo *) field->declaringClass;
f = &c->fields[field->slot];
- return (s8) f->offset;
+ return (int64_t) f->offset;
}
* Method: compareAndSwapInt
* Signature: (Ljava/lang/Object;JII)Z
*/
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* this, java_lang_Object* obj, s8 offset, s4 expect, s4 update)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* this, java_lang_Object* obj, int64_t offset, int32_t expect, int32_t update)
{
- s4 *p;
- s4 value;
+ int32_t *p;
+ int32_t value;
- p = (s4 *) (((u1 *) obj) + offset);
+ p = (int32_t *) (((u1 *) obj) + offset);
/* XXX this should be atomic */
* Method: compareAndSwapLong
* Signature: (Ljava/lang/Object;JJJ)Z
*/
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3, s8 par4)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3, int64_t par4)
{
}
* Method: compareAndSwapObject
* Signature: (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3, struct java_lang_Object* par4)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3, struct java_lang_Object* par4)
{
}
* Method: putOrderedInt
* Signature: (Ljava/lang/Object;JI)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s4 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int32_t par3)
{
}
* Method: putOrderedLong
* Signature: (Ljava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
{
}
* Method: putOrderedObject
* Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
{
}
* Method: putIntVolatile
* Signature: (Ljava/lang/Object;JI)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s4 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int32_t par3)
{
}
* Method: getIntVolatile
* Signature: (Ljava/lang/Object;J)I
*/
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
{
}
* Method: putLongVolatile
* Signature: (Ljava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
{
}
* Method: putLong
* Signature: (Ljava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, s8 par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
{
}
* Method: getLongVolatile
* Signature: (Ljava/lang/Object;J)J
*/
-JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
{
}
* Method: getLong
* Signature: (Ljava/lang/Object;J)J
*/
-JNIEXPORT s8 JNICALL Java_sun_misc_Unsafe_getLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
{
}
* Method: putObjectVolatile
* Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
{
}
* Method: putObject
* Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2, struct java_lang_Object* par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
{
}
* Method: getObjectVolatile
* Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
*/
-JNIEXPORT struct java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, s8 par2)
+JNIEXPORT struct java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
{
}
* Method: arrayBaseOffset
* Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
{
}
* Method: arrayIndexScale
* Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT s4 JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
{
}
* Method: park
* Signature: (ZJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, struct sun_misc_Unsafe* this, s4 par1, s8 par2)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, struct sun_misc_Unsafe* this, int32_t par1, int64_t par2)
{
}
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads.c 8052 2007-06-10 13:44:33Z michi $
+ $Id: threads.c 8123 2007-06-20 23:50:55Z michi $
*/
(void) vm_call_method(method_thread_init, o, threadname);
#endif
- if (*exceptionptr)
+ if (exceptions_get_exception())
return false;
#if defined(ENABLE_JAVASE)
(void) vm_call_method(m, o, t);
- if (*exceptionptr)
+ if (exceptions_get_exception())
return false;
#endif
(void) vm_call_method(method_thread_init, o, s);
#endif
- if (*exceptionptr)
+ if (exceptions_get_exception())
return false;
#if defined(ENABLE_JAVASE)
(void) vm_call_method(m, o, t);
- if (*exceptionptr)
+ if (exceptions_get_exception())
return false;
#endif
(void) vm_call_method(m, o, t);
- if (*exceptionptr)
+ if (exceptions_get_exception())
return false;
}
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads-common.c 8052 2007-06-10 13:44:33Z michi $
+ $Id: threads-common.c 8123 2007-06-20 23:50:55Z michi $
*/
# if defined(_CS_GNU_LIBPTHREAD_VERSION)
len = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, (size_t) 0);
- pathbuf = MNEW(char, len);
+ /* Some systems return as length 0 (maybe cross-compilation
+ related). In this case we also fall back to linuxthreads. */
- (void) confstr(_CS_GNU_LIBPTHREAD_VERSION, pathbuf, len);
+ if (len > 0) {
+ pathbuf = MNEW(char, len);
- if (strstr(pathbuf, "NPTL") != NULL)
- threads_pthreads_implementation_nptl = true;
+ (void) confstr(_CS_GNU_LIBPTHREAD_VERSION, pathbuf, len);
+
+ if (strstr(pathbuf, "NPTL") != NULL)
+ threads_pthreads_implementation_nptl = true;
+ else
+ threads_pthreads_implementation_nptl = false;
+ }
else
threads_pthreads_implementation_nptl = false;
# else
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: builtin.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vmcore/class.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
+#include "vmcore/primitive.h"
#include "vmcore/rt-timing.h"
#if defined(ENABLE_VMLOG)
passed in an array of longs.
Arguments:
- n............number of dimensions to create
- arrayvftbl...vftbl of the array class
- dims.........array containing the size of each dimension to create
+ n.............number of dimensions to create
+ arrayclass....the array class
+ dims..........array containing the size of each dimension to create
Return value: pointer to the array or NULL if no memory is
available
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: exceptions.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "native/jni.h"
#include "native/native.h"
+
#include "native/include/java_lang_String.h"
#include "native/include/java_lang_Throwable.h"
#include "vmcore/class.h"
#include "vmcore/loader.h"
+#include "vmcore/method.h"
#include "vmcore/options.h"
#if defined(ENABLE_VMLOG)
}
+/* exceptions_get_exception ****************************************************
+
+ Returns the current exception pointer of the current thread.
+
+*******************************************************************************/
+
+java_objectheader *exceptions_get_exception(void)
+{
+ /* return the exception */
+
+ return *exceptionptr;
+}
+
+
+/* exceptions_set_exception ****************************************************
+
+ Sets the exception pointer of the current thread.
+
+*******************************************************************************/
+
+void exceptions_set_exception(java_objectheader *o)
+{
+ /* set the exception */
+
+ *exceptionptr = o;
+}
+
+
+/* exceptions_clear_exception **************************************************
+
+ Clears the current exception pointer of the current thread.
+
+*******************************************************************************/
+
+void exceptions_clear_exception(void)
+{
+ exceptions_set_exception(NULL);
+}
+
+
+/* exceptions_get_and_clear_exception ******************************************
+
+ Gets the exception pointer of the current thread and clears it.
+ This function may return NULL.
+
+*******************************************************************************/
+
+java_objectheader *exceptions_get_and_clear_exception(void)
+{
+ java_objectheader *o;
+
+ /* get the exception */
+
+ o = exceptions_get_exception();
+
+ /* and clear the exception */
+
+ exceptions_clear_exception();
+
+ /* return the exception */
+
+ return o;
+}
+
+
/* exceptions_new_class ********************************************************
Creates an exception object from the given class and initalizes it.
o = native_new_and_init(c);
if (o == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
return o;
}
c = load_class_bootstrap(classname);
if (c == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
o = exceptions_new_class(c);
if (o == NULL)
return;
- *exceptionptr = o;
+ exceptions_set_exception(o);
}
static void exceptions_throw_utf_throwable(utf *classname,
java_objectheader *cause)
{
- java_objectheader *o;
- classinfo *c;
-
+ classinfo *c;
+ java_objectheader *o;
+ methodinfo *m;
+ java_lang_Throwable *object;
+
+ object = (java_lang_Throwable *) cause;
+
c = load_class_bootstrap(classname);
if (c == NULL)
return;
- o = native_new_and_init_throwable(c, cause);
+ /* create object */
+ o = builtin_new(c);
+
if (o == NULL)
return;
- *exceptionptr = o;
+ /* call initializer */
+
+ m = class_resolveclassmethod(c,
+ utf_init,
+ utf_java_lang_Throwable__void,
+ NULL,
+ true);
+
+ if (m == NULL)
+ return;
+
+ (void) vm_call_method(m, o, cause);
+
+ exceptions_set_exception(o);
}
static void exceptions_throw_utf_exception(utf *classname,
java_objectheader *exception)
{
- java_objectheader *o;
classinfo *c;
-
+ java_objectheader *o;
+ methodinfo *m;
+
c = load_class_bootstrap(classname);
if (c == NULL)
return;
- o = native_new_and_init_exception(c, exception);
+ /* create object */
+ o = builtin_new(c);
+
if (o == NULL)
return;
- *exceptionptr = o;
+ /* call initializer */
+
+ m = class_resolveclassmethod(c,
+ utf_init,
+ utf_java_lang_Exception__V,
+ NULL,
+ true);
+
+ if (m == NULL)
+ return;
+
+ (void) vm_call_method(m, o, exception);
+
+ exceptions_set_exception(o);
+}
+
+
+/* exceptions_throw_utf_cause **************************************************
+
+ Creates an exception object with the given name and initalizes it
+ with the given java/lang/Throwable exception with initCause.
+
+ IN:
+ classname....class name in UTF-8
+ cause........the given Throwable
+
+*******************************************************************************/
+
+static void exceptions_throw_utf_cause(utf *classname, java_objectheader *cause)
+{
+ classinfo *c;
+ java_objectheader *o;
+ methodinfo *m;
+ java_lang_Throwable *object;
+
+ object = (java_lang_Throwable *) cause;
+
+ c = load_class_bootstrap(classname);
+
+ if (c == NULL)
+ return;
+
+ /* create object */
+
+ o = builtin_new(c);
+
+ if (o == NULL)
+ return;
+
+ /* call initializer */
+
+ m = class_resolveclassmethod(c,
+ utf_init,
+ utf_java_lang_String__void,
+ NULL,
+ true);
+
+ if (m == NULL)
+ return;
+
+ (void) vm_call_method(m, o, object->detailMessage);
+
+ /* call initCause */
+
+ m = class_resolveclassmethod(c,
+ utf_initCause,
+ utf_java_lang_Throwable__java_lang_Throwable,
+ NULL,
+ true);
+
+ if (m == NULL)
+ return;
+
+ (void) vm_call_method(m, o, cause);
+
+ exceptions_set_exception(o);
}
c = load_class_bootstrap(classname);
if (c == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
o = native_new_and_init_string(c, message);
if (o == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
return o;
}
s = javastring_new(message);
if (s == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
o = native_new_and_init_string(c, s);
if (o == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
return o;
}
c = load_class_bootstrap(classname);
if (c == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
o = exceptions_new_class_utf(c, message);
static void exceptions_throw_class_utf(classinfo *c, utf *message)
{
- *exceptionptr = exceptions_new_class_utf(c, message);
+ java_objectheader *o;
+
+ o = exceptions_new_class_utf(c, message);
+
+ exceptions_set_exception(o);
}
static void exceptions_throw_utf_utf(utf *classname, utf *message)
{
- *exceptionptr = exceptions_new_utf_utf(classname, message);
+ java_objectheader *o;
+
+ o = exceptions_new_utf_utf(classname, message);
+
+ exceptions_set_exception(o);
}
}
+/* exceptions_throw_noclassdeffounderror_cause *********************************
+
+ Generates and throws a java.lang.NoClassDefFoundError with the
+ given cause.
+
+*******************************************************************************/
+
+void exceptions_throw_noclassdeffounderror_cause(java_objectheader *cause)
+{
+ exceptions_throw_utf_cause(utf_java_lang_NoClassDefFoundError, cause);
+}
+
+
/* exceptions_throw_noclassdeffounderror_wrong_name ****************************
Generates and throws a java.lang.NoClassDefFoundError with a
specific message:
-
-
IN:
name.........name of the class not found as a utf *
}
-/* classnotfoundexception_to_noclassdeffounderror ******************************
-
- Check the *exceptionptr for a ClassNotFoundException. If it is one,
- convert it to a NoClassDefFoundError.
-
-*******************************************************************************/
-
-void classnotfoundexception_to_noclassdeffounderror(void)
-{
- java_objectheader *xptr;
- java_objectheader *cause;
- java_lang_Throwable *t;
- java_objectheader *s;
-
- /* get the cause */
-
- cause = *exceptionptr;
-
- /* convert ClassNotFoundException's to NoClassDefFoundError's */
-
- if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
- /* clear exception, because we are calling jit code again */
-
- *exceptionptr = NULL;
-
- /* create new error */
-
- t = (java_lang_Throwable *) cause;
- s = (java_objectheader *) t->detailMessage;
-
- xptr = exceptions_new_utf_javastring(utf_java_lang_NoClassDefFoundError,
- s);
-
- /* we had an exception while creating the error */
-
- if (*exceptionptr)
- return;
-
- /* set new exception */
-
- *exceptionptr = xptr;
- }
-}
-
-
/* exceptions_throw_exceptionininitializererror ********************************
Generates and throws a java.lang.ExceptionInInitializerError for
if (o == NULL)
return;
- *exceptionptr = o;
+ exceptions_set_exception(o);
}
true);
if (m == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
s = vm_call_method(m, NULL, index);
if (s == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
o = exceptions_new_utf_javastring(utf_java_lang_ArrayIndexOutOfBoundsException,
s);
if (o == NULL)
- return *exceptionptr;
+ return exceptions_get_exception();
return o;
}
}
-/* exceptions_get_exception ****************************************************
+/* exceptions_classnotfoundexception_to_noclassdeffounderror *******************
- Returns the current exception pointer of the current thread.
+ Check the exception for a ClassNotFoundException. If it is one,
+ convert it to a NoClassDefFoundError.
*******************************************************************************/
-java_objectheader *exceptions_get_exception(void)
+void exceptions_classnotfoundexception_to_noclassdeffounderror(void)
{
- /* return the exception */
+ java_objectheader *o;
+ java_objectheader *cause;
+ java_lang_Throwable *object;
+ java_objectheader *s;
- return *exceptionptr;
-}
+ /* get the cause */
+ cause = exceptions_get_exception();
-/* exceptions_set_exception ****************************************************
-
- Sets the exception pointer of the current thread.
+ /* convert ClassNotFoundException's to NoClassDefFoundError's */
-*******************************************************************************/
+ if (builtin_instanceof(cause, class_java_lang_ClassNotFoundException)) {
+ /* clear exception, because we are calling jit code again */
-void exceptions_set_exception(java_objectheader *o)
-{
- /* set the exception */
+ exceptions_clear_exception();
- *exceptionptr = o;
-}
+ /* create new error */
+ object = (java_lang_Throwable *) cause;
+ s = (java_objectheader *) object->detailMessage;
-/* exceptions_clear_exception **************************************************
+ o = exceptions_new_utf_javastring(utf_java_lang_NoClassDefFoundError,
+ s);
- Clears the current exception pointer of the current thread.
+ /* we had an exception while creating the error */
-*******************************************************************************/
+ if (exceptions_get_exception())
+ return;
-void exceptions_clear_exception(void)
-{
- /* and clear the exception */
+ /* set new exception */
- *exceptionptr = NULL;
+ exceptions_set_exception(o);
+ }
}
/* get exception */
- o = *exceptionptr;
- assert(o);
-
- /* clear exception */
+ o = exceptions_get_and_clear_exception();
- *exceptionptr = NULL;
+ assert(o);
/* resolve methodinfo pointer from exception object */
}
-/* exceptions_get_and_clear_exception ******************************************
-
- Gets the exception pointer of the current thread and clears it.
- This function may return NULL.
-
-*******************************************************************************/
-
-java_objectheader *exceptions_get_and_clear_exception(void)
-{
- java_objectheader **p;
- java_objectheader *e;
-
- /* get the pointer of the exception pointer */
-
- p = exceptionptr;
-
- /* get the exception */
-
- e = *p;
-
- /* and clear the exception */
-
- *p = NULL;
-
- /* return the exception */
-
- return e;
-}
-
-
/* exceptions_new_hardware_exception *******************************************
Creates the correct exception for a hardware-exception thrown and
#if !defined(NDEBUG)
/* print exception trace */
- if (opt_verbose || opt_verbosecall || opt_verboseexception)
+ if (opt_verbose || opt_verbosecall || opt_TraceExceptions)
builtin_trace_exception(xptr, m, xpc, 1);
#endif
vmlog_cacao_catch(xptr);
#endif
- if (opt_verboseexception) {
+ if (opt_TraceExceptions) {
exceptions_print_exception(xptr);
stacktrace_print_trace(xptr);
}
vmlog_cacao_catch(xptr);
#endif
- if (opt_verboseexception) {
+ if (opt_TraceExceptions) {
exceptions_print_exception(xptr);
stacktrace_print_trace(xptr);
}
void exceptions_print_current_exception(void)
{
- java_objectheader *xptr;
+ java_objectheader *o;
- xptr = *exceptionptr;
+ o = exceptions_get_exception();
- exceptions_print_exception(xptr);
+ exceptions_print_exception(o);
}
/* get original exception */
- oxptr = *exceptionptr;
+ oxptr = exceptions_get_and_clear_exception();
if (oxptr == NULL)
vm_abort("exceptions_print_stacktrace: no exception thrown");
/* clear exception, because we are calling jit code again */
- *exceptionptr = NULL;
-
c = oxptr->vftbl->class;
/* find the printStackTrace() method */
have a serious problem while printStackTrace. But may
be another exception, so print it. */
- xptr = *exceptionptr;
+ xptr = exceptions_get_exception();
if (xptr != NULL) {
fprintf(stderr, "Exception while printStackTrace(): ");
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.h 8056 2007-06-10 14:49:57Z michi $
+ $Id: exceptions.h 8123 2007-06-20 23:50:55Z michi $
*/
/* function prototypes ********************************************************/
-/* load and link exceptions used in the system */
-bool exceptions_init(void);
+bool exceptions_init(void);
-/* initialize new exceptions */
+java_objectheader *exceptions_get_exception(void);
+void exceptions_set_exception(java_objectheader *o);
+void exceptions_clear_exception(void);
+java_objectheader *exceptions_get_and_clear_exception(void);
java_objectheader *new_exception_utfmessage(const char *classname,
utf *message);
void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
void exceptions_throw_classnotfoundexception(utf *name);
void exceptions_throw_noclassdeffounderror(utf *name);
+void exceptions_throw_noclassdeffounderror_cause(java_objectheader *cause);
void exceptions_throw_noclassdeffounderror_wrong_name(classinfo *c, utf *name);
void exceptions_throw_linkageerror(const char *message, classinfo *c);
void exceptions_throw_nosuchfielderror(classinfo *c, utf *name);
void exceptions_throw_privilegedactionexception(java_objectheader *cause);
void exceptions_throw_stringindexoutofboundsexception(void);
-java_objectheader *exceptions_fillinstacktrace(void);
-
-void classnotfoundexception_to_noclassdeffounderror(void);
+void exceptions_classnotfoundexception_to_noclassdeffounderror(void);
-java_objectheader *exceptions_get_exception(void);
-void exceptions_set_exception(java_objectheader *o);
-void exceptions_clear_exception(void);
-java_objectheader *exceptions_get_and_clear_exception(void);
+java_objectheader *exceptions_fillinstacktrace(void);
java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: global.h 7940 2007-05-23 09:42:08Z michi $
+ $Id: global.h 8123 2007-06-20 23:50:55Z michi $
*/
#define IS_VOID_TYPE(a) ((a) == TYPE_VOID)
-/* primitive data types *******************************************************/
-
-/* These values are used in parsed descriptors and in some other
- places were the different types handled internally as TYPE_INT have
- to be distinguished. */
-
-#define PRIMITIVETYPE_COUNT 11 /* number of primitive types (+ dummies) */
-
-/* CAUTION: Don't change the numerical values! These constants are
- used as indices into the primitive type table. */
-
-#define PRIMITIVETYPE_INT TYPE_INT
-#define PRIMITIVETYPE_LONG TYPE_LNG
-#define PRIMITIVETYPE_FLOAT TYPE_FLT
-#define PRIMITIVETYPE_DOUBLE TYPE_DBL
-#define PRIMITIVETYPE_DUMMY1 TYPE_ADR /* not used! */
-#define PRIMITIVETYPE_BYTE 5
-#define PRIMITIVETYPE_CHAR 6
-#define PRIMITIVETYPE_SHORT 7
-#define PRIMITIVETYPE_BOOLEAN 8
-#define PRIMITIVETYPE_DUMMY2 9 /* not used! */
-#define PRIMITIVETYPE_VOID TYPE_VOID
-
/* some Java related defines **************************************************/
#define JAVA_VERSION "1.5.0" /* this version is supported by CACAO */
which is referenced by the vftbl.
*/
-/* CAUTION: Don't change the numerical values! These constants (with
- * the exception of ARRAYTYPE_OBJECT) are used as indices in the
- * primitive type table.
- */
-#define ARRAYTYPE_INT PRIMITIVETYPE_INT
-#define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
-#define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
-#define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
-#define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
-#define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
-#define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
-#define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
-#define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
-
typedef struct java_arrayheader { /* header for all arrays */
java_objectheader objheader; /* object header */
s4 size; /* array size */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
- $Id: simplereg.c 7766 2007-04-19 13:24:48Z michi $
+ $Id: simplereg.c 8123 2007-06-20 23:50:55Z michi $
*/
static void simplereg_allocate_temporaries(jitdata *jd);
+/* size of a stackslot used by the internal ABI */
+
+#if defined(HAS_4BYTE_STACKSLOT)
+# define SIZE_OF_STACKSLOT 4
+#else
+# define SIZE_OF_STACKSLOT 8
+#endif
+
+
/* total number of registers */
#if defined(HAS_ADDRESS_REGISTER_FILE)
#define NEW_MEM_SLOT(r) \
do { \
- (r) = rd->memuse; \
+ (r) = rd->memuse * SIZE_OF_STACKSLOT; \
rd->memuse += memneeded + 1; \
} while (0)
do { \
if ( (memneeded) && (rd->memuse & 1)) \
rd->memuse++; \
- (r) = rd->memuse; \
+ (r) = rd->memuse * SIZE_OF_STACKSLOT; \
rd->memuse += memneeded + 1; \
} while (0)
PUSH_BACK(rd->freemem, rd->freememtop, rd->memuse); \
rd->memuse++; \
} \
- (r) = rd->memuse; \
+ (r) = rd->memuse * SIZE_OF_STACKSLOT; \
rd->memuse += memneeded + 1; \
} while (0)
}
else {
flags |= INMEMORY;
- regoff = rd->memuse++;
+ regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
}
}
else /* !IS_ADR_TYPE */
}
else {
flags |= INMEMORY;
- regoff = rd->memuse++;
+ regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
}
}
else
}
else {
v->flags |= INMEMORY;
- v->vv.regoff = rd->memuse++;
+ v->vv.regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
}
}
else {
}
else {
v->flags = INMEMORY;
- v->vv.regoff = rd->memuse++;
+ v->vv.regoff = rd->memuse++ * SIZE_OF_STACKSLOT;
}
}
else {
/* if this is a copy of another variable, just decrement the copy counter */
- /* XXX split reg/mem variables on arm may need special handling here */
-
if (flags & INMEMORY) {
if (flags & INOUT)
return;
+ #warning this will be more efficient if we divide it by SIZE_OF_STACKSLOT
+
if (regoff < rd->memcopycountsize && rd->memcopycount[regoff]) {
rd->memcopycount[regoff]--;
return;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
if (!IS_INMEMORY(var->flags))
M_INTMOVE(s1, var->vv.regoff);
else
- M_LST(s1, REG_SP, var->vv.regoff * 8);
+ M_LST(s1, REG_SP, var->vv.regoff);
}
else { /* stack arguments */
if (!IS_INMEMORY(var->flags))
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) *8);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
else
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
else { /* floating args */
}
else { /* stack arguments */
if (!(var->flags & INMEMORY))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
else
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
}
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_LST(s1, REG_SP, d * 8);
+ M_LST(s1, REG_SP, d);
}
}
else {
}
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
- M_DST(s1, REG_SP, d * 8);
+ M_DST(s1, REG_SP, d);
}
}
}
if (!nmd->params[j].inmemory)
M_INTMOVE(s1, s2);
else
- M_LST(s1, REG_SP, s2 * 8);
+ M_LST(s1, REG_SP, s2);
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
s2 = nmd->params[j].regoff;
- M_LLD(REG_ITMP1, REG_SP, s1 * 8);
- M_LST(REG_ITMP1, REG_SP, s2 * 8);
+ M_LLD(REG_ITMP1, REG_SP, s1);
+ M_LST(REG_ITMP1, REG_SP, s2);
}
}
else {
M_FLTMOVE(s1, s2);
else {
if (IS_2_WORD_TYPE(t))
- M_DST(s1, REG_SP, s2 * 8);
+ M_DST(s1, REG_SP, s2);
else
- M_FST(s1, REG_SP, s2 * 8);
+ M_FST(s1, REG_SP, s2);
}
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
s2 = nmd->params[j].regoff;
- M_DLD(REG_FTMP1, REG_SP, s1 * 8);
+ M_DLD(REG_FTMP1, REG_SP, s1);
if (IS_2_WORD_TYPE(t))
- M_DST(REG_FTMP1, REG_SP, s2 * 8);
+ M_DST(REG_FTMP1, REG_SP, s2);
else
- M_FST(REG_FTMP1, REG_SP, s2 * 8);
+ M_FST(REG_FTMP1, REG_SP, s2);
}
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
*/
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
switch (src->type) {
case TYPE_INT:
if (IS_INMEMORY(dst->flags)) {
COUNT_SPILLS;
- disp = dst->vv.regoff * 8;
+ disp = dst->vv.regoff;
switch (dst->type) {
case TYPE_INT:
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7723 2007-04-16 18:03:08Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7940 2007-05-23 09:42:08Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
spilledregs_num++;
#endif
- cd->stackframesize = spilledregs_num + savedregs_num;
+ cd->stackframesize = (spilledregs_num + savedregs_num) * 4;
/* XXX QUICK FIX: We shouldn't align the stack in Java code, but
only in native stubs. */
/* align stack to 8-byte */
- cd->stackframesize = (cd->stackframesize + 1) & ~1;
+ cd->stackframesize = (cd->stackframesize + 4) & ~4;
/* SECTION: Method Header */
/* create method header */
(void) dseg_add_unique_address(cd, code); /* CodeinfoPointer */
- (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize */
+ (void) dseg_add_unique_s4(cd, cd->stackframesize); /* FrameSize */
#if defined(ENABLE_THREADS)
/* IsSync contains the offset relative to the stack pointer for the
/* create additional stack frame for spilled variables (if necessary) */
- if ((cd->stackframesize - savedregs_num) > 0)
- M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - savedregs_num);
+ if ((cd->stackframesize / 4 - savedregs_num) > 0)
+ M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - savedregs_num);
/* take arguments out of register or stack frame */
}
else {
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, var->vv.regoff * 4);
+ M_LST(s1, REG_SP, var->vv.regoff);
else
- M_IST(s1, REG_SP, var->vv.regoff * 4);
+ M_IST(s1, REG_SP, var->vv.regoff);
}
}
else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack arg -> register */
if (IS_2_WORD_TYPE(t))
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
else
- M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_ILD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
}
else { /* stack arg -> spilled */
/* Reuse Memory Position on Caller Stack */
}
else {
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, var->vv.regoff * 4);
+ M_LST(s1, REG_SP, var->vv.regoff);
else
- M_IST(s1, REG_SP, var->vv.regoff * 4);
+ M_IST(s1, REG_SP, var->vv.regoff);
}
}
else {
if (!(var->flags & INMEMORY)) {
if (IS_2_WORD_TYPE(t))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
else
- M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_FLD(var->vv.regoff, REG_SP, cd->stackframesize + s1);
}
else {
/* Reuse Memory Position on Caller Stack */
/* deallocate stackframe for spilled variables */
- if ((cd->stackframesize - savedregs_num) > 0)
- M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - savedregs_num);
+ if ((cd->stackframesize / 4 - savedregs_num) > 0)
+ M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - savedregs_num);
/* restore callee saved registers + do return */
else {
if (IS_2_WORD_TYPE(var->type)) {
s1 = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(s1, REG_SP, d * 4);
+ M_LST(s1, REG_SP, d);
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(s1, REG_SP, d * 4);
+ M_IST(s1, REG_SP, d);
}
}
#if !defined(ENABLE_SOFTFLOAT)
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(s1, REG_SP, d * 4);
+ M_DST(s1, REG_SP, d);
else
- M_FST(s1, REG_SP, d * 4);
+ M_FST(s1, REG_SP, d);
}
}
#endif /* !defined(ENABLE_SOFTFLOAT) */
/* calculate stackframe size */
- cd->stackframesize =
+ cd->stackframesize = (
1 + /* return address */
sizeof(stackframeinfo) / SIZEOF_VOID_P + /* stackframeinfo */
sizeof(localref_table) / SIZEOF_VOID_P + /* localref_table */
- nmd->memuse; /* stack arguments */
+ nmd->memuse /* stack arguments */
+ ) * 4;
/* align stack to 8-byte */
- cd->stackframesize = (cd->stackframesize + 1) & ~1;
+ cd->stackframesize = (cd->stackframesize + 4) & ~4;
/* create method header */
(void) dseg_add_unique_address(cd, code); /* CodeinfoPointer */
- (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize */
+ (void) dseg_add_unique_s4(cd, cd->stackframesize); /* FrameSize */
(void) dseg_add_unique_s4(cd, 0); /* IsSync */
(void) dseg_add_unique_s4(cd, 0); /* IsLeaf */
(void) dseg_add_unique_s4(cd, 0); /* IntSave */
/* generate stub code */
M_STMFD(1<<REG_LR, REG_SP);
- M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - 1);
+ M_SUB_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - 1);
#if !defined(NDEBUG)
if (JITDATA_HAS_FLAG_VERBOSECALL(jd))
/* create native stackframe info */
- assert(IS_IMM(4*4 + cd->stackframesize * 4));
- M_ADD_IMM(REG_A0, REG_SP, 4*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
+ assert(IS_IMM(4*4 + cd->stackframesize));
+ M_ADD_IMM(REG_A0, REG_SP, 4*4 + cd->stackframesize - SIZEOF_VOID_P);
M_MOV(REG_A1, REG_PV);
- M_ADD_IMM(REG_A2, REG_SP, 4*4 + cd->stackframesize * 4);
- M_LDR_INTERN(REG_A3, REG_SP, 4*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
+ M_ADD_IMM(REG_A2, REG_SP, 4*4 + cd->stackframesize);
+ M_LDR_INTERN(REG_A3, REG_SP, 4*4 + cd->stackframesize - SIZEOF_VOID_P);
disp = dseg_add_functionptr(cd, codegen_start_native_call);
M_DSEG_BRANCH(disp);
}
else {
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, s2 * 4);
+ M_LST(s1, REG_SP, s2);
else
- M_IST(s1, REG_SP, s2 * 4);
+ M_IST(s1, REG_SP, s2);
}
}
else {
s2 = nmd->params[j].regoff;
if (IS_2_WORD_TYPE(t)) {
- M_LLD(REG_ITMP12_PACKED, REG_SP, s1 * 4);
- M_LST(REG_ITMP12_PACKED, REG_SP, s2 * 4);
+ M_LLD(REG_ITMP12_PACKED, REG_SP, s1);
+ M_LST(REG_ITMP12_PACKED, REG_SP, s2);
}
else {
- M_ILD(REG_ITMP1, REG_SP, s1 * 4);
- M_IST(REG_ITMP1, REG_SP, s2 * 4);
+ M_ILD(REG_ITMP1, REG_SP, s1);
+ M_IST(REG_ITMP1, REG_SP, s2);
}
}
}
M_STMFD(BITMASK_RESULT, REG_SP);
- M_ADD_IMM(REG_A0, REG_SP, 2*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
+ M_ADD_IMM(REG_A0, REG_SP, 2*4 + cd->stackframesize - SIZEOF_VOID_P);
disp = dseg_add_functionptr(cd, codegen_finish_native_call);
M_DSEG_BRANCH(disp);
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
/* finish stub code, but do not yet return to caller */
- M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize - 1);
+ M_ADD_IMM_EXT_MUL4(REG_SP, REG_SP, cd->stackframesize / 4 - 1);
M_LDMFD(1<<REG_LR, REG_SP);
/* check for exception */
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
#if defined(ENABLE_SOFTFLOAT)
switch (src->type) {
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
#if defined(__ARMEL__)
M_ILD(tempreg, REG_SP, disp);
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
#if defined(__ARMEL__)
M_ILD(tempreg, REG_SP, disp + 4);
if (dst->flags & INMEMORY) {
COUNT_SPILLS;
- disp = dst->vv.regoff * 4;
+ disp = dst->vv.regoff;
#if defined(ENABLE_SOFTFLOAT)
switch (dst->type) {
M_STMFD(BITMASK_ARGS | (1<<REG_LR) | (1<<REG_PV), REG_SP);
M_SUB_IMM(REG_SP, REG_SP, (2 + 2 + 1 + 1) * 4); /* space for a3, a4 and m */
- stackframesize += 6 + 2 + 2 + 1 + 1;
+ stackframesize += (6 + 2 + 2 + 1 + 1) * 4;
/* prepare args for tracer */
s2 = md->params[i].regoff + stackframesize;
if (IS_2_WORD_TYPE(t))
- M_LLD(s1, REG_SP, s2 * 4);
+ M_LLD(s1, REG_SP, s2);
else {
- M_ILD(GET_LOW_REG(s1), REG_SP, s2 * 4);
+ M_ILD(GET_LOW_REG(s1), REG_SP, s2);
M_MOV_IMM(GET_HIGH_REG(s1), 0);
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7940 2007-05-23 09:42:08Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
ALIGN_2(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize += 2;
}
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
ALIGN_2(stacksize);
#endif
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
reguse = INT_ARG_CNT;
stacksize += 2;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: asmpart.h 8123 2007-06-20 23:50:55Z michi $
*/
#define _ASMPART_H
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
#if defined(ENABLE_THREADS)
void asm_call_jit_compiler(void);
#if defined(ENABLE_JIT)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
java_objectheader *asm_vm_call_method(methodinfo *m, s4 vmargscount,
vm_arg *vmargs);
-
s4 asm_vm_call_method_int(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
s8 asm_vm_call_method_long(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
float asm_vm_call_method_float(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
void asm_vm_call_method_exception_handler(void);
-/* asm_vm_call_method_end is a dummy symbol marking the end of the asm_vm_call_method
- * function and is used to insert the coderange into the avl tree.
- */
void asm_vm_call_method_end(void);
+#else
+java_objectheader *asm_vm_call_method(void *pv, uint64_t *array, int32_t stackargs);
+int32_t asm_vm_call_method_int(void *pv, uint64_t *array, int32_t stackargs);
+
+int64_t asm_vm_call_method_long(void *pv, uint64_t *array, int32_t stackargs);
+float asm_vm_call_method_float(void *pv, uint64_t *array, int32_t stackargs);
+double asm_vm_call_method_double(void *pv, uint64_t *array, int32_t stackargs);
+
+void asm_vm_call_method_exception_handler(void);
+void asm_vm_call_method_end(void);
+#endif
+
#endif
#if defined(ENABLE_INTRP)
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen-common.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: codegen-common.c 8123 2007-06-20 23:50:55Z michi $
*/
cd->mcodeptr = cd->mcodebase + (cd->mcodeptr - oldmcodebase);
-#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__) || defined(ENABLE_INTRP)
+#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__) || defined(ENABLE_INTRP) \
+ || defined(__SPARC_64__)
/* adjust the pointer to the last patcher position */
if (cd->lastmcodeptr != NULL)
}
#endif
-#if defined(ENABLE_JIT) && (defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(__M68K__))
+#if defined(ENABLE_JIT) && (defined(__I386__) || defined(__M68K__) || defined(__MIPS__) \
+ || defined(__SPARC_64__) || defined(__X86_64__))
/* On some architectures the patcher stub call instruction might
be longer than the actual instruction generated. On this
log_println("PC=0x%08x", pc);
#endif
log_println("");
+ assert(0);
log_println("Dumping the current stacktrace:");
#if defined(ENABLE_THREADS)
if (!(v->flags & INMEMORY))
return v->vv.regoff;
-#if defined(ENABLE_STATISTICS)
- if (opt_stat)
- count_spills_read++;
-#endif
-
return tempregnum;
}
branchmpc = cd->mcodeptr - cd->mcodebase;
disp = target->mpc - branchmpc;
+#if defined(ENABLE_STATISTICS)
+ count_emit_branch++;
+ if ((int8_t)disp == disp) count_emit_branch_8bit++;
+ else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+ else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+# if SIZEOF_VOID_P == 8
+ else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+# endif
+#endif
+
emit_branch(cd, disp, condition, reg, options);
}
else {
mpc = cd->mcodeptr - cd->mcodebase;
disp = br->mpc - mpc;
+#if defined(ENABLE_STATISTICS)
+ count_emit_branch++;
+ if ((int8_t)disp == disp) count_emit_branch_8bit++;
+ else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+ else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+# if SIZEOF_VOID_P == 8
+ else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+# endif
+#endif
+
emit_branch(cd, disp, condition, reg, options);
/* now remove the branch reference */
mcodeptr = cd->mcodeptr;
cd->mcodeptr = cd->mcodebase + br->mpc;
+#if defined(ENABLE_STATISTICS)
+ count_emit_branch++;
+ if ((int8_t)disp == disp) count_emit_branch_8bit++;
+ else if ((int16_t)disp == disp) count_emit_branch_16bit++;
+ else if ((int32_t)disp == disp) count_emit_branch_32bit++;
+# if SIZEOF_VOID_P == 8
+ else if ((int64_t)disp == disp) count_emit_branch_64bit++;
+# endif
+#endif
+
emit_branch(cd, disp, br->condition, br->reg, br->options);
/* restore mcodeptr */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8039 2007-06-07 13:46:55Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack arg -> register */
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4, var->vv.regoff);
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4, var->vv.regoff);
/* + 4 for return address */
}
else { /* stack arg -> spilled */
/* no copy avoiding by now possible with SSA */
if (ls != NULL) {
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4,
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4,
REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff);
}
else
#endif /*defined(ENABLE_SSA)*/
/* reuse Stackslotand avoid copying */
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ var->vv.regoff = cd->stackframesize * 4 + s1 + 4;
}
else {
/* no copy avoiding by now possible with SSA */
if (ls != NULL) {
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4,
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4,
REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff);
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4 + 4,
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4 + 4,
REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff + 4);
}
else
#endif /*defined(ENABLE_SSA)*/
/* reuse Stackslotand avoid copying */
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ var->vv.regoff = cd->stackframesize * 4 + s1 + 4;
}
}
}
if (!(var->flags & INMEMORY)) { /* stack-arg -> register */
if (t == TYPE_FLT) {
emit_flds_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
assert(0);
/* emit_fstp_reg(cd, var->vv.regoff + fpu_st_offset); */
}
else {
emit_fldl_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
assert(0);
/* emit_fstp_reg(cd, var->vv.regoff + fpu_st_offset); */
}
/* no copy avoiding by now possible with SSA */
if (ls != NULL) {
emit_mov_membase_reg(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4, REG_ITMP1);
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4, REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff);
if (t == TYPE_FLT) {
emit_flds_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
- emit_fstps_membase(cd, REG_SP, var->vv.regoff * 4);
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ emit_fstps_membase(cd, REG_SP, var->vv.regoff);
}
else {
emit_fldl_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
- emit_fstpl_membase(cd, REG_SP, var->vv.regoff * 4);
+ cd, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ emit_fstpl_membase(cd, REG_SP, var->vv.regoff);
}
}
else
#endif /*defined(ENABLE_SSA)*/
/* reuse Stackslotand avoid copying */
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ var->vv.regoff = cd->stackframesize * 4 + s1 + 4;
}
}
}
d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
if (var->flags & INMEMORY) {
- emit_fildl_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fildl_membase(cd, REG_SP, var->vv.regoff);
} else {
/* XXX not thread safe! */
disp = dseg_add_unique_s4(cd, 0);
var = VAROP(iptr->s1);
d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
if (var->flags & INMEMORY) {
- emit_fildll_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fildll_membase(cd, REG_SP, var->vv.regoff);
} else {
log_text("L2F: longs have to be in memory");
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpl_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpl_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4);
+ REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
} else {
/* XXX not thread safe! */
emit_alu_imm_reg(cd, ALU_CMP, 0x80000000, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + ((REG_RESULT == var->vv.regoff) ? 0 : 2);
}
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_flds_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_flds_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_f2i, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
if (var->flags & INMEMORY) {
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
} else {
M_INTMOVE(REG_RESULT, var->vv.regoff);
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpl_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpl_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4);
+ REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
} else {
/* XXX not thread safe! */
emit_alu_imm_reg(cd, ALU_CMP, 0x80000000, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + ((REG_RESULT == var->vv.regoff) ? 0 : 2);
}
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_fldl_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_fldl_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_d2i, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
if (var->flags & INMEMORY) {
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
} else {
M_INTMOVE(REG_RESULT, var->vv.regoff);
}
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpll_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpll_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
disp = 6 + 4;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2;
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4 + 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff + 4);
emit_jcc(cd, CC_NE, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0,
- REG_SP, var->vv.regoff * 4);
+ REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_flds_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_flds_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_f2l, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
emit_mov_reg_membase(cd, REG_RESULT2,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
} else {
log_text("F2L: longs have to be in memory");
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpll_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpll_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
disp = 6 + 4;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2;
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4 + 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff + 4);
emit_jcc(cd, CC_NE, disp);
- emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, var->vv.regoff * 4);
+ emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_fldl_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_fldl_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_d2l, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
emit_mov_reg_membase(cd, REG_RESULT2,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
} else {
log_text("D2L: longs have to be in memory");
assert(var->flags & INMEMORY);
emit_mov_memindex_reg(cd, OFFSET(java_longarray, data[0]),
s1, s2, 3, REG_ITMP3);
- emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff);
emit_mov_memindex_reg(cd, OFFSET(java_longarray, data[0]) + 4,
s1, s2, 3, REG_ITMP3);
- emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff * 4 + 4);
+ emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff + 4);
break;
case ICMD_FALOAD: /* ..., arrayref, index ==> ..., value */
var = VAROP(iptr->sx.s23.s3);
assert(var->flags & INMEMORY);
- emit_mov_membase_reg(cd, REG_SP, var->vv.regoff * 4, REG_ITMP3);
+ emit_mov_membase_reg(cd, REG_SP, var->vv.regoff, REG_ITMP3);
emit_mov_reg_memindex(cd, REG_ITMP3, OFFSET(java_longarray, data[0])
, s1, s2, 3);
- emit_mov_membase_reg(cd, REG_SP, var->vv.regoff * 4 + 4, REG_ITMP3);
+ emit_mov_membase_reg(cd, REG_SP, var->vv.regoff + 4, REG_ITMP3);
emit_mov_reg_memindex(cd, REG_ITMP3,
OFFSET(java_longarray, data[0]) + 4, s1, s2, 3);
break;
} else {
if (IS_2_WORD_TYPE(var->type)) {
d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(d, REG_SP, md->params[s3].regoff * 4);
+ M_LST(d, REG_SP, md->params[s3].regoff);
} else {
d = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(d, REG_SP, md->params[s3].regoff * 4);
+ M_IST(d, REG_SP, md->params[s3].regoff);
}
}
} else {
d = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(d, REG_SP, md->params[s3].regoff * 4);
+ M_DST(d, REG_SP, md->params[s3].regoff);
else
- M_FST(d, REG_SP, md->params[s3].regoff * 4);
+ M_FST(d, REG_SP, md->params[s3].regoff);
}
}
} /* end of for */
/* Already Preallocated? */
if (!(var->flags & PREALLOC)) {
if (var->flags & INMEMORY) {
- M_ILD(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ M_ILD(REG_ITMP1, REG_SP, var->vv.regoff);
M_IST(REG_ITMP1, REG_SP, (s1 + 3) * 4);
}
else
if (!md->params[i].inmemory) {
/* no integer argument registers */
} else { /* float/double in memory can be copied like int/longs */
- s1 = (md->params[i].regoff + cd->stackframesize + 1) * 4;
- s2 = nmd->params[j].regoff * 4;
+ s1 = md->params[i].regoff + cd->stackframesize * 4 + 4;
+ s2 = nmd->params[j].regoff;
M_ILD(REG_ITMP1, REG_SP, s1);
M_IST(REG_ITMP1, REG_SP, s2);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
*/
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
switch (src->type) {
case TYPE_INT:
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp);
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp + 4);
if (IS_INMEMORY(dst->flags)) {
COUNT_SPILLS;
- disp = dst->vv.regoff * 4;
+ disp = dst->vv.regoff;
switch (dst->type) {
case TYPE_INT:
if (IS_INMEMORY(dst->flags)) {
COUNT_SPILLS;
- M_IST(GET_LOW_REG(d), REG_SP, dst->vv.regoff * 4);
+ M_IST(GET_LOW_REG(d), REG_SP, dst->vv.regoff);
}
}
if (IS_INMEMORY(dst->flags)) {
COUNT_SPILLS;
- M_IST(GET_HIGH_REG(d), REG_SP, dst->vv.regoff * 4 + 4);
+ M_IST(GET_HIGH_REG(d), REG_SP, dst->vv.regoff + 4);
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7723 2007-04-16 18:03:08Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
for (i = 0; i < md->paramcount; i++, pd++) {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize += IS_2_WORD_TYPE(md->paramtypes[i].type) ? 2 : 1;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jit.h 7766 2007-04-19 13:24:48Z michi $
+ $Id: jit.h 8123 2007-06-20 23:50:55Z michi $
*/
#if defined(ENABLE_STATISTICS)
# define COUNT(x) (x)++
-# define COUNT_SPILLS count_spills++
+# define COUNT_SPILLS /* use COUNT_(READ|WRITE)_SPILLS instead */
+# define COUNT_READ_SPILLS(var) \
+ switch(var->type) { \
+ case TYPE_FLT: count_spills_read_flt++; break; \
+ case TYPE_DBL: count_spills_read_dbl++; break; \
+ default: count_spills_read_ila++; break; \
+ }
+
+# define COUNT_WRITE_SPILLS(var) \
+ switch(var->type) { \
+ case TYPE_FLT: count_spills_write_flt++; break; \
+ case TYPE_DBL: count_spills_write_dbl++; break; \
+ default: count_spills_write_ila++; break; \
+ }
+
#else
-# define COUNT(x) /* nothing */
-# define COUNT_SPILLS /* nothing */
+# define COUNT(x) /* nothing */
+# define COUNT_SPILLS /* nothing */
+# define COUNT_READ_SPILLS(x) /* nothing */
+# define COUNT_WRITE_SPILLS(x) /* nothing */
#endif
typedef struct interface_info interface_info;
case TYPE_INT:
if (!IS_INMEMORY(var->flags)) { /* stack arg -> register */
if (IS_2_WORD_TYPE(t)) {
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
} else {
- M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+ M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
}
} else { /* stack arg -> spilled */
#if 1
- M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
if (IS_2_WORD_TYPE(t)) {
- M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4 + 4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4 + 4);
+ M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
}
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 4 + s1;
#endif
}
break;
case TYPE_DBL:
if (!IS_INMEMORY(var->flags)) { /* stack-arg -> register */
if (IS_2_WORD_TYPE(t)) {
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
} else {
- M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+ M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
}
} else { /* stack-arg -> spilled */
#if 1
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
- M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+ M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
} else {
- M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
- M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+ M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
}
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 4 + s1;
#endif
}
break;
#endif /* SOFTFLOAT */
case TYPE_ADR:
if (!IS_INMEMORY(var->flags)) { /* stack-arg -> register */
- M_ALD(var->vv.regoff, REG_SP, (cd->stackframesize + s1 + 1) * 4);
+ M_ALD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
} else { /* stack-arg -> spilled */
#if 1
- M_ALD(REG_ATMP1, REG_SP, (cd->stackframesize + s1 + 1) * 4);
- M_AST(REG_ATMP1, REG_SP, var->vv.regoff * 4);
+ M_ALD(REG_ATMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_AST(REG_ATMP1, REG_SP, var->vv.regoff);
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 4 + s1;
#endif
}
break;
#endif
case TYPE_LNG:
d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(d, REG_SP, md->params[s3].regoff*4);
+ M_LST(d, REG_SP, md->params[s3].regoff);
break;
#if defined(ENABLE_SOFTFLOAT)
case TYPE_FLT:
#endif
case TYPE_INT:
d = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(d, REG_SP, md->params[s3].regoff*4);
+ M_IST(d, REG_SP, md->params[s3].regoff);
break;
case TYPE_ADR:
d = emit_load(jd, iptr, var, REG_ATMP1);
- M_AST(d, REG_SP, md->params[s3].regoff*4);
+ M_AST(d, REG_SP, md->params[s3].regoff);
break;
#if !defined(ENABLE_SOFTFLOAT)
case TYPE_FLT:
d = emit_load(jd, iptr, var, REG_FTMP1);
- M_FST(d, REG_SP, md->params[s3].regoff*4);
+ M_FST(d, REG_SP, md->params[s3].regoff);
break;
case TYPE_DBL:
d = emit_load(jd, iptr, var, REG_FTMP1);
- M_DST(d, REG_SP, md->params[s3].regoff*4);
+ M_DST(d, REG_SP, md->params[s3].regoff);
break;
#endif
default:
/* all arguments via stack */
assert(md->params[i].inmemory);
- s1 = (md->params[i].regoff + cd->stackframesize + 1) * 4;
- s2 = nmd->params[j].regoff * 4;
+ s1 = md->params[i].regoff + cd->stackframesize * 4 + 4;
+ s2 = nmd->params[j].regoff;
/* simply copy argument stack */
M_ILD(REG_ITMP1, REG_SP, s1);
/* setting the struct members must be done after
INIT_DISASSEMBLE_INFO */
- info.mach = bfd_mach_mcf_isa_b_float_emac; /* this is optimistic */
+ info.mach = bfd_mach_mcfv4e; /* this is optimistic */
info.read_memory_func = &disass_buffer_read_memory;
disass_initialized = 1;
case TYPE_DBL:
#endif
case TYPE_LNG:
- M_LST(d, REG_SP, dst->vv.regoff * 4);
+ M_LST(d, REG_SP, dst->vv.regoff);
break;
#if defined(ENABLE_SOFTFLOAT)
case TYPE_FLT:
#endif
case TYPE_INT:
- M_IST(d, REG_SP, dst->vv.regoff * 4);
+ M_IST(d, REG_SP, dst->vv.regoff);
break;
case TYPE_ADR:
- M_AST(d, REG_SP, dst->vv.regoff * 4);
+ M_AST(d, REG_SP, dst->vv.regoff);
break;
#if !defined(ENABLE_SOFTFLOAT)
case TYPE_DBL:
- M_DST(d, REG_SP, dst->vv.regoff * 4);
+ M_DST(d, REG_SP, dst->vv.regoff);
break;
case TYPE_FLT:
- M_FST(d, REG_SP, dst->vv.regoff * 4);
+ M_FST(d, REG_SP, dst->vv.regoff);
break;
#endif
default:
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
switch (src->type) {
#if defined(ENABLE_SOFTFLOAT)
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp + 4);
reg = tempreg;
} else {
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp);
reg = tempreg;
} else {
for (i=0; i<md->paramcount; i++, pd++) {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize += IS_2_WORD_TYPE(md->paramtypes[i].type) ? 2:1;
}
void md_init(void)
{
assert(sizeof(vm_arg) == sizevmarg);
- assert(OFFSET(java_objectheader, vftbl) == offobjvftbl);
assert(OFFSET(vftbl_t, baseval) == offbaseval);
assert(OFFSET(vftbl_t, diffval) == offdiffval);
assert(OFFSET(vm_arg, type) == offvmargtype);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 8027 2007-06-07 10:30:33Z michi $
+ $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
*/
L_asm_vm_call_method_compute_pv:
aaddiu pv,ra,-4*4
- ast s7,3*8(sp)
+ ast s0,3*8(sp) /* save callee saved register */
+ ast a0,4*8(sp) /* save method PV */
#if SIZEOF_VOID_P == 8
sdc1 fss0,5*8(sp) /* save non JavaABI saved flt registers */
sdc1 fss5,10*8(sp)
#endif
- ast a0,4*8(sp) /* save method pointer for compiler */
-
- move t0,a2 /* address of first block */
- move s7,a1 /* argument count */
- blez s7,calljava_argsloaded
- nop
+ move t0,a1 /* address of data structure */
+ move t1,a2 /* stack argument count */
+ move s0,sp /* save stack pointer */
#if SIZEOF_VOID_P == 8
- ald a0,offvmargdata(t0)
- ldc1 fa0,offvmargdata(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a1,offvmargdata+sizevmarg*1(t0)
- ldc1 fa1,offvmargdata+sizevmarg*1(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a2,offvmargdata+sizevmarg*2(t0)
- ldc1 fa2,offvmargdata+sizevmarg*2(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a3,offvmargdata+sizevmarg*3(t0)
- ldc1 fa3,offvmargdata+sizevmarg*3(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a4,offvmargdata+sizevmarg*4(t0)
- ldc1 fa4,offvmargdata+sizevmarg*4(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a5,offvmargdata+sizevmarg*5(t0)
- ldc1 fa5,offvmargdata+sizevmarg*5(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a6,offvmargdata+sizevmarg*6(t0)
- ldc1 fa6,offvmargdata+sizevmarg*6(t0)
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
- nop
-
- ald a7,offvmargdata+sizevmarg*7(t0)
- ldc1 fa7,offvmargdata+sizevmarg*7(t0)
- aaddi s7,s7,-1
+ ld a0,0*8(t0)
+ ld a1,1*8(t0)
+ ld a2,2*8(t0)
+ ld a3,3*8(t0)
+ ld a4,4*8(t0)
+ ld a5,5*8(t0)
+ ld a6,6*8(t0)
+ ld a7,7*8(t0)
+
+ ldc1 fa0,8*8(t0)
+ ldc1 fa1,9*8(t0)
+ ldc1 fa2,10*8(t0)
+ ldc1 fa3,11*8(t0)
+ ldc1 fa4,12*8(t0)
+ ldc1 fa5,13*8(t0)
+ ldc1 fa6,14*8(t0)
+ ldc1 fa7,15*8(t0)
#else /* SIZEOF_VOID_P == 8 */
-#if WORDS_BIGENDIAN == 1
- ald a0,offvmargdata+4(t0)
-#else
- ald a0,offvmargdata(t0)
-#endif
-#if !defined(ENABLE_SOFT_FLOAT)
- ldc1 fa0,offvmargdata(t0)
-#endif
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
-
-#if WORDS_BIGENDIAN == 1
- ald a1,offvmargdata+4+sizevmarg*1(t0)
-#else
- ald a1,offvmargdata+sizevmarg*1(t0)
-#endif
-#if !defined(ENABLE_SOFT_FLOAT)
- ldc1 fa1,offvmargdata+sizevmarg*1(t0)
-#endif
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
-
-#if WORDS_BIGENDIAN == 1
- ald a2,offvmargdata+4+sizevmarg*2(t0)
-#else
- ald a2,offvmargdata+sizevmarg*2(t0)
-#endif
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
+# if WORDS_BIGENDIAN == 1
+ lw a0,0*8+4(t0)
+ lw a1,1*8+4(t0)
+ lw a2,2*8+4(t0)
+ lw a3,3*8+4(t0)
+# else
+ lw a0,0*8(t0)
+ lw a1,1*8(t0)
+ lw a2,2*8(t0)
+ lw a3,3*8(t0)
+# endif
-#if WORDS_BIGENDIAN == 1
- ald a3,offvmargdata+4+sizevmarg*3(t0)
-#else
- ald a3,offvmargdata+sizevmarg*3(t0)
-#endif
- aaddi s7,s7,-1
- blez s7,calljava_argsloaded
+# if !defined(ENABLE_SOFT_FLOAT)
+ ldc1 fa0,4*8(t0)
+ ldc1 fa1,5*8(t0)
+# endif
#endif /* SIZEOF_VOID_P == 8 */
-calljava_argsloaded:
- move t4,sp /* save stack pointer */
- blez s7,calljava_nocopy
+ beqz t1,L_asm_vm_call_method_stack_copy_done
nop
-#if SIZEOF_VOID_P == 4
- aaddiu s7,s7,4 /* add stack space for 4 arguments */
-#endif
- subu t1,zero,s7 /* remaining argument count (negative) */
- sll t2,t1,3 /* calculate stackframe size */
- aaddu sp,sp,t2 /* create stackframe */
- aaddu t2,t2,t4 /* also set temp sp */
-#if SIZEOF_VOID_P == 4
- aaddiu t2,t2,4*4 /* skip stack space for 4 arguments */
- addiu t1,t1,4
-#endif
+ sll t2,t1,3 /* calculate stackframe size (* 8) */
+ asubu sp,sp,t2 /* create stackframe */
+ move t2,sp /* temporary stack pointer */
-calljava_copyloop:
+L_asm_vm_call_method_stack_copy_loop:
#if SIZEOF_VOID_P == 8
- ald t3,offvmargdata+sizevmarg*8(t0)
+ ld t3,16*8(t0) /* load argument */
+ sd t3,0(t2) /* store argument on stack */
#else
-# if WORDS_BIGENDIAN == 1
- ald t3,offvmargdata+4+sizevmarg*4(t0)
+# if !defined(ENABLE_SOFT_FLOAT)
+ lw t3,6*8+0(t0) /* load argument */
+ lw t4,6*8+4(t0)
+ sw t3,0(t2) /* store argument on stack */
+ sw t4,4(t2)
# else
- ald t3,offvmargdata+sizevmarg*4(t0)
+# error implement me
# endif
#endif
- ast t3,0(t2) /* store argument on stack */
- addi t1,t1,1 /* count 1 argument */
- aaddi t0,t0,sizevmarg /* load address of next block */
- aaddi t2,t2,8 /* increase stack position */
- bnez t1,calljava_copyloop /* all arguments copied? */
- nop
-calljava_nocopy:
- ald itmp1,4*8(t4) /* pass method pointer via itmp1 */
+ aaddi t1,t1,-1 /* subtract 1 argument */
+ aaddi t0,t0,8 /* load address of next argument */
+ aaddi t2,t2,8 /* increase stack pointer */
- ala mptr,asm_call_jit_compiler/* fake virtual function call (2 instr) */
- ast mptr,2*8(t4) /* store function address */
- ala mptr,1*8(t4) /* set method pointer */
+ bgtz t1,L_asm_vm_call_method_stack_copy_loop
+ nop
- ald pv,1*8(mptr) /* method call as in Java */
- jalr pv /* call JIT compiler */
+L_asm_vm_call_method_stack_copy_done:
+ ala mptr,4*8(s0) /* get address of PV */
+ ald pv,0*8(mptr) /* load PV */
+ jalr pv
nop
L_asm_vm_call_method_recompute_pv:
#if SIZEOF_VOID_P == 8
.set reorder /* XXX we need to recompute pv */
- sll t1,s7,3 /* remove argument stackframe */
- aaddu sp,sp,t1
+ move sp,s0 /* restore stack pointer */
calljava_return2:
ald ra,0*8(sp) /* restore return address */
ald pv,1*8(sp) /* restore procedure vector */
- ald s7,3*8(sp)
+ ald s0,3*8(sp)
#if SIZEOF_VOID_P == 8
ldc1 fss0,5*8(sp) /* restore non JavaABI saved flt regs */
j ra /* return */
asm_vm_call_method_exception_handler:
- sll t1,s7,3 /* remove stackframe */
- aaddu sp,sp,t1
+ move sp,s0 /* restore stack pointer */
#if SIZEOF_VOID_P == 4
aaddiu sp,sp,-4*4 /* reserve space for 1 argument */
#endif
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
if (!(var->flags & INMEMORY))
M_INTMOVE(s1, var->vv.regoff);
else
- M_LST(s1, REG_SP, var->vv.regoff * 8);
+ M_LST(s1, REG_SP, var->vv.regoff);
#else
if (!(var->flags & INMEMORY)) {
if (IS_2_WORD_TYPE(t))
}
else {
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, var->vv.regoff * 8);
+ M_LST(s1, REG_SP, var->vv.regoff);
else
- M_IST(s1, REG_SP, var->vv.regoff * 8);
+ M_IST(s1, REG_SP, var->vv.regoff);
}
#endif
}
else { /* stack arguments */
if (!(var->flags & INMEMORY)) {
#if SIZEOF_VOID_P == 8
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
#else
if (IS_2_WORD_TYPE(t))
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
else
- M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
#endif
}
else
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
else { /* floating args */
}
else {
if (IS_2_WORD_TYPE(t))
- M_DST(s1, REG_SP, var->vv.regoff * 8);
+ M_DST(s1, REG_SP, var->vv.regoff);
else
- M_FST(s1, REG_SP, var->vv.regoff * 8);
+ M_FST(s1, REG_SP, var->vv.regoff);
}
}
else {
if (!(var->flags & INMEMORY)) {
if (IS_2_WORD_TYPE(t))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
else
- M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
}
else
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
}
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_LST(s1, REG_SP, d * 8);
+ M_LST(s1, REG_SP, d);
}
#else
if (!md->params[s3].inmemory) {
else {
if (IS_2_WORD_TYPE(var->type)) {
s1 = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(s1, REG_SP, d * 8);
+ M_LST(s1, REG_SP, d);
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(s1, REG_SP, d * 8);
+ M_IST(s1, REG_SP, d);
}
}
#endif
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(s1, REG_SP, d * 8);
+ M_DST(s1, REG_SP, d);
else
- M_FST(s1, REG_SP, d * 8);
+ M_FST(s1, REG_SP, d);
}
}
}
}
else {
#if SIZEOF_VOID_P == 8
- M_LST(s1, REG_SP, s2 * 8);
+ M_LST(s1, REG_SP, s2);
#else
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, s2 * 4);
+ M_LST(s1, REG_SP, s2);
else
- M_IST(s1, REG_SP, s2 * 4);
+ M_IST(s1, REG_SP, s2);
#endif
}
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
s2 = nmd->params[j].regoff;
#if SIZEOF_VOID_P == 8
- M_LLD(REG_ITMP1, REG_SP, s1 * 8);
- M_LST(REG_ITMP1, REG_SP, s2 * 8);
+ M_LLD(REG_ITMP1, REG_SP, s1);
+ M_LST(REG_ITMP1, REG_SP, s2);
#else
if (IS_2_WORD_TYPE(t)) {
- M_LLD(REG_ITMP12_PACKED, REG_SP, s1 * 8);
- M_LST(REG_ITMP12_PACKED, REG_SP, s2 * 4);
+ M_LLD(REG_ITMP12_PACKED, REG_SP, s1);
+ M_LST(REG_ITMP12_PACKED, REG_SP, s2);
}
else {
- M_ILD(REG_ITMP1, REG_SP, s1 * 8);
- M_IST(REG_ITMP1, REG_SP, s2 * 4);
+ M_ILD(REG_ITMP1, REG_SP, s1);
+ M_IST(REG_ITMP1, REG_SP, s2);
}
#endif
}
else {
#if SIZEOF_VOID_P == 8
if (IS_2_WORD_TYPE(t))
- M_DST(s1, REG_SP, s2 * 8);
+ M_DST(s1, REG_SP, s2);
else
- M_FST(s1, REG_SP, s2 * 8);
+ M_FST(s1, REG_SP, s2);
#else
/* s1 may have been originally in 2 int registers,
but was moved out by the native function
argument(s), just get low register */
if (IS_2_WORD_TYPE(t))
- M_DST(GET_LOW_REG(s1), REG_SP, s2 * 4);
+ M_DST(GET_LOW_REG(s1), REG_SP, s2);
else
- M_FST(GET_LOW_REG(s1), REG_SP, s2 * 4);
+ M_FST(GET_LOW_REG(s1), REG_SP, s2);
#endif
}
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
s2 = nmd->params[j].regoff;
#if SIZEOF_VOID_P == 8
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, s1 * 8);
- M_DST(REG_FTMP1, REG_SP, s2 * 8);
+ M_DLD(REG_FTMP1, REG_SP, s1);
+ M_DST(REG_FTMP1, REG_SP, s2);
}
else {
- M_FLD(REG_FTMP1, REG_SP, s1 * 8);
- M_FST(REG_FTMP1, REG_SP, s2 * 8);
+ M_FLD(REG_FTMP1, REG_SP, s1);
+ M_FST(REG_FTMP1, REG_SP, s2);
}
#else
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, s1 * 8);
- M_DST(REG_FTMP1, REG_SP, s2 * 4);
+ M_DLD(REG_FTMP1, REG_SP, s1);
+ M_DST(REG_FTMP1, REG_SP, s2);
}
else {
- M_FLD(REG_FTMP1, REG_SP, s1 * 8);
- M_FST(REG_FTMP1, REG_SP, s2 * 4);
+ M_FLD(REG_FTMP1, REG_SP, s1);
+ M_FST(REG_FTMP1, REG_SP, s2);
}
#endif
}
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
switch (src->type) {
#if SIZEOF_VOID_P == 8
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
#if WORDS_BIGENDIAN == 1
M_ILD(tempreg, REG_SP, disp + 4);
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
#if WORDS_BIGENDIAN == 1
M_ILD(tempreg, REG_SP, disp);
if (dst->flags & INMEMORY) {
COUNT_SPILLS;
- disp = dst->vv.regoff * 8;
+ disp = dst->vv.regoff;
switch (dst->type) {
#if SIZEOF_VOID_P == 8
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
+
+#include <stdarg.h>
+
#include "vm/types.h"
#include "vm/jit/mips/md-abi.h"
+#include "mm/memory.h"
+
#include "vm/global.h"
#include "vm/jit/abi.h"
#include "vmcore/descriptor.h"
+#include "vmcore/method.h"
/* register descripton array **************************************************/
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
case TYPE_ADR:
if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = reguse;
pd->regoff = abi_registers_integer_argument[reguse];
reguse++;
md->argintreguse = reguse;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
# if WORDS_BIGENDIAN == 1
+ pd->index = PACK_REGS(reguse + 1, reguse);
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse + 1],
abi_registers_integer_argument[reguse]);
# else
+ pd->index = PACK_REGS(reguse, reguse + 1);
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse],
abi_registers_integer_argument[reguse + 1]);
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
case TYPE_DBL:
if (reguse < FLT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = reguse;
pd->regoff = abi_registers_float_argument[reguse];
reguse++;
md->argfltreguse = reguse;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 8;
}
stacksize++;
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 8;
}
stacksize += 2;
break;
ALIGN_2(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize += 2;
}
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize++;
}
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize++;
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize += 2;
break;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
}
else {
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, var->vv.regoff * 4);
+ M_LST(s1, REG_SP, var->vv.regoff);
else
- M_IST(s1, REG_SP, var->vv.regoff * 4);
+ M_IST(s1, REG_SP, var->vv.regoff);
}
}
else {
if (!IS_INMEMORY(var->flags)) {
if (IS_2_WORD_TYPE(t))
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
else
- M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
}
else {
#if 1
- M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1);
+ M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
if (IS_2_WORD_TYPE(t)) {
- M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4 +4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
}
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 4 + s1;
#endif
}
}
M_FLTMOVE(s1, var->vv.regoff);
else {
if (IS_2_WORD_TYPE(t))
- M_DST(s1, REG_SP, var->vv.regoff * 4);
+ M_DST(s1, REG_SP, var->vv.regoff);
else
- M_FST(s1, REG_SP, var->vv.regoff * 4);
+ M_FST(s1, REG_SP, var->vv.regoff);
}
}
else {
if (!IS_INMEMORY(var->flags)) {
if (IS_2_WORD_TYPE(t))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
else
- M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
}
else {
#if 1
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
- M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+ M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+ M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
var->vv.regoff = cd->stackframesize + s1;
} else {
- M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
- M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+ M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+ M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
}
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 4 + s1;
#endif
}
}
else {
if (IS_2_WORD_TYPE(var->type)) {
s1 = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(s1, REG_SP, d * 4);
+ M_LST(s1, REG_SP, d);
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(s1, REG_SP, d * 4);
+ M_IST(s1, REG_SP, d);
}
}
}
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(s1, REG_SP, d * 4);
+ M_DST(s1, REG_SP, d);
else
- M_FST(s1, REG_SP, d * 4);
+ M_FST(s1, REG_SP, d);
}
}
}
}
else {
if (IS_2_WORD_TYPE(t))
- M_LST(s1, REG_SP, s2 * 4);
+ M_LST(s1, REG_SP, s2);
else
- M_IST(s1, REG_SP, s2 * 4);
+ M_IST(s1, REG_SP, s2);
}
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 4;
s2 = nmd->params[j].regoff;
- M_ILD(REG_ITMP1, REG_SP, s1 * 4);
+ M_ILD(REG_ITMP1, REG_SP, s1);
if (IS_2_WORD_TYPE(t))
- M_ILD(REG_ITMP2, REG_SP, s1 * 4 + 4);
+ M_ILD(REG_ITMP2, REG_SP, s1 + 4);
- M_IST(REG_ITMP1, REG_SP, s2 * 4);
+ M_IST(REG_ITMP1, REG_SP, s2);
if (IS_2_WORD_TYPE(t))
- M_IST(REG_ITMP2, REG_SP, s2 * 4 + 4);
+ M_IST(REG_ITMP2, REG_SP, s2 + 4);
}
}
else {
argument registers keep unchanged. */
if (md->params[i].inmemory) {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 4;
s2 = nmd->params[j].regoff;
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, s1 * 4);
- M_DST(REG_FTMP1, REG_SP, s2 * 4);
+ M_DLD(REG_FTMP1, REG_SP, s1);
+ M_DST(REG_FTMP1, REG_SP, s2);
}
else {
- M_FLD(REG_FTMP1, REG_SP, s1 * 4);
- M_FST(REG_FTMP1, REG_SP, s2 * 4);
+ M_FLD(REG_FTMP1, REG_SP, s1);
+ M_FST(REG_FTMP1, REG_SP, s2);
}
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize++;
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
iarg = INT_ARG_CNT;
}
stacksize += 2;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize++;
break;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
}
stacksize += 2;
break;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
*/
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
switch (src->type) {
case TYPE_INT:
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp + 4);
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp);
if (IS_INMEMORY(dst->flags)) {
COUNT_SPILLS;
- disp = dst->vv.regoff * 4;
+ disp = dst->vv.regoff;
switch (dst->type) {
case TYPE_INT:
}
}
else {
- s1 = (md->params[p].regoff + cd->stackframesize) * 4
+ s1 = md->params[p].regoff + cd->stackframesize * 4
+ stack_size;
if (IS_2_WORD_TYPE(t)) {
M_ILD(REG_ITMP2, REG_SP, s1);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
else {
_ALIGN(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
iarg = INT_ARG_CNT;
stacksize += 2;
}
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
else {
_ALIGN(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize += 2;
}
break;
iarg++;
} else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
} else {
_ALIGN(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
iarg = INT_ARG_CNT;
stacksize += 2;
}
farg++;
} else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
} else {
_ALIGN(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize += 2;
}
break;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7918 2007-05-20 20:42:18Z michi $
+ $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
*/
#include "vm/jit/methodheader.h"
#include "vm/jit/powerpc64/offsets.h"
-.section ".toc","aw"
-.section ".text"
-
- .align 2
-
-
/* export functions ***********************************************************/
.globl asm_vm_call_method_exception_handler
.globl asm_criticalsections
.globl asm_getclassvalues_atomic
-
/* asm_vm_call_method **********************************************************
* *
* This function calls a Java-method (which possibly needs compilation) *
*******************************************************************************/
/* this is the method header see src/vm/jit/methodheader.h */
- .align 8
+ .align 3
.quad 0 /* catch type all */
.quad 0 /* handler pc */
stfd ftmp1,13*8(sp) /* registers f14-f31 are callee saved */
stfd ftmp2,14*8(sp)
- SAVE_TEMPORARY_REGISTERS(15)
-
- mr itmp2,a1 /* arg count */
- mr itmp1,a2 /* pointer to arg block */
- mr t4,itmp2 /* save argument count */
- mr t5,itmp1 /* save argument block pointer */
-
- mr s0,sp /* save current sp to s0 */
+ SAVE_TEMPORARY_REGISTERS(15)
+ mr s0, r1 /* save stack pointer */
- addi itmp1,itmp1,-sizevmarg /* initialize pointer (smaller code) */
- addi itmp2,itmp2,1 /* initialize argument count */
- li t0,0 /* initialize integer argument counter */
- li t1,0 /* initialize float argument counter */
- li t6,0 /* initialize integer register counter */
- li t3,8 /* initialize PA counter*/
+ /* a1 contains a pointer to a unit64_t structure filled with all INT_ARG_REG,
+ followed by ADR_ARG_CNT and FLT_ARG_CNT, afterwards what else needs to be copied onto
+ the stack
+ a2 contains the number of additional stack slots to be copied
+ */
L_register_copy:
- addi itmp1,itmp1,sizevmarg /* goto next argument block */
- addi itmp2,itmp2,-1 /* argument count - 1 */
- mr. itmp2,itmp2
- beq L_register_copy_done
-
- addi t3,t3,-1 /* uses a PA slot */
- lwz itmp3,offvmargtype+4(itmp1)
- andi. r0,itmp3,0x0002 /* is this a float/double type? */
- bne L_register_handle_float
-
-L_register_handle_int:
- cmpwi t6,INT_ARG_CNT /* are we out of integer argument */
- beq L_register_copy /* registers? yes, next loop */
-
- cmpwi itmp3,0x0004 /* is it TYPE_ADR? */
- beq L_register_handle_long
-
- andi. r0,itmp3,0x0001 /* is this a 2-word type? */
- bne L_register_handle_long
-
- lis itmp3,L_jumptable_int@highest /* load 64bit address */
- ori itmp3,itmp3,L_jumptable_int@higher
- rldicr itmp3,itmp3,32,31
- oris itmp3,itmp3,L_jumptable_int@h
- ori itmp3,itmp3,L_jumptable_int@l
- b L_register_do_copy_longint
-
-L_register_handle_long:
-
- lis itmp3,L_jumptable_long@highest /* load 64bit address */
- ori itmp3,itmp3,L_jumptable_long@higher
- rldicr itmp3,itmp3,32,31
- oris itmp3,itmp3,L_jumptable_long@h
- ori itmp3,itmp3,L_jumptable_long@l
-
-L_register_do_copy_longint:
- slwi t2,t6,3 /* multiple of 8-bytes */
- add itmp3,itmp3,t2 /* calculate address of jumptable */
- ld itmp3,0(itmp3) /* load function address */
- mtctr itmp3
- addi t0,t0,1 /* integer argument counter */
- addi t6,t6,1 /* integer argument register counter */
- bctr
-
-L_register_handle_float:
- cmpwi t1,FLT_ARG_CNT /* are we out of float argument */
- beq L_register_copy /* registers? yes, next loop */
-
- andi. r0,itmp3,0x0001 /* is this a 2-word type? */
- bne L_register_handle_double
-
- lis itmp3,L_jumptable_float@highest /* load 64bit address */
- ori itmp3,itmp3,L_jumptable_float@higher
- rldicr itmp3,itmp3,32,31
- oris itmp3,itmp3,L_jumptable_float@h
- ori itmp3,itmp3,L_jumptable_float@l
- b L_register_do_copy_floatdouble
-
-L_register_handle_double:
-
- lis itmp3,L_jumptable_double@highest /* load 64bit address */
- ori itmp3,itmp3,L_jumptable_double@higher
- rldicr itmp3,itmp3,32,31
- oris itmp3,itmp3,L_jumptable_double@h
- ori itmp3,itmp3,L_jumptable_double@l
-
-
-L_register_do_copy_floatdouble:
-
- slwi t2,t1,3 /* multiple of 8-bytes */
- add itmp3,itmp3,t2 /* calculate address of jumptable */
- ld itmp3,0(itmp3) /* load function address */
- mtctr itmp3
- addi t1,t1,1 /* float argument counter */
- mr. t3,t3 /* are we still in PA ? */
- blt L_float_not_uses_PA
- addi t6,t6,1 /* if so it uses an interger arg reg */
-L_float_not_uses_PA:
- bctr
-
-
-L_register_copy_done:
- subi sp,sp,PA_SIZE /* PA_SIZE are used by definition */
- /* calculate remaining arguments */
- sub itmp3,t4,t0 /* - integer arguments in registers */
- sub itmp3,itmp3,t1 /* - float arguments in registers */
- mr. itmp3,itmp3
- beq L_stack_copy_done
-
- mr itmp2,t4 /* restore argument count */
- mr itmp1,t5 /* restore argument block pointer */
+ mr t1, a1
+ mr t2, a2
+
+ ld a0 , 0*8(t1)
+ ld a1 , 1*8(t1)
+ ld a2 , 2*8(t1)
+ ld a3 , 3*8(t1)
+ ld a4 , 4*8(t1)
+ ld a5 , 5*8(t1)
+ ld a6 , 6*8(t1)
+ ld a7 , 7*8(t1)
+
+ lfd fa0 , 8*8(t1)
+ lfd fa1 , 9*8(t1)
+ lfd fa2 ,10*8(t1)
+ lfd fa3 ,11*8(t1)
+ lfd fa4 ,12*8(t1)
+ lfd fa5 ,13*8(t1)
+ lfd fa6 ,14*8(t1)
+ lfd fa7 ,15*8(t1)
+ lfd fa8 ,16*8(t1)
+ lfd fa9 ,17*8(t1)
+ lfd fa10,18*8(t1)
+ lfd fa11,19*8(t1)
+ lfd fa12,20*8(t1)
+
+ mr. t2,t2
+ beq L_stack_copy_done
+
+L_stack_copy:
+ addi t1,t1,20*8 /* before first possible stack slot arg */
+ mr t3,t2 /* argument counter */
+ sldi t2,t2,8 /* calculate size of stack */
+ sub sp,sp,t2 /* increase the stack */
+ mr t2,sp /* t2 points to bottom of stack now */
- slwi t4,itmp3,3 /* XXX use 8-bytes slots for now */
- addi t4,t4,LA_SIZE /* add size of linkage area */
- sub sp,sp,t4
-
- mr t6,sp /* use t6 as temporary sp */
- addi t6,t6,LA_SIZE /* skip linkage area */
-
- addi itmp1,itmp1,-sizevmarg /* initialize pointer (smaller code) */
- addi itmp2,itmp2,1 /* initialize argument count */
- li t3,8 /* initialize PA counter */
- addi t6,t6,-8 /* make code simpler */
-
L_stack_copy_loop:
- addi itmp1,itmp1,sizevmarg /* goto next argument block */
- addi itmp2,itmp2,-1 /* argument count - 1 */
- mr. itmp2,itmp2
- beq L_stack_copy_done
- addi t6,t6,8 /* increase stack */
-L_stack_not_uses_PA:
-
- lwz itmp3,offvmargtype+4(itmp1)
- andi. r0,itmp3,0x0002 /* is this a float/double type? */
- bne L_stack_handle_float
-
-L_stack_handle_int:
- addi t0,t0,-1 /* arguments assigned to registers */
- mr. t0,t0
- bge L_stack_copy_loop
-
- andi. r0,itmp3,0x0001 /* is this a 2-word type? */
- bne L_stack_handle_long
-
- lwa itmp3,offvmargdata+4(itmp1) /* get integer argument */
- std itmp3,0(t6) /* and store it on the stack */
- b L_stack_copy_loop
-
-L_stack_handle_long:
- ld itmp3,offvmargdata+0(itmp1) /* get long argument */
- std itmp3,0(t6) /* and store it on the stack */
- b L_stack_copy_loop
-
-L_stack_handle_float:
- addi t1,t1,-1 /* arguments assigned to registers */
- mr. t1,t1
- bge L_stack_copy_loop
-
- andi. r0,itmp3,0x0001 /* is this a 2-word type? */
- bne L_stack_handle_double
-
- lfs ftmp3,offvmargdata(itmp1) /* get float argument */
- stfd ftmp3,0(t6) /* and store it on the stack */
- b L_stack_copy_loop
-
-L_stack_handle_double:
- lfd ftmp3,offvmargdata(itmp1) /* get double argument */
- stfd ftmp3,0(t6) /* and store it on the stack */
- b L_stack_copy_loop
+ addi t1,t1,8 /* next possible stack slot to copy */
+ mr. t3,t3 /* more stack slots to copy ? */
+ beq L_stack_copy_done
+ ld itmp3, 0(t1)
+ std itmp3, 0(t2)
+ addi t2,t2,8
+ addi t3,t3,-1
+ b L_stack_copy_loop
L_stack_copy_done:
- ld itmp1,9*8(s0) /* pass method pointer via tmp1 */
-
- lis mptr,L_asm_call_jit_compiler@highest /* load 64bit address */
- ori mptr,mptr,L_asm_call_jit_compiler@higher
- rldicr mptr,mptr,32,31
- oris mptr,mptr,L_asm_call_jit_compiler@h
- ori mptr,mptr,L_asm_call_jit_compiler@l
- std mptr,7*8(s0)
- addi mptr,s0,7*8
-
- ld pv,0*8(mptr)
+ mr itmp1, s0 /* fake invokevirtual invocation */
+ addi itmp1, itmp1, 9*8 /* address of methods pv */
+ ld pv,0*8(itmp1)
mtctr pv
bctrl
1:
mflr itmp1
-
addi pv,itmp1,(.asm_vm_call_method - 1b)@l
L_asm_vm_call_method_return:
bl builtin_throw_exception
b L_asm_vm_call_method_return
-
- .data
- .align 8
-
-L_jumptable_int:
- .quad L_handle_a0
- .quad L_handle_a1
- .quad L_handle_a2
- .quad L_handle_a3
- .quad L_handle_a4
- .quad L_handle_a5
- .quad L_handle_a6
- .quad L_handle_a7
-
- .text
- .align 4
-
-L_handle_a0:
- lwa a0,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a1:
- lwa a1,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a2:
- lwa a2,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a3:
- lwa a3,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a4:
- lwa a4,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a5:
- lwa a5,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a6:
- lwa a6,offvmargdata+4(itmp1)
- b L_register_copy
-L_handle_a7:
- lwa a7,offvmargdata+4(itmp1)
- b L_register_copy
-
-
- .data
- .align 8
-
-L_jumptable_long:
- .quad L_handle_a0l
- .quad L_handle_a1l
- .quad L_handle_a2l
- .quad L_handle_a3l
- .quad L_handle_a4l
- .quad L_handle_a5l
- .quad L_handle_a6l
- .quad L_handle_a7l
-
- .text
- .align 4
-
-L_handle_a0l:
- ld a0,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a1l:
- ld a1,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a2l:
- ld a2,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a3l:
- ld a3,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a4l:
- ld a4,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a5l:
- ld a5,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a6l:
- ld a6,offvmargdata(itmp1)
- b L_register_copy
-L_handle_a7l:
- ld a7,offvmargdata(itmp1)
- b L_register_copy
-
- .data
- .align 8
-
-L_jumptable_float:
- .quad L_handle_fa0
- .quad L_handle_fa1
- .quad L_handle_fa2
- .quad L_handle_fa3
- .quad L_handle_fa4
- .quad L_handle_fa5
- .quad L_handle_fa6
- .quad L_handle_fa7
- .quad L_handle_fa8
- .quad L_handle_fa9
- .quad L_handle_fa10
- .quad L_handle_fa11
- .quad L_handle_fa12
-
- .text
- .align 4
-
-L_handle_fa0:
- lfs fa0,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa1:
- lfs fa1,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa2:
- lfs fa2,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa3:
- lfs fa3,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa4:
- lfs fa4,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa5:
- lfs fa5,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa6:
- lfs fa6,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa7:
- lfs fa7,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa8:
- lfs fa8,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa9:
- lfs fa9,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa10:
- lfs fa10,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa11:
- lfs fa11,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fa12:
- lfs fa12,offvmargdata(itmp1)
- b L_register_copy
-
- .data
- .align 8
-
-L_jumptable_double:
- .quad L_handle_fda0
- .quad L_handle_fda1
- .quad L_handle_fda2
- .quad L_handle_fda3
- .quad L_handle_fda4
- .quad L_handle_fda5
- .quad L_handle_fda6
- .quad L_handle_fda7
- .quad L_handle_fda8
- .quad L_handle_fda9
- .quad L_handle_fda10
- .quad L_handle_fda11
- .quad L_handle_fda12
-
- .text
- .align 4
-
-L_handle_fda0:
- lfd fa0,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda1:
- lfd fa1,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda2:
- lfd fa2,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda3:
- lfd fa3,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda4:
- lfd fa4,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda5:
- lfd fa5,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda6:
- lfd fa6,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda7:
- lfd fa7,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda8:
- lfd fa8,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda9:
- lfd fa9,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda10:
- lfd fa10,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda11:
- lfd fa11,offvmargdata(itmp1)
- b L_register_copy
-L_handle_fda12:
- lfd fa12,offvmargdata(itmp1)
- b L_register_copy
-
asm_vm_call_method_end:
nop
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
if (!IS_INMEMORY(var->flags))
M_INTMOVE(s1, var->vv.regoff);
else
- M_LST(s1, REG_SP, var->vv.regoff * 8);
+ M_LST(s1, REG_SP, var->vv.regoff);
}
else {
if (!IS_INMEMORY(var->flags))
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
else
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
else {
if (!IS_INMEMORY(var->flags))
M_FLTMOVE(s1, var->vv.regoff);
else
- M_DST(s1, REG_SP, var->vv.regoff * 8);
+ M_DST(s1, REG_SP, var->vv.regoff);
}
else {
if (!(var->flags & INMEMORY)) {
if (IS_2_WORD_TYPE(t))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
else
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1);
}
else
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
}
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_LST(s1, REG_SP, d * 8);
+ M_LST(s1, REG_SP, d);
}
}
else {
}
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
- M_DST(s1, REG_SP, d * 8);
+ M_DST(s1, REG_SP, d);
}
}
}
if (!nmd->params[j].inmemory)
M_INTMOVE(s1, s2);
else
- M_LST(s1, REG_SP, s2 * 8);
+ M_LST(s1, REG_SP, s2);
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
s2 = nmd->params[j].regoff;
- M_LLD(REG_ITMP1, REG_SP, s1 * 8);
- M_LST(REG_ITMP1, REG_SP, s2 * 8);
+ M_LLD(REG_ITMP1, REG_SP, s1);
+ M_LST(REG_ITMP1, REG_SP, s2);
}
}
else {
argument registers keep unchanged. */
if (md->params[i].inmemory) {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
s2 = nmd->params[j].regoff;
- M_DLD(REG_FTMP1, REG_SP, s1 * 8);
+ M_DLD(REG_FTMP1, REG_SP, s1);
if (IS_2_WORD_TYPE(t))
- M_DST(REG_FTMP1, REG_SP, s2 * 8);
+ M_DST(REG_FTMP1, REG_SP, s2);
else
- M_FST(REG_FTMP1, REG_SP, s2 * 8 + 4);
+ M_FST(REG_FTMP1, REG_SP, s2 + 4);
}
}
}
if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
if (IS_FLT_DBL_TYPE(src->type)) {
M_DLD(tempreg, REG_SP, disp);
COUNT_SPILLS;
if (IS_FLT_DBL_TYPE(dst->type)) {
- M_DST(d, REG_SP, dst->vv.regoff * 8);
+ M_DST(d, REG_SP, dst->vv.regoff);
}
else {
- M_LST(d, REG_SP, dst->vv.regoff * 8);
+ M_LST(d, REG_SP, dst->vv.regoff);
}
}
}
if (!md->params[p].inmemory) { /* Param in Arg Reg */
M_LST(md->params[p].regoff, REG_SP, LA_SIZE + PA_SIZE + 8 + p * 8);
} else { /* Param on Stack */
- s1 = (md->params[p].regoff + cd->stackframesize) * 8 + stack_size;
+ s1 = md->params[p].regoff + cd->stackframesize * 8 + stack_size;
M_LLD(REG_ITMP2, REG_SP, s1);
M_LST(REG_ITMP2, REG_SP, LA_SIZE + PA_SIZE + 8 + p * 8);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7727 2007-04-16 21:18:43Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
case TYPE_ADR:
if (iarg < INT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = iarg;
pd->regoff = abi_registers_integer_argument[iarg];
iarg++;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize + stackcount;
+ pd->index = stacksize + stackcount;
+ pd->regoff = (stacksize + stackcount) * 8;
}
break;
case TYPE_FLT:
case TYPE_DBL:
if (farg < FLT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = farg;
pd->regoff = abi_registers_float_argument[farg];
farg++;
if (arg < INT_ARG_CNT) {
}
else {
pd->inmemory = true;
- pd->regoff = stacksize + stackcount ;
+ pd->index = stacksize + stackcount;
+ pd->regoff = (stacksize + stackcount) * 8;
}
break;
default:
/*** debugging ****************************************************************/
-/*#define REPLACE_VERBOSE*/
-
#if !defined(NDEBUG)
static void java_value_print(s4 type, replace_val_t value);
static void replace_stackframeinfo_println(stackframeinfo *sfi);
#endif
-#if !defined(NDEBUG) && defined(REPLACE_VERBOSE)
-int replace_verbose = 0;
-#define DOLOG(code) do{ if (replace_verbose > 1) { code; } } while(0)
-#define DOLOG_SHORT(code) do{ if (replace_verbose > 0) { code; } } while(0)
+#if !defined(NDEBUG)
+#define DOLOG(code) do{ if (opt_TraceReplacement > 1) { code; } } while(0)
+#define DOLOG_SHORT(code) do{ if (opt_TraceReplacement > 0) { code; } } while(0)
#else
#define DOLOG(code)
#define DOLOG_SHORT(code)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7918 2007-05-20 20:42:18Z michi $
+ $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
*/
lr xpc,v0 /* move handlerpc into xpc */
l xptr,0*4(sp) /* restore exception pointer */
l pv,2*4(sp) /* restore PV */
+ ahi pv,-0xffc /* offset PV */
l %r0,4*4(sp) /* get maybe-leaf flag */
ahi sp,(6*4) /* free stack frame */
/* pass arguments */
la a0, apw_sfs(sp) /* pass SP of patcher stub */
- lr a1, pv /* pass PV (if NULL, use findmethod) */
+ la a1, 0xffc(pv) /* pass PV (if NULL, use findmethod) */
lhi a2, 0 /* pass RA */
/* call patcher_wrapper */
/* jump to new code */
ret
-
-
-/* asm_builtin_x2x *************************************************************
-* *
-* Wrapper functions for float to int corner cases *
-* *
-*******************************************************************************/
-
-asm_builtin_f2i:
- sub $(ARG_CNT*8),sp
-
- SAVE_ARGUMENT_REGISTERS(0)
-
- movq ftmp1,fa0
- call builtin_f2i@PLT
-
- RESTORE_ARGUMENT_REGISTERS(0)
-
- add $(ARG_CNT*8),sp
- ret
-
-
-asm_builtin_f2l:
- sub $(ARG_CNT*8),sp
-
- SAVE_ARGUMENT_REGISTERS(0)
-
- movq ftmp1,fa0
- call builtin_f2l@PLT
-
- RESTORE_ARGUMENT_REGISTERS(0)
-
- add $(ARG_CNT*8),sp
- ret
-
-
-asm_builtin_d2i:
- sub $(ARG_CNT*8),sp
-
- SAVE_ARGUMENT_REGISTERS(0)
-
- movq ftmp1,fa0
- call builtin_d2i@PLT
-
- RESTORE_ARGUMENT_REGISTERS(0)
-
- add $(ARG_CNT*8),sp
- ret
-
-
-asm_builtin_d2l:
- sub $(ARG_CNT*8),sp
-
- SAVE_ARGUMENT_REGISTERS(0)
-
- movq ftmp1,fa0
- call builtin_d2l@PLT
-
- RESTORE_ARGUMENT_REGISTERS(0)
-
- add $(ARG_CNT*8),sp
- ret
-
-#endif /* if 0 */
+#endif
/* TODO use move here ? */
.long 0
-/* disable exec-stacks ********************************************************/
-
-#if 0
-
-#if defined(__linux__) && defined(__ELF__)
- .section .note.GNU-stack,"",%progbits
-#endif
-
-
-#endif /* if 0 */
-
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
#endif
#define OOPS() assert(0);
+#define SUPPORT_HERCULES 1
void panic() { }
dseg_add_target(cd, ex->handler);
(void) dseg_add_unique_address(cd, ex->catchtype.any);
}
-
+
+ /* Offset PV */
+
+ M_AADD_IMM(N_PV_OFFSET, REG_PV);
+
/* generate method profiling code */
#if defined(ENABLE_PROFILING)
} else { /* reg arg -> spilled */
if (IS_2_WORD_TYPE(t))
- M_LST(s2, REG_SP, var->vv.regoff * 4);
+ M_LST(s2, REG_SP, var->vv.regoff);
else
- M_IST(s2, REG_SP, var->vv.regoff * 4);
+ M_IST(s2, REG_SP, var->vv.regoff);
}
} else { /* stack arguments */
if (!IS_INMEMORY(var->flags)) { /* stack arg -> register */
if (IS_2_WORD_TYPE(t))
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
else
- M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
} else { /* stack arg -> spilled */
- M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1);
+ M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
if (IS_2_WORD_TYPE(t)) {
- M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4 +4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
}
}
}
} else { /* reg arg -> spilled */
if (IS_2_WORD_TYPE(t))
- M_DST(s2, REG_SP, var->vv.regoff * 4);
+ M_DST(s2, REG_SP, var->vv.regoff);
else
- M_FST(s2, REG_SP, var->vv.regoff * 4);
+ M_FST(s2, REG_SP, var->vv.regoff);
}
} else { /* stack arguments */
if (!IS_INMEMORY(var->flags)) { /* stack-arg -> register */
if (IS_2_WORD_TYPE(t))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
else
- M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
+ M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
} else { /* stack-arg -> spilled */
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
- M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
- var->vv.regoff = cd->stackframesize + s1;
+ M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+ M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
+ var->vv.regoff = cd->stackframesize * 4 + s1;
} else {
- M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
- M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
+ M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
+ M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
}
}
}
if (m->flags & ACC_STATIC) {
disp = dseg_add_address(cd, &m->class->object.header);
- M_ALD(REG_A0, REG_PV, disp);
+ M_ALD_DSEG(REG_A0, disp);
}
else {
M_TEST(REG_A0);
}
disp = dseg_add_functionptr(cd, LOCK_monitor_enter);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_AST(REG_A0, REG_SP, s1 * 4);
case ICMD_FCONST: /* ... ==> ..., constant */
d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
disp = dseg_add_float(cd, iptr->sx.val.f);
- M_FLDN(d, REG_PV, disp, REG_ITMP1);
+ M_FLD_DSEG(d, disp, REG_ITMP1);
emit_store_dst(jd, iptr, d);
break;
case ICMD_DCONST: /* ... ==> ..., constant */
d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
disp = dseg_add_double(cd, iptr->sx.val.d);
- M_DLDN(d, REG_PV, disp, REG_ITMP1);
+ M_DLD_DSEG(d, disp, REG_ITMP1);
emit_store_dst(jd, iptr, d);
break;
/* PROFILE_CYCLE_START; */
- M_ALD(d, REG_PV, disp);
+ M_ALD_DSEG(d, disp);
} else {
if (iptr->sx.val.anyptr == 0) {
M_CLR(d);
} else {
disp = dseg_add_unique_address(cd, iptr->sx.val.anyptr);
- M_ALD(d, REG_PV, disp);
+ M_ALD_DSEG(d, disp);
}
}
emit_store_dst(jd, iptr, d);
M_IMUL_IMM(iptr->sx.val.i, d);
} else {
disp = dseg_add_s4(cd, iptr->sx.val.i);
- M_ILD(REG_ITMP2, REG_PV, disp);
+ M_ILD_DSEG(REG_ITMP2, disp);
M_IMUL(REG_ITMP2, d);
}
emit_store_dst(jd, iptr, d);
/* call builtin */
M_ASUB_IMM(96, REG_SP);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_JSR(REG_RA, REG_ITMP3);
M_AADD_IMM(96, REG_SP);
M_IADD(REG_ITMP1, d);
}
- *(u4 *)ref |= (u4)(cd->mcodeptr - ref) / 2;
+ N_BRC_BACK_PATCH(ref);
M_SRA_IMM(iptr->sx.val.i, d);
break;
case ICMD_F2I: /* ..., value ==> ..., (int) value */
- s1 = emit_load_s1(jd, iptr, REG_FTMP1);
- d = codegen_reg_of_dst(jd, iptr, REG_ITMP3);
- M_CVTFI(s1, d);
- emit_store_dst(jd, iptr, d);
- /* TODO: corner cases ? */
- break;
+ case ICMD_D2I:
+ {
+ u1 *ref1;
+#ifdef SUPPORT_HERCULES
+ u1 *ref2, *ref3;
+#endif
- case ICMD_D2I: /* ..., value ==> ..., (int) value */
- s1 = emit_load_s1(jd, iptr, REG_FTMP1);
- d = codegen_reg_of_dst(jd, iptr, REG_ITMP3);
- M_CVTDI(s1, d);
- emit_store_dst(jd, iptr, d);
- /* TODO: corner cases ? */
- break;
+ s1 = emit_load_s1(jd, iptr, REG_FTMP1);
+ d = codegen_reg_of_dst(jd, iptr, REG_ITMP3);
+
+ /* Test if NAN */
+
+ switch (iptr->opc) {
+ case ICMD_F2I:
+ N_LTEBR(s1, s1);
+ break;
+ case ICMD_D2I:
+ N_LTDBR(s1, s1);
+ break;
+ }
+
+ N_BRC(DD_0 | DD_1 | DD_2, SZ_BRC + SZ_LHI + SZ_BRC); /* Non a NaN */
+ N_LHI(d, 0); /* Load 0 */
+ ref1 = cd->mcodeptr;
+ N_BRC(DD_ANY, 0); /* Exit */
+
+ /* Convert */
+ switch (iptr->opc) {
+ case ICMD_F2I:
+ M_CVTFI(s1, d);
+ break;
+ case ICMD_D2I:
+ M_CVTDI(s1, d);
+ break;
+ }
+
+#ifdef SUPPORT_HERCULES
+ /* Hercules does the conversion using a plain C conversion.
+ * According to manual, real hardware should *NOT* require this.
+ *
+ * Corner case: Positive float leads to INT_MIN (overflow).
+ */
+
+ switch (iptr->opc) {
+ case ICMD_F2I:
+ N_LTEBR(s1, s1);
+ break;
+ case ICMD_D2I:
+ N_LTDBR(s1, s1);
+ break;
+ }
+
+ ref2 = cd->mcodeptr;
+ N_BRC(DD_0 | DD_1 | DD_3, 0); /* If operand is positive, continue */
+
+ M_TEST(d);
+
+ ref3 = cd->mcodeptr;
+ M_BGE(0); /* If integer result is negative, continue */
+
+ disp = dseg_add_s4(cd, 0x7fffffff); /* Load INT_MAX */
+ M_ILD_DSEG(d, disp);
+#endif
+ N_BRC_BACK_PATCH(ref1);
+#ifdef SUPPORT_HERCULES
+ N_BRC_BACK_PATCH(ref2);
+ N_BRC_BACK_PATCH(ref3);
+#endif
+ emit_store_dst(jd, iptr, d);
+ }
break;
case ICMD_F2D: /* ..., value ==> ..., (double) value */
- s1 = emit_load_s1(jd, iptr, REG_FTMP1);
- d = codegen_reg_of_dst(jd, iptr, REG_FTMP2);
- M_CVTFD(s1, d);
- emit_store_dst(jd, iptr, d);
+ {
+ u1 *ref;
+ s1 = emit_load_s1(jd, iptr, REG_FTMP1);
+ d = codegen_reg_of_dst(jd, iptr, REG_FTMP2);
+#ifdef SUPPORT_HERCULES
+ N_LTEBR(s1, s1);
+ ref = cd->mcodeptr;
+ N_BRC(DD_0 | DD_1 | DD_2, 0); /* Non a NaN */
+ disp = dseg_add_double(cd, 0.0 / 0.0);
+ M_DLD_DSEG(d, disp, REG_ITMP1);
+ emit_label_br(cd, BRANCH_LABEL_1);
+ N_BRC_BACK_PATCH(ref);
+#endif
+ M_CVTFD(s1, d);
+#ifdef SUPPORT_HERCULES
+ emit_label(cd, BRANCH_LABEL_1);
+#endif
+ emit_store_dst(jd, iptr, d);
+ }
break;
case ICMD_D2F: /* ..., value ==> ..., (float) value */
M_INTMOVE(s2, REG_ITMP2);
M_SLL_IMM(3, REG_ITMP2); /* scale index by 8 */
+ /* We need to preserve the array address after the first load */
+
+ if (GET_HIGH_REG(d) == s1) {
+ M_INTMOVE(s1, REG_ITMP3);
+ s1 = REG_ITMP3;
+ }
+
N_L(GET_HIGH_REG(d) /* evntl. itmp1 */, OFFSET(java_intarray, data[0]), REG_ITMP2, s1);
N_L(GET_LOW_REG(d) /* evntl. itmp2 */, OFFSET(java_intarray, data[0]) + 4, REG_ITMP2, s1);
emit_store_dst(jd, iptr, d);
M_INTMOVE(s3, REG_A1);
disp = dseg_add_functionptr(cd, BUILTIN_canstore);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_ASUB_IMM(96, REG_SP);
M_JSR(REG_RA, REG_ITMP3);
M_AADD_IMM(96, REG_SP);
}
}
- M_ALD(REG_ITMP1, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP1, disp);
switch (fieldtype) {
case TYPE_INT:
fi->class, disp);
}
- M_ALD(REG_ITMP1, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP1, disp);
switch (fieldtype) {
case TYPE_INT:
s1 = emit_load_s1(jd, iptr, REG_ITMP2);
#endif /* ENABLE_VERIFIER */
disp = dseg_add_functionptr(cd, asm_handle_exception);
- M_ALD(REG_ITMP2, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP2, disp);
M_JMP(REG_ITMP2_XPC, REG_ITMP2);
M_NOP;
M_ICMP_IMM(s1, iptr->sx.val.i);
else {
disp = dseg_add_s4(cd, iptr->sx.val.i);
- ICONST(REG_ITMP2, disp);
- N_C(s1, 0, REG_ITMP2, REG_PV);
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_C(s1, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ ICONST(REG_ITMP2, disp);
+ N_C(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+ }
}
switch (iptr->opc) {
M_ICMP_IMM(s1, iptr->sx.val.l >> 32);
else {
disp = dseg_add_s4(cd, iptr->sx.val.l >> 32);
- ICONST(REG_ITMP2, disp);
- N_C(s1, 0, REG_ITMP2, REG_PV);
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_C(s1, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ ICONST(REG_ITMP2, disp);
+ N_C(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+ }
}
switch(iptr->opc) {
s1 = emit_load_s1_low(jd, iptr, REG_ITMP1);
disp = dseg_add_s4(cd, (s4)(iptr->sx.val.l & 0xffffffff));
- ICONST(REG_ITMP2, disp);
- N_CL(s1, 0, REG_ITMP2, REG_PV);
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_CL(s1, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ ICONST(REG_ITMP2, disp);
+ N_CL(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+ }
switch(iptr->opc) {
case ICMD_IF_LLT:
M_ALD(REG_A0, REG_SP, rd->memuse * 4);
disp = dseg_add_functionptr(cd, LOCK_monitor_exit);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_ASUB_IMM(96, REG_SP);
M_CALL(REG_ITMP3);
M_SLL_IMM(2, REG_ITMP1); /* scale by 4 */
M_ASUB_IMM(cd->dseglen, REG_ITMP1);
- N_L(REG_ITMP1, 0, REG_ITMP1, REG_PV);
+ N_L(REG_ITMP1, -N_PV_OFFSET, REG_ITMP1, REG_PV);
M_JMP(RN, REG_ITMP1);
break;
else {
if (IS_2_WORD_TYPE(var->type)) {
d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(d, REG_SP, md->params[s3].regoff * 4);
+ M_LST(d, REG_SP, md->params[s3].regoff);
}
else {
d = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(d, REG_SP, md->params[s3].regoff * 4);
+ M_IST(d, REG_SP, md->params[s3].regoff);
}
}
}
else {
d = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(d, REG_SP, md->params[s3].regoff * 4);
+ M_DST(d, REG_SP, md->params[s3].regoff);
else
- M_FST(d, REG_SP, md->params[s3].regoff * 4);
+ M_FST(d, REG_SP, md->params[s3].regoff);
}
}
}
disp = dseg_add_functionptr(cd, bte->fp);
M_ASUB_IMM(96, REG_SP); /* register save area as required by C abi */
- N_LHI(REG_ITMP1, disp);
- N_L(REG_PV, 0, REG_ITMP1, REG_PV);
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_L(REG_PV, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ N_LHI(REG_ITMP1, disp);
+ N_L(REG_PV, -N_PV_OFFSET, REG_ITMP1, REG_PV);
+ }
break;
case ICMD_INVOKESPECIAL:
else
disp = dseg_add_address(cd, lm->stubroutine);
- N_LHI(REG_ITMP1, disp);
- N_L(REG_PV, 0, REG_ITMP1, REG_PV);
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_L(REG_PV, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ N_LHI(REG_ITMP1, disp);
+ N_L(REG_PV, -N_PV_OFFSET, REG_ITMP1, REG_PV);
+ }
break;
case ICMD_INVOKEVIRTUAL:
disp);
ICONST(REG_ITMP2, ACC_INTERFACE);
- ICONST(REG_ITMP3, disp); /* TODO negative displacement */
- N_N(REG_ITMP2, 0, REG_ITMP3, REG_PV);
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_N(REG_ITMP2, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ ICONST(REG_ITMP3, disp);
+ N_N(REG_ITMP2, -N_PV_OFFSET, REG_ITMP3, REG_PV);
+ }
emit_label_beq(cd, LABEL_CLASS);
}
}
M_ALD(REG_ITMP2, s1, OFFSET(java_objectheader, vftbl));
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
CODEGEN_CRITICAL_SECTION_START;
M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, baseval));
M_ISUB(REG_ITMP3, REG_ITMP2);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval));
CODEGEN_CRITICAL_SECTION_END;
else
disp = dseg_add_address(cd, iptr->sx.s23.s3.c.cls);
- M_ALD(REG_A1, REG_PV, disp);
+ M_ALD_DSEG(REG_A1, disp);
disp = dseg_add_functionptr(cd, BUILTIN_arraycheckcast);
- M_ALD(REG_ITMP1, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP1, disp);
M_ASUB_IMM(96, REG_SP);
M_JSR(REG_RA, REG_ITMP1);
M_AADD_IMM(96, REG_SP);
iptr->sx.s23.s3.c.ref, disp);
ICONST(REG_ITMP2, ACC_INTERFACE);
- ICONST(REG_ITMP3, disp); /* TODO negative displacement */
- N_N(REG_ITMP2, 0, REG_ITMP3, REG_PV);
+
+ if (N_VALID_DSEG_DISP(disp)) {
+ N_N(REG_ITMP2, N_DSEG_DISP(disp), RN, REG_PV);
+ } else {
+ ICONST(REG_ITMP3, disp);
+ N_N(REG_ITMP2, -N_PV_OFFSET, REG_ITMP3, REG_PV);
+ }
+
emit_label_beq(cd, LABEL_CLASS);
}
}
M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
- M_ALD(REG_ITMP2, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP2, disp);
CODEGEN_CRITICAL_SECTION_START;
/* a1 = classinfo */
- M_ALD(REG_A1, REG_PV, disp);
+ M_ALD_DSEG(REG_A1, disp);
/* a2 = pointer to dimensions = stack pointer */
M_MOV(REG_SP, REG_A2);
disp = dseg_add_functionptr(cd, BUILTIN_multianewarray);
- M_ALD(REG_ITMP1, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP1, disp);
M_ASUB_IMM(96, REG_SP);
M_JSR(REG_RA, REG_ITMP1);
M_AADD_IMM(96, REG_SP);
/* don't touch ITMP3 as it cointains the return address */
- M_ISUB_IMM((3 * 4), REG_PV); /* suppress negative displacements */
+ M_AADD_IMM(N_PV_OFFSET, REG_PV); /* suppress negative displacements */
- M_ILD(REG_ITMP1, REG_PV, 1 * 4); /* methodinfo */
+ M_ILD_DSEG(REG_ITMP1, -2 * SIZEOF_VOID_P); /* methodinfo */
/* TODO where is methodpointer loaded into itmp2? is it already inside? */
- M_ILD(REG_PV, REG_PV, 0 * 4); /* compiler pointer */
+ M_ILD_DSEG(REG_PV, -3 * SIZEOF_VOID_P); /* compiler pointer */
N_BR(REG_PV);
}
/* generate stub code */
N_AHI(REG_SP, -(cd->stackframesize * SIZEOF_VOID_P));
+ N_AHI(REG_PV, N_PV_OFFSET);
/* save return address */
codegen_add_patch_ref(cd, PATCHER_resolve_native, m, disp);
#endif
- M_ILD(REG_ITMP1, REG_PV, disp);
+ M_ILD_DSEG(REG_ITMP1, disp);
j = 96 + (nmd->memuse * 4);
/* create dynamic stack info */
N_LAE(REG_A0, (cd->stackframesize - 1) * 4, RN, REG_SP); /* datasp */
- N_LR(REG_A1, REG_PV); /* pv */
+ N_LA(REG_A1, -N_PV_OFFSET, RN, REG_PV); /* pv */
N_LAE(REG_A2, cd->stackframesize * 4, RN, REG_SP); /* old SP */
N_L(REG_A3, (cd->stackframesize - 1) * 4, RN, REG_SP); /* return address */
disp = dseg_add_functionptr(cd, codegen_start_native_call);
- M_ILD(REG_ITMP1, REG_PV, disp);
+ M_ILD_DSEG(REG_ITMP1, disp);
M_CALL(REG_ITMP1); /* call */
N_STM(
GET_HIGH_REG(s1),
GET_LOW_REG(s1),
- 96 + (s2 * 4), REG_SP
+ 96 + s2, REG_SP
);
} else {
N_ST(
s1,
- 96 + (s2 * 4), RN, REG_SP
+ 96 + s2, RN, REG_SP
);
}
}
} else {
- s1 = cd->stackframesize + md->params[i].regoff;
+ s1 = cd->stackframesize * 4 + md->params[i].regoff;
s2 = nmd->params[j].regoff;
if (IS_2_WORD_TYPE(t)) {
- N_MVC(96 + (s2 * 4), 8, REG_SP, (s1 * 4), REG_SP);
+ N_MVC(96 + s2, 8, REG_SP, s1, REG_SP);
} else {
- N_MVC(96 + (s2 * 4), 4, REG_SP, (s1 * 4), REG_SP);
+ N_MVC(96 + s2, 4, REG_SP, s1, REG_SP);
}
}
/* registers keep unchanged. */
if (md->params[i].inmemory) {
- s1 = cd->stackframesize + md->params[i].regoff;
+ s1 = cd->stackframesize * 4 + md->params[i].regoff;
s2 = nmd->params[j].regoff;
if (IS_2_WORD_TYPE(t)) {
- N_MVC(96 + (s2 * 4), 8, REG_SP, (s1 * 4), REG_SP);
+ N_MVC(96 + s2, 8, REG_SP, s1, REG_SP);
} else {
- N_MVC(96 + (s2 * 4), 4, REG_SP, (s1 * 4), REG_SP);
+ N_MVC(96 + s2, 4, REG_SP, s1, REG_SP);
}
}
}
if (m->flags & ACC_STATIC) {
disp = dseg_add_address(cd, m->class);
- M_ILD(REG_A1, REG_PV, disp);
+ M_ILD_DSEG(REG_A1, disp);
}
/* put env into first argument register */
disp = dseg_add_address(cd, _Jv_env);
- M_ILD(REG_A0, REG_PV, disp);
+ M_ILD_DSEG(REG_A0, disp);
/* do the native function call */
N_LAE(REG_A0, (cd->stackframesize - 1) * 4, RN, REG_SP); /* datasp */
disp = dseg_add_functionptr(cd, codegen_finish_native_call);
- M_ILD(REG_ITMP1, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP1, disp);
M_CALL(REG_ITMP1);
N_LR(REG_ITMP3, REG_RESULT);
#endif
disp = dseg_add_functionptr(cd, asm_handle_nat_exception);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_JMP(RN, REG_ITMP3);
/* generate patcher stubs */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: codegen.h 8123 2007-06-20 23:50:55Z michi $
*/
#define N_VALID_DISP(x) ((N_DISP_MIN <= (x)) && ((x) <= N_DISP_MAX))
#define ASSERT_VALID_DISP(x) assert(N_VALID_DISP(x))
+#define N_PV_OFFSET (-0xFFC)
+#define N_DSEG_DISP(x) ((x) - N_PV_OFFSET)
+#define N_VALID_DSEG_DISP(x) N_VALID_DISP(N_DSEG_DISP(x))
+
#define N_BRANCH_MIN -32768
#define N_BRANCH_MAX 32767
#define N_VALID_BRANCH(x) ((N_BRANCH_MIN <= (x)) && ((x) <= N_BRANCH_MAX))
#define DD_NO 14
#define DD_ANY 15
+#define DD_0 8
+#define DD_1 4
+#define DD_2 2
+#define DD_3 1
+
/* Misc */
/* Trap instruction.
# define N_J(i2) N_BRC(DD_ANY, i2)
# define SZ_BRC SZ_RI
# define SZ_J SZ_RI
+# define N_BRC_BACK_PATCH(brc_pos) \
+ do { \
+ *(u4 *)(brc_pos) |= (u4)(cd->mcodeptr - (brc_pos)) / 2; \
+ } while (0)
#define N_BRCT(r1, i2) N_RI(0xA7, 0x6, r1, (i2) / 2)
#define N_BRXH(r1, r3, i2) N_RSI(0x84, r1, r3, (i2) / 2)
#define N_BRXLE(r1, r3, i2) N_RSI(0x85, r1, r2, (i2) / 2)
#define N_LCXBR(r1, r2) N_RRE(0xB343, r1, r2)
#define N_LDEBR(r1, r2) N_RRE(0xB304, r1, r2)
+# define SZ_LDEBR SZ_RRE
#define N_LXDBR(r1, r2) N_RRE(0xB305, r1, r2)
#define N_LXEBR(r1, r2) N_RRE(0xB306, r1, r2)
#define N_LDXBR(r1, r2) N_RRE(0xB345, r1, r2)
#define N_LEXBR(r1, r2) N_RRE(0xB346, r1, r2)
+#define N_LTEBR(r1, r2) N_RRE(0xB302, r1, r2)
+#define N_LTDBR(r1, r2) N_RRE(0xB312, r1, r2)
+#define N_LTXBR(r1, r2) N_RRE(0xB342, r1, r2)
+
#define N_MEEBR(r1, r2) N_RRE(0xB317, r1, r2)
#define N_MDBR(r1, r2) N_RRE(0xB31C, r1, r2)
#define N_MXBR(r1, r2) N_RRE(0xB34C, r1, r2)
} \
} while (0)
+#define M_ILD_DSEG(r, d) M_ILD(r, REG_PV, N_DSEG_DISP(d))
+
#define M_ALD(r, b, d) M_ILD(r, b, d)
+#define M_ALD_DSEG(r, d) M_ALD(r, REG_PV, N_DSEG_DISP(d))
#define M_LDA(r, b, d) \
do { \
N_LA(r, 0, r, b); \
} \
} while (0)
+#define M_LDA_DSEG(r, d) M_LDA(r, REG_PV, N_DSEG_DISP(d))
#define M_FLD(r, b, d) N_LE(r, d, RN, b)
-
#define M_FLDN(r, b, d, t) _IFNEG( \
d, \
N_LHI(t, d); N_LE(r, 0, t, b), \
N_LE(r, d, RN, b) \
)
-
+#define M_FLD_DSEG(r, d, t) M_FLDN(r, REG_PV, N_DSEG_DISP(d), t)
+
#define M_DLD(r, b, d) N_LD(r, d, RN, b)
#define M_DLDN(r, b, d, t) _IFNEG( \
d, \
N_LHI(t, d); N_LD(r, 0, t, b), \
N_LD(r, d, RN, b) \
)
+#define M_DLD_DSEG(r, d, t) M_DLDN(r, REG_PV, N_DSEG_DISP(d), t)
#define M_LLD(r, b, d) _IFNEG( \
d, \
N_L(GET_LOW_REG(r), 4, GET_LOW_REG(r), b), \
N_L(GET_HIGH_REG(r), (d) + 0, RN, b); N_L(GET_LOW_REG(r), (d) + 4, RN, b) \
)
+#define M_LLD_DSEG(r, d) M_LLD(r, REG_PV, N_DSEG_DISP(d)
/* MOV(a, b) -> mov from A to B */
#define M_DSUB(a, dest) N_SDBR(dest, a)
#define M_DADD(a, dest) N_ADBR(dest, a)
#define M_DDIV(a, dest) N_DDBR(dest, a)
-#define M_CVTFI(src, dst) N_CFEBR(dst, 5, src)
-#define M_CVTDI(src, dst) N_CFDBR(dst, 5, src)
+#define M_CVTFI(src, dst) N_CFEBR(dst, 4, src)
+#define M_CVTDI(src, dst) N_CFDBR(dst, 4, src)
#define M_IADD(a, dest) N_AR(dest, a)
#define M_AADD(a, dest) N_AR(dest, a)
#define M_ISUB(a, dest) N_SR(dest, a)
N_LHI(reg, i); \
} else { \
disp = dseg_add_s4(cd, (i)); \
- M_ILD(reg, REG_PV, disp); \
+ M_ILD_DSEG(reg, disp); \
} \
} while (0)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
*/
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
if (IS_FLT_DBL_TYPE(src->type)) {
if (IS_2_WORD_TYPE(src->type))
if (IS_FLT_DBL_TYPE(dst->type)) {
if (IS_2_WORD_TYPE(dst->type))
- M_DST(d, REG_SP, dst->vv.regoff * 4);
+ M_DST(d, REG_SP, dst->vv.regoff);
else
- M_FST(d, REG_SP, dst->vv.regoff * 4);
+ M_FST(d, REG_SP, dst->vv.regoff);
}
else {
if (IS_2_WORD_TYPE(dst->type))
- M_LST(d, REG_SP, dst->vv.regoff * 4);
+ M_LST(d, REG_SP, dst->vv.regoff);
else
- M_IST(d, REG_SP, dst->vv.regoff * 4);
+ M_IST(d, REG_SP, dst->vv.regoff);
}
}
}
/* Generating long branches */
- disp = dseg_add_s4(cd, savedmcodeptr - cd->mcodebase);
+ disp = dseg_add_s4(cd, savedmcodeptr - cd->mcodebase - N_PV_OFFSET);
- M_ILD(REG_ITMP3, REG_PV, disp);
+ M_ILD_DSEG(REG_ITMP3, disp);
M_AADD(REG_PV, REG_ITMP3);
/* Do the branch at the end of NOP sequence.
(void) dseg_add_unique_address(cd, lock_get_initial_lock_word());
disp = dseg_add_unique_address(cd, NULL); /* vftbl */
- M_LDA(REG_ITMP3, REG_PV, disp);
+ M_LDA_DSEG(REG_ITMP3, disp);
M_AST(REG_ITMP3, REG_SP, 4 * 4);
#else
/* nothing to do */
/* move machine code onto stack */
disp = dseg_add_s4(cd, mcode);
- M_ILD(REG_ITMP3, REG_PV, disp);
+ M_ILD_DSEG(REG_ITMP3, disp);
M_IST(REG_ITMP3, REG_SP, 3 * 4);
/* move class/method/field reference onto stack */
disp = dseg_add_address(cd, pref->ref);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_AST(REG_ITMP3, REG_SP, 2 * 4);
/* move data segment displacement onto stack */
disp = dseg_add_s4(cd, pref->disp);
- M_ILD(REG_ITMP3, REG_PV, disp);
+ M_ILD_DSEG(REG_ITMP3, disp);
M_IST(REG_ITMP3, REG_SP, 1 * 4);
/* move patcher function pointer onto stack */
disp = dseg_add_functionptr(cd, pref->patcher);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_AST(REG_ITMP3, REG_SP, 0 * 4);
if (targetdisp == 0) {
targetdisp = (cd->mcodeptr) - (cd->mcodebase);
disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
- M_ALD(REG_ITMP3, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP3, disp);
M_JMP(RN, REG_ITMP3);
}
else {
/* Finally load methodinfo argument */
disp = dseg_add_address(cd, m);
- M_ALD(REG_ITMP2, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP2, disp);
M_AST(REG_ITMP2, REG_SP, 6 * 8);
/* Call builtin_verbosecall_enter */
disp = dseg_add_address(cd, builtin_verbosecall_enter);
- M_ALD(REG_ITMP2, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP2, disp);
M_ASUB_IMM(96, REG_SP);
M_CALL(REG_ITMP2);
M_AADD_IMM(96, REG_SP);
}
disp = dseg_add_address(cd, m);
- M_ALD(REG_A2, REG_PV, disp);
+ M_ALD_DSEG(REG_A2, disp);
/* REG_FRESULT is REG_FA0, so no need to move */
M_FLTMOVE(REG_FRESULT, REG_FA1);
disp = dseg_add_address(cd, builtin_verbosecall_exit);
- M_ALD(REG_ITMP1, REG_PV, disp);
+ M_ALD_DSEG(REG_ITMP1, disp);
M_ASUB_IMM(96, REG_SP);
M_CALL(REG_ITMP1);
M_AADD_IMM(96, REG_SP);
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp);
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 4;
+ disp = src->vv.regoff;
M_ILD(tempreg, REG_SP, disp + 4);
codegendata *cd = jd->cd;
s4 reg = emit_load_s2(jd, iptr, tempreg);
if (reg == 0) {
- M_MOV(reg, tempreg);
+ if (IS_FLT_DBL_TYPE(VAROP(iptr->sx.s23.s2)->type)) {
+ M_FMOV(reg, tempreg);
+ } else {
+ M_MOV(reg, tempreg);
+ }
return tempreg;
} else {
return reg;
codegendata *cd = jd->cd;
s4 reg = emit_load_s1(jd, iptr, tempreg);
if (reg == notreg) {
- M_MOV(reg, tempreg);
+ if (IS_FLT_DBL_TYPE(VAROP(iptr->s1)->type)) {
+ M_FMOV(reg, tempreg);
+ } else {
+ M_MOV(reg, tempreg);
+ }
return tempreg;
} else {
return reg;
codegendata *cd = jd->cd;
s4 reg = emit_load_s2(jd, iptr, tempreg);
if (reg == notreg) {
- M_MOV(reg, tempreg);
+ if (IS_FLT_DBL_TYPE(VAROP(iptr->sx.s23.s2)->type)) {
+ M_FMOV(reg, tempreg);
+ } else {
+ M_MOV(reg, tempreg);
+ }
return tempreg;
} else {
return reg;
/* The actual long branch */
- disp = dseg_add_s4(cd, branchmpc + disp);
- M_ILD(REG_ITMP3, REG_PV, disp);
+ disp = dseg_add_s4(cd, branchmpc + disp - N_PV_OFFSET);
+ M_ILD_DSEG(REG_ITMP3, disp);
M_AADD(REG_PV, REG_ITMP3);
M_JMP(RN, REG_ITMP3);
}
void emit_restore_pv(codegendata *cd) {
- s4 offset;
+ s4 offset, offset_imm;
/*
N_BASR(REG_PV, RN);
/* Displacement from start of method to here */
offset = (s4) (cd->mcodeptr - cd->mcodebase);
+ offset_imm = -offset - SZ_BASR + N_PV_OFFSET;
- if (N_VALID_IMM(-(offset + SZ_BASR))) {
+ if (N_VALID_IMM(offset_imm)) {
/* Get program counter */
N_BASR(REG_PV, RN);
/* Substract displacement */
- M_ASUB_IMM(offset + SZ_BASR, REG_PV);
+ M_AADD_IMM(offset_imm, REG_PV);
} else {
/* Save program counter and jump over displacement in instruction flow */
N_BRAS(REG_PV, SZ_BRAS + SZ_LONG);
/* Place displacement here */
/* REG_PV points now exactly to this position */
- N_LONG(offset + SZ_BRAS);
+ N_LONG(-offset - SZ_BRAS + N_PV_OFFSET);
/* Substract *(REG_PV) from REG_PV */
- N_S(REG_PV, 0, RN, REG_PV);
+ N_A(REG_PV, 0, RN, REG_PV);
}
}
Changes:
- $Id: md-abi.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
else {
/* _ALIGN(stacksize); */
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
iarg = INT_ARG_CNT;
stacksize += 2;
}
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize++;
}
break;
else {
/* _ALIGN(stacksize); */
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize * 4;
stacksize += 2;
}
break;
Changes: Edwin Steiner
- $Id: md.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: md.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vm/exceptions.h"
#include "vm/signallocal.h"
#include "vm/jit/asmpart.h"
+#include "vm/jit/methodheader.h"
#include "vm/jit/stacktrace.h"
#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
void md_dump_context(u1 *pc, mcontext_t *mc) {
int i;
+ u1 *pv;
+ methodinfo *m;
union {
u8 l;
log_println("Program counter: 0x%08X", pc);
+ pv = codegen_get_pv_from_pc_nocheck(pc);
+ if (pv == NULL) {
+ log_println("No java method found at location.");
+ } else {
+ m = ((codeinfo *)(pv + CodeinfoPointer))->m;
+ log_println(
+ "Java method: class %s, method %s, descriptor %s.",
+ utf_bytes(m->class->name), utf_bytes(m->name), utf_bytes(m->descriptor)
+ );
+ }
+
#if defined(ENABLE_DISASSEMBLER)
log_println("Printing instruction at program counter:");
disassinstr(pc);
vm_abort("%s: segmentation fault at %p, aborting.", __FUNCTION__, xpc);
}
- pv = (u1 *)_mc->gregs[REG_PV];
+ pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
sp = (u1 *)_mc->gregs[REG_SP];
ra = xpc;
type = EXCEPTION_HARDWARE_NULLPOINTER;
/* bits 3-0 designate the exception type */
type = xpc[1] & 0xF;
- pv = (u1 *)_mc->gregs[REG_PV];
+ pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
sp = (u1 *)_mc->gregs[REG_SP];
val = (ptrint)_mc->gregs[reg];
} else if (_mc->gregs[r2] == 0) {
/* division by 0 */
- pv = (u1 *)_mc->gregs[REG_PV];
+ pv = (u1 *)_mc->gregs[REG_PV] - N_PV_OFFSET;
sp = (u1 *)_mc->gregs[REG_SP];
ra = xpc;
u1 *md_get_method_patch_address(u1 *ra, stackframeinfo *sfi, u1 *mptr)
{
- u1 base;
+ u1 base, index;
s4 offset;
u1 *pa; /* patch address */
/* get the base register of the load */
base = ra[2] >> 4;
+ index = ra[1] & 0xF;
/* check for the different calls */
- if (base == 0xd) { /* pv relative */
- /* INVOKESTATIC/SPECIAL */
+ switch (base) {
+ case 0xd:
+ /* INVOKESTATIC/SPECIAL */
- /* the offset is in the load before the load */
+
+ switch (index) {
+ case 0x0:
+ /* the offset is in the load instruction */
+ offset = ((*(u2 *)(ra + 2)) & 0xFFF) + N_PV_OFFSET;
+ break;
+ case 0x1:
+ /* the offset is in the immediate load before the load */
+ offset = *((s2 *) (ra - 2));
+ break;
+ default:
+ assert(0);
+ }
- offset = *((s2 *) (ra - 2));
+ /* add the offset to the procedure vector */
- /* add the offset to the procedure vector */
+ pa = sfi->pv + offset;
- pa = sfi->pv + offset;
- }
- else if (base == 0xc) { /* mptr relative */
- /* INVOKEVIRTUAL/INTERFACE */
+ break;
- offset = *((u2 *)(ra + 2)) & 0xFFF;
+ case 0xc:
+ /* mptr relative */
+ /* INVOKEVIRTUAL/INTERFACE */
- /* add offset to method pointer */
-
- pa = mptr + offset;
- }
- else {
- /* catch any problems */
- assert(0);
+ offset = *((u2 *)(ra + 2)) & 0xFFF;
+
+ /* add offset to method pointer */
+
+ pa = mptr + offset;
+ break;
+ default:
+ /* catch any problems */
+ assert(0);
+ break;
}
return pa;
Changes:
- $Id: patcher.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: patcher.c 8123 2007-06-20 23:50:55Z michi $
GENERATED PATCHER BRANCH AFTER PATCH
return true;
}
-
-/* patcher_putfieldconst *******************************************************
-
- Machine code:
-
- <patched call position>
- 41 c7 85 00 00 00 00 7b 00 00 00 movl $0x7b,0x0(%r13)
-
-*******************************************************************************/
-
-bool patcher_putfieldconst(u1 *sp)
-{
- OOPS();
- u1 *ra;
- u8 mcode;
- unresolved_field *uf;
- fieldinfo *fi;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
-
- /* get the fieldinfo */
-
- if (!(fi = resolve_field_eager(uf)))
- return false;
-
- /* patch back original code */
-
- *((u8 *) ra) = mcode;
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + 5;
-
- /* patch the field's offset */
-
- if (IS_2_WORD_TYPE(fi->type) || IS_ADR_TYPE(fi->type)) {
- /* handle special case when the base register is %r12 */
-
- if (*(ra + 2) == 0x84) {
- *((u4 *) (ra + 4)) = (u4) (fi->offset);
- *((u4 *) (ra + 12 + 4)) = (u4) (fi->offset + 4);
- }
- else {
- *((u4 *) (ra + 3)) = (u4) (fi->offset);
- *((u4 *) (ra + 11 + 3)) = (u4) (fi->offset + 4);
- }
- }
- else {
- /* handle special case when the base register is %r12 */
-
- if (*(ra + 2) == 0x84)
- *((u4 *) (ra + 4)) = (u4) (fi->offset);
- else
- *((u4 *) (ra + 3)) = (u4) (fi->offset);
- }
-
- return true;
-}
-
-
-/* patcher_aconst **************************************************************
-
- Machine code:
-
- <patched call position>
- 48 bf a0 f0 92 00 00 00 00 00 mov $0x92f0a0,%rdi
-
-*******************************************************************************/
-
-bool patcher_aconst(u1 *sp)
-{
- OOPS();
- u1 *ra;
- u8 mcode;
- constant_classref *cr;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
- /* get the classinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch back original code */
-
- *((u8 *) ra) = mcode;
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + 5;
-
- /* patch the classinfo pointer */
-
- *((ptrint *) (ra + 2)) = (ptrint) c;
-
- return true;
-}
-
-
-/* patcher_builtin_multianewarray **********************************************
-
- Machine code:
-
- <patched call position>
- 48 bf 02 00 00 00 00 00 00 00 mov $0x2,%rdi
- 48 be 30 40 b2 00 00 00 00 00 mov $0xb24030,%rsi
- 48 89 e2 mov %rsp,%rdx
- 48 b8 7c 96 4b 00 00 00 00 00 mov $0x4b967c,%rax
- 48 ff d0 callq *%rax
-
-*******************************************************************************/
-
-bool patcher_builtin_multianewarray(u1 *sp)
-{
- OOPS();
- u1 *ra;
- u8 mcode;
- constant_classref *cr;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
- /* get the classinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch back original code */
-
- *((u8 *) ra) = mcode;
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + 5;
-
- /* patch the classinfo pointer */
-
- *((ptrint *) (ra + 10 + 2)) = (ptrint) c;
-
- return true;
-}
-
-
-/* patcher_builtin_arraycheckcast **********************************************
-
- Machine code:
-
- <patched call position>
- 48 be b8 3f b2 00 00 00 00 00 mov $0xb23fb8,%rsi
- 48 b8 00 00 00 00 00 00 00 00 mov $0x0,%rax
- 48 ff d0 callq *%rax
-
-*******************************************************************************/
-
-bool patcher_builtin_arraycheckcast(u1 *sp)
-{
- OOPS();
- u1 *ra;
- u8 mcode;
- constant_classref *cr;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
- /* get the classinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch back original code */
-
- *((u8 *) ra) = mcode;
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + 5;
-
- /* patch the classinfo pointer */
-
- *((ptrint *) (ra + 2)) = (ptrint) c;
-
- return true;
-}
-
-
/* patcher_invokestatic_special ************************************************
Machine code:
return true;
}
-
-/* patcher_checkcast_class *****************************************************
-
- Machine code:
-
- <patched call position>
- 49 bb 00 00 00 00 00 00 00 00 mov $0x0,%r11
- 45 8b 92 20 00 00 00 mov 0x20(%r10),%r10d
- 45 8b 9b 20 00 00 00 mov 0x20(%r11),%r11d
- 4d 29 da sub %r11,%r10
- 49 bb 00 00 00 00 00 00 00 00 mov $0x0,%r11
-
-*******************************************************************************/
-
-bool patcher_checkcast_class(u1 *sp)
-{
- OOPS();
- u1 *ra;
- u8 mcode;
- constant_classref *cr;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
- /* get the fieldinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch back original code */
-
- *((u8 *) ra) = mcode;
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + 5;
-
- /* patch super class' vftbl */
-
- *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
- *((ptrint *) (ra + 10 + 7 + 7 + 3 + 2)) = (ptrint) c->vftbl;
-
- return true;
-}
-
-
-/* patcher_instanceof_class ****************************************************
-
- Machine code:
-
- <patched call position>
- 49 ba 00 00 00 00 00 00 00 00 mov $0x0,%r10
-
-*******************************************************************************/
-
-bool patcher_instanceof_class(u1 *sp)
-{
- OOPS();
- u1 *ra;
- u8 mcode;
- constant_classref *cr;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- mcode = *((u8 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
-
- /* get the fieldinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch back original code */
-
- *((u8 *) ra) = mcode;
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + 5;
-
- /* patch super class' vftbl */
-
- *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
-
- return true;
-}
-
-
/* patcher_clinit **************************************************************
May be used for GET/PUTSTATIC and in native stub.
* Wed May 9 23:58:51 CEST 2007: (ibm java) ===== DaCapo antlr PASSED in 269244 msec =====
* Thu May 10 00:05:50 CEST 2007: ===== DaCapo antlr PASSED in 70164 msec =====
* Thu May 10 08:54:54 CEST 2007: (ibm java intrp) ===== DaCapo antlr PASSED in 686373 msec =====
-
+ * Sun Jun 17 15:43:49 CEST 2007: ===== DaCapo antlr PASSED in 73151 msec =====
bloat
eclipse
* executes some of the (non-gui) jdt performance tests for the Eclipse IDE
+ * Mon Jun 11 22:20:00 CEST 2007: ===== DaCapo eclipse PASSED in 1647658 msec =====
+ * Tue Jun 12 19:15:04 CEST 2007: ===== DaCapo eclipse PASSED in 2733857 msec =====
fop
lusearch
* Uses lucene to do a text search of keywords over a corpus of data comprising the works of Shakespeare and the King James Bible
+ * Mon Jun 11 17:21:09 CEST 2007: ===== DaCapo lusearch PASSED in 386295 msec =====
+ * Sun Jun 17 15:44:15 CEST 2007: ===== DaCapo lusearch PASSED in 692290 msec ===== *
pmd
=> branch to patcher overflow
* HANGUP !
+
+<<<<<<<<<<<<<<<<<<<<<<< Eclispe 10 runs 06.06.2007 >>>>>>>>>>>>>>>>>>>>>>>
+
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+Exception in thread "Java indexing" java.lang.OutOfMemoryError
+ at org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(Util.java:238)
+ at org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(Util.java)
+ at org.eclipse.jdt.internal.core.search.JavaSearchDocument.getCharContents(JavaSearchDocument.java:58)
+ at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexDocument(SourceIndexer.java:87)
+ at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:76)
+ at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java)
+ at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java)
+ at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java)
+ at java.lang.Thread.run(Thread.java:741)
+ at java.lang.VMThread.run(VMThread.java:148)
+Digest validation failed for stderr.log, expecting 0xda39a3ee5e6b4b0d3255bfef95601890afd80709 found 0xd291dacf7614656c68267e6bb8a3d23fe1815c37
+===== DaCapo eclipse FAILED =====
+Validation FAILED for eclipse small
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 1703309 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2303868 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2458292 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 1642183 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2391901 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 1748244 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2685671 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+===== DaCapo eclipse PASSED in 2100417 msec =====
+===== DaCapo eclipse starting =====
+<setting up workspace...>
+<creating projects..............................................................>
+<running tests at level 0...>
+<performing AST tests...>
+ AST creation: org.eclipse.jdt.internal.compiler.parser
+Exception in thread "Java indexing" java.lang.OutOfMemoryError
+ at org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(Util.java:238)
+ at org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(Util.java)
+ at org.eclipse.jdt.internal.core.search.JavaSearchDocument.getCharContents(JavaSearchDocument.java:58)
+ at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.indexDocument(SourceIndexer.java:87)
+ at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:76)
+ at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java)
+ at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java)
+ at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java)
+ at java.lang.Thread.run(Thread.java:741)
+ at java.lang.VMThread.run(VMThread.java:148)
+Digest validation failed for stderr.log, expecting 0xda39a3ee5e6b4b0d3255bfef95601890afd80709 found 0xd291dacf7614656c68267e6bb8a3d23fe1815c37
+===== DaCapo eclipse FAILED =====
+Validation FAILED for eclipse small
+
+<<<<<<<<<<<<<<<<<<<<<<< End Eclispe 10 runs >>>>>>>>>>>>>>>>>>>>>>>
asm_vm_call_method_double:
save %sp,-((JITSTACK_CNT+2)*8),%sp
- add %sp,JITSTACK,%l1 /* right above window save area */
-
-
- /* %i1 not needed after _nocopy -> calculate in branch delay */
-
- brlez %i1, calljava_nocopy
+ add %sp,JITSTACK,%l1 /* pointer to usable stack */
+
+ /* i0: PV */
+ /* i1: ptr to arg array */
+ /* i2: num stackargs */
+
+ ldx [%i1+0*8],%o0
+ ldx [%i1+1*8],%o1
+ ldx [%i1+2*8],%o2
+ ldx [%i1+3*8],%o3
+ ldx [%i1+4*8],%o4
+
+ ldd [%i1+5*8],fa0
+ ldd [%i1+6*8],fa1
+ ldd [%i1+7*8],fa2
+ ldd [%i1+8*8],fa3
+ ldd [%i1+9*8],fa4
+
+ brlez %i2, calljava_nocopy
+ nop /* delay: fill me! */
- dec %i1 /* branch delay */
- ldx [%i2 + offvmargdata],%o0
- ldx [%i2 + offvmargtype],%l2
- cmp %l2,2
- be,a %xcc,calljava_arg0isfloat
- ld [%i2 + offvmargdata],fa0f /* delay: annulled if branch not taken */
- ldd [%i2 + offvmargdata],fa0
-calljava_arg0isfloat:
- brlez %i1,calljava_nocopy
-
- dec %i1 /* branch delay */
- ldx [%i2 + (offvmargdata+sizevmarg*1)],%o1
- ldx [%i2 + (offvmargtype+sizevmarg*1)],%l2
- cmp %l2,2
- be,a %xcc,calljava_arg1isfloat
- ld [%i2 + (offvmargdata+sizevmarg*1)],fa1f
- ldd [%i2 + (offvmargdata+sizevmarg*1)],fa1
-calljava_arg1isfloat:
- brlez %i1,calljava_nocopy
-
- dec %i1
- ldx [%i2 + (offvmargdata+sizevmarg*2)],%o2
- ldx [%i2 + (offvmargtype+sizevmarg*2)],%l2
- cmp %l2,2
- be,a %xcc,calljava_arg2isfloat
- ld [%i2 + (offvmargdata+sizevmarg*2)],fa2f
- ldd [%i2 + (offvmargdata+sizevmarg*2)],fa2
-calljava_arg2isfloat:
- brlez %i1,calljava_nocopy
-
- dec %i1
- ldx [%i2 + (offvmargdata+sizevmarg*3)],%o3
- ldx [%i2 + (offvmargtype+sizevmarg*3)],%l2
- cmp %l2,2
- be,a %xcc,calljava_arg3isfloat
- ld [%i2 + (offvmargdata+sizevmarg*3)],fa3f
- ldd [%i2 + (offvmargdata+sizevmarg*3)],fa3
-calljava_arg3isfloat:
- brlez %i1,calljava_nocopy
-
- dec %i1
- ldx [%i2 + (offvmargdata+sizevmarg*4)],%o4
- ldx [%i2 + (offvmargtype+sizevmarg*4)],%l2
- cmp %l2,2
- be,a %xcc,calljava_arg4isfloat
- ld [%i2 + (offvmargdata+sizevmarg*4)],fa4f
- ldd [%i2 + (offvmargdata+sizevmarg*4)],fa4
-calljava_arg4isfloat:
-
-calljava_argsloaded:
- brlez %i1, calljava_nocopy
- nop
- sllx %i1,3,%l0 /* remaining args * 8 */
+ sllx %i2,3,%l0 /* remaining args * 8 */
sub %sp,%l0,%sp /* allocate more stack space */
add %sp,JITSTACK,%l1 /* adjust stack begin pointer */
-calljava_copyloop:
- ldx [%i2 + (offvmargtype+sizevmarg*5)],%l2
- cmp %l2,2
- be %xcc,calljava_copyloop_float
- nop
- ldx [%i2 + (offvmargdata+sizevmarg*5)],%l0
- stx %l0,[%l1]
- b calljava_copy_done
-calljava_copyloop_float:
- ld [%i2 + (offvmargdata+sizevmarg*5)],%f1
- std %f0,[%l1]
-calljava_copy_done:
- inc sizevmarg,%i2 /* src++ */
- subcc %i1,1,%i1 /* arg_count-- */
- bnz %xcc, calljava_copyloop /* use cc from previous instr */
+asm_vm_call_copyloop:
+ ldx [%i1+10*8],%l0 /* load argument from array */
+ stx %l0,[%l1] /* store argument to stack */
+
+ inc 8,%i1 /* src++ */
+ subcc %i2,1,%i2 /* arg_count-- */
+ bnz %xcc, asm_vm_call_copyloop /* use cc from previous instr */
inc 8,%l1 /* dst++ (delay) */
-
+
calljava_nocopy:
/* set pv, like a java method does */
- /* add ra_caller,(asm_vm_call_method - calljava_nocopy + 8),pv_callee */
setx asm_vm_call_method,%l0,pv_callee
- mov %i0,itmp1 /* pass method info pointer via itmp1 */
+ stx %i0,[%l1 + 1*8] /* store PV on stack */
+ mov %l1,mptr_itmp2 /* set address of PV (-1*8) */
- setx asm_call_jit_compiler,%l0,mptr_itmp2 /* fake virtual function call (2 instr) */
- stx mptr_itmp2,[%l1 + 1*8] /* store function address */
- mov %l1,mptr_itmp2 /* set method pointer */
-
- ldx [1*8 + mptr_itmp2], pv_caller /* method call as in Java */
- jmpl pv_caller,ra_caller /* call JIT compiler */
+ ldx [1*8 + mptr_itmp2], pv_caller /* load PV from stack */
+ jmpl pv_caller,ra_caller /* method call as in Java */
nop
+
calljava_jit2:
/* pretend to restore pv */
add ra_caller,(asm_vm_call_method - calljava_jit2 + 8),zero
mov pv_callee,%g4
/* save bigger stack frame for float args and temps */
- save %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+CSTACK_CNT)*8),%sp
+ save %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+16+CSTACK_CNT)*8),%sp
SAVE_FLOAT_ARGUMENT_REGISTERS(CSTACK_CNT)
SAVE_FLOAT_TEMPORARY_REGISTERS(CSTACK_CNT+FLT_ARG_CNT)
mov pv_callee,pv_caller
/* create window and stack frame */
- save %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+CSTACK_CNT+6)*8),%sp
+ save %sp,-((FLT_ARG_CNT+FLT_TMP_CNT+16+CSTACK_CNT+6)*8),%sp
SAVE_FLOAT_RETURN_REGISTER(CSTACK_CNT)
SAVE_FLOAT_ARGUMENT_REGISTERS(CSTACK_CNT+1)
{
s4 i, p, t, l;
- s4 savedregs_num, localbase;
+ s4 savedregs_num;
#if 0 /* no leaf optimization yet */
savedregs_num = (jd->isleafmethod) ? 0 : 1; /* space to save the RA */
md = m->parseddesc;
- /* when storing locals, use this as base */
- localbase = JITSTACK;
-
- /* since the register allocator does not know about the shifting window
- * arg regs need to be copied via the stack
- */
- if (md->argintreguse > 0) {
- /* allocate scratch space for copying in to save(i&l) regs */
- M_SUB_IMM(REG_SP, INT_ARG_CNT * 8, REG_SP);
-
- localbase += INT_ARG_CNT * 8;
-
- /* XXX could use the param slots on the stack for this! */
- for (p = 0; p < INT_ARG_CNT; p++)
- M_STX(REG_WINDOW_TRANSPOSE(abi_registers_integer_argument[p]), REG_SP, JITSTACK + (p * 8));
- }
-
-
for (p = 0, l = 0; p < md->paramcount; p++) {
t = md->paramtypes[p].type;
s1 = md->params[p].regoff;
if (IS_INT_LNG_TYPE(t)) { /* integer args */
+
+ s2 = var->vv.regoff;
if (!md->params[p].inmemory) { /* register arguments */
- /*s2 = rd->argintregs[s1];*/
- /*s2 = REG_WINDOW_TRANSPOSE(s2);*/
-
- /* need the argument index (p) here, not the register number */
+ s1 = REG_WINDOW_TRANSPOSE(s1);
if (!(var->flags & INMEMORY)) { /* reg arg -> register */
- /*M_INTMOVE(s2, var->vv.regoff);*/
- M_LDX(var->vv.regoff, REG_SP, JITSTACK + (p * 8));
- } else { /* reg arg -> spilled */
- /*M_STX(s2, REG_SP, (WINSAVE_CNT + var->vv.regoff) * 8);*/
-
- M_LDX(REG_ITMP1, REG_SP, JITSTACK + (p * 8));
- M_STX(REG_ITMP1, REG_SP, localbase + (var->vv.regoff * 8));
+ /* the register allocator does not know about the window. */
+ /* avoid copying the locals from save to save regs by */
+ /* swapping variables. */
+
+ {
+ int old_dest = var->vv.regoff;
+ int new_dest = p + 24;
+
+ /* run through all variables */
+
+ for (i = 0; i < jd->varcount; i++) {
+ varinfo* uvar = VAR(i);
+
+ if (IS_FLT_DBL_TYPE(uvar->type))
+ continue;
+
+ s2 = uvar->vv.regoff;
+
+ /* free the in reg by moving all other references */
+
+ if (s2 == new_dest) {
+ uvar->vv.regoff = old_dest;
+ /*printf("p%d-var[%d]: moved %d -> %d (to free save reg)\n", p, i, s2, old_dest);*/
+ }
+
+ /* move all variables to the in reg */
+
+ if (s2 == old_dest) {
+ uvar->vv.regoff = new_dest;
+ /*printf("p%d-var[%d]: moved %d -> %d (to avoid copy)\n", p, i, s2, new_dest);*/
+ }
+ }
+ }
+
+
+
+ }
+ else { /* reg arg -> spilled */
+ M_STX(s1, REG_SP, JITSTACK + var->vv.regoff);
}
} else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack arg -> register */
- M_LDX(var->vv.regoff, REG_FP, JITSTACK + (s1 * 8));
+ M_LDX(var->vv.regoff, REG_FP, JITSTACK + s1);
} else { /* stack arg -> spilled */
/* add the callers window save registers */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
M_FLTMOVE(s1, var->vv.regoff);
} else { /* reg arg -> spilled */
- M_DST(s1, REG_SP, localbase + (var->vv.regoff) * 8);
+ M_DST(s1, REG_SP, JITSTACK + var->vv.regoff);
}
} else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack-arg -> register */
- M_DLD(var->vv.regoff, REG_FP, JITSTACK + (s1 * 8));
+ M_DLD(var->vv.regoff, REG_FP, JITSTACK + s1);
} else { /* stack-arg -> spilled */
- var->vv.regoff = cd->stackframesize + s1;
+ var->vv.regoff = cd->stackframesize * 8 + s1;
}
}
}
} /* end for */
- if (md->argintreguse > 0) {
- /* release scratch space */
- M_ADD_IMM(REG_SP, INT_ARG_CNT * 8, REG_SP);
- }
-
-
-
}
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_STX(s1, REG_SP, JITSTACK + d * 8);
+ M_STX(s1, REG_SP, JITSTACK + d);
}
}
else {
}
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
- M_DST(s1, REG_SP, JITSTACK + d * 8);
+ M_DST(s1, REG_SP, JITSTACK + d);
}
}
}
s2 = nat_argintregs[nmd->params[j].regoff];
M_INTMOVE(s1, s2);
} else {
- s2 = nmd->params[j].regoff - 6;
- M_AST(s1, REG_SP, CSTACK + s2 * 8);
+ s2 = nmd->params[j].regoff - 6 * 8;
+ M_AST(s1, REG_SP, CSTACK + s2);
}
} else {
assert(false); /* path never taken */
}
- s1 = md->params[i].regoff + cd->stackframesize;
- s2 = nmd->params[j].regoff - 6;
- M_ALD(REG_ITMP1, REG_SP, CSTACK + s1 * 8);
- M_AST(REG_ITMP1, REG_SP, CSTACK + s2 * 8);
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
+ s2 = nmd->params[j].regoff - 6 * 8;
+ M_ALD(REG_ITMP1, REG_SP, CSTACK + s1);
+ M_AST(REG_ITMP1, REG_SP, CSTACK + s2);
}
} else {
}
else {
- s1 = md->params[i].regoff + cd->stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize * 8;
if (!nmd->params[j].inmemory) {
/* JIT stack -> NAT reg */
s2 = nmd->params[j].regoff;
- M_DLD(s2, REG_SP, CSTACK + s1 * 8);
+ M_DLD(s2, REG_SP, CSTACK + s1);
}
else {
/* JIT stack -> NAT stack */
- s2 = nmd->params[j].regoff - 6;
+ s2 = nmd->params[j].regoff - 6 * 8;
/* The FTMP register may already be loaded with args */
/* we know $f0 is unused because of the env pointer */
- M_DLD(REG_F0, REG_SP, CSTACK + s1 * 8);
- M_DST(REG_F0, REG_SP, CSTACK + s2 * 8);
+ M_DLD(REG_F0, REG_SP, CSTACK + s1);
+ M_DST(REG_F0, REG_SP, CSTACK + s2);
}
}
}
cd = jd->cd;
if (src->flags & INMEMORY) {
- COUNT_SPILLS;
+ COUNT_READ_SPILLS(src)
- disp = JITSTACK + src->vv.regoff * 8;
+ disp = JITSTACK + src->vv.regoff;
switch(src->type)
{
cd = jd->cd;
if (dst->flags & INMEMORY) {
- COUNT_SPILLS;
+ COUNT_WRITE_SPILLS(dst)
- disp = JITSTACK + dst->vv.regoff * 8;
+ disp = JITSTACK + dst->vv.regoff;
switch(dst->type)
{
void md_critical_section_restart(ucontext_t *_uc)
{
- mcontext_t *_mc;
+ /* mcontext_t *_mc; */
+ sigcontext *ctx;
u1 *pc;
u1 *npc;
- _mc = &_uc->uc_mcontext;
+ printf("ignoring md_critical_section_restart\n");
+ return;
- pc = (u1 *) _mc->mc_gregs[MC_PC];
+ /* again, we are getting sigcontext instead of ucontext */
+ ctx = (sigcontext *) _uc;
+
+ pc = (u1 *) ctx->sigc_regs.tpc;
npc = critical_find_restart_point(pc);
- assert(npc);
- _mc->mc_gregs[MC_NPC] = (ptrint) npc;
+ if (npc != NULL) {
+ log_println("md_critical_section_restart: pc=%p, npc=%p", pc, npc);
+ ctx->sigc_regs.tnpc = (ptrint) npc;
+ }
- assert(false); /* test this */
}
#endif
/* l0 l1 l2 l3 l4 l5 l6 l7 */
REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
- /* i0/v0 i1 i2 i3 i4 pv/i5 fp/i6 ra/i7 */
- REG_RET, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES,
+ /* i0 i1 i2 i3 i4 pv/i5 fp/i6 ra/i7 */
+ REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_RES, REG_RES, REG_RES,
REG_END
};
21, /* l5 */
22, /* l6 */
23, /* l7 */
+ 24, /* i0 */
25, /* i1 */
26, /* i2 */
27, /* i3 */
case TYPE_LNG:
if (i < INT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = reguse;
pd->regoff = abi_registers_integer_argument[reguse];
reguse++;
md->argintreguse = reguse;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
case TYPE_DBL:
if (i < FLT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = reguse;
pd->regoff = abi_registers_float_argument[reguse];
reguse++;
md->argfltreguse = reguse;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
#define INT_REG_CNT 32 /* number of integer registers */
-#define INT_SAV_CNT 12 /* number of int callee saved registers */
+#define INT_SAV_CNT 13 /* number of int callee saved registers */
#define INT_ARG_CNT 5 /* number of int argument registers (-1 for PV) */
#define INT_TMP_CNT 0 /* int temp registers (%g4-%g5) */
#define INT_RES_CNT 14 /* number of reserved integer registers */
/* applies when the caller's window was saved */
#define REG_WINDOW_TRANSPOSE(reg) \
- (reg + 16)
+ (reg + 16 * 8)
#endif /* _MD_ABI_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: genoffsets.c 7291 2007-02-06 08:49:08Z twisti $
+ $Id: genoffsets.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vm/jit/asmpart.h"
#include "vm/jit/replace.h"
-#include "vmcore/class.h"
-#include "vmcore/linker.h"
-#include "vmcore/method.h"
-
int main(int argc, char **argv)
{
printf("\n\n/* define some offsets */\n\n");
- printf("#define offobjvftbl %3d\n", (s4) OFFSET(java_objectheader, vftbl));
- printf("\n\n");
-
printf("/* vftbl_t */\n\n");
printf("#define offbaseval %3d\n", (s4) OFFSET(vftbl_t, baseval));
printf("#define offdiffval %3d\n", (s4) OFFSET(vftbl_t, diffval));
printf("\n\n");
- printf("/* classinfo */\n\n");
- printf("#define offclassvftbl %3d\n", (s4) OFFSET(classinfo, vftbl));
- printf("\n\n");
-
printf("#define offvmargtype %3d\n", (s4) OFFSET(vm_arg, type));
printf("#define offvmargdata %3d\n", (s4) OFFSET(vm_arg, data));
printf("\n\n");
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Edwin Steiner
-
$Id$
*/
#include "vm/jit/stack.h"
#include "vm/jit/verify/typecheck-common.h"
+#include "vmcore/primitive.h"
+
/* this #if runs over the whole file: */
#if defined(ENABLE_VERIFIER)
#include <string.h>
#include "mm/memory.h"
-#include "toolbox/logging.h"
+
#include "native/native.h"
+#include "toolbox/logging.h"
+
#include "vm/access.h"
#include "vm/builtin.h"
#include "vm/exceptions.h"
+#include "vm/resolve.h"
#include "vm/vm.h"
#include "vm/jit/patcher.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
#define TYPECHECK_NO_STATISTICS
#include <typecheck-common.h>
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: typecheck.c 7766 2007-04-19 13:24:48Z michi $
+ $Id: typecheck.c 8123 2007-06-20 23:50:55Z michi $
*/
#ifdef ENABLE_VERIFIER
#include "mm/memory.h"
+
#include "native/native.h"
#include "toolbox/logging.h"
+#include "vm/access.h"
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/resolve.h"
-#include "vm/access.h"
#include "vm/jit/jit.h"
#include "vm/jit/parse.h"
#include "vm/jit/patcher.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
#include <typecheck-common.h>
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: typeinfo.c 7766 2007-04-19 13:24:48Z michi $
+ $Id: typeinfo.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "toolbox/logging.h"
#include "vm/exceptions.h"
+#include "vm/resolve.h"
#include "vm/jit/jit.h"
#include "vm/jit/verify/typeinfo.h"
#include "vmcore/class.h"
#include "vmcore/descriptor.h"
#include "vmcore/loader.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
/* check if a linked class is an array class. Only use for linked classes! */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7688 2007-04-12 09:05:12Z michi $
+ $Id: asmpart.S 8123 2007-06-20 23:50:55Z michi $
*/
mov s3,4*8(sp)
mov s4,5*8(sp)
- mov a0,itmp1 /* move method pointer for compiler */
- xor %rbp,%rbp /* set argument stack frame to zero */
+ mov a0,6*8(sp) /* store method PV */
- test a1,a1 /* maybe we have no args... */
- jle L_copy_done
+ mov sp,s0 /* save stack pointer */
- mov a1,itmp3 /* arg count */
- mov a2,itmp2 /* pointer to arg block */
+ mov a1,t0 /* address of data structure */
+ mov a2,itmp1 /* number of stack arguments */
- mov itmp2,%r14 /* save argument block pointer */
- mov itmp3,%r15 /* save argument count */
+ mov 0*8(t0),a0
+ mov 1*8(t0),a1
+ mov 2*8(t0),a2
+ mov 3*8(t0),a3
+ mov 4*8(t0),a4
+ mov 5*8(t0),a5
- sub $sizevmarg,itmp2 /* initialize pointer (smaller code) */
- add $1,itmp3 /* initialize argument count */
- xor %r12,%r12 /* initialize integer argument counter*/
- xor %r13,%r13 /* initialize float argument counter */
+ movq 6*8(t0),fa0
+ movq 7*8(t0),fa1
+ movq 8*8(t0),fa2
+ movq 9*8(t0),fa3
+ movq 10*8(t0),fa4
+ movq 11*8(t0),fa5
+ movq 12*8(t0),fa6
+ movq 13*8(t0),fa7
-L_register_copy:
- add $sizevmarg,itmp2 /* goto next argument block */
- dec itmp3 /* argument count - 1 */
- jz L_register_copy_done
- andb $0x02,offvmargtype(itmp2) /* is this a float/double type? */
- jnz L_register_handle_float /* yes, handle it */
+ cmp $0,itmp1l
+ je L_asm_vm_call_method_stack_copy_done
- cmp $INT_ARG_CNT,%r12 /* are we out of integer argument */
- je L_register_copy /* register? yes, next loop */
+ mov itmp1,itmp2
+ and $0xfffffffffffffffe,itmp2 /* keep stack 16-byte aligned */
+ shl $3,itmp2 /* calculate stack size */
+ sub itmp2,sp /* create stack frame */
+ mov sp,itmp2 /* temporary stack pointer */
- lea jumptable_integer(%rip),%rbp
- mov 0(%rbp,%r12,8),%rbx
- inc %r12 /* integer argument counter + 1 */
- jmp *%rbx
+L_asm_vm_call_method_stack_copy_loop:
+ mov 14*8(t0),itmp3 /* load argument */
+ mov itmp3,0(itmp2) /* store argument on stack */
-L_register_handle_float:
- cmp $FLT_ARG_CNT,%r13 /* are we out of float argument */
- je L_register_copy /* register? yes, next loop */
+ sub $1,itmp1l /* subtract 1 argument */
+ add $8,t0 /* set address of next argument */
+ add $8,itmp2 /* increase SP */
- lea jumptable_float(%rip),%rbp
- mov 0(%rbp,%r13,8),%rbx
- inc %r13 /* float argument counter + 1 */
- jmp *%rbx
-
-L_register_copy_done:
- mov %r15,%rbp /* calculate remaining arguments */
- sub %r12,%rbp /* - integer arguments in registers */
- sub %r13,%rbp /* - float arguments in registers */
- jle L_copy_done /* are all assigned to registers? */
-
- and $0xfffffffffffffffe,%rbp /* keep stack 16-byte aligned */
- shl $3,%rbp /* calculate stack size */
- sub %rbp,sp /* stack frame for arguments */
- mov sp,%rbx /* use %rbx as temp sp */
-
- sub $sizevmarg,%r14 /* initialize pointer (smaller code) */
- add $1,%r15 /* initialize argument count */
-
-L_stack_copy_loop:
- add $sizevmarg,%r14 /* goto next argument block */
- dec %r15 /* are there any arguments left? */
- jz L_copy_done /* no test needed after dec */
-
- andb $0x02,offvmargtype(%r14) /* is this a float/double type? */
- jnz L_stack_handle_float
- dec %r12 /* arguments assigned to registers */
- jge L_stack_copy_loop
- jmp L_stack_copy
-
-L_stack_handle_float:
- dec %r13 /* arguments assigned to registers */
- jge L_stack_copy_loop
-
-L_stack_copy:
- mov offvmargdata(%r14),itmp3 /* copy s8 argument onto stack */
- mov itmp3,0(%rbx)
- add $8,%rbx /* increase sp to next argument */
- jmp L_stack_copy_loop
-
-L_copy_done:
- /* itmp1 still contains method pointer*/
- lea L_asm_call_jit_compiler(%rip),mptr
- mov sp,itmp3 /* calculate the old stack pointer */
- add bp,itmp3
- mov mptr,6*8(itmp3)
- lea (6*8-256)(itmp3),mptr /* We subtract 256 to force the next */
+ cmp $0,itmp1l
+ jg L_asm_vm_call_method_stack_copy_loop
+
+L_asm_vm_call_method_stack_copy_done:
+ lea (6*8-256)(s0),mptr /* We subtract 256 to force the next */
/* move instruction to have a 32-bit */
/* offset. */
- mov (0*8+256)(mptr),itmp3 /* method call as in Java */
- call *itmp3 /* call JIT compiler */
+ mov (0*8+256)(mptr),itmp3 /* load PV */
+ call *itmp3
- add bp,sp /* remove argument stack frame if any */
+ mov s0,sp /* restore SP */
L_asm_vm_call_method_return:
mov 0*8(sp),%rbx /* restore callee saved registers */
call builtin_throw_exception@PLT
jmp L_asm_vm_call_method_return
-
-jumptable_integer:
- .quad handle_a0
- .quad handle_a1
- .quad handle_a2
- .quad handle_a3
- .quad handle_a4
- .quad handle_a5
-
-handle_a0:
- mov offvmargdata(itmp2),a0
- jmp L_register_copy
-handle_a1:
- mov offvmargdata(itmp2),a1
- jmp L_register_copy
-handle_a2:
- mov offvmargdata(itmp2),a2
- jmp L_register_copy
-handle_a3:
- mov offvmargdata(itmp2),a3
- jmp L_register_copy
-handle_a4:
- mov offvmargdata(itmp2),a4
- jmp L_register_copy
-handle_a5:
- mov offvmargdata(itmp2),a5
- jmp L_register_copy
-
-
-jumptable_float:
- .quad handle_fa0
- .quad handle_fa1
- .quad handle_fa2
- .quad handle_fa3
- .quad handle_fa4
- .quad handle_fa5
- .quad handle_fa6
- .quad handle_fa7
-
-handle_fa0:
- movq offvmargdata(itmp2),fa0
- jmp L_register_copy
-handle_fa1:
- movq offvmargdata(itmp2),fa1
- jmp L_register_copy
-handle_fa2:
- movq offvmargdata(itmp2),fa2
- jmp L_register_copy
-handle_fa3:
- movq offvmargdata(itmp2),fa3
- jmp L_register_copy
-handle_fa4:
- movq offvmargdata(itmp2),fa4
- jmp L_register_copy
-handle_fa5:
- movq offvmargdata(itmp2),fa5
- jmp L_register_copy
-handle_fa6:
- movq offvmargdata(itmp2),fa6
- jmp L_register_copy
-handle_fa7:
- movq offvmargdata(itmp2),fa7
- jmp L_register_copy
-
asm_vm_call_method_end:
nop
+
/****************** function asm_call_jit_compiler *****************************
* *
* invokes the compiler for untranslated JavaVM methods. *
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8039 2007-06-07 13:46:55Z michi $
+ $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
*/
if (!IS_INMEMORY(var->flags))
M_INTMOVE(s1, var->vv.regoff);
else
- M_LST(s1, REG_SP, var->vv.regoff * 8);
+ M_LST(s1, REG_SP, var->vv.regoff);
}
else { /* stack arguments */
if (!IS_INMEMORY(var->flags))
/* + 8 for return address */
- M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8 + 8);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1 + 8);
else
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ var->vv.regoff = cd->stackframesize * 8 + s1 + 8;
}
}
else { /* floating args */
if (!IS_INMEMORY(var->flags))
M_FLTMOVE(s1, var->vv.regoff);
else
- M_DST(s1, REG_SP, var->vv.regoff * 8);
+ M_DST(s1, REG_SP, var->vv.regoff);
}
else { /* stack arguments */
if (!IS_INMEMORY(var->flags))
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8 + 8);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 8 + s1 + 8);
else
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ var->vv.regoff = cd->stackframesize * 8 + s1 + 8;
}
}
}
}
else {
s1 = emit_load(jd, iptr, var, REG_ITMP1);
- M_LST(s1, REG_SP, d * 8);
+ M_LST(s1, REG_SP, d);
}
}
else {
s1 = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(s1, REG_SP, d * 8);
+ M_DST(s1, REG_SP, d);
else
- M_FST(s1, REG_SP, d * 8);
+ M_FST(s1, REG_SP, d);
}
}
}
if (!nmd->params[j].inmemory)
M_INTMOVE(s1, s2);
else
- M_LST(s1, REG_SP, s2 * 8);
+ M_LST(s1, REG_SP, s2);
}
else {
- s1 = md->params[i].regoff + cd->stackframesize + 1;/* +1 (RA) */
- M_LLD(REG_ITMP1, REG_SP, s1 * 8);
- M_LST(REG_ITMP1, REG_SP, s2 * 8);
+ s1 = md->params[i].regoff + cd->stackframesize * 8 + 8;/* +1 (RA) */
+ M_LLD(REG_ITMP1, REG_SP, s1);
+ M_LST(REG_ITMP1, REG_SP, s2);
}
}
else {
argument registers keep unchanged. */
if (md->params[i].inmemory) {
- s1 = md->params[i].regoff + cd->stackframesize + 1;/* +1 (RA) */
+ s1 = md->params[i].regoff + cd->stackframesize * 8 + 8;/* +1 (RA) */
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, s1 * 8);
- M_DST(REG_FTMP1, REG_SP, s2 * 8);
+ M_DLD(REG_FTMP1, REG_SP, s1);
+ M_DST(REG_FTMP1, REG_SP, s2);
}
else {
- M_FLD(REG_FTMP1, REG_SP, s1 * 8);
- M_FST(REG_FTMP1, REG_SP, s2 * 8);
+ M_FLD(REG_FTMP1, REG_SP, s1);
+ M_FST(REG_FTMP1, REG_SP, s2);
}
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
*/
if (IS_INMEMORY(src->flags)) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
switch (src->type) {
case TYPE_INT:
if (IS_INMEMORY(dst->flags)) {
COUNT_SPILLS;
- disp = dst->vv.regoff * 8;
+ disp = dst->vv.regoff;
switch (dst->type) {
case TYPE_INT:
if (IS_INMEMORY(v_dst->flags)) {
if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
if (s1 == d) {
- M_ILD(RCX, REG_SP, s2 * 8);
- emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+ M_ILD(RCX, REG_SP, s2);
+ emit_shiftl_membase(cd, shift_op, REG_SP, d);
} else {
- M_ILD(RCX, REG_SP, s2 * 8);
- M_ILD(REG_ITMP2, REG_SP, s1 * 8);
+ M_ILD(RCX, REG_SP, s2);
+ M_ILD(REG_ITMP2, REG_SP, s1);
emit_shiftl_reg(cd, shift_op, REG_ITMP2);
- M_IST(REG_ITMP2, REG_SP, d * 8);
+ M_IST(REG_ITMP2, REG_SP, d);
}
} else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
/* s1 may be equal to RCX */
if (s1 == RCX) {
if (s2 == d) {
- M_ILD(REG_ITMP1, REG_SP, s2 * 8);
- M_IST(s1, REG_SP, d * 8);
+ M_ILD(REG_ITMP1, REG_SP, s2);
+ M_IST(s1, REG_SP, d);
M_INTMOVE(REG_ITMP1, RCX);
} else {
- M_IST(s1, REG_SP, d * 8);
- M_ILD(RCX, REG_SP, s2 * 8);
+ M_IST(s1, REG_SP, d);
+ M_ILD(RCX, REG_SP, s2);
}
} else {
- M_ILD(RCX, REG_SP, s2 * 8);
- M_IST(s1, REG_SP, d * 8);
+ M_ILD(RCX, REG_SP, s2);
+ M_IST(s1, REG_SP, d);
}
- emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+ emit_shiftl_membase(cd, shift_op, REG_SP, d);
} else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
if (s1 == d) {
M_INTMOVE(s2, RCX);
- emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+ emit_shiftl_membase(cd, shift_op, REG_SP, d);
} else {
M_INTMOVE(s2, RCX);
- M_ILD(REG_ITMP2, REG_SP, s1 * 8);
+ M_ILD(REG_ITMP2, REG_SP, s1);
emit_shiftl_reg(cd, shift_op, REG_ITMP2);
- M_IST(REG_ITMP2, REG_SP, d * 8);
+ M_IST(REG_ITMP2, REG_SP, d);
}
} else {
/* s1 may be equal to RCX */
- M_IST(s1, REG_SP, d * 8);
+ M_IST(s1, REG_SP, d);
M_INTMOVE(s2, RCX);
- emit_shiftl_membase(cd, shift_op, REG_SP, d * 8);
+ emit_shiftl_membase(cd, shift_op, REG_SP, d);
}
M_INTMOVE(REG_ITMP1, RCX); /* restore RCX */
}
if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
- M_ILD(RCX, REG_SP, s2 * 8);
- M_ILD(d, REG_SP, s1 * 8);
+ M_ILD(RCX, REG_SP, s2);
+ M_ILD(d, REG_SP, s1);
emit_shiftl_reg(cd, shift_op, d);
} else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
/* s1 may be equal to RCX */
M_INTMOVE(s1, d);
- M_ILD(RCX, REG_SP, s2 * 8);
+ M_ILD(RCX, REG_SP, s2);
emit_shiftl_reg(cd, shift_op, d);
} else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
M_INTMOVE(s2, RCX);
- M_ILD(d, REG_SP, s1 * 8);
+ M_ILD(d, REG_SP, s1);
emit_shiftl_reg(cd, shift_op, d);
} else {
if (IS_INMEMORY(v_dst->flags)) {
if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
if (s1 == d) {
- M_ILD(RCX, REG_SP, s2 * 8);
- emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+ M_ILD(RCX, REG_SP, s2);
+ emit_shift_membase(cd, shift_op, REG_SP, d);
} else {
- M_ILD(RCX, REG_SP, s2 * 8);
- M_LLD(REG_ITMP2, REG_SP, s1 * 8);
+ M_ILD(RCX, REG_SP, s2);
+ M_LLD(REG_ITMP2, REG_SP, s1);
emit_shift_reg(cd, shift_op, REG_ITMP2);
- M_LST(REG_ITMP2, REG_SP, d * 8);
+ M_LST(REG_ITMP2, REG_SP, d);
}
} else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
/* s1 may be equal to RCX */
if (s1 == RCX) {
if (s2 == d) {
- M_ILD(REG_ITMP1, REG_SP, s2 * 8);
- M_LST(s1, REG_SP, d * 8);
+ M_ILD(REG_ITMP1, REG_SP, s2);
+ M_LST(s1, REG_SP, d);
M_INTMOVE(REG_ITMP1, RCX);
} else {
- M_LST(s1, REG_SP, d * 8);
- M_ILD(RCX, REG_SP, s2 * 8);
+ M_LST(s1, REG_SP, d);
+ M_ILD(RCX, REG_SP, s2);
}
} else {
- M_ILD(RCX, REG_SP, s2 * 8);
- M_LST(s1, REG_SP, d * 8);
+ M_ILD(RCX, REG_SP, s2);
+ M_LST(s1, REG_SP, d);
}
- emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+ emit_shift_membase(cd, shift_op, REG_SP, d);
} else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
if (s1 == d) {
M_INTMOVE(s2, RCX);
- emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+ emit_shift_membase(cd, shift_op, REG_SP, d);
} else {
M_INTMOVE(s2, RCX);
- M_LLD(REG_ITMP2, REG_SP, s1 * 8);
+ M_LLD(REG_ITMP2, REG_SP, s1);
emit_shift_reg(cd, shift_op, REG_ITMP2);
- M_LST(REG_ITMP2, REG_SP, d * 8);
+ M_LST(REG_ITMP2, REG_SP, d);
}
} else {
/* s1 may be equal to RCX */
- M_LST(s1, REG_SP, d * 8);
+ M_LST(s1, REG_SP, d);
M_INTMOVE(s2, RCX);
- emit_shift_membase(cd, shift_op, REG_SP, d * 8);
+ emit_shift_membase(cd, shift_op, REG_SP, d);
}
M_INTMOVE(REG_ITMP1, RCX); /* restore RCX */
}
if (IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
- M_ILD(RCX, REG_SP, s2 * 8);
- M_LLD(d, REG_SP, s1 * 8);
+ M_ILD(RCX, REG_SP, s2);
+ M_LLD(d, REG_SP, s1);
emit_shift_reg(cd, shift_op, d);
} else if (IS_INMEMORY(v_s2->flags) && !IS_INMEMORY(v_s1->flags)) {
/* s1 may be equal to RCX */
M_INTMOVE(s1, d);
- M_ILD(RCX, REG_SP, s2 * 8);
+ M_ILD(RCX, REG_SP, s2);
emit_shift_reg(cd, shift_op, d);
} else if (!IS_INMEMORY(v_s2->flags) && IS_INMEMORY(v_s1->flags)) {
M_INTMOVE(s2, RCX);
- M_LLD(d, REG_SP, s1 * 8);
+ M_LLD(d, REG_SP, s1);
emit_shift_reg(cd, shift_op, d);
} else {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7723 2007-04-16 18:03:08Z michi $
+ $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
*/
case TYPE_LNG:
if (iarg < INT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = iarg;
pd->regoff = abi_registers_integer_argument[iarg];
iarg++;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
case TYPE_DBL:
if (farg < FLT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = farg;
pd->regoff = abi_registers_float_argument[farg];
farg++;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: resolve.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: resolve.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vm/access.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/resolve.h"
#include "vm/jit/jit.h"
#include "vm/jit/verify/typeinfo.h"
#include "vmcore/linker.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vm/resolve.h"
+#include "vmcore/primitive.h"
/******************************************************************************/
#endif
/* load the class */
- if (!cls) {
- if (!(cls = load_class_from_classloader(classname,
- referer->classloader)))
- return false; /* exception */
+
+ if (cls == NULL) {
+ cls = load_class_from_classloader(classname, referer->classloader);
+
+ if (cls == NULL) {
+ /* If the exception is a ClassNotFoundException,
+ convert it to a NoClassDefFoundError. */
+
+ exceptions_classnotfoundexception_to_noclassdeffounderror();
+
+ return false;
+ }
}
}
}
else {
/* a primitive type */
- cls = primitivetype_table[d->decltype].class_primitive;
+
+ cls = primitive_class_get_by_type(d->decltype);
+
assert(cls->state & CLASS_LOADED);
+
if (!(cls->state & CLASS_LINKED))
if (!link_class(cls))
return false; /* exception */
}
+
assert(cls);
assert(cls->state & CLASS_LOADED);
assert(!link || (cls->state & CLASS_LINKED));
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: string.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: string.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/stringlocal.h"
+#include "vm/vm.h"
#include "vmcore/options.h"
+#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
#include "vmcore/utf8.h"
s = hashtable_string.ptr[i];
if (s) {
while (s) {
-
js = (java_lang_String *) s->string;
- if (!js || !js->value) {
+ if ((js == NULL) || (js->value == NULL)) {
/* error in hashtable found */
- log_text("invalid literalstring in hashtable");
- assert(0);
+
+ vm_abort("stringtable_update: invalid literalstring in hashtable");
}
a = js->value;
if (!a->header.objheader.vftbl)
/* vftbl of character-array is NULL */
- a->header.objheader.vftbl = primitivetype_table[ARRAYTYPE_CHAR].arrayvftbl;
+ a->header.objheader.vftbl =
+ primitive_arrayclass_get_by_type(ARRAYTYPE_CHAR)->vftbl;
/* follow link in external hash chain */
s = s->hashlink;
{
literalstring *s; /* hashtable element */
java_lang_String *js; /* u2-array wrapped in javastring */
- java_chararray *stringdata; /* copy of u2-array */
+ java_chararray *ca; /* copy of u2-array */
u4 key;
u4 slot;
u2 i;
if (copymode) {
/* create copy of u2-array for new javastring */
u4 arraysize = sizeof(java_chararray) + sizeof(u2) * (length - 1) + 10;
- stringdata = mem_alloc(arraysize);
-/* memcpy(stringdata, a, arraysize); */
- memcpy(&(stringdata->header), &(a->header), sizeof(java_arrayheader));
- memcpy(&(stringdata->data), &(a->data) + offset, sizeof(u2) * (length - 1) + 10);
+ ca = mem_alloc(arraysize);
+/* memcpy(ca, a, arraysize); */
+ memcpy(&(ca->header), &(a->header), sizeof(java_arrayheader));
+ memcpy(&(ca->data), &(a->data) + offset, sizeof(u2) * (length - 1) + 10);
} else {
- stringdata = a;
+ ca = a;
}
/* location in hashtable found, complete arrayheader */
- stringdata->header.objheader.vftbl =
- primitivetype_table[ARRAYTYPE_CHAR].arrayvftbl;
- stringdata->header.size = length;
+ ca->header.objheader.vftbl =
+ primitive_arrayclass_get_by_type(ARRAYTYPE_CHAR)->vftbl;
+ ca->header.size = length;
assert(class_java_lang_String);
assert(class_java_lang_String->state & CLASS_LOADED);
#endif
js->header.vftbl = class_java_lang_String->vftbl;
- js->value = stringdata;
+ js->value = ca;
js->offset = 0;
js->count = length;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: vm.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: vm.c 8123 2007-06-20 23:50:55Z michi $
*/
#include <assert.h>
#include <errno.h>
+#include <stdint.h>
#include <stdlib.h>
#if defined(WITH_JRE_LAYOUT)
#include "vm/types.h"
+#include "arch.h"
+#include "md-abi.h"
+
+#include "vm/jit/abi-asm.h"
+
#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/include/java_lang_String.h" /* required by java_lang_Class.h */
#include "native/include/java_lang_Class.h"
+#include "native/include/java_lang_Byte.h"
+#include "native/include/java_lang_Character.h"
+#include "native/include/java_lang_Short.h"
+#include "native/include/java_lang_Integer.h"
+#include "native/include/java_lang_Boolean.h"
+#include "native/include/java_lang_Long.h"
+#include "native/include/java_lang_Float.h"
+#include "native/include/java_lang_Double.h"
+
#include "threads/threads-common.h"
#include "toolbox/logging.h"
#include "vmcore/classcache.h"
#include "vmcore/options.h"
+#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
#include "vmcore/suck.h"
OPT_X,
OPT_XX,
+ OPT_EA,
+ OPT_DA,
+
OPT_ESA,
OPT_DSA,
{ "help", false, OPT_HELP },
{ "?", false, OPT_HELP },
{ "X", false, OPT_X },
- { "XX", false, OPT_XX },
+ { "XX:", true, OPT_XX },
+
+ { "ea:", true, OPT_EA },
+ { "da:", true, OPT_DA },
+ { "ea", false, OPT_EA },
+ { "da", false, OPT_DA },
{ "esa", false, OPT_ESA },
{ "enablesystemassertions", false, OPT_ESA },
puts(" -help, -? print this help message");
puts(" -X print help on non-standard Java options");
puts(" -XX print help on CACAO options");
+ puts(" -ea[:<packagename>...|:<classname>]");
+ puts(" -enableassertions[:<packagename>...|:<classname>]");
+ puts(" enable assertions with specified granularity");
+ puts(" -da[:<packagename>...|:<classname>]");
+ puts(" -disableassertions[:<packagename>...|:<classname>]");
+ puts(" disable assertions with specified granularity");
puts(" -esa | -enablesystemassertions");
puts(" enable system assertions");
puts(" -dsa | -disablesystemassertions");
{
puts(" -v write state-information");
#if !defined(NDEBUG)
- puts(" -verbose[:call|exception|jit|memory|threads]");
+ puts(" -verbose[:call|jit|threads]");
puts(" enable specific verbose output");
puts(" -debug-color colored output for ANSI terms");
#endif
else if (strcmp("call", opt_arg) == 0) {
opt_verbosecall = true;
}
- else if (strcmp("exception", opt_arg) == 0) {
- opt_verboseexception = true;
- }
else if (strcmp("jit", opt_arg) == 0) {
opt_verbose = true;
loadverbose = true;
initverbose = true;
compileverbose = true;
}
- else if (strcmp("memory", opt_arg) == 0) {
- opt_verbosememory = true;
-
-# if defined(ENABLE_STATISTICS)
- /* we also need statistics */
-
- opt_stat = true;
-# endif
- }
else if (strcmp("threads", opt_arg) == 0) {
opt_verbosethreads = true;
}
break;
case OPT_XX:
- XXusage();
+ options_xx(opt_arg);
+ break;
+
+ case OPT_EA:
+ /* currently ignored */
+ break;
+
+ case OPT_DA:
+ /* currently ignored */
break;
case OPT_ESA:
if (!loader_init())
vm_abort("vm_create: loader_init failed");
+ /* Link some important VM classes. */
+ /* AFTER: utf8_init */
+
if (!linker_init())
vm_abort("vm_create: linker_init failed");
+ if (!primitive_init())
+ vm_abort("vm_create: primitive_init failed");
+
/* Initialize the native subsystem. */
if (!native_init())
# if !defined(NDEBUG)
/* start the memory profiling thread */
- if (opt_verbosememory)
+ if (opt_ProfileMemoryUsage || opt_ProfileGCMemoryUsage)
if (!memory_start_thread())
vm_abort("vm_create: memory_start_thread failed");
# endif
{
utf *mainutf;
classinfo *mainclass;
+ java_objectheader *e;
methodinfo *m;
java_objectarray *oa;
s4 oalength;
/* error loading class */
- if ((exceptions_get_exception() != NULL) || (mainclass == NULL)) {
+ e = exceptions_get_and_clear_exception();
+
+ if ((e != NULL) || (mainclass == NULL)) {
+ exceptions_throw_noclassdeffounderror_cause(e);
exceptions_print_stacktrace();
vm_exit(1);
}
#endif /* !defined(NDEBUG) */
+/* vm_array_store_int **********************************************************
+
+ Helper function to store an integer into the argument array, taking
+ care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_int(uint64_t *array, paramdesc *pd, int32_t value)
+{
+ int32_t index;
+
+ if (!pd->inmemory) {
+ index = pd->index;
+ array[index] = (int64_t) value;
+ }
+ else {
+ index = ARG_CNT + pd->index;
+#if SIZEOF_VOID_P == 8
+ array[index] = (int64_t) value;
+#else
+# if WORDS_BIGENDIAN == 1
+ array[index] = ((int64_t) value) << 32;
+# else
+ array[index] = (int64_t) value;
+# endif
+#endif
+ }
+}
+
+
+/* vm_array_store_lng **********************************************************
+
+ Helper function to store a long into the argument array, taking
+ care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_lng(uint64_t *array, paramdesc *pd, int64_t value)
+{
+ int32_t index;
+
+#if SIZEOF_VOID_P == 8
+ if (!pd->inmemory)
+ index = pd->index;
+ else
+ index = ARG_CNT + pd->index;
+
+ array[index] = value;
+#else
+ if (!pd->inmemory) {
+ /* move low and high 32-bits into it's own argument slot */
+
+ index = GET_LOW_REG(pd->index);
+ array[index] = value & 0x00000000ffffffff;
+
+ index = GET_HIGH_REG(pd->index);
+ array[index] = value >> 32;
+ }
+ else {
+ index = ARG_CNT + pd->index;
+ array[index] = value;
+ }
+#endif
+}
+
+
+/* vm_array_store_flt **********************************************************
+
+ Helper function to store a float into the argument array, taking
+ care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_flt(uint64_t *array, paramdesc *pd, uint64_t value)
+{
+ int32_t index;
+
+ if (!pd->inmemory) {
+ index = INT_ARG_CNT + pd->index;
+#if WORDS_BIGENDIAN == 1 && !defined(__POWERPC64__)
+ array[index] = value >> 32;
+#else
+ array[index] = value;
+#endif
+ }
+ else {
+ index = ARG_CNT + pd->index;
+#if defined(__SPARC_64__)
+ array[index] = value >> 32;
+#else
+ array[index] = value;
+#endif
+ }
+}
+
+
+/* vm_array_store_dbl **********************************************************
+
+ Helper function to store a double into the argument array, taking
+ care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_dbl(uint64_t *array, paramdesc *pd, uint64_t value)
+{
+ int32_t index;
+
+ if (!pd->inmemory)
+ index = INT_ARG_CNT + pd->index;
+ else
+ index = ARG_CNT + pd->index;
+
+ array[index] = value;
+}
+
+
+/* vm_array_store_adr **********************************************************
+
+ Helper function to store an address into the argument array, taking
+ care of architecture specific issues.
+
+*******************************************************************************/
+
+static void vm_array_store_adr(uint64_t *array, paramdesc *pd, void *value)
+{
+ int32_t index;
+
+ if (!pd->inmemory) {
+#if defined(HAS_ADDRESS_REGISTER_FILE)
+ /* When the architecture has address registers, place them
+ after integer and float registers. */
+
+ index = INT_ARG_CNT + FLT_ARG_CNT + pd->index;
+#else
+ index = pd->index;
+#endif
+ array[index] = (uint64_t) (intptr_t) value;
+ }
+ else {
+ index = ARG_CNT + pd->index;
+#if SIZEOF_VOID_P == 8
+ array[index] = (uint64_t) (intptr_t) value;
+#else
+# if WORDS_BIGENDIAN == 1 && !defined(__POWERPC64__)
+ array[index] = ((uint64_t) (intptr_t) value) << 32;
+# else
+ array[index] = (uint64_t) (intptr_t) value;
+# endif
+#endif
+ }
+}
+
+
/* vm_vmargs_from_valist *******************************************************
XXX
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, va_list ap)
{
}
for (; i < m->parseddesc->paramcount; i++, paramtypes++) {
- switch (paramtypes->decltype) {
- /* primitive types */
- case PRIMITIVETYPE_BOOLEAN:
- case PRIMITIVETYPE_BYTE:
- case PRIMITIVETYPE_CHAR:
- case PRIMITIVETYPE_SHORT:
- case PRIMITIVETYPE_INT:
+ switch (paramtypes->type) {
+ case TYPE_INT:
vmargs[i].type = TYPE_INT;
vmargs[i].data.l = (s8) va_arg(ap, s4);
break;
- case PRIMITIVETYPE_LONG:
+ case TYPE_LNG:
vmargs[i].type = TYPE_LNG;
vmargs[i].data.l = (s8) va_arg(ap, s8);
break;
- case PRIMITIVETYPE_FLOAT:
+ case TYPE_FLT:
vmargs[i].type = TYPE_FLT;
#if defined(__ALPHA__)
/* this keeps the assembler function much simpler */
#endif
break;
- case PRIMITIVETYPE_DOUBLE:
+ case TYPE_DBL:
vmargs[i].type = TYPE_DBL;
vmargs[i].data.d = (jdouble) va_arg(ap, jdouble);
break;
}
}
}
+#else
+uint64_t *vm_array_from_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+ methoddesc *md;
+ paramdesc *pd;
+ typedesc *td;
+ uint64_t *array;
+ int32_t i;
+ imm_union value;
+
+ /* get the descriptors */
+
+ md = m->parseddesc;
+ pd = md->params;
+ td = md->paramtypes;
+
+ /* allocate argument array */
+
+ array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+
+ /* if method is non-static fill first block and skip `this' pointer */
+
+ i = 0;
+
+ if (o != NULL) {
+ /* the `this' pointer */
+ vm_array_store_adr(array, pd, o);
+
+ pd++;
+ td++;
+ i++;
+ }
+
+ for (; i < md->paramcount; i++, pd++, td++) {
+ switch (td->type) {
+ case TYPE_INT:
+ value.i = va_arg(ap, int32_t);
+ vm_array_store_int(array, pd, value.i);
+ break;
+
+ case TYPE_LNG:
+ value.l = va_arg(ap, int64_t);
+ vm_array_store_lng(array, pd, value.l);
+ break;
+
+ case TYPE_FLT:
+#if defined(__ALPHA__) || defined(__POWERPC64__)
+ /* this keeps the assembler function much simpler */
+
+ value.d = (double) va_arg(ap, double);
+#else
+ value.f = (float) va_arg(ap, double);
+#endif
+ vm_array_store_flt(array, pd, value.l);
+ break;
+
+ case TYPE_DBL:
+ value.d = va_arg(ap, double);
+ vm_array_store_dbl(array, pd, value.l);
+ break;
+
+ case TYPE_ADR:
+ value.a = va_arg(ap, void*);
+ vm_array_store_adr(array, pd, value.a);
+ break;
+ }
+ }
+
+ return array;
+}
+#endif
/* vm_vmargs_from_jvalue *******************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, jvalue *args)
{
for (j = 0; i < m->parseddesc->paramcount; i++, j++, paramtypes++) {
switch (paramtypes->decltype) {
- /* primitive types */
- case PRIMITIVETYPE_BOOLEAN:
- case PRIMITIVETYPE_BYTE:
- case PRIMITIVETYPE_CHAR:
- case PRIMITIVETYPE_SHORT:
- case PRIMITIVETYPE_INT:
+ case TYPE_INT:
vmargs[i].type = TYPE_INT;
vmargs[i].data.l = (s8) args[j].i;
break;
- case PRIMITIVETYPE_LONG:
+ case TYPE_LNG:
vmargs[i].type = TYPE_LNG;
vmargs[i].data.l = (s8) args[j].j;
break;
- case PRIMITIVETYPE_FLOAT:
+ case TYPE_FLT:
vmargs[i].type = TYPE_FLT;
#if defined(__ALPHA__)
/* this keeps the assembler function much simpler */
#endif
break;
- case PRIMITIVETYPE_DOUBLE:
+ case TYPE_DBL:
vmargs[i].type = TYPE_DBL;
vmargs[i].data.d = args[j].d;
break;
}
}
}
+#else
+static uint64_t *vm_array_from_jvalue(methodinfo *m, java_objectheader *o,
+ jvalue *args)
+{
+ methoddesc *md;
+ paramdesc *pd;
+ typedesc *td;
+ uint64_t *array;
+ int32_t i;
+ int32_t j;
+ /* get the descriptors */
-/* vm_call_method **************************************************************
+ md = m->parseddesc;
+ pd = md->params;
+ td = md->paramtypes;
- Calls a Java method with a variable number of arguments and returns
- an address.
+ /* allocate argument array */
-*******************************************************************************/
+#if defined(HAS_ADDRESS_REGISTER_FILE)
+ array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + ADR_ARG_CNT + md->memuse);
+#else
+ array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+#endif
-java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
-{
- va_list ap;
- java_objectheader *ro;
+ /* if method is non-static fill first block and skip `this' pointer */
- va_start(ap, o);
- ro = vm_call_method_valist(m, o, ap);
- va_end(ap);
+ i = 0;
- return ro;
-}
+ if (o != NULL) {
+ /* the `this' pointer */
+ vm_array_store_adr(array, pd, o);
+ pd++;
+ td++;
+ i++;
+ }
-/* vm_call_method_valist *******************************************************
+ for (j = 0; i < md->paramcount; i++, j++, pd++, td++) {
+ switch (td->decltype) {
+ case TYPE_INT:
+ vm_array_store_int(array, pd, args[j].i);
+ break;
- Calls a Java method with a variable number of arguments, passed via
- a va_list, and returns an address.
+ case TYPE_LNG:
+ vm_array_store_lng(array, pd, args[j].j);
+ break;
-*******************************************************************************/
+ case TYPE_FLT:
+ vm_array_store_flt(array, pd, args[j].j);
+ break;
-java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
- va_list ap)
-{
- s4 vmargscount;
- vm_arg *vmargs;
- java_objectheader *ro;
- s4 dumpsize;
+ case TYPE_DBL:
+ vm_array_store_dbl(array, pd, args[j].j);
+ break;
- /* mark start of dump memory area */
+ case TYPE_ADR:
+ vm_array_store_adr(array, pd, args[j].l);
+ break;
+ }
+ }
- dumpsize = dump_size();
+ return array;
+}
+#endif
- /* get number of Java method arguments */
+/* vm_vmargs_from_objectarray **************************************************
- vmargscount = m->parseddesc->paramcount;
+ XXX
- /* allocate vm_arg array */
+*******************************************************************************/
- vmargs = DMNEW(vm_arg, vmargscount);
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
+ vm_arg *vmargs, java_objectarray *params)
+{
+ java_objectheader *param;
+ typedesc *paramtypes;
+ classinfo *c;
+ int32_t i;
+ int32_t j;
+ int64_t value;
- /* fill the vm_arg array from a va_list */
+ paramtypes = m->parseddesc->paramtypes;
- vm_vmargs_from_valist(m, o, vmargs, ap);
+ /* if method is non-static fill first block and skip `this' pointer */
- /* call the Java method */
+ i = 0;
- ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+ if (o != NULL) {
+ /* this pointer */
+ vmargs[0].type = TYPE_ADR;
+ vmargs[0].data.l = (uint64_t) (intptr_t) o;
- /* release dump area */
+ paramtypes++;
+ i++;
+ }
- dump_release(dumpsize);
+ for (j = 0; i < m->parseddesc->paramcount; i++, j++, paramtypes++) {
+ switch (paramtypes->type) {
+ /* primitive types */
+ case TYPE_INT:
+ case TYPE_LNG:
+ case TYPE_FLT:
+ case TYPE_DBL:
+ param = params->data[j];
- return ro;
-}
+ if (param == NULL)
+ goto illegal_arg;
+ /* internally used data type */
+ vmargs[i].type = paramtypes->type;
-/* vm_call_method_jvalue *******************************************************
+ /* convert the value according to its declared type */
- Calls a Java method with a variable number of arguments, passed via
- a jvalue array, and returns an address.
+ c = param->vftbl->class;
-*******************************************************************************/
+ switch (paramtypes->decltype) {
+ case PRIMITIVETYPE_BOOLEAN:
+ if (c == class_java_lang_Boolean)
+ value = (int64_t) ((java_lang_Boolean *) param)->value;
+ else
+ goto illegal_arg;
-java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args)
-{
- s4 vmargscount;
- vm_arg *vmargs;
- java_objectheader *ro;
- s4 dumpsize;
+ vmargs[i].data.l = value;
+ break;
- /* mark start of dump memory area */
+ case PRIMITIVETYPE_BYTE:
+ if (c == class_java_lang_Byte)
+ value = (int64_t) ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
- dumpsize = dump_size();
+ vmargs[i].data.l = value;
+ break;
- /* get number of Java method arguments */
+ case PRIMITIVETYPE_CHAR:
+ if (c == class_java_lang_Character)
+ value = (int64_t) ((java_lang_Character *) param)->value;
+ else
+ goto illegal_arg;
- vmargscount = m->parseddesc->paramcount;
+ vmargs[i].data.l = value;
+ break;
- /* allocate vm_arg array */
+ case PRIMITIVETYPE_SHORT:
+ if (c == class_java_lang_Short)
+ value = (int64_t) ((java_lang_Short *) param)->value;
+ else if (c == class_java_lang_Byte)
+ value = (int64_t) ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
+
+ vmargs[i].data.l = value;
+ break;
+
+ case PRIMITIVETYPE_INT:
+ if (c == class_java_lang_Integer)
+ value = (int64_t) ((java_lang_Integer *) param)->value;
+ else if (c == class_java_lang_Short)
+ value = (int64_t) ((java_lang_Short *) param)->value;
+ else if (c == class_java_lang_Byte)
+ value = (int64_t) ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
+
+ vmargs[i].data.l = value;
+ break;
+
+ case PRIMITIVETYPE_LONG:
+ if (c == class_java_lang_Long)
+ value = (int64_t) ((java_lang_Long *) param)->value;
+ else if (c == class_java_lang_Integer)
+ value = (int64_t) ((java_lang_Integer *) param)->value;
+ else if (c == class_java_lang_Short)
+ value = (int64_t) ((java_lang_Short *) param)->value;
+ else if (c == class_java_lang_Byte)
+ value = (int64_t) ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
- vmargs = DMNEW(vm_arg, vmargscount);
+ vmargs[i].data.l = value;
+ break;
- /* fill the vm_arg array from a va_list */
+ case PRIMITIVETYPE_FLOAT:
+ if (c == class_java_lang_Float)
+ vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ case PRIMITIVETYPE_DOUBLE:
+ if (c == class_java_lang_Double)
+ vmargs[i].data.d = (jdouble) ((java_lang_Double *) param)->value;
+ else if (c == class_java_lang_Float)
+ vmargs[i].data.f = (jfloat) ((java_lang_Float *) param)->value;
+ else
+ goto illegal_arg;
+ break;
- vm_vmargs_from_jvalue(m, o, vmargs, args);
+ default:
+ goto illegal_arg;
+ }
+ break;
+
+ case TYPE_ADR:
+ if (!resolve_class_from_typedesc(paramtypes, true, true, &c))
+ return false;
+
+ if (params->data[j] != 0) {
+ if (paramtypes->arraydim > 0) {
+ if (!builtin_arrayinstanceof(params->data[j], c))
+ goto illegal_arg;
+
+ } else {
+ if (!builtin_instanceof(params->data[j], c))
+ goto illegal_arg;
+ }
+ }
- /* call the Java method */
+ vmargs[i].type = TYPE_ADR;
+ vmargs[i].data.l = (u8) (ptrint) params->data[j];
+ break;
- ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+ default:
+ goto illegal_arg;
+ }
+ }
- /* release dump area */
+/* if (rettype) */
+/* *rettype = descr->returntype.decltype; */
- dump_release(dumpsize);
+ return true;
- return ro;
+illegal_arg:
+ exceptions_throw_illegalargumentexception();
+ return false;
+}
+#else
+uint64_t *vm_array_from_objectarray(methodinfo *m, java_objectheader *o,
+ java_objectarray *params)
+{
+ methoddesc *md;
+ paramdesc *pd;
+ typedesc *td;
+ uint64_t *array;
+ java_objectheader *param;
+ classinfo *c;
+ int32_t i;
+ int32_t j;
+ imm_union value;
+
+ /* get the descriptors */
+
+ md = m->parseddesc;
+ pd = md->params;
+ td = md->paramtypes;
+
+ /* allocate argument array */
+
+ array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+
+ /* if method is non-static fill first block and skip `this' pointer */
+
+ i = 0;
+
+ if (o != NULL) {
+ /* this pointer */
+ vm_array_store_adr(array, pd, o);
+
+ pd++;
+ td++;
+ i++;
+ }
+
+ for (j = 0; i < md->paramcount; i++, j++, pd++, td++) {
+ param = params->data[j];
+
+ switch (td->type) {
+ case TYPE_INT:
+ if (param == NULL)
+ goto illegal_arg;
+
+ /* convert the value according to its declared type */
+
+ c = param->vftbl->class;
+
+ switch (td->decltype) {
+ case PRIMITIVETYPE_BOOLEAN:
+ if (c == class_java_lang_Boolean)
+ value.i = ((java_lang_Boolean *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ case PRIMITIVETYPE_BYTE:
+ if (c == class_java_lang_Byte)
+ value.i = ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ case PRIMITIVETYPE_CHAR:
+ if (c == class_java_lang_Character)
+ value.i = ((java_lang_Character *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ case PRIMITIVETYPE_SHORT:
+ if (c == class_java_lang_Short)
+ value.i = ((java_lang_Short *) param)->value;
+ else if (c == class_java_lang_Byte)
+ value.i = ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ case PRIMITIVETYPE_INT:
+ if (c == class_java_lang_Integer)
+ value.i = ((java_lang_Integer *) param)->value;
+ else if (c == class_java_lang_Short)
+ value.i = ((java_lang_Short *) param)->value;
+ else if (c == class_java_lang_Byte)
+ value.i = ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ default:
+ goto illegal_arg;
+ }
+
+ vm_array_store_int(array, pd, value.i);
+ break;
+
+ case TYPE_LNG:
+ if (param == NULL)
+ goto illegal_arg;
+
+ /* convert the value according to its declared type */
+
+ c = param->vftbl->class;
+
+ switch (td->decltype) {
+ case PRIMITIVETYPE_LONG:
+ if (c == class_java_lang_Long)
+ value.l = ((java_lang_Long *) param)->value;
+ else if (c == class_java_lang_Integer)
+ value.l = (int64_t) ((java_lang_Integer *) param)->value;
+ else if (c == class_java_lang_Short)
+ value.l = (int64_t) ((java_lang_Short *) param)->value;
+ else if (c == class_java_lang_Byte)
+ value.l = (int64_t) ((java_lang_Byte *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ default:
+ goto illegal_arg;
+ }
+
+ vm_array_store_lng(array, pd, value.l);
+ break;
+
+ case TYPE_FLT:
+ if (param == NULL)
+ goto illegal_arg;
+
+ /* convert the value according to its declared type */
+
+ c = param->vftbl->class;
+
+ switch (td->decltype) {
+ case PRIMITIVETYPE_FLOAT:
+ if (c == class_java_lang_Float)
+ value.f = ((java_lang_Float *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ default:
+ goto illegal_arg;
+ }
+
+ vm_array_store_flt(array, pd, value.l);
+ break;
+
+ case TYPE_DBL:
+ if (param == NULL)
+ goto illegal_arg;
+
+ /* convert the value according to its declared type */
+
+ c = param->vftbl->class;
+
+ switch (td->decltype) {
+ case PRIMITIVETYPE_DOUBLE:
+ if (c == class_java_lang_Double)
+ value.d = ((java_lang_Double *) param)->value;
+ else if (c == class_java_lang_Float)
+ value.f = ((java_lang_Float *) param)->value;
+ else
+ goto illegal_arg;
+ break;
+
+ default:
+ goto illegal_arg;
+ }
+
+ vm_array_store_dbl(array, pd, value.l);
+ break;
+
+ case TYPE_ADR:
+ if (!resolve_class_from_typedesc(td, true, true, &c))
+ return false;
+
+ if (param != NULL) {
+ if (td->arraydim > 0) {
+ if (!builtin_arrayinstanceof(param, c))
+ goto illegal_arg;
+ }
+ else {
+ if (!builtin_instanceof(param, c))
+ goto illegal_arg;
+ }
+ }
+
+ vm_array_store_adr(array, pd, param);
+ break;
+
+ default:
+ goto illegal_arg;
+ }
+ }
+
+ return array;
+
+illegal_arg:
+ exceptions_throw_illegalargumentexception();
+ return NULL;
+}
+#endif
+
+
+/* vm_call_method **************************************************************
+
+ Calls a Java method with a variable number of arguments and returns
+ an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
+{
+ va_list ap;
+ java_objectheader *ro;
+
+ va_start(ap, o);
+ ro = vm_call_method_valist(m, o, ap);
+ va_end(ap);
+
+ return ro;
+}
+
+
+/* vm_call_method_valist *******************************************************
+
+ Calls a Java method with a variable number of arguments, passed via
+ a va_list, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
+ va_list ap)
+{
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+ s4 vmargscount;
+ vm_arg *vmargs;
+ java_objectheader *ro;
+ s4 dumpsize;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* get number of Java method arguments */
+
+ vmargscount = m->parseddesc->paramcount;
+
+ /* allocate vm_arg array */
+
+ vmargs = DMNEW(vm_arg, vmargscount);
+
+ /* fill the vm_arg array from a va_list */
+
+ vm_vmargs_from_valist(m, o, vmargs, ap);
+
+ /* call the Java method */
+
+ ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return ro;
+#else
+ java_objectheader *ro;
+ int32_t dumpsize;
+ uint64_t *array;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_valist(m, o, ap);
+
+ /* call the Java method */
+
+ ro = vm_call_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return ro;
+#endif
+}
+
+
+/* vm_call_method_jvalue *******************************************************
+
+ Calls a Java method with a variable number of arguments, passed via
+ a jvalue array, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
+ jvalue *args)
+{
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+ s4 vmargscount;
+ vm_arg *vmargs;
+ java_objectheader *ro;
+ s4 dumpsize;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* get number of Java method arguments */
+
+ vmargscount = m->parseddesc->paramcount;
+
+ /* allocate vm_arg array */
+
+ vmargs = DMNEW(vm_arg, vmargscount);
+
+ /* fill the vm_arg array from a va_list */
+
+ vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+ /* call the Java method */
+
+ ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return ro;
+#else
+ java_objectheader *ro;
+ int32_t dumpsize;
+ uint64_t *array;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_jvalue(m, o, args);
+
+ /* call the Java method */
+
+ ro = vm_call_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return ro;
+#endif
}
-
-/* vm_call_method_vmarg ********************************************************
-
+
+/* vm_call_array ***************************************************************
+
Calls a Java method with a variable number of arguments, passed via
- a vm_arg array, and returns an address.
+ an argument array, and returns an address.
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs)
{
return o;
}
+#else
+java_objectheader *vm_call_array(methodinfo *m, uint64_t *array)
+{
+ methoddesc *md;
+ java_objectheader *o;
+
+ md = m->parseddesc;
+
+ /* compile the method if not already done */
+
+ if (m->code == NULL)
+ if (!jit_compile(m))
+ return NULL;
+
+ STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp)
+ o = intrp_asm_vm_call_method(m, vmargscount, vmargs);
+ else
+# endif
+ o = asm_vm_call_method(m->code->entrypoint, array, md->memuse);
+#else
+ o = intrp_asm_vm_call_method(m, vmargscount, vmargs);
+#endif
+
+ return o;
+}
+#endif
+
+
+/* vm_call_int_array ***********************************************************
+
+ Calls a Java method with a variable number of arguments, passed via
+ an argument array, and returns an integer (int32_t).
+
+*******************************************************************************/
+
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+{
+ s4 i;
+
+ STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
+ THREADOBJECT->flags &= ~THREAD_FLAG_IN_NATIVE;
+#endif
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp)
+ i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+ else
+# endif
+ i = asm_vm_call_method_int(m, vmargscount, vmargs);
+#else
+ i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+#endif
+
+#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
+ THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
+#endif
+
+ return i;
+}
+#else
+int32_t vm_call_int_array(methodinfo *m, uint64_t *array)
+{
+ methoddesc *md;
+ int32_t i;
+
+ md = m->parseddesc;
+
+ /* compile the method if not already done */
+
+ if (m->code == NULL)
+ if (!jit_compile(m))
+ return 0;
+
+ STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp)
+ i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+ else
+# endif
+ i = asm_vm_call_method_int(m->code->entrypoint, array, md->memuse);
+#else
+ i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+#endif
+
+ return i;
+}
+#endif
/* vm_call_method_int **********************************************************
/* vm_call_method_int_valist ***************************************************
Calls a Java method with a variable number of arguments, passed via
- a va_list, and returns an integer (s4).
+ a va_list, and returns an integer (int32_t).
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
{
s4 vmargscount;
/* fill the vm_arg array from a va_list */
- vm_vmargs_from_valist(m, o, vmargs, ap);
+ vm_vmargs_from_valist(m, o, vmargs, ap);
+
+ /* call the Java method */
+
+ i = vm_call_method_int_vmarg(m, vmargscount, vmargs);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return i;
+}
+#else
+int32_t vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ int32_t i;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_valist(m, o, ap);
/* call the Java method */
- i = vm_call_method_int_vmarg(m, vmargscount, vmargs);
+ i = vm_call_int_array(m, array);
/* release dump area */
return i;
}
+#endif
/* vm_call_method_int_jvalue ***************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
{
s4 vmargscount;
return i;
}
+#else
+int32_t vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ int32_t i;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_jvalue(m, o, args);
+
+ /* call the Java method */
+
+ i = vm_call_int_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return i;
+}
+#endif
-/* vm_call_method_int_vmarg ****************************************************
+/* vm_call_long_array **********************************************************
Calls a Java method with a variable number of arguments, passed via
- a vm_arg array, and returns an integer (s4).
+ an argument array, and returns a long (int64_t).
*******************************************************************************/
-s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
- s4 i;
+ s8 l;
STATISTICS(count_calls_native_to_java++);
#if defined(ENABLE_JIT)
# if defined(ENABLE_INTRP)
if (opt_intrp)
- i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+ l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
else
# endif
- i = asm_vm_call_method_int(m, vmargscount, vmargs);
+ l = asm_vm_call_method_long(m, vmargscount, vmargs);
#else
- i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
+ l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
#endif
#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
#endif
- return i;
+ return l;
+}
+#else
+int64_t vm_call_long_array(methodinfo *m, uint64_t *array)
+{
+ methoddesc *md;
+ int64_t l;
+
+ md = m->parseddesc;
+
+ /* compile the method if not already done */
+
+ if (m->code == NULL)
+ if (!jit_compile(m))
+ return 0;
+
+ STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp)
+ l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+ else
+# endif
+ l = asm_vm_call_method_long(m->code->entrypoint, array, md->memuse);
+#else
+ l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+#endif
+
+ return l;
}
+#endif
/* vm_call_method_long *********************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
{
s4 vmargscount;
return l;
}
+#else
+int64_t vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ int64_t l;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_valist(m, o, ap);
+
+ /* call the Java method */
+
+ l = vm_call_long_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return l;
+}
+#endif
/* vm_call_method_long_jvalue **************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
{
s4 vmargscount;
return l;
}
+#else
+int64_t vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ int64_t l;
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
-/* vm_call_method_long_vmarg ***************************************************
+ /* fill the argument array from a va_list */
- Calls a Java method with a variable number of arguments, passed via
- a vm_arg array, and returns a long (s8).
+ array = vm_array_from_jvalue(m, o, args);
+
+ /* call the Java method */
+
+ l = vm_call_long_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return l;
+}
+#endif
+
+
+/* vm_call_float_array *********************************************************
+
+ Calls a Java method with a variable number of arguments and returns
+ an float.
*******************************************************************************/
-s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
- s8 l;
+ float f;
+
+ vm_abort("IMPLEMENT ME!");
STATISTICS(count_calls_native_to_java++);
#if defined(ENABLE_JIT)
# if defined(ENABLE_INTRP)
if (opt_intrp)
- l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+ f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
else
# endif
- l = asm_vm_call_method_long(m, vmargscount, vmargs);
+ f = asm_vm_call_method_float(m, vmargscount, vmargs);
#else
- l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+ f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
#endif
#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
#endif
- return l;
+ return f;
}
+#else
+float vm_call_float_array(methodinfo *m, uint64_t *array)
+{
+ methoddesc *md;
+ float f;
+
+ md = m->parseddesc;
+ /* compile the method if not already done */
+
+ if (m->code == NULL)
+ if (!jit_compile(m))
+ return 0;
+
+ STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp)
+ f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+ else
+# endif
+ f = asm_vm_call_method_float(m->code->entrypoint, array, md->memuse);
+#else
+ f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+#endif
+
+ return f;
+}
+#endif
/* vm_call_method_float ********************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
return f;
}
+#else
+float vm_call_method_float_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ float f;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_valist(m, o, ap);
+
+ /* call the Java method */
+
+ f = vm_call_float_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+ return f;
+}
+#endif
/* vm_call_method_float_jvalue *************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
jvalue *args)
{
return f;
}
+#else
+float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ float f;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_jvalue(m, o, args);
+
+ /* call the Java method */
+
+ f = vm_call_float_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return f;
+}
+#endif
-/* vm_call_method_float_vmarg **************************************************
+/* vm_call_double_array ********************************************************
Calls a Java method with a variable number of arguments and returns
- an float.
+ a double.
*******************************************************************************/
-float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
+ vm_arg *vmargs)
{
- float f;
+ double d;
+
+ vm_abort("IMPLEMENT ME!");
STATISTICS(count_calls_native_to_java++);
#if defined(ENABLE_JIT)
# if defined(ENABLE_INTRP)
if (opt_intrp)
- f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+ d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
else
# endif
- f = asm_vm_call_method_float(m, vmargscount, vmargs);
+ d = asm_vm_call_method_double(m, vmargscount, vmargs);
#else
- f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+ d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
#endif
#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
#endif
- return f;
+ return d;
+}
+#else
+double vm_call_double_array(methodinfo *m, uint64_t *array)
+{
+ methoddesc *md;
+ double d;
+
+ md = m->parseddesc;
+
+ /* compile the method if not already done */
+
+ if (m->code == NULL)
+ if (!jit_compile(m))
+ return 0;
+
+ STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (opt_intrp)
+ d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
+ else
+# endif
+ d = asm_vm_call_method_double(m->code->entrypoint, array, md->memuse);
+#else
+ d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
+#endif
+
+ return d;
}
+#endif
/* vm_call_method_double *******************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
return d;
}
+#else
+double vm_call_method_double_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ double d;
+
+ /* mark start of dump memory area */
+
+ dumpsize = dump_size();
+
+ /* fill the argument array from a va_list */
+
+ array = vm_array_from_valist(m, o, ap);
+
+ /* call the Java method */
+
+ d = vm_call_double_array(m, array);
+
+ /* release dump area */
+
+ dump_release(dumpsize);
+
+ return d;
+}
+#endif
/* vm_call_method_double_jvalue ************************************************
*******************************************************************************/
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
jvalue *args)
{
return d;
}
+#else
+double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+ int32_t dumpsize;
+ uint64_t *array;
+ double d;
+ /* mark start of dump memory area */
-/* vm_call_method_double_vmarg *************************************************
-
- Calls a Java method with a variable number of arguments and returns
- a double.
+ dumpsize = dump_size();
-*******************************************************************************/
+ /* fill the argument array from a va_list */
-double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
- vm_arg *vmargs)
-{
- double d;
+ array = vm_array_from_jvalue(m, o, args);
- STATISTICS(count_calls_native_to_java++);
+ /* call the Java method */
-#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
- THREADOBJECT->flags &= ~THREAD_FLAG_IN_NATIVE;
-#endif
+ d = vm_call_double_array(m, array);
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
- if (opt_intrp)
- d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
- else
-# endif
- d = asm_vm_call_method_double(m, vmargscount, vmargs);
-#else
- d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
-#endif
+ /* release dump area */
-#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
- THREADOBJECT->flags |= THREAD_FLAG_IN_NATIVE;
-#endif
+ dump_release(dumpsize);
return d;
}
-
+#endif
/*
* These are local overrides for various environment variables in Emacs.
/* src/vm/vm.h - basic JVM functions
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
$Id: finalizer.c 4357 2006-01-22 23:33:38Z twisti $
*/
#define _VM_H
#include "config.h"
+
+#include <stdarg.h>
+
#include "vm/types.h"
#include "native/jni.h"
+
#include "vm/global.h"
+#include "vmcore/class.h"
+#include "vmcore/method.h"
+
/* export global variables ****************************************************/
void vm_abort(const char *text, ...);
/* Java method calling functions */
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
+ vm_arg *vmargs, java_objectarray *params);
+#else
+uint64_t *vm_array_from_objectarray(methodinfo *m, java_objectheader *o,
+ java_objectarray *params);
+#endif
+
java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...);
java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
va_list ap);
java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
jvalue *args);
+
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs);
+s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+#else
+java_objectheader *vm_call_array(methodinfo *m, uint64_t *array);
+int32_t vm_call_int_array(methodinfo *m, uint64_t *array);
+int64_t vm_call_long_array(methodinfo *m, uint64_t *array);
+float vm_call_float_array(methodinfo *m, uint64_t *array);
+double vm_call_double_array(methodinfo *m, uint64_t *array);
+#endif
s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...);
s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap);
s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
-s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...);
s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap);
s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
-s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
float vm_call_method_float(methodinfo *m, java_objectheader *o, ...);
float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
va_list ap);
float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
jvalue *args);
-float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
double vm_call_method_double(methodinfo *m, java_objectheader *o, ...);
double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
va_list ap);
double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
jvalue *args);
-double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
- vm_arg *vmargs);
#endif /* _VM_H */
method.h \
options.c \
options.h \
+ primitive.c \
+ primitive.h \
references.h \
$(RT_TIMING_SOURCES) \
$(STACKMAP_SOURCES) \
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: class.c 8123 2007-06-20 23:50:55Z michi $
*/
classinfo *class_array_of(classinfo *component, bool link)
{
- s4 namelen;
- char *namebuf;
- s4 dumpsize;
- classinfo *c;
+ java_objectheader *cl;
+ s4 namelen;
+ char *namebuf;
+ utf *u;
+ classinfo *c;
+ s4 dumpsize;
+
+ cl = component->classloader;
dumpsize = dump_size();
namebuf[0] = '[';
MCOPY(namebuf + 1, component->name->text, char, namelen);
namelen++;
-
- } else {
+ }
+ else {
/* the component is a non-array class */
namebuf = DMNEW(char, namelen + 3);
namebuf[0] = '[';
namelen += 3;
}
- c = get_array_class(utf_new(namebuf, namelen),
- component->classloader,
- component->classloader,
- link);
+ u = utf_new(namebuf, namelen);
+
+ c = get_array_class(u, cl, cl, link);
dump_release(dumpsize);
}
-/* class_is_primitive **********************************************************
-
- Check if the given class is a primitive class.
-
-*******************************************************************************/
-
-bool class_is_primitive(classinfo *c)
-{
- s4 i;
-
- /* search table of primitive classes */
-
- for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
- if (primitivetype_table[i].class_primitive == c)
- return true;
-
- return false;
-}
-
-
-/* class_primitive_get *********************************************************
-
- Returns the primitive class of the given class name.
-
-*******************************************************************************/
-
-classinfo *class_primitive_get(utf *name)
-{
- s4 i;
-
- /* search table of primitive classes */
-
- for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
- if (primitivetype_table[i].name == name)
- return primitivetype_table[i].class_primitive;
-
- vm_abort("class_primitive_get: unknown primitive type");
-
- /* keep compiler happy */
-
- return NULL;
-}
-
-
/* class_issubclass ************************************************************
Checks if sub is a descendant of super.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.h 8056 2007-06-10 14:49:57Z michi $
+ $Id: class.h 8123 2007-06-20 23:50:55Z michi $
*/
methodinfo *class_resolveclassmethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool throwexception);
methodinfo *class_resolveinterfacemethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool throwexception);
-classinfo *class_primitive_get(utf *name);
-bool class_is_primitive(classinfo *c);
-
bool class_issubclass(classinfo *sub, classinfo *super);
bool class_isanysubclass(classinfo *sub, classinfo *super);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: descriptor.c 7483 2007-03-08 13:17:40Z michi $
+ $Id: descriptor.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vm/jit_interface.h"
#include "vmcore/descriptor.h"
+#include "vmcore/primitive.h"
#include "vmcore/options.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: descriptor.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: descriptor.h 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
#include "toolbox/hashtable.h"
#if defined(__MIPS__)
u1 type; /* TYPE_??? of the register allocated */
#endif
- bool inmemory; /* argument in register or on stack */
- s4 regoff; /* register index or stack offset */
+ bool inmemory; /* argument in register or on stack */
+ uint32_t index; /* index into argument register array */
+ uint32_t regoff; /* register index or stack offset */
};
struct methoddesc {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: linker.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vmcore/classcache.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
+#include "vmcore/primitive.h"
#include "vmcore/rt-timing.h"
/* #include "vm/resolve.h" */
java_objectheader *linker_classrenumber_lock;
-/* primitivetype_table *********************************************************
-
- Structure for primitive classes: contains the class for wrapping
- the primitive type, the primitive class, the name of the class for
- wrapping, the one character type signature and the name of the
- primitive class.
-
- CAUTION: Don't change the order of the types. This table is indexed
- by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
-
-*******************************************************************************/
-
-primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
- { "int" , NULL, NULL, NULL, "java/lang/Integer", 'I', "[I", NULL, NULL },
- { "long" , NULL, NULL, NULL, "java/lang/Long", 'J', "[J", NULL, NULL },
- { "float" , NULL, NULL, NULL, "java/lang/Float", 'F', "[F", NULL, NULL },
- { "double" , NULL, NULL, NULL, "java/lang/Double", 'D', "[D", NULL, NULL },
- { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL, NULL },
- { "byte" , NULL, NULL, NULL, "java/lang/Byte", 'B', "[B", NULL, NULL },
- { "char" , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL, NULL },
- { "short" , NULL, NULL, NULL, "java/lang/Short", 'S', "[S", NULL, NULL },
- { "boolean" , NULL, NULL, NULL, "java/lang/Boolean", 'Z', "[Z", NULL, NULL },
- { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL, NULL },
-#if defined(ENABLE_JAVASE)
- { "void" , NULL, NULL, NULL, "java/lang/Void", 'V', NULL, NULL, NULL }
-#else
- { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL, NULL },
-#endif
-};
-
-
/* private functions **********************************************************/
-static bool link_primitivetype_table(void);
static classinfo *link_class_intern(classinfo *c);
static arraydescriptor *link_array(classinfo *c);
static void linker_compute_class_values(classinfo *c);
if (!classcache_store_unique(pseudo_class_New))
vm_abort("linker_init: could not cache pseudo_class_New");
- /* create classes representing primitive types */
-
- if (!link_primitivetype_table())
- return false;
-
-
/* Correct vftbl-entries (retarded loading and linking of class
java/lang/String). */
}
-/* link_primitivetype_table ****************************************************
-
- Create classes representing primitive types.
-
-*******************************************************************************/
-
-static bool link_primitivetype_table(void)
-{
- utf *name;
- classinfo *c;
- utf *u;
- s4 i;
-
- for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
- /* skip dummies */
-
- if (primitivetype_table[i].cname == NULL)
- continue;
-
- /* create UTF-8 name */
-
- name = utf_new_char(primitivetype_table[i].cname);
-
- primitivetype_table[i].name = name;
-
- /* create primitive class */
-
- c = class_create_classinfo(name);
-
- /* primitive classes don't have a super class */
-
- c->super.any = NULL;
-
- /* set flags and mark it as primitive class */
-
- c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
-
- /* prevent loader from loading primitive class */
-
- c->state |= CLASS_LOADED;
-
- /* INFO: don't put primitive classes into the classcache */
-
- if (!link_class(c))
- return false;
-
- primitivetype_table[i].class_primitive = c;
-
- /* create class for wrapping the primitive type */
-
- u = utf_new_char(primitivetype_table[i].wrapname);
- c = load_class_bootstrap(u);
-
- if (c == NULL)
- return false;
-
- primitivetype_table[i].class_wrap = c;
-
- /* create the primitive array class */
-
- if (primitivetype_table[i].arrayname) {
- u = utf_new_char(primitivetype_table[i].arrayname);
- c = class_create_classinfo(u);
- c = load_newly_created_array(c, NULL);
-
- if (c == NULL)
- return false;
-
- primitivetype_table[i].arrayclass = c;
-
- assert(c->state & CLASS_LOADED);
-
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
- return false;
-
- primitivetype_table[i].arrayvftbl = c->vftbl;
- }
- }
-
- return true;
-}
-
-
/* link_class ******************************************************************
Wrapper function for link_class_intern to ease monitor enter/exit
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.h 8056 2007-06-10 14:49:57Z michi $
+ $Id: linker.h 8123 2007-06-20 23:50:55Z michi $
*/
};
-/* primitivetypeinfo **********************************************************/
-
-struct primitivetypeinfo {
- char *cname; /* char name of primitive class */
- utf *name; /* name of primitive class */
- classinfo *class_wrap; /* class for wrapping primitive type */
- classinfo *class_primitive; /* primitive class */
- char *wrapname; /* name of class for wrapping */
- char typesig; /* one character type signature */
- char *arrayname; /* name of primitive array class */
- classinfo *arrayclass; /* primitive array class */
- vftbl_t *arrayvftbl; /* vftbl of primitive array class */
-};
-
-
/* global variables ***********************************************************/
-/* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_ constants */
-/* (except ARRAYTYPE_OBJECT). */
-
-extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
-
/* This lock must be taken while renumbering classes or while atomically */
/* accessing classes. */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: loader.c 7921 2007-05-20 23:14:11Z michi $
+ $Id: loader.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "vmcore/linker.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
+#include "vmcore/primitive.h"
#include "vmcore/rt-timing.h"
#if defined(ENABLE_STATISTICS)
case 'L':
/* check for cases like `[L;' or `[L[I;' or `[Ljava.lang.Object' */
if (namelen < 4 || text[2] == '[' || text[namelen - 1] != ';') {
- exceptions_throw_noclassdeffounderror(name);
+ exceptions_throw_classnotfoundexception(name);
return false;
}
}
c = tmpc;
-
- } else {
- /* loadClass has thrown an exception. We must convert
- ClassNotFoundException into
- NoClassDefFoundException. */
-
- /* XXX Maybe we should have a flag that avoids this
- conversion for calling load_class_from_classloader from
- Class.forName. Currently we do a double conversion in
- these cases. */
-
- classnotfoundexception_to_noclassdeffounderror();
}
RT_TIMING_GET_TIME(time_cache);
/* lookup if this class has already been loaded */
- if ((r = classcache_lookup(NULL, name))) {
+ r = classcache_lookup(NULL, name);
+ if (r != NULL) {
RT_TIMING_GET_TIME(time_lookup);
RT_TIMING_TIME_DIFF(time_start,time_lookup,RT_TIMING_LOAD_BOOT_LOOKUP);
if (name->text[0] == '[') {
c = load_newly_created_array(c, NULL);
+
if (c == NULL)
return NULL;
+
assert(c->state & CLASS_LOADED);
RT_TIMING_GET_TIME(time_array);
if (name == utf_java_lang_Object)
vm_abort("java/lang/NoClassDefFoundError: java/lang/Object");
- exceptions_throw_noclassdeffounderror(name);
+ exceptions_throw_classnotfoundexception(name);
return NULL;
}
s4 namelen;
utf *u;
- text = c->name->text;
+ text = c->name->text;
namelen = c->name->blength;
/* Check array class name */
if ((namelen < 2) || (text[0] != '[')) {
- exceptions_throw_noclassdeffounderror(c->name);
+ exceptions_throw_classnotfoundexception(c->name);
return NULL;
}
/* c is an array of arrays. We have to create the component class. */
u = utf_new(text + 1, namelen - 1);
- if (!(comp = load_class_from_classloader(u, loader)))
+
+ comp = load_class_from_classloader(u, loader);
+
+ if (comp == NULL)
return NULL;
assert(comp->state & CLASS_LOADED);
/* check for cases like `[L;' or `[L[I;' or `[Ljava.lang.Object' */
if ((namelen < 4) || (text[2] == '[') || (text[namelen - 1] != ';')) {
- exceptions_throw_noclassdeffounderror(c->name);
+ exceptions_throw_classnotfoundexception(c->name);
return NULL;
}
default:
/* c is an array of a primitive type */
- /* check for cases like `[II' */
- if (namelen > 2) {
- exceptions_throw_noclassdeffounderror(c->name);
+ /* check for cases like `[II' and whether the character is a
+ valid primitive type */
+
+ if ((namelen > 2) || (primitive_class_get_by_char(text[1]) == NULL)) {
+ exceptions_throw_classnotfoundexception(c->name);
return NULL;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: method.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: method.c 8123 2007-06-20 23:50:55Z michi $
*/
}
+/* method_returntype_get *******************************************************
+
+ Get the return type of the method.
+
+*******************************************************************************/
+
+classinfo *method_returntype_get(methodinfo *m)
+{
+ typedesc *td;
+ classinfo *c;
+
+ td = &(m->parseddesc->returntype);
+
+ if (!resolve_class_from_typedesc(td, true, false, &c))
+ return NULL;
+
+ return c;
+}
+
+
/* method_count_implementations ************************************************
Count the implementations of a method in a class cone (a class and all its
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: method.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: method.h 8123 2007-06-20 23:50:55Z michi $
*/
java_objectarray *method_get_parametertypearray(methodinfo *m);
java_objectarray *method_get_exceptionarray(methodinfo *m);
+classinfo *method_returntype_get(methodinfo *m);
void method_add_assumption_monomorphic(methodinfo *m, methodinfo *caller);
void method_break_assumption_monomorphic(methodinfo *m, method_worklist **wl);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: options.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: options.c 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#if defined(HAVE_STRING_H)
# include <string.h>
#endif
#include <limits.h>
-#include "vm/types.h"
-
#include "mm/memory.h"
+
#include "native/jni.h"
+
+#include "vm/vm.h"
+
#include "vmcore/options.h"
bool opt_verbosegc = false;
bool opt_verbosejni = false;
bool opt_verbosecall = false; /* trace all method invocation */
-bool opt_verboseexception = false;
-bool opt_verbosememory = false;
bool opt_verbosethreads = false;
bool showmethods = false;
const char *opt_filter_show_method = 0;
#endif
+
+/* -XX options ****************************************************************/
+
+/* NOTE: For better readability keep these alpha-sorted. */
+
+int32_t opt_ProfileGCMemoryUsage = 0;
+int32_t opt_ProfileMemoryUsage = 0;
+FILE *opt_ProfileMemoryUsageGNUPlot = NULL;
+int32_t opt_TraceExceptions = 0;
+#if defined(ENABLE_REPLACEMENT)
+int32_t opt_TraceReplacement = 0;
+#endif
+
+
+enum {
+ OPT_ProfileGCMemoryUsage,
+ OPT_ProfileMemoryUsage,
+ OPT_ProfileMemoryUsageGNUPlot,
+ OPT_TraceExceptions,
+ OPT_TraceReplacement
+};
+
+
+option_t options_XX[] = {
+ { "ProfileGCMemoryUsage", OPT_ProfileGCMemoryUsage, "" },
+ { "ProfileMemoryUsage", OPT_ProfileMemoryUsage, "" },
+ { "ProfileMemoryUsageGNUPlot", OPT_ProfileMemoryUsageGNUPlot, "" },
+ { "TraceExceptions", OPT_TraceExceptions, "" },
+#if defined(ENABLE_REPLACEMENT)
+ { "TraceReplacement", OPT_TraceReplacement, "" },
+#endif
+};
+
+
/* options_get *****************************************************************
DOCUMENT ME!!!
}
+/* options_xx ******************************************************************
+
+ Handle -XX: options.
+
+*******************************************************************************/
+
+void options_xx(const char *name)
+{
+ char *end;
+ int32_t length;
+ char *value;
+ int32_t option;
+ char *filename;
+ FILE *file;
+ int32_t i;
+
+ log_println("name: %s", name);
+
+ /* Search for a ':' in the option name and get the option name
+ length and the value of the option. */
+
+ end = strchr(name, ':');
+
+ if (end == NULL) {
+ length = strlen(name);
+ value = NULL;
+ }
+ else {
+ length = end - name;
+ value = end + 1;
+ }
+
+ /* search the option in the option array */
+
+ option = OPT_ERROR;
+
+ for (i = 0; options_XX[i].name != NULL; i++) {
+ if (strncmp(options_XX[i].name, name, length) == 0) {
+ option = options_XX[i].option;
+ break;
+ }
+ }
+
+ /* process the option */
+
+ switch (option) {
+ case OPT_ProfileGCMemoryUsage:
+ if (value == NULL)
+ opt_ProfileGCMemoryUsage = 5;
+ else
+ opt_ProfileGCMemoryUsage = atoi(value);
+ break;
+
+ case OPT_ProfileMemoryUsage:
+ if (value == NULL)
+ opt_ProfileMemoryUsage = 5;
+ else
+ opt_ProfileMemoryUsage = atoi(value);
+
+# if defined(ENABLE_STATISTICS)
+ /* we also need statistics */
+
+ opt_stat = true;
+# endif
+ break;
+
+ case OPT_ProfileMemoryUsageGNUPlot:
+ if (value == NULL)
+ filename = "profile.dat";
+ else
+ filename = value;
+
+ file = fopen(filename, "w");
+
+ if (file == NULL)
+ vm_abort("options_xx: fopen failed: %s", strerror(errno));
+
+ opt_ProfileMemoryUsageGNUPlot = file;
+ break;
+
+ case OPT_TraceExceptions:
+ opt_TraceExceptions = true;
+ break;
+
+#if defined(ENABLE_REPLACEMENT)
+ case OPT_TraceReplacement:
+ if (value == NULL)
+ opt_TraceReplacement = 1;
+ else
+ opt_TraceReplacement = atoi(value);
+ break;
+#endif
+
+ default:
+ printf("Unknown option: -XX:%s\n", name);
+ break;
+ }
+}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: options.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: options.h 8123 2007-06-20 23:50:55Z michi $
*/
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
#include "native/jni.h"
};
+typedef struct option_t option_t;
+
+struct option_t {
+ char *name;
+ int32_t option;
+ char *doc;
+};
+
+
/* global variables ***********************************************************/
extern s4 opt_index;
extern bool opt_verbosegc;
extern bool opt_verbosejni;
extern bool opt_verbosecall;
-extern bool opt_verboseexception;
-extern bool opt_verbosememory;
extern bool opt_verbosethreads;
extern bool showmethods;
extern const char *opt_filter_show_method;
#endif
+
+/* -XX options ****************************************************************/
+
+/* NOTE: For better readability keep these alpha-sorted. */
+
+extern int32_t opt_ProfileGCMemoryUsage;
+extern int32_t opt_ProfileMemoryUsage;
+extern FILE *opt_ProfileMemoryUsageGNUPlot;
+extern int32_t opt_TraceExceptions;
+#if defined(ENABLE_REPLACEMENT)
+extern int32_t opt_TraceReplacement;
+#endif
+
+
/* function prototypes ********************************************************/
-s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args);
+s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args);
+void options_xx(const char *name);
#endif /* _OPTIONS_H */
--- /dev/null
+/* src/vmcore/primitive.c - primitive types
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+
+#include "vm/types.h"
+
+#include "vm/global.h"
+
+#include "vmcore/class.h"
+#include "vmcore/primitive.h"
+#include "vmcore/utf8.h"
+
+
+/* primitivetype_table *********************************************************
+
+ Structure for primitive classes: contains the class for wrapping
+ the primitive type, the primitive class, the name of the class for
+ wrapping, the one character type signature and the name of the
+ primitive class.
+
+ CAUTION: Don't change the order of the types. This table is indexed
+ by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
+
+*******************************************************************************/
+
+primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
+ { "int" , NULL, NULL, NULL, "java/lang/Integer", 'I', "[I", NULL },
+ { "long" , NULL, NULL, NULL, "java/lang/Long", 'J', "[J", NULL },
+ { "float" , NULL, NULL, NULL, "java/lang/Float", 'F', "[F", NULL },
+ { "double" , NULL, NULL, NULL, "java/lang/Double", 'D', "[D", NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
+ { "byte" , NULL, NULL, NULL, "java/lang/Byte", 'B', "[B", NULL },
+ { "char" , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL },
+ { "short" , NULL, NULL, NULL, "java/lang/Short", 'S', "[S", NULL },
+ { "boolean" , NULL, NULL, NULL, "java/lang/Boolean", 'Z', "[Z", NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
+#if defined(ENABLE_JAVASE)
+ { "void" , NULL, NULL, NULL, "java/lang/Void", 'V', NULL, NULL }
+#else
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
+#endif
+};
+
+
+/* primitive_init **************************************************************
+
+ Create classes representing primitive types.
+
+*******************************************************************************/
+
+bool primitive_init(void)
+{
+ utf *name;
+ classinfo *c;
+ utf *u;
+ s4 i;
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
+ /* skip dummies */
+
+ if (primitivetype_table[i].cname == NULL)
+ continue;
+
+ /* create UTF-8 name */
+
+ name = utf_new_char(primitivetype_table[i].cname);
+
+ primitivetype_table[i].name = name;
+
+ /* create primitive class */
+
+ c = class_create_classinfo(name);
+
+ /* primitive classes don't have a super class */
+
+ c->super.any = NULL;
+
+ /* set flags and mark it as primitive class */
+
+ c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
+
+ /* prevent loader from loading primitive class */
+
+ c->state |= CLASS_LOADED;
+
+ /* INFO: don't put primitive classes into the classcache */
+
+ if (!link_class(c))
+ return false;
+
+ primitivetype_table[i].class_primitive = c;
+
+ /* create class for wrapping the primitive type */
+
+ u = utf_new_char(primitivetype_table[i].wrapname);
+ c = load_class_bootstrap(u);
+
+ if (c == NULL)
+ return false;
+
+ primitivetype_table[i].class_wrap = c;
+
+ /* create the primitive array class */
+
+ if (primitivetype_table[i].arrayname) {
+ u = utf_new_char(primitivetype_table[i].arrayname);
+ c = class_create_classinfo(u);
+ c = load_newly_created_array(c, NULL);
+
+ if (c == NULL)
+ return false;
+
+ primitivetype_table[i].arrayclass = c;
+
+ assert(c->state & CLASS_LOADED);
+
+ if (!(c->state & CLASS_LINKED))
+ if (!link_class(c))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+/* primitive_class_is_primitive ************************************************
+
+ Check if the given class is a primitive class.
+
+*******************************************************************************/
+
+bool primitive_class_is_primitive(classinfo *c)
+{
+ s4 i;
+
+ /* search table of primitive classes */
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+ if (primitivetype_table[i].class_primitive == c)
+ return true;
+
+ return false;
+}
+
+
+/* primitive_class_get_by_name *************************************************
+
+ Returns the primitive class of the given class name.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_name(utf *name)
+{
+ s4 i;
+
+ /* search table of primitive classes */
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+ if (primitivetype_table[i].name == name)
+ return primitivetype_table[i].class_primitive;
+
+ /* keep compiler happy */
+
+ return NULL;
+}
+
+
+/* primitive_class_get_by_type *************************************************
+
+ Returns the primitive class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_type(s4 type)
+{
+ return primitivetype_table[type].class_primitive;
+}
+
+
+/* primitive_class_get_by_char *************************************************
+
+ Returns the primitive class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_char(char ch)
+{
+ s4 index;
+
+ switch (ch) {
+ case 'I':
+ index = PRIMITIVETYPE_INT;
+ break;
+ case 'J':
+ index = PRIMITIVETYPE_LONG;
+ break;
+ case 'F':
+ index = PRIMITIVETYPE_FLOAT;
+ break;
+ case 'D':
+ index = PRIMITIVETYPE_DOUBLE;
+ break;
+ case 'B':
+ index = PRIMITIVETYPE_BYTE;
+ break;
+ case 'C':
+ index = PRIMITIVETYPE_CHAR;
+ break;
+ case 'S':
+ index = PRIMITIVETYPE_SHORT;
+ break;
+ case 'Z':
+ index = PRIMITIVETYPE_BOOLEAN;
+ break;
+ case 'V':
+ index = PRIMITIVETYPE_VOID;
+ break;
+ default:
+ return NULL;
+ }
+
+ return primitivetype_table[index].class_primitive;
+}
+
+
+/* primitive_arrayclass_get_by_type ********************************************
+
+ Returns the primitive array-class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_arrayclass_get_by_type(s4 type)
+{
+ return primitivetype_table[type].arrayclass;
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
--- /dev/null
+/* src/vmcore/primitive.c - primitive types
+
+ Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+ C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+ E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+ J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#ifndef _PRIMITIVE_H
+#define _PRIMITIVE_H
+
+#include "config.h"
+
+#include "vm/global.h"
+
+#include "vmcore/class.h"
+#include "vmcore/linker.h"
+#include "vmcore/utf8.h"
+
+
+/* primitive data types *******************************************************/
+
+/* These values are used in parsed descriptors and in some other
+ places were the different types handled internally as TYPE_INT have
+ to be distinguished. */
+
+#define PRIMITIVETYPE_COUNT 11 /* number of primitive types (+ dummies) */
+
+/* CAUTION: Don't change the numerical values! These constants are
+ used as indices into the primitive type table. */
+
+#define PRIMITIVETYPE_INT TYPE_INT
+#define PRIMITIVETYPE_LONG TYPE_LNG
+#define PRIMITIVETYPE_FLOAT TYPE_FLT
+#define PRIMITIVETYPE_DOUBLE TYPE_DBL
+#define PRIMITIVETYPE_DUMMY1 TYPE_ADR /* not used! */
+#define PRIMITIVETYPE_BYTE 5
+#define PRIMITIVETYPE_CHAR 6
+#define PRIMITIVETYPE_SHORT 7
+#define PRIMITIVETYPE_BOOLEAN 8
+#define PRIMITIVETYPE_DUMMY2 9 /* not used! */
+#define PRIMITIVETYPE_VOID TYPE_VOID
+
+
+/* CAUTION: Don't change the numerical values! These constants (with
+ the exception of ARRAYTYPE_OBJECT) are used as indices in the
+ primitive type table. */
+
+#define ARRAYTYPE_INT PRIMITIVETYPE_INT
+#define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
+#define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
+#define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
+#define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
+#define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
+#define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
+#define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
+#define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
+
+
+/* primitivetypeinfo **********************************************************/
+
+struct primitivetypeinfo {
+ char *cname; /* char name of primitive class */
+ utf *name; /* name of primitive class */
+ classinfo *class_wrap; /* class for wrapping primitive type */
+ classinfo *class_primitive; /* primitive class */
+ char *wrapname; /* name of class for wrapping */
+ char typesig; /* one character type signature */
+ char *arrayname; /* name of primitive array class */
+ classinfo *arrayclass; /* primitive array class */
+};
+
+
+/* global variables ***********************************************************/
+
+/* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
+ constants (except ARRAYTYPE_OBJECT). */
+
+extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
+
+
+/* function prototypes ********************************************************/
+
+bool primitive_init(void);
+bool primitive_class_is_primitive(classinfo *c);
+classinfo *primitive_class_get_by_name(utf *name);
+classinfo *primitive_class_get_by_type(s4 type);
+classinfo *primitive_class_get_by_char(char ch);
+classinfo *primitive_arrayclass_get_by_type(s4 type);
+
+#endif /* _PRIMITIVE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: statistics.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: statistics.c 8123 2007-06-20 23:50:55Z michi $
*/
int count_jit_calls = 0;
int count_methods = 0;
-int count_spills = 0;
-int count_spills_read = 0;
+int count_spills_read_ila = 0;
+int count_spills_read_flt = 0;
+int count_spills_read_dbl = 0;
+int count_spills_write_ila = 0;
+int count_spills_write_flt = 0;
+int count_spills_write_dbl = 0;
int count_pcmd_activ = 0;
int count_pcmd_drop = 0;
int count_pcmd_zero = 0;
int count_max_new_stack = 0;
int count_upper_bound_new_stack = 0;
+int count_emit_branch = 0;
+int count_emit_branch_8bit = 0;
+int count_emit_branch_16bit = 0;
+int count_emit_branch_32bit = 0;
+int count_emit_branch_64bit = 0;
+
s4 count_branches_resolved = 0;
s4 count_branches_unresolved = 0;
dolog("Size of compiled Exception Tables: %d", count_javaexcsize);
dolog("Number of Machine-Instructions: %d", count_code_len >> 2);
- dolog("Number of Spills (write to memory): %d", count_spills);
- dolog("Number of Spills (read from memory): %d", count_spills_read);
+ dolog("Number of Spills (write to memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+ count_spills_write_ila + count_spills_write_flt + count_spills_write_dbl,
+ count_spills_write_ila, count_spills_write_flt, count_spills_write_dbl);
+ dolog("Number of Spills (read from memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+ count_spills_read_ila + count_spills_read_flt + count_spills_read_dbl,
+ count_spills_read_ila, count_spills_read_flt, count_spills_read_dbl);
dolog("Number of Activ Pseudocommands: %6d", count_pcmd_activ);
dolog("Number of Drop Pseudocommands: %6d", count_pcmd_drop);
dolog("Number of Const Pseudocommands: %6d (zero:%5d)",
dolog("Number of Null Pointer Checks: %6d", count_check_null);
dolog("Number of Array Bound Checks: %6d", count_check_bound);
dolog("Number of Try-Blocks: %d", count_tryblocks);
+
+ dolog("Number of branch_emit (total, 8bit/16bit/32bit/64bit offset): %d, %d/%d/%d/%d",
+ count_emit_branch, count_emit_branch_8bit, count_emit_branch_16bit,
+ count_emit_branch_32bit, count_emit_branch_64bit);
+
dolog("Maximal count of stack elements: %d", count_max_new_stack);
dolog("Upper bound of max stack elements: %d", count_upper_bound_new_stack);
dolog("Distribution of stack sizes at block boundary");
void statistics_print_gc_memory_usage(void)
{
- log_println("GC memory usage -------------------");
- log_println("");
- log_println("max. heap size: %10lld", gc_get_max_heap_size());
- log_println("");
- log_println("heap size: %10lld", gc_get_heap_size());
- log_println("free: %10lld", gc_get_free_bytes());
- log_println("used: %10lld", gc_get_total_bytes());
- log_println("");
+ static int64_t count = 0;
+ int64_t max;
+ int64_t size;
+ int64_t free;
+ int64_t used;
+ int64_t total;
+
+ count++;
+
+ max = gc_get_max_heap_size();
+ size = gc_get_heap_size();
+ free = gc_get_free_bytes();
+ used = size - free;
+ total = gc_get_total_bytes();
+
+ if (opt_ProfileMemoryUsageGNUPlot) {
+ if (count == 1)
+ fprintf(opt_ProfileMemoryUsageGNUPlot, "plot \"profile.dat\" using 1:2 with lines title \"max. Java heap size\", \"profile.dat\" using 1:3 with lines title \"Java heap size\", \"profile.dat\" using 1:4 with lines title \"used\", \"profile.dat\" using 1:5 with lines title \"free\"\n");
+
+#if SIZEOF_VOID_P == 8
+ fprintf(opt_ProfileMemoryUsageGNUPlot, "%ld %ld %ld %ld %ld\n", count, max, size, used, free);
+#else
+ fprintf(opt_ProfileMemoryUsageGNUPlot, "%lld %lld %lld %lld %lld\n", count, max, size, used, free);
+#endif
+
+ fflush(opt_ProfileMemoryUsageGNUPlot);
+ }
+ else {
+ log_println("GC memory usage -------------------");
+ log_println("");
+ log_println("max. Java heap size: %10lld", max);
+ log_println("");
+ log_println("Java heap size: %10lld", size);
+ log_println("used: %10lld", used);
+ log_println("free: %10lld", free);
+ log_println("totally used: %10lld", total);
+ log_println("");
+ }
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: statistics.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: statistics.h 8123 2007-06-20 23:50:55Z michi $
*/
extern int count_jit_calls;
extern int count_methods;
-extern int count_spills;
-extern int count_spills_read;
+extern int count_spills_read_ila;
+extern int count_spills_read_flt;
+extern int count_spills_read_dbl;
+extern int count_spills_write_ila;
+extern int count_spills_write_flt;
+extern int count_spills_write_dbl;
extern int count_pcmd_activ;
extern int count_pcmd_drop;
extern int count_pcmd_zero;
extern int count_max_new_stack;
extern int count_upper_bound_new_stack;
+extern int count_emit_branch;
+extern int count_emit_branch_8bit;
+extern int count_emit_branch_16bit;
+extern int count_emit_branch_32bit;
+extern int count_emit_branch_64bit;
+
extern s4 count_branches_resolved;
extern s4 count_branches_unresolved;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: utf8.c 8056 2007-06-10 14:49:57Z michi $
+ $Id: utf8.c 8123 2007-06-20 23:50:55Z michi $
*/
utf *utf_fillInStackTrace;
utf *utf_getSystemClassLoader;
+utf *utf_initCause;
utf *utf_loadClass;
utf *utf_printStackTrace;
utf *utf_java_lang_String__java_lang_Class;
utf *utf_java_lang_Thread__V; /* (Ljava/lang/Thread;)V */
utf *utf_java_lang_Throwable__void; /* (Ljava/lang/Throwable;)V */
+utf *utf_java_lang_Throwable__java_lang_Throwable;
utf *utf_not_named_yet; /* special name for unnamed classes */
utf *utf_null;
utf_fillInStackTrace = utf_new_char("fillInStackTrace");
utf_getSystemClassLoader = utf_new_char("getSystemClassLoader");
+ utf_initCause = utf_new_char("initCause");
utf_loadClass = utf_new_char("loadClass");
utf_printStackTrace = utf_new_char("printStackTrace");
utf_java_lang_Thread__V = utf_new_char("(Ljava/lang/Thread;)V");
utf_java_lang_Throwable__void = utf_new_char("(Ljava/lang/Throwable;)V");
+ utf_java_lang_Throwable__java_lang_Throwable =
+ utf_new_char("(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
+
utf_null = utf_new_char("null");
utf_not_named_yet = utf_new_char("\t<not_named_yet>");
array_packagename = utf_new_char("\t<the array package>");
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: utf8.h 8056 2007-06-10 14:49:57Z michi $
+ $Id: utf8.h 8123 2007-06-20 23:50:55Z michi $
*/
extern utf *utf_fillInStackTrace;
extern utf *utf_getSystemClassLoader;
+extern utf *utf_initCause;
extern utf *utf_loadClass;
extern utf *utf_printStackTrace;
extern utf *utf_java_lang_String__java_lang_Class;
extern utf *utf_java_lang_Thread__V;
extern utf *utf_java_lang_Throwable__void;
+extern utf *utf_java_lang_Throwable__java_lang_Throwable;
extern utf *utf_not_named_yet;
extern utf *utf_null;
/* tests/regression/native/testarguments.c - tests argument passing
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: testarguments.c 4893 2006-05-08 11:03:57Z twisti $
+ $Id: testarguments.c 8123 2007-06-20 23:50:55Z michi $
*/
+#include "config.h"
+
#include <stdio.h>
-#include "config.h"
#include "native/jni.h"
+JNIEXPORT jobject JNICALL Java_testarguments_adr(JNIEnv *env, jclass clazz, jint i)
+{
+ switch (i) {
+ case 1:
+ return (jobject) 0x11111111;
+ case 2:
+ return (jobject) 0x22222222;
+ case 3:
+ return (jobject) 0x33333333;
+ case 4:
+ return (jobject) 0x44444444;
+ case 5:
+ return (jobject) 0x55555555;
+ case 6:
+ return (jobject) 0x66666666;
+ case 7:
+ return (jobject) 0x77777777;
+ case 8:
+ return (jobject) 0x88888888;
+ case 9:
+ return (jobject) 0x99999999;
+ case 10:
+ return (jobject) 0xaaaaaaaa;
+ case 11:
+ return (jobject) 0xbbbbbbbb;
+ case 12:
+ return (jobject) 0xcccccccc;
+ case 13:
+ return (jobject) 0xdddddddd;
+ case 14:
+ return (jobject) 0xeeeeeeee;
+ case 15:
+ return (jobject) 0xffffffff;
+ }
+}
+
+
+JNIEXPORT void JNICALL Java_testarguments_np(JNIEnv *env, jclass clazz, jobject o)
+{
+#if SIZEOF_VOID_P == 8
+ printf(" 0x%lx", (long) o);
+#else
+ printf(" 0x%x", (int) o);
+#endif
+
+ fflush(stdout);
+}
+
+
JNIEXPORT void JNICALL Java_testarguments_nisub(JNIEnv *env, jclass clazz, jint a, jint b, jint c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k, jint l, jint m, jint n, jint o)
{
jmethodID mid;
}
+JNIEXPORT void JNICALL Java_testarguments_nasub(JNIEnv *env, jclass clazz, jobject a, jobject b, jobject c, jobject d, jobject e, jobject f, jobject g, jobject h, jobject i, jobject j, jobject k, jobject l, jobject m, jobject n, jobject o)
+{
+ jmethodID mid;
+
+#if SIZEOF_VOID_P == 8
+ printf("java-native: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", (long) a, (long) b, (long) c, (long) d, (long) e, (long) f, (long) g, (long) h, (long) i, (long) j, (long) k, (long) l, (long) m, (long) n, (long) o);
+#else
+ printf("java-native: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", (int) a, (int) b, (int) c, (int) d, (int) e, (int) f, (int) g, (int) h, (int) i, (int) j, (int) k, (int) l, (int) m, (int) n, (int) o);
+#endif
+
+ fflush(stdout);
+
+ mid = (*env)->GetStaticMethodID(env, clazz, "jasub", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V");
+
+ if (mid == 0) {
+ printf("native: couldn't find jasub\n");
+ return;
+ }
+
+ (*env)->CallStaticVoidMethod(env, clazz, mid, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
+}
+
+
JNIEXPORT void JNICALL Java_testarguments_nmsub(JNIEnv *env, jclass clazz, jint a, jlong b, jfloat c, jdouble d, jint e, jlong f, jfloat g, jdouble h, jint i, jlong j, jfloat k, jdouble l, jint m, jlong n, jfloat o)
{
jmethodID mid;
/* tests/regressions/native/testarguments.java - tests argument passing
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: testarguments.java 4893 2006-05-08 11:03:57Z twisti $
+ $Id: testarguments.java 8123 2007-06-20 23:50:55Z michi $
*/
public class testarguments {
+ public static native Object adr(int i);
+ public static native void np(Object o);
+
public static native void nisub(int a, int b, int c, int d, int e,
int f, int g, int h, int i, int j,
int k, int l, int m, int n, int o);
double f, double g, double h, double i, double j,
double k, double l, double m, double n, double o);
+ public static native void nasub(Object a, Object b, Object c, Object d, Object e,
+ Object f, Object g, Object h, Object i, Object j,
+ Object k, Object l, Object m, Object n, Object o);
+
public static native void nmsub(int a, long b, float c, double d,
int e, long f, float g, double h,
int i, long j, float k, double l,
ltest();
ftest();
dtest();
+ atest();
mtest();
}
pln();
}
+ static void atest() {
+ pln("testing address ----------------------------------------------");
+
+ asub(adr(1), adr(2), adr(3), adr(4), adr(5),
+ adr(6), adr(7), adr(8), adr(9), adr(10),
+ adr(11), adr(12), adr(13), adr(14), adr(15));
+
+ pln();
+ }
+
static void mtest() {
pln("testing mixed ------------------------------------------------");
ndsub(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
}
+ public static void asub(Object a, Object b, Object c, Object d, Object e,
+ Object f, Object g, Object h, Object i, Object j,
+ Object k, Object l, Object m, Object n, Object o) {
+ p("java-java :");
+
+ p(a); p(b); p(c); p(d); p(e);
+ p(f); p(g); p(h); p(i); p(j);
+ p(k); p(l); p(m); p(n); p(o);
+
+ pln();
+
+ nasub(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
+ }
+
public static void msub(int a, long b, float c, double d,
int e, long f, float g, double h,
int i, long j, float k, double l,
pln();
}
+ public static void jasub(Object a, Object b, Object c, Object d, Object e,
+ Object f, Object g, Object h, Object i, Object j,
+ Object k, Object l, Object m, Object n, Object o) {
+ p("native-java:");
+
+ p(a); p(b); p(c); p(d); p(e);
+ p(f); p(g); p(h); p(i); p(j);
+ p(k); p(l); p(m); p(n); p(o);
+
+ pln();
+ }
+
public static void jmsub(int a, long b, float c, double d,
int e, long f, float g, double h,
int i, long j, float k, double l,
p(Double.doubleToLongBits(d));
}
+ static void p(Object o) {
+ np(o);
+ }
+
static void pln() { System.out.println(); }
static void pln(String s) { System.out.println(s); }
}
java-native: 0x1111111111111111 0x2222222222222222 0x3333333333333333 0x4444444444444444 0x5555555555555555 0x6666666666666666 0x7777777777777777 0x8888888888888888 0x9999999999999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbbbbbbbbbb 0xcccccccccccccccc 0xdddddddddddddddd 0xeeeeeeeeeeeeeeee 0xffffffffffffffff
native-java: 0x1111111111111111 0x2222222222222222 0x3333333333333333 0x4444444444444444 0x5555555555555555 0x6666666666666666 0x7777777777777777 0x8888888888888888 0x9999999999999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbbbbbbbbbb 0xcccccccccccccccc 0xdddddddddddddddd 0xeeeeeeeeeeeeeeee 0x7ff8000000000000
+testing address ----------------------------------------------
+java-java : 0x11111111 0x22222222 0x33333333 0x44444444 0x55555555 0x66666666 0x77777777 0x88888888 0x99999999 0xaaaaaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee 0xffffffff
+java-native: 0x11111111 0x22222222 0x33333333 0x44444444 0x55555555 0x66666666 0x77777777 0x88888888 0x99999999 0xaaaaaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee 0xffffffff
+native-java: 0x11111111 0x22222222 0x33333333 0x44444444 0x55555555 0x66666666 0x77777777 0x88888888 0x99999999 0xaaaaaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee 0xffffffff
+
testing mixed ------------------------------------------------
java-java : 0x11111111 0x2222222222222222 0x33333333 0x4444444444444444 0x55555555 0x6666666666666666 0x77777777 0x8888888888888888 0x99999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbb 0xcccccccccccccccc 0xdddddddd 0xeeeeeeeeeeeeeeee 0x7fc00000
java-native: 0x11111111 0x2222222222222222 0x33333333 0x4444444444444444 0x55555555 0x6666666666666666 0x77777777 0x8888888888888888 0x99999999 0xaaaaaaaaaaaaaaaa 0xbbbbbbbb 0xcccccccccccccccc 0xdddddddd 0xeeeeeeeeeeeeeeee 0xffffffff