dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 8132 2007-06-22 11:15:47Z twisti $
+dnl $Id: configure.ac 8163 2007-06-29 18:53:55Z twisti $
dnl Process this file with autoconf to produce a configure script.
dnl keep them alpha-sorted!
AC_CHECK_HEADERS([fcntl.h])
+AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([time.h])
+AC_CHECK_HEADERS([ucontext.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_FUNCS([free])
AC_CHECK_FUNCS([fstat])
AC_CHECK_FUNCS([getcwd])
+AC_CHECK_FUNCS([gethostbyname])
AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([getpagesize])
AC_CHECK_FUNCS([getrusage])
AC_CHECK_FUNCS([getsockname])
AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([htons])
AC_CHECK_FUNCS([ioctl])
AC_CHECK_FUNCS([isnan])
AC_CHECK_FUNCS([listen])
AC_CHECK_FUNCS([localtime])
AC_CHECK_FUNCS([localtime_r])
AC_CHECK_FUNCS([lseek])
+AC_CHECK_FUNCS([malloc])
AC_CHECK_FUNCS([mmap])
AC_CHECK_FUNCS([mprotect])
AC_CHECK_FUNCS([open])
+AC_CHECK_FUNCS([recv])
AC_CHECK_FUNCS([scandir])
AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS([send])
AC_CHECK_FUNCS([setsockopt])
AC_CHECK_FUNCS([shutdown])
AC_CHECK_FUNCS([socket])
;;
esac
+ case "${OS_DIR}" in
+ solaris)
+ AC_CHECK_LIB(rt, sem_init,, [AC_MSG_ERROR(cannot find librt)])
+ ;;
+ esac
+
+
AC_CHECK_LIB(iberty, xstrerror,, [AC_MSG_ERROR(cannot find libiberty (from binutils))])
AC_CHECK_LIB(bfd, bfd_get_arch,, [AC_MSG_ERROR(cannot find libbfd (from binutils))])
AC_CHECK_LIB(opcodes, disassembler,, [AC_MSG_ERROR(cannot find libopcodes (from binutils))])
fi
-dnl check if zlib should be used
-AC_MSG_CHECKING(whether ZIP/JAR archives should be supported)
-AC_ARG_ENABLE([zlib],
- [AS_HELP_STRING(--disable-zlib,disable ZIP/JAR archive support (needs zlib) [[default=yes]])],
- [case "${enableval}" in
- no) ENABLE_ZLIB=no;;
- *) ENABLE_ZLIB=yes;;
- esac],
- [ENABLE_ZLIB=yes])
-AC_MSG_RESULT(${ENABLE_ZLIB})
-
-if test x"${ENABLE_ZLIB}" = "xyes"; then
- AC_CHECK_HEADERS([zconf.h],, [AC_MSG_ERROR(cannot find zconf.h)])
- AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
- AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
- AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
-fi
-AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
-
+AC_CHECK_ENABLE_ZLIB
dnl check for stuff to be built
AC_CHECK_ENABLE_JNI
dnl check for some classpath related stuff when we link statically
AM_ICONV_LINK
else
- dnl we need this check for --enable-staticvm, otherwise ltdl can't find dlopen
- if test x"${ENABLE_STATICVM}" = "xyes"; then
- AC_CHECK_LIB(dl, dlopen,, [AC_MSG_ERROR(cannot find libdl)])
- fi
-
- AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
- AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
+ AC_CHECK_ENABLE_LTDL
fi
AM_CONDITIONAL([WITH_STATIC_CLASSPATH], test x"${WITH_STATIC_CLASSPATH}" = "xyes")
AC_SUBST(WITH_STATIC_CLASSPATH)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: boehm.c 7615 2007-03-29 23:10:59Z michi $
+ $Id: boehm.c 8179 2007-07-05 11:21:08Z michi $
*/
{
size_t heapcurrentsize;
- GC_INIT();
+ /* just to be sure (should be set to 1 by JAVA_FINALIZATION macro) */
- /* set the maximal heap size */
+ GC_java_finalization = 1;
- GC_set_max_heap_size(heapmaxsize);
+ /* Ignore pointers that do not point to the start of an object. */
- /* set the initial heap size */
+ GC_all_interior_pointers = 0;
- heapcurrentsize = GC_get_heap_size();
+ /* suppress warnings */
- if (heapstartsize > heapcurrentsize) {
- GC_expand_hp(heapstartsize - heapcurrentsize);
- }
+ GC_set_warn_proc(gc_ignore_warnings);
+
+ /* install a GC notifier */
+
+ GC_finalize_on_demand = 1;
+ GC_finalizer_notifier = finalizer_notify;
/* define OOM function */
GC_oom_fn = gc_out_of_memory;
- /* just to be sure (should be set to 1 by JAVA_FINALIZATION macro) */
+ GC_INIT();
- GC_java_finalization = 1;
+ /* set the maximal heap size */
- /* suppress warnings */
+ GC_set_max_heap_size(heapmaxsize);
- GC_set_warn_proc(gc_ignore_warnings);
+ /* set the initial heap size */
- /* install a GC notifier */
+ heapcurrentsize = GC_get_heap_size();
- GC_finalize_on_demand = 1;
- GC_finalizer_notifier = finalizer_notify;
+ if (heapstartsize > heapcurrentsize)
+ GC_expand_hp(heapstartsize - heapcurrentsize);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: nogc.c 7615 2007-03-29 23:10:59Z michi $
+ $Id: nogc.c 8179 2007-07-05 11:21:08Z michi $
*/
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/stringlocal.h"
+#include "vm/vm.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.c 8137 2007-06-22 16:41:36Z michi $
+ $Id: jni.c 8179 2007-07-05 11:21:08Z michi $
*/
#if defined(ENABLE_JAVASE)
# include "native/vm/java_lang_ClassLoader.h"
+# include "native/vm/reflect.h"
#endif
#include "threads/lock-common.h"
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) \
+ && !defined(__M68K__) && !defined(__ARM__) && !defined(__SPARC_64__)
java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
java_objectarray *params)
{
jobject _Jv_JNI_ToReflectedMethod(JNIEnv* env, jclass cls, jmethodID methodID,
jboolean isStatic)
{
+#if defined(ENABLE_JAVASE)
+ methodinfo *m;
+ java_lang_reflect_Constructor *rc;
+ java_lang_reflect_Method *rm;
+
STATISTICS(jniinvokation());
- log_text("JNI-Call: ToReflectedMethod: IMPLEMENT ME!");
+ m = (methodinfo *) methodID;
+
+ /* HotSpot does the same assert. */
+
+ assert(((m->flags & ACC_STATIC) != 0) == (isStatic != 0));
+
+ if (m->name == utf_init) {
+ rc = reflect_constructor_new(m);
+
+ return (jobject) rc;
+ }
+ else {
+ rm = reflect_method_new(m);
+
+ return (jobject) rm;
+ }
+#else
+ vm_abort("_Jv_JNI_ToReflectedMethod: not implemented in this configuration");
+
+ /* keep compiler happy */
return NULL;
+#endif
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.c 8137 2007-06-22 16:41:36Z michi $
+ $Id: native.c 8179 2007-07-05 11:21:08Z michi $
*/
#include <assert.h>
#include <ctype.h>
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL) && defined(HAVE_LTDL_H)
# include <ltdl.h>
#endif
/* global variables ***********************************************************/
static avl_tree_t *tree_native_methods;
+
+#if defined(ENABLE_LTDL)
static hashtable *hashtable_library;
+#endif
/* prototypes *****************************************************************/
bool native_init(void)
{
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL)
/* initialize libltdl */
if (lt_dlinit())
*******************************************************************************/
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL)
lt_dlhandle native_library_open(utf *filename)
{
lt_dlhandle handle;
*******************************************************************************/
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL)
void native_library_add(utf *filename, java_objectheader *loader,
lt_dlhandle handle)
{
LOCK_MONITOR_EXIT(hashtable_library->header);
}
-#endif /* !defined(WITH_STATIC_CLASSPATH) */
+#endif
/* native_library_find *********************************************************
*******************************************************************************/
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL)
hashtable_library_name_entry *native_library_find(utf *filename,
java_objectheader *loader)
{
utf *name;
utf *newname;
functionptr f;
+#if defined(ENABLE_LTDL)
hashtable_library_loader_entry *le;
hashtable_library_name_entry *ne;
u4 key; /* hashkey */
u4 slot; /* slot in hashtable */
+#endif
#if defined(WITH_CLASSPATH_SUN)
methodinfo *method_findNative;
java_objectheader *s;
f = NULL;
+#if defined(ENABLE_LTDL)
/* normally addresses are aligned to 4, 8 or 16 bytes */
key = ((u4) (ptrint) cl) >> 4; /* align to 16-byte */
le = le->hashlink;
}
-#if defined(WITH_CLASSPATH_SUN)
+# if defined(WITH_CLASSPATH_SUN)
if (f == NULL) {
/* We can resolve the function directly from
java.lang.ClassLoader as it's a static function. */
NULL, cl, s);
}
}
-#endif
+# endif
if (f != NULL)
if (opt_verbosejni)
printf("JNI ]\n");
+#endif
/* If not found, try to find the native function symbol in the
main program. */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.h 8137 2007-06-22 16:41:36Z michi $
+ $Id: native.h 8179 2007-07-05 11:21:08Z michi $
*/
#include "config.h"
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL) && defined(HAVE_LTDL_H)
# include <ltdl.h>
#endif
/* table for locating native methods */
+#if defined(WITH_STATIC_CLASSPATH)
typedef struct nativeref nativeref;
typedef struct nativecompref nativecompref;
-
-
-#if !defined(WITH_STATIC_CLASSPATH)
-typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
-typedef struct hashtable_library_name_entry hashtable_library_name_entry;
+#endif
/* native_methods_node_t ******************************************************/
/* hashtable_library_loader_entry *********************************************/
+#if defined(ENABLE_LTDL)
+typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
+typedef struct hashtable_library_name_entry hashtable_library_name_entry;
+
struct hashtable_library_loader_entry {
hashtable_classloader_entry *cle; /* class loader */
hashtable_library_name_entry *namelink;/* libs loaded by this loader */
hashtable_library_loader_entry *hashlink;/* link for external chaining */
};
+#endif
/* hashtable_library_name_entry ***********************************************/
+#if defined(ENABLE_LTDL)
struct hashtable_library_name_entry {
utf *name; /* library name */
lt_dlhandle handle; /* libtool library handle */
#else /* defined(WITH_STATIC_CLASSPATH) */
+# if defined(ENABLE_LTDL)
lt_dlhandle native_library_open(utf *filename);
void native_library_add(utf *filename, java_objectheader *loader,
lt_dlhandle handle);
-
hashtable_library_name_entry *native_library_find(utf *filename,
java_objectheader *loader);
+# endif
functionptr native_resolve_function(methodinfo *m);
endif
if ENABLE_JAVASE
+REFLECT_SOURCES = \
+ reflect.c \
+ reflect.h
+
CLASSLOADER_SOURCES = \
java_lang_ClassLoader.c \
java_lang_ClassLoader.h
libnativevm_la_SOURCES = \
nativevm.c \
nativevm.h \
+ $(REFLECT_SOURCES) \
\
java_lang_Class.c \
java_lang_Class.h \
{ "newInstance", "()Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_Class_newInstance },
{ "isInstance", "(Ljava/lang/Object;)Z", (void *) (ptrint) &Java_java_lang_Class_isInstance },
{ "isAssignableFrom", "(Ljava/lang/Class;)Z", (void *) (ptrint) &Java_java_lang_Class_isAssignableFrom },
- { "isInterface", "()Z", (void *) (ptrint) &Java_java_lang_Class_isInterface },
- { "isArray", "()Z", (void *) (ptrint) &Java_java_lang_Class_isArray },
+ { "isInterface", "()Z", (void *) (ptrint) &_Jv_java_lang_Class_isInterface },
+ { "isArray", "()Z", (void *) (ptrint) &_Jv_java_lang_Class_isArray },
{ "getName", "()Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_Class_getName },
};
}
-/*
- * Class: java/lang/Class
- * Method: isInterface
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Class_isInterface(JNIEnv *env, java_lang_Class *this)
-{
- return _Jv_java_lang_Class_isInterface(this);
-}
-
-
-/*
- * Class: java/lang/Class
- * Method: isArray
- * Signature: ()Z
- */
-JNIEXPORT s4 JNICALL Java_java_lang_Class_isArray(JNIEnv *env, java_lang_Class *this)
-{
- return _Jv_java_lang_Class_isArray(this);
-}
-
-
/*
* Class: java/lang/Class
* Method: getName
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMClass.c 7912 2007-05-18 13:12:09Z twisti $
+ $Id: java_lang_VMClass.c 8169 2007-06-30 12:33:50Z twisti $
*/
*/
JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInterface(JNIEnv *env, jclass clazz, java_lang_Class *klass)
{
- return _Jv_java_lang_Class_isInterface(klass);
+ return _Jv_java_lang_Class_isInterface(env, klass);
}
*/
JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isArray(JNIEnv *env, jclass clazz, java_lang_Class *klass)
{
- return _Jv_java_lang_Class_isArray(klass);
+ return _Jv_java_lang_Class_isArray(env, klass);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMRuntime.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: java_lang_VMRuntime.c 8147 2007-06-27 09:23:24Z twisti $
*/
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
+#include <unistd.h>
#include <sys/utsname.h>
#if defined(__DARWIN__)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8137 2007-06-22 16:41:36Z michi $
+ $Id: java_lang_Class.c 8179 2007-07-05 11:21:08Z michi $
*/
#include "config.h"
#include <assert.h>
+#include <stdint.h>
#include <string.h>
#include "vm/types.h"
#include "native/vm/java_lang_Class.h"
#include "native/vm/java_lang_String.h"
+#if defined(ENABLE_JAVASE)
+# include "native/vm/reflect.h"
+#endif
+
#include "toolbox/logging.h"
#include "vm/builtin.h"
* Method: isInterface
* Signature: ()Z
*/
-s4 _Jv_java_lang_Class_isInterface(java_lang_Class *klass)
+JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isInterface(JNIEnv *env, java_lang_Class *this)
{
classinfo *c;
- c = (classinfo *) klass;
-
- if (c->flags & ACC_INTERFACE)
- return true;
+ c = (classinfo *) this;
- return false;
+ return class_is_interface(c);
}
classinfo *c;
java_objectarray *oa; /* result: array of field-objects */
fieldinfo *f;
- java_objectheader *o;
java_lang_reflect_Field *rf;
s4 public_fields; /* number of elements in field-array */
s4 pos;
if ((f->flags & ACC_PUBLIC) || (publicOnly == 0)) {
/* create Field object */
- o = native_new_and_init(class_java_lang_reflect_Field);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rf = (java_lang_reflect_Field *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
-
- rf->clazz = (java_lang_Class *) c;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rf->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name));
- rf->slot = i;
-
-#elif defined(WITH_CLASSPATH_SUN)
-
- rf->clazz = (java_lang_Class *) c;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rf->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name));
- rf->type = (java_lang_Class *) field_get_type(f);
- rf->modifiers = f->flags;
- rf->slot = i;
- rf->signature = f->signature ? (java_lang_String *) javastring_new(f->signature) : NULL;
- rf->annotations = NULL;
-#else
-# error unknown classpath configuration
-#endif
+ rf = reflect_field_new(f);
/* store object into array */
- oa->data[pos++] = o;
+ oa->data[pos++] = (java_objectheader *) rf;
}
}
java_objectarray *_Jv_java_lang_Class_getDeclaredMethods(java_lang_Class *klass, s4 publicOnly)
{
classinfo *c;
- java_objectheader *o;
java_lang_reflect_Method *rm;
java_objectarray *oa; /* result: array of Method-objects */
methodinfo *m; /* the current method to be represented */
s4 pos;
s4 i;
- c = (classinfo *) klass;
+ c = (classinfo *) klass;
+
public_methods = 0;
/* JOWENN: array classes do not declare methods according to mauve
clone method overriding instead of declaring it as a member
function. */
- if (_Jv_java_lang_Class_isArray(klass))
+ if (class_is_array(c))
return builtin_anewarray(0, class_java_lang_reflect_Method);
/* determine number of methods */
if (((m->flags & ACC_PUBLIC) || (publicOnly == false)) &&
((m->name != utf_init) && (m->name != utf_clinit)) &&
!(m->flags & ACC_MIRANDA)) {
+ /* create Method object */
- o = native_new_and_init(class_java_lang_reflect_Method);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rm = (java_lang_reflect_Method *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
-
- rm->clazz = (java_lang_Class *) m->class;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
- rm->slot = i;
-
-#elif defined(WITH_CLASSPATH_SUN)
-
- rm->clazz = (java_lang_Class *) m->class;
-
- /* The name needs to be interned */
- /* XXX implement me better! */
-
- rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
- rm->parameterTypes = method_get_parametertypearray(m);
- rm->returnType = (java_lang_Class *) method_returntype_get(m);
- rm->exceptionTypes = method_get_exceptionarray(m);
- rm->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
- rm->slot = i;
- rm->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
- rm->annotations = NULL;
- rm->parameterAnnotations = NULL;
- rm->annotationDefault = NULL;
-
-#else
-# error unknown classpath configuration
-#endif
+ rm = reflect_method_new(m);
/* store object into array */
- oa->data[pos++] = o;
+ oa->data[pos++] = (java_objectheader *) rm;
}
}
classinfo *c;
methodinfo *m; /* the current method to be represented */
java_objectarray *oa; /* result: array of Method-objects */
- java_objectheader *o;
java_lang_reflect_Constructor *rc;
s4 public_methods; /* number of public methods of the class */
s4 pos;
if (((m->flags & ACC_PUBLIC) || (publicOnly == 0)) &&
(m->name == utf_init)) {
+ /* create Constructor object */
- o = native_new_and_init(class_java_lang_reflect_Constructor);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rc = (java_lang_reflect_Constructor *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
-
- rc->clazz = (java_lang_Class *) c;
- rc->slot = i;
-
-#elif defined(WITH_CLASSPATH_SUN)
-
- rc->clazz = (java_lang_Class *) c;
- rc->parameterTypes = method_get_parametertypearray(m);
- rc->exceptionTypes = method_get_exceptionarray(m);
- rc->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
- rc->slot = i;
- rc->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
- rc->annotations = NULL;
- rc->parameterAnnotations = NULL;
-
-#else
-# error unknown classpath configuration
-#endif
+ rc = reflect_constructor_new(m);
/* store object into array */
- oa->data[pos++] = o;
+ oa->data[pos++] = (java_objectheader *) rc;
}
}
* Method: isArray
* Signature: ()Z
*/
-s4 _Jv_java_lang_Class_isArray(java_lang_Class *klass)
+JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isArray(JNIEnv *env, java_lang_Class *this)
{
classinfo *c;
- c = (classinfo *) klass;
+ c = (classinfo *) this;
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
- return 0;
-
- return (c->vftbl->arraydesc != NULL);
+ return class_is_array(c);
}
{
classinfo *c;
methodinfo *m;
- java_objectheader *o;
java_lang_reflect_Constructor *rc;
c = (classinfo *) klass;
if (m->name != utf_init)
return NULL;
- /* create java.lang.reflect.Constructor object */
-
- o = native_new_and_init(class_java_lang_reflect_Constructor);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rc = (java_lang_reflect_Constructor *) o;
+ /* create Constructor object */
- rc->clazz = (java_lang_Class *) m->class;
- rc->slot = m - m->class->methods; /* calculate method slot */
+ rc = reflect_constructor_new(m);
return rc;
}
{
classinfo *c;
methodinfo *m;
- java_objectheader *o;
java_lang_reflect_Method *rm;
c = (classinfo *) klass;
/* create java.lang.reflect.Method object */
- o = native_new_and_init(class_java_lang_reflect_Method);
-
- if (o == NULL)
- return NULL;
-
- /* initialize instance fields */
-
- rm = (java_lang_reflect_Method *) o;
-
-#if defined(WITH_CLASSPATH_GNU)
- rm->clazz = (java_lang_Class *) m->class;
-#elif defined(WITH_CLASSPATH_SUN)
- rm->clazz = (java_lang_Class *) m->class;
-#else
-# error unknown classpath configuration
-#endif
-
- rm->name = (java_lang_String *) javastring_new(m->name);
- rm->slot = m - m->class->methods; /* calculate method slot */
+ rm = reflect_method_new(m);
return rm;
}
#define _JV_JAVA_LANG_CLASS_H
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
#include "native/jni.h"
s4 _Jv_java_lang_Class_isInstance(java_lang_Class *klass, java_lang_Object *o);
s4 _Jv_java_lang_Class_isAssignableFrom(java_lang_Class *klass, java_lang_Class *c);
-s4 _Jv_java_lang_Class_isInterface(java_lang_Class *klass);
+JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isInterface(JNIEnv *env, java_lang_Class *this);
#if defined(ENABLE_JAVASE)
s4 _Jv_java_lang_Class_isPrimitive(java_lang_Class *klass);
java_lang_ClassLoader *_Jv_java_lang_Class_getClassLoader(java_lang_Class *klass);
#endif
-s4 _Jv_java_lang_Class_isArray(java_lang_Class *klass);
+JNIEXPORT int32_t JNICALL _Jv_java_lang_Class_isArray(JNIEnv *env, java_lang_Class *this);
#if defined(ENABLE_JAVASE)
void _Jv_java_lang_Class_throwException(java_lang_Throwable *t);
#include "config.h"
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL) && defined(HAVE_LTDL_H)
# include <ltdl.h>
#endif
s4 _Jv_java_lang_Runtime_loadLibrary(java_lang_String *libname, java_objectheader *cl)
#endif
{
-#if !defined(WITH_STATIC_CLASSPATH)
+#if defined(ENABLE_LTDL)
utf *name;
lt_dlhandle handle;
# if defined(ENABLE_JNI)
lt_ptr onload;
s4 version;
# endif
-#endif
if (libname == NULL) {
exceptions_throw_nullpointerexception();
return 0;
}
-#if defined(WITH_STATIC_CLASSPATH)
- return 1;
-#else /* defined(WITH_STATIC_CLASSPATH) */
name = javastring_toutf((java_objectheader *) libname, false);
/* is the library already loaded? */
native_library_add(name, cl, handle);
return 1;
-#endif /* defined(WITH_STATIC_CLASSPATH) */
+#else
+ vm_abort("_Jv_java_lang_Runtime_loadLibrary: not available");
+
+ /* keep compiler happy */
+
+ return 0;
+#endif
}
static JNINativeMethod methods[] = {
{ "registerNatives", "()V", (void *) (intptr_t) &Java_sun_misc_Unsafe_registerNatives },
{ "getInt", "(Ljava/lang/Object;J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J },
+ { "putObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putObject },
{ "getBoolean", "(Ljava/lang/Object;J)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_getBoolean },
{ "putBoolean", "(Ljava/lang/Object;JZ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putBoolean },
{ "getByte", "(Ljava/lang/Object;J)B", (void *) (intptr_t) &Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J },
{ "compareAndSwapLong", "(Ljava/lang/Object;JJJ)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapLong },
{ "getObjectVolatile", "(Ljava/lang/Object;J)Ljava/lang/Object;", (void *) (intptr_t) &Java_sun_misc_Unsafe_getObjectVolatile },
{ "getIntVolatile", "(Ljava/lang/Object;J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getIntVolatile },
+ { "unpark", "(Ljava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_unpark },
+ { "park", "(ZJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_park },
};
}
+/*
+ * Class: sun/misc/Unsafe
+ * Method: putObject
+ * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset, java_lang_Object *x)
+{
+ void **p;
+
+ p = (void **) (((uint8_t *) o) + offset);
+
+ *p = (void *) x;
+}
+
+
/*
* Class: sun/misc/Unsafe
* Method: getBoolean
}
+/*
+ * Class: sun/misc/Unsafe
+ * Method: unpark
+ * Signature: (Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *thread)
+{
+ /* XXX IMPLEMENT ME */
+}
+
+
+/*
+ * Class: sun/misc/Unsafe
+ * Method: park
+ * Signature: (ZJ)V
+ */
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, sun_misc_Unsafe *this, int32_t isAbsolute, int64_t time)
+{
+ /* XXX IMPLEMENT ME */
+}
+
+
/*
* 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
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: builtin.c 8179 2007-07-05 11:21:08Z michi $
*/
#include "vm/stringlocal.h"
#include "vm/jit/asmpart.h"
-#include "vm/jit/patcher.h"
#include "vmcore/class.h"
#include "vmcore/loader.h"
#endif /* !(SUPPORT_FLOAT && SUPPORT_F2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC) */
-#if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L)
+#if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L) || defined(DISABLE_GC)
s8 builtin_f2l(float a)
{
s8 l;
#endif /* !(SUPPORT_DOUBLE && SUPPORT_D2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC) */
-#if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L)
+#if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L) || defined(DISABLE_GC)
s8 builtin_d2l(double a)
{
double d;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: exceptions.c 8178 2007-07-05 11:13:20Z michi $
*/
#include "vm/jit/disass.h"
#include "vm/jit/jit.h"
#include "vm/jit/methodheader.h"
+#include "vm/jit/patcher-common.h"
#include "vm/jit/stacktrace.h"
#include "vmcore/class.h"
bool exceptions_init(void)
{
+#if !(defined(__ARM__) && defined(__LINUX__))
+ /* On arm-linux the first memory page can't be mmap'ed, as it
+ contains the exception vectors. */
+
int pagesize;
/* mmap a memory page at address 0x0, so our hardware-exceptions
pagesize = getpagesize();
(void) memory_mmap_anon(NULL, pagesize, PROT_NONE, MAP_PRIVATE | MAP_FIXED);
+#endif
/* check if we get into trouble with our hardware-exceptions */
- if (OFFSET(java_bytearray, data) <= EXCEPTION_HARDWARE_PATCHER)
- vm_abort("signal_init: array-data offset is less or equal the maximum hardware-exception displacement: %d <= %d", OFFSET(java_bytearray, data), EXCEPTION_HARDWARE_PATCHER);
+ if (OFFSET(java_bytearray, data) <= EXCEPTION_HARDWARE_LARGEST)
+ vm_abort("signal_init: array-data offset is less or equal the maximum hardware-exception displacement: %d <= %d", OFFSET(java_bytearray, data), EXCEPTION_HARDWARE_LARGEST);
/* java/lang/Throwable */
*******************************************************************************/
-java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val)
+java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val, stackframeinfo *sfi)
{
- stackframeinfo sfi;
java_objectheader *e;
java_objectheader *o;
s4 index;
/* create stackframeinfo */
- stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
+ stacktrace_create_extern_stackframeinfo(sfi, pv, sp, ra, xpc);
switch (type) {
case EXCEPTION_HARDWARE_NULLPOINTER:
e = exceptions_fillinstacktrace();
break;
+ case EXCEPTION_HARDWARE_PATCHER:
+ e = patcher_handler(xpc);
+ break;
+
default:
/* let's try to get a backtrace */
/* remove stackframeinfo */
- stacktrace_remove_stackframeinfo(&sfi);
+ stacktrace_remove_stackframeinfo(sfi);
/* return the exception object */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: exceptions.h 8178 2007-07-05 11:13:20Z michi $
*/
#include "vm/global.h"
+#include "vm/jit/stacktrace.h"
+
#include "vmcore/references.h"
#include "vmcore/method.h"
8-byte boundaries, since normal loads could have such offsets with
a base of NULL which should result in a NullPointerException.
- NOTE: In signal_init() we have a check whether the offset of
+ NOTE: In exceptions_init() we have a check whether the offset of
java_objectheader.data[0] is greater than the largest displacement
defined below. Otherwise normal array loads/stores could trigger
an exception.
#define EXCEPTION_HARDWARE_EXCEPTION 5
#define EXCEPTION_HARDWARE_PATCHER 6
+#define EXCEPTION_HARDWARE_COMPILER 7
+
+#define EXCEPTION_HARDWARE_LARGEST 7
/* function prototypes ********************************************************/
java_objectheader *exceptions_fillinstacktrace(void);
-java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val);
+java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val, stackframeinfo *sfi);
void exceptions_print_exception(java_objectheader *xptr);
void exceptions_print_current_exception(void);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: global.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: global.h 8179 2007-07-05 11:21:08Z michi $
*/
#define ACC_CLASS_REFLECT_MASK 0x0000ffff/* flags reported by reflection */
#define ACC_CLASS_PRIMITIVE 0x00010000/* class is a primitive class */
+
#define ACC_CLASS_HAS_POINTERS 0x00020000/* instance contains pointers */
-#define ACC_CLASS_SOFT_REFERENCE 0x00040000
-#define ACC_CLASS_WEAK_REFERENCE 0x00080000
-#define ACC_CLASS_PHANTOM_REFERENCE 0x00100000
+
+#define ACC_CLASS_REFERENCE_MASK 0x001c0000
+#define ACC_CLASS_REFERENCE_SOFT 0x00040000
+#define ACC_CLASS_REFERENCE_WEAK 0x00080000
+#define ACC_CLASS_REFERENCE_PHANTOM 0x00100000
/* special flags used in methodinfo *******************************************/
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
-## $Id: Makefile.am 7786 2007-04-21 12:37:47Z edwin $
+## $Id: Makefile.am 8145 2007-06-27 08:54:10Z michi $
## Process this file with automake to produce Makefile.in
jit.h \
parse.c \
parse.h \
+ patcher-common.c \
+ patcher-common.h \
$(RECOMPILE_SOURCES) \
$(REG_SOURCES) \
$(REPLACE_SOURCES) \
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7955 2007-05-23 18:05:26Z twisti $
+ $Id: md-os.c 8178 2007-07-05 11:13:20Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
/* generate appropriate exception */
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 8127 2007-06-21 11:55:56Z michi $
+ $Id: asmpart.S 8160 2007-06-28 01:52:19Z michi $
*/
.globl asm_abstractmethoderror
- .globl asm_patcher_wrapper
-
.globl asm_cacheflush
.globl asm_getclassvalues_atomic
b asm_handle_exception_loop
-/* asm_patcher_wrapper *********************************************************
-* *
-* TODO: document me *
-* *
-* Stack layout when calling patcher function: *
-* 28 empty because stack needs to be aligned *
-* 24 saved REG_ITMP3, should be restored ( -8) *
-* 20 data segment displacement from load instructions (-12) *
-* 16 return address into JIT code (patch position) (-16) *
-* 12 pointer to virtual java_objectheader *
-* 8 machine code (which is patched back later) *
-* [ 8 result of patcher function (indicates exception) ] *
-* 4 unresolved class/method/field reference *
-* [ 0 patcher function pointer to call ] *
-* 0 saved IP of caller (caller needs it!) *
-* *
-*******************************************************************************/
-
-#define PATCHSTACKSIZE 8*4
-
-asm_patcher_wrapper:
- mov itmp3, sp /* preserve original SP in ITMP3 */
-
- SAVE_ARGUMENT_REGISTERS_IP /* save our argument registers & LR */
- SAVE_FLOAT_REGISTERS /* save our float registers here */
-
- mov a0, itmp3 /* pass SP of patcher stub */
- mov a1, ip /* pass PV */
- mov a2, lr /* pass RA (correct for leafs) */
- bl patcher_wrapper
- mov itmp3, res1 /* save return value */
-
- RESTORE_FLOAT_REGISTERS /* restore our float registers here */
- RESTORE_ARGUMENT_REGISTERS_IP /* load our argument registers & LR */
-
- add sp, sp, #PATCHSTACKSIZE /* remove patcher stack frame */
-
- tst itmp3, itmp3 /* check for an exception */
- bne L_asm_patcher_wrapper_exception
-
- ldr itmp3, [sp, #-8] /* restore ITMP3 for calling method */
- ldr pc, [sp, #-16] /* jump to new patched code */
-
-L_asm_patcher_wrapper_exception:
- mov xptr, itmp3 /* get exception */
- ldr xpc, [sp, #-16] /* RA is xpc */
-
- /* Note: A normal branch instruction could modify the PV here, */
- /* so we use this construct instead. */
- ldr pc, [pc, #-4]
- .word asm_handle_exception
-
-
/* asm_abstractmethoderror *****************************************************
Creates and throws an AbstractMethodError.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8127 2007-06-21 11:55:56Z michi $
+ $Id: codegen.c 8160 2007-06-28 01:52:19Z michi $
*/
#include "vm/jit/md.h"
#include "vm/jit/methodheader.h"
#include "vm/jit/parse.h"
-#include "vm/jit/patcher.h"
+#include "vm/jit/patcher-common.h"
#include "vm/jit/reg.h"
#if defined(ENABLE_LSRA)
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_aconst,
- iptr->sx.val.c.ref,
- disp);
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_classinfo,
+ iptr->sx.val.c.ref, disp);
if (opt_showdisassemble)
M_NOP;
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_get_putstatic, uf, disp);
+ patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp);
if (opt_showdisassemble)
M_NOP;
fieldtype = fi->type;
if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
- codegen_addpatchref(cd, PATCHER_clinit, fi->class, 0);
+ patcher_add_patch_ref(jd, PATCHER_initialize_class,
+ fi->class, 0);
if (opt_showdisassemble)
M_NOP;
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_get_putstatic, uf, disp);
+ patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp);
if (opt_showdisassemble)
M_NOP;
fieldtype = fi->type;
if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
- codegen_addpatchref(cd, PATCHER_clinit, fi->class, 0);
+ patcher_add_patch_ref(jd, PATCHER_initialize_class,
+ fi->class, 0);
if (opt_showdisassemble)
M_NOP;
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
unresolved_field *uf = iptr->sx.s23.s3.uf;
- codegen_addpatchref(cd, PATCHER_get_putfield, uf, 0);
+ patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
if (opt_showdisassemble)
M_NOP;
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
unresolved_field *uf = iptr->sx.s23.s3.uf;
- codegen_addpatchref(cd, PATCHER_get_putfield, uf, 0);
+ patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
if (opt_showdisassemble)
M_NOP;
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
M_INTMOVE(s1, REG_ITMP1_XPTR);
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
- codegen_addpatchref(cd, PATCHER_athrow_areturn,
+ patcher_add_patch_ref(jd, PATCHER_resolve_class,
iptr->sx.s23.s2.uc, 0);
if (opt_showdisassemble)
s1 = emit_load_s1(jd, iptr, REG_RESULT);
M_INTMOVE(s1, REG_RESULT);
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
- codegen_addpatchref(cd, PATCHER_athrow_areturn,
+ patcher_add_patch_ref(jd, PATCHER_resolve_class,
iptr->sx.s23.s2.uc, 0);
if (opt_showdisassemble)
if (lm == NULL) {
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_invokestatic_special,
+ patcher_add_patch_ref(jd, PATCHER_invokestatic_special,
um, disp);
if (opt_showdisassemble)
case ICMD_INVOKEVIRTUAL:
if (lm == NULL) {
- codegen_addpatchref(cd, PATCHER_invokevirtual, um, 0);
+ patcher_add_patch_ref(jd, PATCHER_invokevirtual, um, 0);
if (opt_showdisassemble)
M_NOP;
case ICMD_INVOKEINTERFACE:
if (lm == NULL) {
- codegen_addpatchref(cd, PATCHER_invokeinterface, um, 0);
+ patcher_add_patch_ref(jd, PATCHER_invokeinterface, um, 0);
if (opt_showdisassemble)
M_NOP;
emit_label_beq(cd, BRANCH_LABEL_1);
disp = dseg_add_unique_s4(cd, 0); /* super->flags */
- codegen_addpatchref(cd, PATCHER_checkcast_instanceof_flags,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_flags,
iptr->sx.s23.s3.c.ref, disp);
if (opt_showdisassemble)
disp = dseg_add_unique_s4(cd, superindex);
}
if (super == NULL) {
- codegen_addpatchref(cd,
- PATCHER_checkcast_instanceof_interface,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_index,
iptr->sx.s23.s3.c.ref, disp);
if (opt_showdisassemble)
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_checkcast_instanceof_class,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_vftbl,
iptr->sx.s23.s3.c.ref,
disp);
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_builtin_arraycheckcast,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_classinfo,
iptr->sx.s23.s3.c.ref,
disp);
emit_label_beq(cd, BRANCH_LABEL_1);
disp = dseg_add_unique_s4(cd, 0); /* super->flags */
- codegen_addpatchref(cd, PATCHER_checkcast_instanceof_flags,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_flags,
iptr->sx.s23.s3.c.ref, disp);
if (opt_showdisassemble)
if (d == REG_ITMP2)
M_EOR(d, d, d);
- codegen_addpatchref(cd,
- PATCHER_checkcast_instanceof_interface,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_index,
iptr->sx.s23.s3.c.ref, disp);
if (opt_showdisassemble)
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_checkcast_instanceof_class,
- iptr->sx.s23.s3.c.ref,
- disp);
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_vftbl,
+ iptr->sx.s23.s3.c.ref, disp);
if (opt_showdisassemble)
M_NOP;
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
disp = dseg_add_unique_address(cd, NULL);
- codegen_addpatchref(cd, PATCHER_builtin_multianewarray,
+ patcher_add_patch_ref(jd, PATCHER_resolve_classref_to_classinfo,
iptr->sx.s23.s3.c.ref, disp);
if (opt_showdisassemble)
/* generate stubs */
- emit_patcher_stubs(jd);
+ emit_patcher_traps(jd);
/* everything's ok */
#if !defined(WITH_STATIC_CLASSPATH)
if (f == NULL) {
- codegen_addpatchref(cd, PATCHER_resolve_native, m, funcdisp);
+ patcher_add_patch_ref(jd, PATCHER_resolve_native_function, m, funcdisp);
if (opt_showdisassemble)
M_NOP;
/* generate patcher stubs */
- emit_patcher_stubs(jd);
+ emit_patcher_traps(jd);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.h 7929 2007-05-21 11:45:31Z michi $
+ $Id: codegen.h 8160 2007-06-28 01:52:19Z michi $
*/
#define M_DMOV(a,b) M_MVFD(b,a)
+#define M_TRAP(a,i) M_UNDEFINED(UNCOND,i,a);
#define M_TRAPEQ(a,i) M_UNDEFINED(COND_EQ,i,a);
#define M_TRAPLE(a,i) M_UNDEFINED(COND_LE,i,a);
#define M_TRAPHI(a,i) M_UNDEFINED(COND_HI,i,a);
#include "vm/jit/asmpart.h"
#include "vm/jit/emit-common.h"
#include "vm/jit/jit.h"
+#include "vm/jit/patcher-common.h"
#include "vm/jit/replace.h"
#include "toolbox/logging.h" /* XXX for debugging only */
}
-/* emit_patcher_stubs **********************************************************
+/* emit_patcher_traps **********************************************************
- Generates the code for the patcher stubs.
+ Generates the code for the patcher traps.
*******************************************************************************/
-void emit_patcher_stubs(jitdata *jd)
+void emit_patcher_traps(jitdata *jd)
{
codegendata *cd;
- patchref *pref;
- u4 mcode;
+ codeinfo *code;
+ patchref_t *pr;
u1 *savedmcodeptr;
u1 *tmpmcodeptr;
- s4 targetdisp;
- s4 disp;
/* get required compiler data */
- cd = jd->cd;
-
- /* generate patcher stub call code */
-
- targetdisp = 0;
+ cd = jd->cd;
+ code = jd->code;
- for (pref = cd->patchrefs; pref != NULL; pref = pref->next) {
- /* check code segment size */
+ /* generate patcher traps code */
- MCODECHECK(100);
+ for (pr = list_first_unsynced(code->patchers); pr != NULL; pr = list_next_unsynced(code->patchers, pr)) {
/* Get machine code which is patched back in later. The
- call is 1 instruction word long. */
+ trap is 1 instruction word long. */
- tmpmcodeptr = (u1 *) (cd->mcodebase + pref->branchpos);
+ tmpmcodeptr = (u1 *) (cd->mcodebase + pr->mpc);
- mcode = *((u4 *) tmpmcodeptr);
+ pr->mcode = *((u4 *) tmpmcodeptr);
- /* Patch in the call to call the following code (done at
+ /* Patch in the trap to call the signal handler (done at
compile time). */
savedmcodeptr = cd->mcodeptr; /* save current mcodeptr */
cd->mcodeptr = tmpmcodeptr; /* set mcodeptr to patch position */
- disp = ((u4 *) savedmcodeptr) - (((u4 *) tmpmcodeptr) + 2);
- M_B(disp);
+ M_TRAP(0, EXCEPTION_HARDWARE_PATCHER);
cd->mcodeptr = savedmcodeptr; /* restore the current mcodeptr */
-
- /* create stack frame (align stack to 8-byte) */
-
- M_SUB_IMM(REG_SP, REG_SP, 8 * 4);
-
- /* save itmp3 onto stack */
-
- M_STR_INTERN(REG_ITMP3, REG_SP, 6 * 4);
-
- /* calculate return address and move it onto stack */
- /* ATTENTION: we can not use BL to branch to patcher stub, */
- /* ATTENTION: because we need to preserve LR for leaf methods */
-
- disp = (s4) (((u4 *) cd->mcodeptr) - (((u4 *) tmpmcodeptr) + 1) + 2);
-
- M_SUB_IMM_EXT_MUL4(REG_ITMP3, REG_PC, disp);
- M_STR_INTERN(REG_ITMP3, REG_SP, 4 * 4);
-
- /* move pointer to java_objectheader onto stack */
-
-#if defined(ENABLE_THREADS)
- /* order reversed because of data segment layout */
-
- (void) dseg_add_unique_address(cd, NULL); /* flcword */
- (void) dseg_add_unique_address(cd, lock_get_initial_lock_word());
- disp = dseg_add_unique_address(cd, NULL); /* vftbl */
-
- M_SUB_IMM_EXT_MUL4(REG_ITMP3, REG_PV, -disp / 4);
- M_STR_INTERN(REG_ITMP3, REG_SP, 3 * 4);
-#else
- M_EOR(REG_ITMP3, REG_ITMP3, REG_ITMP3);
- M_STR_INTERN(REG_ITMP3, REG_SP, 3 * 4);
-#endif
-
- /* move machine code onto stack */
-
- disp = dseg_add_unique_s4(cd, mcode);
- M_DSEG_LOAD(REG_ITMP3, disp);
- M_STR_INTERN(REG_ITMP3, REG_SP, 2 * 4);
-
- /* move class/method/field reference onto stack */
-
- disp = dseg_add_unique_address(cd, pref->ref);
- M_DSEG_LOAD(REG_ITMP3, disp);
- M_STR_INTERN(REG_ITMP3, REG_SP, 1 * 4);
-
- /* move data segment displacement onto stack */
-
- disp = dseg_add_unique_s4(cd, pref->disp);
- M_DSEG_LOAD(REG_ITMP3, disp);
- M_STR_INTERN(REG_ITMP3, REG_SP, 5 * 4);
-
- /* move patcher function pointer onto stack */
-
- disp = dseg_add_functionptr(cd, pref->patcher);
- M_DSEG_LOAD(REG_ITMP3, disp);
- M_STR_INTERN(REG_ITMP3, REG_SP, 0 * 4);
-
- /* finally call the patcher via asm_patcher_wrapper */
- /* ATTENTION: don't use REG_PV here, because some patchers need it */
-
- if (targetdisp == 0) {
- targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
-
- disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
- /*M_DSEG_BRANCH_NOLINK(REG_PC, REG_PV, a);*/
- /* TODO: this is only a hack */
- M_DSEG_LOAD(REG_ITMP3, disp);
- M_MOV(REG_PC, REG_ITMP3);
- }
- else {
- disp = (((u4 *) cd->mcodebase) + targetdisp) -
- (((u4 *) cd->mcodeptr) + 2);
-
- M_B(disp);
- }
}
}
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
scontext_t *_sc;
u1 *pv;
/* this is a NullPointerException */
-/* addr = _mc->gregs[s1]; */
addr = *((s4 *) _sc + OFFSET(scontext_t, arm_r0)/4 + ((mcode >> 16) & 0x0f));
type = EXCEPTION_HARDWARE_NULLPOINTER;
val = 0;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
scontext_t *_sc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
- /* set registers */
+ /* set registers if we have an exception, return continue execution
+ otherwise (this is needed for patchers to work) */
- _sc->arm_r10 = (ptrint) o;
- _sc->arm_fp = (ptrint) xpc;
- _sc->arm_pc = (ptrint) asm_handle_exception;
+ if (o != NULL) {
+ _sc->arm_r10 = (ptrint) o;
+ _sc->arm_fp = (ptrint) xpc;
+ _sc->arm_pc = (ptrint) asm_handle_exception;
+ }
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: patcher.c 7929 2007-05-21 11:45:31Z michi $
+ $Id: patcher.c 8160 2007-06-28 01:52:19Z michi $
*/
#include "vm/jit/asmpart.h"
#include "vm/jit/md.h"
-#include "vm/jit/patcher.h"
+#include "vm/jit/patcher-common.h"
#include "vmcore/field.h"
#include "vmcore/options.h"
#include "vm/resolve.h"
+#define PATCH_BACK_ORIGINAL_MCODE \
+ *((u4 *) pr->mpc) = (u4) pr->mcode; \
+ md_icacheflush((u1 *) pr->mpc, 1 * 4);
+
#define gen_resolveload(inst,offset) \
assert((offset) >= -0x0fff && (offset) <= 0x0fff); \
assert(!((inst) & 0x0fff)); \
}
-/* patcher_wrapper *************************************************************
-
- Wrapper for all patchers. It also creates the stackframe info
- structure.
-
- If the return value of the patcher function is false, it gets the
- exception object, clears the exception pointer and returns the
- exception.
-
-*******************************************************************************/
-
-java_objectheader *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra)
-{
- stackframeinfo sfi;
- u1 *xpc;
- java_objectheader *o;
- u4 mcode;
- functionptr f;
- bool result;
- java_objectheader *e;
-
- /* define the patcher function */
-
- bool (*patcher_function)(u1 *);
-
- assert(pv != NULL);
-
- /* get stuff from the stack */
-
- xpc = (u1 *) *((ptrint *) (sp + 4 * 4));
- o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
- f = (functionptr) *((ptrint *) (sp + 0 * 4));
-
- /* calculate and set the new return address */
-
- xpc = xpc - 1 * 4;
-
- *((ptrint *) (sp + 4 * 4)) = (ptrint) xpc;
-
- /* store PV into the patcher function position */
-
- *((ptrint *) (sp + 0 * 4)) = (ptrint) pv;
-
- /* cast the passed function to a patcher function */
-
- patcher_function = (bool (*)(u1 *)) (ptrint) f;
-
- /* enter a monitor on the patching position */
-
- PATCHER_MONITORENTER;
-
- /* create the stackframeinfo */
-
- stacktrace_create_extern_stackframeinfo(&sfi, pv, sp + 8 * 4, ra, xpc);
-
- /* call the proper patcher function */
-
- result = (patcher_function)(sp);
-
- /* remove the stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- /* check for an error, get the exception and return it */
-
- if (result == false) {
- e = exceptions_get_and_clear_exception();
-
- PATCHER_MONITOREXIT;
-
- return e;
- }
-
- /* patch back original code */
-
- mcode = *((u4 *) (sp + 2 * 4));
-
- *((u4 *) xpc) = mcode;
-
- /* synchronize instruction cache */
-
- md_icacheflush(xpc, 1 * 4);
-
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
- return NULL;
-}
-
-
/* patcher_get_putstatic *******************************************************
Machine code:
*******************************************************************************/
-bool patcher_get_putstatic(u1 *sp)
+bool patcher_get_putstatic(patchref_t *pr)
{
- s4 disp;
unresolved_field *uf;
- u1 *pv;
+ u1 *datap;
fieldinfo *fi;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- uf = (unresolved_field *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
+ uf = (unresolved_field *) pr->ref;
+ datap = (u1 *) pr->datap;
/* get the fieldinfo */
if (!initialize_class(fi->class))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch the field value's address */
- *((ptrint *) (pv + disp)) = (ptrint) &(fi->value);
+ *((ptrint *) datap) = (ptrint) &(fi->value);
return true;
}
*******************************************************************************/
-bool patcher_get_putfield(u1 *sp)
+bool patcher_get_putfield(patchref_t *pr)
{
u1 *ra;
u4 mcode;
unresolved_field *uf;
- u1 *pv;
fieldinfo *fi;
/* get stuff from the stack */
- ra = (u1*) *((ptrint *) (sp + 4 * 4));
- mcode = *((u4 *) (sp + 2 * 4));
- uf = (unresolved_field*) *((ptrint *) (sp + 1 * 4));
- pv = (u1*) *((ptrint *) (sp + 0 * 4));
+ ra = (u1*) pr->mpc;
+ mcode = pr->mcode;
+ uf = (unresolved_field*) pr->ref;
/* get the fieldinfo */
if (!(fi = resolve_field_eager(uf)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* if we show disassembly, we have to skip the nop */
- if (opt_showdisassemble) {
+ if (opt_showdisassemble)
ra = ra + 1 * 4;
- /* patch the field's offset into the instruction */
-
- switch(fi->type) {
- case TYPE_ADR:
- case TYPE_INT:
-#if defined(ENABLE_SOFTFLOAT)
- case TYPE_FLT:
-#endif
- assert(fi->offset <= 0x0fff);
- *((u4 *) (ra + 0 * 4)) |= (fi->offset & 0x0fff);
- break;
-
- case TYPE_LNG:
-#if defined(ENABLE_SOFTFLOAT)
- case TYPE_DBL:
-#endif
- assert((fi->offset + 4) <= 0x0fff);
- *((u4 *) (ra + 0 * 4)) |= ((fi->offset + 0) & 0x0fff);
- *((u4 *) (ra + 1 * 4)) |= ((fi->offset + 4) & 0x0fff);
- break;
-
-#if !defined(ENABLE_SOFTFLOAT)
- case TYPE_FLT:
- case TYPE_DBL:
- assert(fi->offset <= 0x03ff);
- *((u4 *) (ra + 0 * 4)) |= ((fi->offset >> 2) & 0x00ff);
- break;
-#endif
- }
- }
- else {
- /* patch the field's offset into the instruction stored on the
- stack and the next instruction in the code */
+ /* patch the field's offset into the instruction */
- switch(fi->type) {
- case TYPE_ADR:
- case TYPE_INT:
+ switch(fi->type) {
+ case TYPE_ADR:
+ case TYPE_INT:
#if defined(ENABLE_SOFTFLOAT)
- case TYPE_FLT:
+ case TYPE_FLT:
#endif
- assert(fi->offset <= 0x0fff);
- *((u4 *) (sp + 2 * 4)) |= (fi->offset & 0x0fff);
- break;
+ assert(fi->offset <= 0x0fff);
+ *((u4 *) (ra + 0 * 4)) |= (fi->offset & 0x0fff);
+ break;
- case TYPE_LNG:
+ case TYPE_LNG:
#if defined(ENABLE_SOFTFLOAT)
- case TYPE_DBL:
+ case TYPE_DBL:
#endif
- assert((fi->offset + 4) <= 0x0fff);
- *((u4 *) (sp + 2 * 4)) |= ((fi->offset + 0) & 0x0fff);
- *((u4 *) (ra + 1 * 4)) |= ((fi->offset + 4) & 0x0fff);
- break;
+ assert((fi->offset + 4) <= 0x0fff);
+ *((u4 *) (ra + 0 * 4)) |= ((fi->offset + 0) & 0x0fff);
+ *((u4 *) (ra + 1 * 4)) &= 0xfffff000;
+ *((u4 *) (ra + 1 * 4)) |= ((fi->offset + 4) & 0x0fff);
+ break;
#if !defined(ENABLE_SOFTFLOAT)
- case TYPE_FLT:
- case TYPE_DBL:
- assert(fi->offset <= 0x03ff);
- *((u4 *) (sp + 2 * 4)) |= ((fi->offset >> 2) & 0x00ff);
- break;
+ case TYPE_FLT:
+ case TYPE_DBL:
+ assert(fi->offset <= 0x03ff);
+ *((u4 *) (ra + 0 * 4)) |= ((fi->offset >> 2) & 0x00ff);
+ break;
#endif
- }
}
/* synchronize instruction cache */
}
-/* patcher_aconst **************************************************************
+/* patcher_resolve_classref_to_classinfo ***************************************
- Machine code:
+ ACONST - Machine code:
<patched call postition>
e51cc030 ldr r0, [ip, #-48]
-*******************************************************************************/
-
-bool patcher_aconst(u1 *sp)
-{
- s4 disp;
- constant_classref *cr;
- u1 *pv;
- classinfo *c;
-
- /* get stuff from the stack */
-
- disp = *((s4 *) (sp + 5 * 4));
- cr = (constant_classref *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
-
- /* get the classinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch the classinfo pointer */
-
- *((ptrint *) (pv + disp)) = (ptrint) c;
-
- return true;
-}
-
-
-/* patcher_builtin_multianewarray **********************************************
-
- Machine code:
-
+ MULTIANEWARRAY - Machine code:
+
<patched call position>
e3a00002 mov r0, #2 ; 0x2
e51c1064 ldr r1, [ip, #-100]
e1a0e00f mov lr, pc
e51cf068 ldr pc, [ip, #-104]
-*******************************************************************************/
-
-bool patcher_builtin_multianewarray(u1 *sp)
-{
- s4 disp;
- constant_classref *cr;
- u1 *pv;
- classinfo *c;
-
- /* get stuff from the stack */
-
- disp = *((s4 *) (sp + 5 * 4));
- cr = (constant_classref *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
-
- /* get the classinfo */
-
- if (!(c = resolve_classref_eager(cr)))
- return false;
-
- /* patch the classinfo pointer */
-
- *((ptrint *) (pv + disp)) = (ptrint) c;
-
- return true;
-}
-
-
-/* patcher_builtin_arraycheckcast **********************************************
-
- Machine code:
+ ARRAYCHECKCAST - Machine code:
<patched call position>
e51c1120 ldr r1, [ip, #-288]
*******************************************************************************/
-bool patcher_builtin_arraycheckcast(u1 *sp)
+bool patcher_resolve_classref_to_classinfo(patchref_t *pr)
{
- s4 disp;
constant_classref *cr;
- u1 *pv;
+ u1 *datap;
classinfo *c;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- cr = (constant_classref *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
+ cr = (constant_classref *) pr->ref;
+ datap = (u1 *) pr->datap;
/* get the classinfo */
if (!(c = resolve_classref_eager(cr)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch the classinfo pointer */
- *((ptrint *) (pv + disp)) = (ptrint) c;
+ *((ptrint *) datap) = (ptrint) c;
return true;
}
******************************************************************************/
-bool patcher_invokestatic_special(u1 *sp)
+bool patcher_invokestatic_special(patchref_t *pr)
{
- s4 disp;
unresolved_method *um;
- u1 *pv;
+ u1 *datap;
methodinfo *m;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- um = (unresolved_method*) *((ptrint *) (sp + 1 * 4));
- pv = (u1*) *((ptrint *) (sp + 0 * 4));
+ um = (unresolved_method*) pr->ref;
+ datap = (u1 *) pr->datap;
/* get the methodinfo */
if (!(m = resolve_method_eager(um)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch stubroutine */
- *((ptrint *) (pv + disp)) = (ptrint) m->stubroutine;
+ *((ptrint *) datap) = (ptrint) m->stubroutine;
return true;
}
*******************************************************************************/
-bool patcher_invokevirtual(u1 *sp)
+bool patcher_invokevirtual(patchref_t *pr)
{
u1 *ra;
unresolved_method *um;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 4 * 4));
- um = (unresolved_method *) *((ptrint *) (sp + 1 * 4));
+ ra = (u1 *) pr->mpc;
+ um = (unresolved_method *) pr->ref;
/* get the methodinfo */
if (!(m = resolve_method_eager(um)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* if we show disassembly, we have to skip the nop */
if (opt_showdisassemble)
*******************************************************************************/
-bool patcher_invokeinterface(u1 *sp)
+bool patcher_invokeinterface(patchref_t *pr)
{
u1 *ra;
unresolved_method *um;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 4 * 4));
- um = (unresolved_method *) *((ptrint *) (sp + 1 * 4));
+ ra = (u1 *) pr->mpc;
+ um = (unresolved_method *) pr->ref;
/* get the methodinfo */
if (!(m = resolve_method_eager(um)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* if we show disassembly, we have to skip the nop */
if (opt_showdisassemble)
*******************************************************************************/
-bool patcher_checkcast_instanceof_flags(u1 *sp)
+bool patcher_resolve_classref_to_flags(patchref_t *pr)
{
- s4 disp;
constant_classref *cr;
- u1 *pv;
+ u1 *datap;
classinfo *c;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- cr = (constant_classref *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
+ cr = (constant_classref *) pr->ref;
+ datap = (u1 *) pr->datap;
/* get the classinfo */
if (!(c = resolve_classref_eager(cr)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch class flags */
- *((s4 *) (pv + disp)) = (s4) c->flags;
+ *((s4 *) datap) = (s4) c->flags;
return true;
}
-/* patcher_checkcast_instanceof_interface **************************************
+/* patcher_resolve_classref_to_index *******************************************
Machine code:
*******************************************************************************/
-bool patcher_checkcast_instanceof_interface(u1 *sp)
+bool patcher_resolve_classref_to_index(patchref_t *pr)
{
- s4 disp;
constant_classref *cr;
- u1 *pv;
+ u1 *datap;
classinfo *c;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- cr = (constant_classref *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
+ cr = (constant_classref *) pr->ref;
+ datap = (u1 *) pr->datap;
/* get the classinfo */
if (!(c = resolve_classref_eager(cr)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch super class index */
- *((s4 *) (pv + disp)) = (s4) c->index;
+ *((s4 *) datap) = (s4) c->index;
return true;
}
-/* patcher_checkcast_instanceof_class ******************************************
+/* patcher_resolve_classref_to_vftbl *******************************************
Machine code:
*******************************************************************************/
-bool patcher_checkcast_instanceof_class(u1 *sp)
+bool patcher_resolve_classref_to_vftbl(patchref_t *pr)
{
- s4 disp;
constant_classref *cr;
- u1 *pv;
+ u1 *datap;
classinfo *c;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- cr = (constant_classref *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
+ cr = (constant_classref *) pr->ref;
+ datap = (u1 *) pr->datap;
/* get the classinfo */
if (!(c = resolve_classref_eager(cr)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch super class' vftbl */
- *((ptrint *) (pv + disp)) = (ptrint) c->vftbl;
+ *((ptrint *) datap) = (ptrint) c->vftbl;
return true;
}
-/* patcher_clinit **************************************************************
+/* patcher_initialize_class ****************************************************
XXX
*******************************************************************************/
-bool patcher_clinit(u1 *sp)
+bool patcher_initialize_class(patchref_t *pr)
{
classinfo *c;
/* get stuff from the stack */
- c = (classinfo *) *((ptrint *) (sp + 1 * 4));
+ c = (classinfo *) pr->ref;
/* check if the class is initialized */
if (!initialize_class(c))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
return true;
}
-/* patcher_athrow_areturn ******************************************************
+/* patcher_resolve_class *******************************************************
Machine code:
*******************************************************************************/
#ifdef ENABLE_VERIFIER
-bool patcher_athrow_areturn(u1 *sp)
+bool patcher_resolve_class(patchref_t *pr)
{
unresolved_class *uc;
/* get stuff from the stack */
- uc = (unresolved_class *) *((ptrint *) (sp + 1 * 4));
+ uc = (unresolved_class *) pr->ref;
/* resolve the class and check subtype constraints */
if (!resolve_class_eager_no_access_check(uc))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
return true;
}
#endif /* ENABLE_VERIFIER */
-/* patcher_resolve_native ******************************************************
+/* patcher_resolve_native_function *********************************************
XXX
*******************************************************************************/
#if !defined(WITH_STATIC_CLASSPATH)
-bool patcher_resolve_native(u1 *sp)
+bool patcher_resolve_native_function(patchref_t *pr)
{
- s4 disp;
methodinfo *m;
- u1 *pv;
+ u1 *datap;
functionptr f;
/* get stuff from the stack */
- disp = *((s4 *) (sp + 5 * 4));
- m = (methodinfo *) *((ptrint *) (sp + 1 * 4));
- pv = (u1 *) *((ptrint *) (sp + 0 * 4));
+ m = (methodinfo *) pr->ref;
+ datap = (u1 *) pr->datap;
/* resolve native function */
if (!(f = native_resolve_function(m)))
return false;
+ PATCH_BACK_ORIGINAL_MCODE;
+
/* patch native function pointer */
- *((ptrint *) (pv + disp)) = (ptrint) f;
+ *((ptrint *) datap) = (ptrint) f;
return true;
}
#include "vm/jit/code.h"
#include "vm/jit/codegen-common.h"
#include "vm/jit/methodheader.h"
+#include "vm/jit/patcher-common.h"
#include "vmcore/options.h"
The following fields are set in codeinfo:
m
- isleafmethod
- all other fields are zeroed
+ patchers
RETURN VALUE:
a new, initialized codeinfo, or
code->m = m;
+ patcher_list_create(code);
+
#if defined(ENABLE_STATISTICS)
if (opt_stat)
size_codeinfo += sizeof(codeinfo);
if (code->mcode != NULL)
CFREE((void *) (ptrint) code->mcode, code->mcodelength);
+ patcher_list_free(code);
+
#if defined(ENABLE_REPLACEMENT)
replace_free_replacement_points(code);
#endif
#include "config.h"
#include "vm/types.h"
+#include "toolbox/list.h"
+
#include "vm/global.h"
#include "vm/jit/replace.h"
u1 *entrypoint; /* machine code entry point */
s4 mcodelength; /* length of generated machine code */
+ /* patcher list */
+ list_t *patchers;
+
/* replacement */
#if defined(ENABLE_REPLACEMENT)
rplpoint *rplpoints; /* replacement points */
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 8123 2007-06-20 23:50:55Z michi $
+ $Id: codegen-common.c 8179 2007-07-05 11:21:08Z michi $
*/
#include "vm/jit/emit-common.h"
#include "vm/jit/jit.h"
#include "vm/jit/md.h"
+#include "vm/jit/patcher-common.h"
#include "vm/jit/replace.h"
#if defined(ENABLE_SSA)
# include "vm/jit/optimizing/lsra.h"
#endif
s4 alignedmcodelen;
jumpref *jr;
+ patchref_t *pr;
u1 *epoint;
s4 alignedlen;
*((ptrint *) ((ptrint) epoint + cd->linenumbertablesizepos)) = lrtlen;
}
+ /* patcher resolving */
+
+ pr = list_first_unsynced(code->patchers);
+ while (pr) {
+ pr->mpc += (ptrint) epoint;
+ pr->datap = (ptrint) (pr->disp + epoint);
+ pr = list_next_unsynced(code->patchers, pr);
+ }
+
#if defined(ENABLE_REPLACEMENT)
/* replacement point resolving */
{
void emit_exception_check(codegendata *cd, instruction *iptr);
void emit_patcher_stubs(jitdata *jd);
+void emit_patcher_traps(jitdata *jd);
#if defined(ENABLE_REPLACEMENT)
void emit_replacement_stubs(jitdata *jd);
#endif
-## src/vm/jit/i386/linux/Makefile.am
+## src/vm/jit/i386/darwin/Makefile.am
##
-## Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+## Copyright (C) 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: Makefile.am 4563 2006-03-06 13:03:05Z twisti $
## Process this file with automake to produce Makefile.in
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_builddir)/src
LIBS =
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t _mc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t _mc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
_ss->eax = (ptrint) o;
_ss->ecx = (ptrint) xpc;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: md-os.c 8179 2007-07-05 11:21:08Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
_mc->gregs[REG_EAX] = (ptrint) o;
_mc->gregs[REG_ECX] = (ptrint) xpc; /* REG_ITMP2_XPC */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: patcher.c 7596 2007-03-28 21:05:53Z twisti $
+ $Id: patcher.c 8143 2007-06-26 15:47:43Z twisti $
*/
*((ptrint *) (ra + 7 + 4)) = (ptrint) c;
- /* patch new function address */
-
- *((ptrint *) (ra + 7 + 8 + 2 + 3 + 4 + 1)) =
- (ptrint) BUILTIN_multianewarray;
-
return true;
}
**********************************************************************/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, actual_ucontext_t *_uc)
{
+ stackframeinfo sfi;
uint32_t xpc, sp;
uint16_t opc;
uint32_t val, regval, off;
/*fprintf(stderr, "SEGV: sp=%x, xpc=%x, regval=%x\n", sp, xpc, regval);
*/
- e = exceptions_new_hardware_exception(0, sp, xpc, xpc, EXCEPTION_HARDWARE_NULLPOINTER, regval);
+ e = exceptions_new_hardware_exception(0, sp, xpc, xpc, EXCEPTION_HARDWARE_NULLPOINTER, regval, &sfi);
_mc->gregs[GREGS_ADRREG_OFF + REG_ATMP1] = (ptrint) e;
_mc->gregs[GREGS_ADRREG_OFF + REG_ATMP2_XPC] = (ptrint) xpc;
**********************************************************************/
void md_signal_handler_sigill(int sig, siginfo_t *siginfo, actual_ucontext_t *_uc)
{
+ stackframeinfo sfi;
uint32_t xpc, sp;
uint16_t opc;
uint32_t type;
/*fprintf(stderr, "NEW HWE: sp=%x, xpc=%x, tpye=%x, regval=%x\n", sp, xpc, type, regval);
*/
- e = exceptions_new_hardware_exception(0, sp, xpc, xpc, type, regval);
+ e = exceptions_new_hardware_exception(0, sp, xpc, xpc, type, regval, &sfi);
_mc->gregs[GREGS_ADRREG_OFF + REG_ATMP1] = (ptrint) e;
_mc->gregs[GREGS_ADRREG_OFF + REG_ATMP2_XPC] = (ptrint) xpc;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: md-os.c 8179 2007-07-05 11:21:08Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: md-os.c 8179 2007-07-05 11:21:08Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
greg_t *_gregs;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: parse.c 7813 2007-04-25 19:20:13Z twisti $
+ $Id: parse.c 8159 2007-06-28 00:31:31Z michi $
*/
#include "vm/jit/asmpart.h"
#include "vm/jit/jit.h"
#include "vm/jit/parse.h"
-#include "vm/jit/patcher.h"
#include "vm/jit/loop/loop.h"
#include "vmcore/linker.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: patcher.h 7813 2007-04-25 19:20:13Z twisti $
+ $Id: patcher.h 8160 2007-06-28 01:52:19Z michi $
*/
#include "vm/global.h"
+#if defined(__ARM__)
+# error "you should no longer include this file"
+#else
+
+
/* patcher macros *************************************************************/
#define PATCHER_FLAG_PATCHED (vftbl_t *) 0xdeadbeef
bool intrp_patcher_resolve_native(u1 *sp);
#endif /* defined(ENABLE_INTRP) */
+#endif /* architecture list */
+
#endif /* _PATCHER_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7990 2007-05-30 21:05:20Z twisti $
+ $Id: md-os.c 8178 2007-07-05 11:13:20Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t _mc;
ppc_thread_state_t *_ss;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
void md_signal_handler_sigtrap(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t _mc;
ppc_thread_state_t *_ss;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7955 2007-05-23 18:05:26Z twisti $
+ $Id: md-os.c 8178 2007-07-05 11:13:20Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
unsigned long *_gregs;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
void md_signal_handler_sigtrap(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
unsigned long *_gregs;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7958 2007-05-23 19:11:10Z twisti $
+ $Id: md-os.c 8178 2007-07-05 11:13:20Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
addr = _mc->gp_regs[s1];
type = (s4) addr;
}
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
_mc->gp_regs[REG_ITMP1] = (ptrint) e;
_mc->gp_regs[REG_ITMP2_XPC] = (ptrint) xpc;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: codegen.c 8152 2007-06-27 20:37:45Z pm $
*/
#if defined(ENABLE_PROFILING)
if (JITDATA_HAS_FLAG_INSTRUMENT(jd)) {
/* count frequency */
-
- M_ALD(REG_ITMP1, REG_PV, CodeinfoPointer);
- M_ILD(REG_ITMP2, REG_ITMP1, OFFSET(codeinfo, frequency));
- M_IADD_IMM(1, REG_ITMP2);
+ M_ALD_DSEG(REG_ITMP1, CodeinfoPointer);
+ ICONST(REG_ITMP2, 1);
+ N_AL(REG_ITMP2, OFFSET(codeinfo, frequency), RN, REG_ITMP1);
M_IST(REG_ITMP2, REG_ITMP1, OFFSET(codeinfo, frequency));
-
-/* PROFILE_CYCLE_START; */
}
#endif
M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1);
} else { /* stack arg -> spilled */
- 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 * 4 + s1 + 4);
- M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
+ N_MVC(var->vv.regoff, 8, REG_SP, cd->stackframesize * 4 + s1, REG_SP);
+ } else {
+ N_MVC(var->vv.regoff, 4, REG_SP, cd->stackframesize * 4 + s1, REG_SP);
}
}
}
} else { /* stack-arg -> spilled */
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
- M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
+ N_MVC(var->vv.regoff, 8, REG_SP, cd->stackframesize * 4 + s1, REG_SP);
var->vv.regoff = cd->stackframesize * 4 + s1;
} else {
- M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1);
- M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
+ N_MVC(var->vv.regoff, 4, REG_SP, cd->stackframesize * 4 + s1, REG_SP);
}
}
}
Changes: Edwin Steiner
- $Id: md.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: md.c 8178 2007-07-05 11:13:20Z michi $
*/
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
type = EXCEPTION_HARDWARE_NULLPOINTER;
val = 0;
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
_mc->gregs[REG_ITMP2_XPC] = (ptrint) xpc;
_mc->gregs[REG_ITMP1_XPTR] = (ptrint) e;
}
void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p) {
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *xpc;
sp = (u1 *)_mc->gregs[REG_SP];
val = (ptrint)_mc->gregs[reg];
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
_mc->gregs[REG_ITMP1_XPTR] = (ptrint)e;
_mc->gregs[REG_ITMP2_XPC] = (ptrint)xpc;
void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
type = EXCEPTION_HARDWARE_ARITHMETIC;
val = 0;
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
_mc->gregs[REG_ITMP1_XPTR] = (ptrint)e;
_mc->gregs[REG_ITMP2_XPC] = (ptrint)xpc;
Validation FAILED for eclipse small
<<<<<<<<<<<<<<<<<<<<<<< End Eclispe 10 runs >>>>>>>>>>>>>>>>>>>>>>>
+
+<<<<<<<<<<<<<<<<<<<<<<< Eclispe 10 runs 26.06.2007 >>>>>>>>>>>>>>>>>>>>>>>
+
+=== 1 ===
+===== 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 1332477 msec =====
+=== 2 ===
+===== 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 1553188 msec =====
+=== 3 ===
+===== 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 1319232 msec =====
+=== 4 ===
+===== 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:744)
+ at java.lang.VMThread.run(VMThread.java:148)
+Digest validation failed for stderr.log, expecting 0xda39a3ee5e6b4b0d3255bfef95601890afd80709 found 0x93cd485dca7fd4d628bd98a043045ab4f0c0a0ef
+===== DaCapo eclipse FAILED =====
+Validation FAILED for eclipse small
+=== 5 ===
+===== 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 1278903 msec =====
+
+=== 6 ===
+
+===== 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 1361033 msec =====
+=== 7 ===
+===== 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 1308363 msec =====
+=== 8 ===
+===== 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 1325536 msec =====
+=== 9 ===
+===== 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 1281511 msec =====
+=== 10 ===
+===== 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 1363537 msec =====
+
+<<<<<<<<<<<<<<<<<<<<<<< End Eclispe 10 runs >>>>>>>>>>>>>>>>>>>>>>>
#include "config.h"
#include "vm/jit/sparc64/md-abi.h"
-#include "offsets.h"
+#include "vm/jit/sparc64/offsets.h"
#include "md-asm.h"
.register %g2,#scratch /* define as scratch */
#include "vmcore/loader.h"
#include "vmcore/options.h"
+#include "vm/jit/sparc64/solaris/macro_rename.h"
#define BUILTIN_FLOAT_ARGS 1
s2 = nat_argintregs[nmd->params[j].regoff];
M_INTMOVE(s1, s2);
} else {
- s2 = nmd->params[j].regoff - 6 * 8;
- M_AST(s1, REG_SP, CSTACK + s2);
+ /* nmd's regoff is relative to the start of the param array */
+ s2 = BIAS + WINSAVE_CNT * 8 + nmd->params[j].regoff;
+ M_AST(s1, REG_SP, s2);
}
} else {
}
s1 = md->params[i].regoff + cd->stackframesize * 8;
- s2 = nmd->params[j].regoff - 6 * 8;
+ s2 = BIAS + WINSAVE_CNT + 8 + nmd->params[j].regoff;
M_ALD(REG_ITMP1, REG_SP, CSTACK + s1);
- M_AST(REG_ITMP1, REG_SP, CSTACK + s2);
+ M_AST(REG_ITMP1, REG_SP, s2);
}
} else {
/* JIT stack -> NAT reg */
- s2 = nmd->params[j].regoff;
- M_DLD(s2, REG_SP, CSTACK + s1);
+ s2 = BIAS + WINSAVE_CNT * 8 + nmd->params[j].regoff;
+ M_DLD(s2, REG_SP, s1);
}
else {
#include "vmcore/options.h"
+#include "vm/jit/sparc64/solaris/macro_rename.h"
+
/* how to leaf optimization in the emitted stubs?? */
#define REG_PV REG_PV_CALLEE
void md_signal_handler_sigsegv(int sig, siginfo_t *info , void *_p)
{
+ stackframeinfo sfi;
/*
ucontext_t *_uc;
mcontext_t *_mc;
}
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
} else {
pd->inmemory = true;
- pd->regoff = reguse;
+ pd->regoff = reguse * 8;
reguse++;
}
md->argfltreguse = reguse;
} else {
pd->inmemory = true;
- pd->regoff = reguse;
+ pd->regoff = reguse * 8;
reguse++;
}
/* applies when the caller's window was saved */
#define REG_WINDOW_TRANSPOSE(reg) \
- (reg + 16 * 8)
+ (reg + 16)
#endif /* _MD_ABI_H */
#include "vmcore/references.h"
#include "vm/resolve.h"
+#include "vm/jit/sparc64/solaris/macro_rename.h"
/* patcher_wrapper *************************************************************
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u4 instr;
}
#endif
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stacktrace.c 7918 2007-05-20 20:42:18Z michi $
+ $Id: stacktrace.c 8139 2007-06-24 10:12:27Z twisti $
*/
#if defined(WITH_CLASSPATH_GNU)
vmt = t->vmState;
stc = (stacktracecontainer *) vmt->vmData;
- stb = &(stc->stb);
-#elif defined(WITH_CLASSPATH_CLDC1_1)
+#elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
stc = (stacktracecontainer *) t->backtrace;
- stb = &(stc->stb);
+#else
+# error unknown classpath configuration
#endif
+ stb = &(stc->stb);
+
stacktrace_print_trace_from_buffer(stb);
}
#include "vm/resolve.h"
#include "vm/vm.h"
-#include "vm/jit/patcher.h"
#include "vm/jit/jit.h"
#include "vm/jit/show.h"
#include "vm/jit/parse.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: typecheck.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: typecheck.c 8159 2007-06-28 00:31:31Z michi $
*/
#include "vm/jit/jit.h"
#include "vm/jit/parse.h"
-#include "vm/jit/patcher.h"
#include "vm/jit/show.h"
#include "vmcore/loader.h"
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *sp;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(NULL, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(NULL, sp, ra, xpc, type, vali, &sfi);
/* set registers */
void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
{
+ stackframeinfo sfi;
ucontext_t *_uc;
mcontext_t *_mc;
u1 *pv;
/* generate appropriate exception */
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val, &sfi);
/* set registers */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: vm.c 8137 2007-06-22 16:41:36Z michi $
+ $Id: vm.c 8179 2007-07-05 11:21:08Z michi $
*/
vm_initializing = true;
+ /* initialize the garbage collector */
+
+ gc_init(opt_heapmaxsize, opt_heapstartsize);
+
#if defined(ENABLE_THREADS)
- /* pre-initialize some core thread stuff, like the stopworldlock,
- thus this has to happen _before_ gc_init()!!! */
+ /* AFTER: gc_init (directly after, as this initializes the
+ stopworldlock lock */
threads_preinit();
#endif
- /* initialize the garbage collector */
-
- gc_init(opt_heapmaxsize, opt_heapstartsize);
-
/* install architecture dependent signal handlers */
if (!signal_init())
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, java_objectarray *params)
{
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__) && !defined(__ARM__) & !defined(__M68K__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s4 vmargscount;
vm_arg *vmargs;
java_objectheader *ro;
java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
const jvalue *args)
{
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s4 vmargscount;
vm_arg *vmargs;
java_objectheader *ro;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
s8 l;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
{
s4 vmargscount;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o,
const jvalue *args)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
float f;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
const jvalue *args)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
const jvalue *args)
{
void vm_abort(const char *text, ...);
/* Java method calling functions */
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, java_objectarray *params);
#else
java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
const jvalue *args);
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
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);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.c 8140 2007-06-25 13:26:23Z michi $
+ $Id: class.c 8179 2007-07-05 11:21:08Z michi $
*/
/* check if the class is a reference class and flag it */
if (classname == utf_java_lang_ref_SoftReference) {
- c->flags |= ACC_CLASS_SOFT_REFERENCE;
+ c->flags |= ACC_CLASS_REFERENCE_SOFT;
}
else if (classname == utf_java_lang_ref_WeakReference) {
- c->flags |= ACC_CLASS_WEAK_REFERENCE;
+ c->flags |= ACC_CLASS_REFERENCE_WEAK;
}
else if (classname == utf_java_lang_ref_PhantomReference) {
- c->flags |= ACC_CLASS_PHANTOM_REFERENCE;
+ c->flags |= ACC_CLASS_REFERENCE_PHANTOM;
}
#endif
}
+/* class_is_array **************************************************************
+
+ Checks if the given class is an array class.
+
+*******************************************************************************/
+
+bool class_is_array(classinfo *c)
+{
+ if (!(c->state & CLASS_LINKED))
+ if (!link_class(c))
+ return false;
+
+ return (c->vftbl->arraydesc != NULL);
+}
+
+
+/* class_is_interface **********************************************************
+
+ Checks if the given class is an interface.
+
+*******************************************************************************/
+
+bool class_is_interface(classinfo *c)
+{
+ if (c->flags & ACC_INTERFACE)
+ return true;
+
+ return false;
+}
+
+
/* class_printflags ************************************************************
Prints flags of a class.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.h 8140 2007-06-25 13:26:23Z michi $
+ $Id: class.h 8179 2007-07-05 11:21:08Z michi $
*/
bool class_issubclass(classinfo *sub, classinfo *super);
bool class_isanysubclass(classinfo *sub, classinfo *super);
+bool class_is_array(classinfo *c);
+bool class_is_interface(classinfo *c);
/* some debugging functions */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: linker.c 8179 2007-07-05 11:21:08Z michi $
*/
if (!link_class(super))
return NULL;
- /* OR the ACC_CLASS_HAS_POINTERS flag */
+ /* OR the ACC_CLASS_HAS_POINTERS and the ACC_CLASS_REFERENCE_*
+ flags. */
- c->flags |= (super->flags & ACC_CLASS_HAS_POINTERS);
+ c->flags |= (super->flags &
+ (ACC_CLASS_HAS_POINTERS | ACC_CLASS_REFERENCE_MASK));
/* handle array classes */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: options.c 8134 2007-06-22 14:49:10Z twisti $
+ $Id: options.c 8174 2007-07-01 17:49:25Z twisti $
*/
void options_xx(const char *name)
{
- char *start;
- char *end;
- int32_t length;
- int32_t enable;
- char *value;
- int32_t option;
- char *filename;
- FILE *file;
- int32_t i;
+ const char *start;
+ char *end;
+ int32_t length;
+ int32_t enable;
+ char *value;
+ int32_t option;
+ char *filename;
+ FILE *file;
+ int32_t i;
/* Check if the option is a boolean option. */