Merged revisions 7642-7664 via svnmerge from
authormichi <none@none>
Thu, 5 Apr 2007 00:16:05 +0000 (00:16 +0000)
committermichi <none@none>
Thu, 5 Apr 2007 00:16:05 +0000 (00:16 +0000)
svn+ssh://michi@c1.complang.tuwien.ac.at/ahome/cacao/svn/cacao/trunk

........
  r7643 | twisti | 2007-04-03 13:35:40 +0200 (Tue, 03 Apr 2007) | 3 lines

  * src/vmcore/statistics.c (statistics_print_memory_usage): Prevent
  compiler warning on 64-bit machines.
........
  r7644 | twisti | 2007-04-03 13:37:30 +0200 (Tue, 03 Apr 2007) | 3 lines

  * src/vm/jit/x86_64/emit.c (emit_replacement_stubs): Removed unused
  variable disp.
........
  r7645 | twisti | 2007-04-03 13:46:50 +0200 (Tue, 03 Apr 2007) | 3 lines

  * src/vm/jit/allocator/simplereg.c (simplereg_make_statistics): Fixed
  compiler warning.
........
  r7646 | twisti | 2007-04-03 13:56:21 +0200 (Tue, 03 Apr 2007) | 3 lines

  * src/vm/jit/replace.c (native/include/java_lang_String.h): Removed.
  (java_value_print): Don't cast to java_lang_String.
........
  r7647 | twisti | 2007-04-03 14:10:22 +0200 (Tue, 03 Apr 2007) | 2 lines

  * src/vm/jit/jit.h: Includes alpha-sorted.
........
  r7648 | twisti | 2007-04-03 15:14:09 +0200 (Tue, 03 Apr 2007) | 3 lines

  * src/vm/jit/i386/linux/md-os.c (md_signal_handler_sigfpe): Use
  exceptions_new_hardware_exception.
........
  r7649 | twisti | 2007-04-03 15:47:39 +0200 (Tue, 03 Apr 2007) | 4 lines

  * src/vm/jit/arm/linux/md-os.c (md_signal_handler_sigsegv): Use
  exceptions_new_hardware_exception.
  [ENABLE_THREADS] (md_signal_handler_sigusr2): New function.
........
  r7650 | twisti | 2007-04-03 15:48:10 +0200 (Tue, 03 Apr 2007) | 2 lines

  * configure.ac: Added armv4 architecture.
........
  r7651 | twisti | 2007-04-03 16:00:32 +0200 (Tue, 03 Apr 2007) | 13 lines

  * src/vm/jit/stacktrace.c (stacktrace_create_inline_stackframeinfo):
  Removed.
  (stacktrace_inline_arithmeticexception): Likewise.
  (stacktrace_inline_arrayindexoutofboundsexception): Likewise.
  (stacktrace_inline_arraystoreexception): Likewise.
  (stacktrace_inline_classcastexception): Likewise.
  (stacktrace_inline_nullpointerexception): Likewise.
  (stacktrace_inline_fillInStackTrace): Likewise.
  (stacktrace_hardware_arithmeticexception): Likewise.
  (stacktrace_hardware_nullpointerexception): Likewise.

  * src/vm/jit/stacktrace.h: Likewise.
........
  r7652 | twisti | 2007-04-03 16:23:16 +0200 (Tue, 03 Apr 2007) | 15 lines

  * src/threads/native/threads.h (STACKFRAMEINFO): Return stackframeinfo
  instead of a pointer to it.
  * src/threads/none/threads.h (STACKFRAMEINFO): Likewise.

  * src/vm/jit/codegen-common.c (codegen_finish_native_call):
  STACKFRAMEINFO changes.

  * src/vm/jit/replace.c (replace_recover_source_state): Likewise.

  * src/vm/jit/stacktrace.c (stacktrace_create_stackframeinfo):
  Likewise.
  (stacktrace_create_extern_stackframeinfo): Likewise.
  (stacktrace_create_native_stackframeinfo): Likewise.
  (stacktrace_remove_stackframeinfo): Likewise.
........
  r7653 | twisti | 2007-04-03 16:34:23 +0200 (Tue, 03 Apr 2007) | 5 lines

  * src/vm/jit/arm/emit.c (emit_exception_stubs): Removed.

  * src/vm/jit/arm/md.c (md_codegen_patch_branch): Likewise.
  (md_stacktrace_get_returnaddress): Removed debug code.
........
  r7654 | twisti | 2007-04-03 17:22:21 +0200 (Tue, 03 Apr 2007) | 4 lines

  * src/vm/exceptions.c (exceptions_fillinstacktrace)
  [ENABLE_JAVAME_CLDC1_1]: fillInStackTrace has another signature in
  CLDC-1.1.
........
  r7655 | twisti | 2007-04-03 17:22:57 +0200 (Tue, 03 Apr 2007) | 3 lines

  * src/vm/jit/x86_64/linux/md-os.c (md_signal_handler_sigfpe): Use
  exceptions_new_hardware_exception.
........
  r7656 | twisti | 2007-04-03 17:29:26 +0200 (Tue, 03 Apr 2007) | 5 lines

  * src/vm/jit/replace.c (threads/threads-common.h): Added.

  * src/vm/jit/replace.h: Moved empty defines to the top of the file to
  see what's happening when !defined(ENABLE_REPLACEMENT).
........
  r7657 | twisti | 2007-04-03 17:51:52 +0200 (Tue, 03 Apr 2007) | 24 lines

  * src/vm/jit/stacktrace.c (stacktrace_create): Changed signature.

  (stacktrace_fillInStackTrace): Pass stackframeinfo to
  stacktrace_create.
  (stacktrace_getClassContext): Likewise.
  (stacktrace_getCurrentClass): Likewise.
  (stacktrace_getStack): Likewise.
  (stacktrace_dump_trace): Removed.

  * src/vm/jit/stacktrace.h (threads/native/threads.h)
  (threads/none/threads.h): Removed.
  (stacktrace_create): Added.
  (stacktrace_dump_trace): Removed.

  * src/threads/native/threads.c (threads_dump): Removed.
  * src/threads/native/threads.h (threads_dump): Likewise.

  * src/threads/threads-common.c (vm/jit/stacktrace.h): Added.
  (threads_dump): Added.
  (threads_print_stacktrace): Likewise.

  * src/threads/threads-common.h (threads_dump): Added.
  (threads_print_stacktrace): Likewise.
........
  r7658 | twisti | 2007-04-03 18:06:30 +0200 (Tue, 03 Apr 2007) | 10 lines

  * src/threads/threads-common.c (threads_print_stacktrace): Pass
  stackframeinfo to stacktrace_create.

  * src/vm/jit/codegen-common.c (threads/native/threads.h): Removed.
  (threads/threads-common.h): Added.
  (codegen_get_pv_from_pc): Replaced stacktrace_dump_trace with
  threads_print_stacktrace.

  * src/vm/jit/stacktrace.h (stacktrace_print_trace_from_buffer): Added.
........
  r7659 | twisti | 2007-04-03 20:02:48 +0200 (Tue, 03 Apr 2007) | 2 lines

  * src/vm/jit/mips/md-abi.h (REG_FA0, REG_FA1, REG_FA2): Defined.
........
  r7660 | twisti | 2007-04-03 23:30:13 +0200 (Tue, 03 Apr 2007) | 2 lines

  * src/vm/jit/i386/linux/md-os.c (threads/threads-common.h): Added.
........
  r7661 | twisti | 2007-04-04 00:29:59 +0200 (Wed, 04 Apr 2007) | 11 lines

  * src/vm/jit/alpha/asmpart.S: Replaced __GNU__ with __linux__ for
  exec-stacks.
  * src/vm/jit/arm/asmpart.S: Likewise.
  * src/vm/jit/i386/asmpart.S: Likewise.
  * src/vm/jit/mips/asmpart.S: Likewise.
  * src/vm/jit/powerpc/asmpart.S: Likewise.
  * src/vm/jit/powerpc64/asmpart.S: Likewise.
  * src/vm/jit/s390/asmpart.S: Likewise.
  * src/vm/jit/sparc64/asmpart.S: Likewise.
  * src/vm/jit/x86_64/asmpart.S: Likewise.
........
  r7662 | twisti | 2007-04-04 16:16:37 +0200 (Wed, 04 Apr 2007) | 8 lines

  * src/native/vm/gnu/sun_misc_Unsafe.c: Header changes.

  * src/native/native.c [ENABLE_JAVASE]
  (native/include/sun_misc_Unsafe.h): Added.
  [ENABLE_JAVASE] (dummynativetable): Added
  Java_sun_misc_Unsafe_objectFieldOffset and
  Java_sun_misc_Unsafe_compareAndSwapInt.
........
  r7663 | twisti | 2007-04-05 00:14:42 +0200 (Thu, 05 Apr 2007) | 24 lines

  * src/vm/jit/parse.c (BYTECODEINDEX_TO_BASICBLOCK): Added.
  (parsedata_t): Removed instructionstart, added bytecodestart,
  basicblockstart, bytecodemap, instructionmap.
  (parse_setup): Allocate new arrays.
  (parse_bytecodeindex_to_basicblock): New function.
  (parse_mark_exception_boundaries): Pass parsedata_t.
  (parse_resolve_exception_table): Likewise.
  (parse): Completely rewritten so we are able to have basic block
  boundaries on IR instruction level. We now also resolve basic block
  pointers in this pass.

  * src/vm/jit/parse.h (MARK_BASICBLOCK): Pass parsedata_t.
  (BLOCK_OF): Removed.

  * src/vm/jit/jit.h (jitdata): Removed basicblockindex.

  * src/vm/jit/show.c (SHOW_TARGET): Print block instead of insindex.
  (show_icmd): Likewise.

  * src/vm/jit/stack.c (BRANCH_TARGET): Directly use block.
  (stack_analyse): Likewise.
  * src/vm/jit/verify/icmds.c: Likewise.
  * src/vm/jit/verify/typecheck-stackbased.c: Likewise.
........
  r7664 | twisti | 2007-04-05 00:29:36 +0200 (Thu, 05 Apr 2007) | 4 lines

  * src/vm/jit/verify/typecheck-stackbased.c: Use block directly instead
  of insindex.
  * src/vm/jit/verify/typecheck-stackbased-gen.inc: Newly generated.
........

--HG--
branch : exact-gc

41 files changed:
configure.ac
src/mm/cacao-gc/gc.c
src/native/native.c
src/native/vm/gnu/sun_misc_Unsafe.c
src/threads/native/threads.c
src/threads/native/threads.h
src/threads/none/threads.h
src/threads/threads-common.c
src/threads/threads-common.h
src/vm/exceptions.c
src/vm/jit/allocator/simplereg.c
src/vm/jit/alpha/asmpart.S
src/vm/jit/arm/asmpart.S
src/vm/jit/arm/emit.c
src/vm/jit/arm/linux/md-os.c
src/vm/jit/arm/md.c
src/vm/jit/codegen-common.c
src/vm/jit/i386/asmpart.S
src/vm/jit/i386/linux/md-os.c
src/vm/jit/jit.h
src/vm/jit/mips/asmpart.S
src/vm/jit/mips/md-abi.h
src/vm/jit/parse.c
src/vm/jit/parse.h
src/vm/jit/powerpc/asmpart.S
src/vm/jit/powerpc64/asmpart.S
src/vm/jit/replace.c
src/vm/jit/replace.h
src/vm/jit/s390/asmpart.S
src/vm/jit/show.c
src/vm/jit/sparc64/asmpart.S
src/vm/jit/stack.c
src/vm/jit/stacktrace.c
src/vm/jit/stacktrace.h
src/vm/jit/verify/icmds.c
src/vm/jit/verify/typecheck-stackbased-gen.inc
src/vm/jit/verify/typecheck-stackbased.c
src/vm/jit/x86_64/asmpart.S
src/vm/jit/x86_64/emit.c
src/vm/jit/x86_64/linux/md-os.c
src/vmcore/statistics.c

index 202959e48818bea6d5a1d6f2390fd446beb397c8..4a982fd6c5bf78be96417ec10a2da815ab3b647b 100644 (file)
@@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 dnl 02110-1301, USA.
 dnl 
-dnl $Id: configure.ac 7601 2007-03-28 23:02:50Z michi $
+dnl $Id: configure.ac 7650 2007-04-03 13:48:10Z twisti $
 
 dnl Process this file with autoconf to produce a configure script.
 
@@ -53,7 +53,7 @@ alpha | alphaev56 | alphapca56 )
     ARCH_CFLAGS="-mieee -D__ALPHA__"
     ;;
 
-arm | armv4tl | armv5b | armv5l )
+arm | armv4 | armv4tl | armv5b | armv5l )
     ARCH_DIR="arm"
     ARCH_CFLAGS="-D__ARM__"
     ;;
index 66ff6ece2c00dd064c32b8eda0db5a19b20da8a3..b1fe76a2f170149eb0d38ae0f3a96094f8df4923 100644 (file)
@@ -158,7 +158,7 @@ void gc_collect(s4 level)
 
        /* sourcestate of the current thread, assuming we are in the native world */
        GC_LOG( dolog("GC: Stackwalking current thread ..."); );
-       GC_LOG( stacktrace_dump_trace(THREADOBJECT); );
+       GC_LOG( threads_print_stacktrace(THREADOBJECT); );
        /* TODO: GC_ASSERT(thread flags say in-native-world) */
        replace_gc_from_native(THREADOBJECT, NULL, NULL);
 
index ef8ef2ccb00caeae2e58cb7404d9a061708e0452..4a54885d347f1a7bc65ff0fad864085a5e4a7c0c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: native.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: native.c 7667 2007-04-05 00:16:05Z michi $
 
 */
 
 #include "native/include/java_lang_reflect_Method.h"
 #include "native/include/java_lang_reflect_VMProxy.h"
 #include "native/include/java_security_VMAccessController.h"
+#include "native/include/sun_misc_Unsafe.h"
 
 #if defined(ENABLE_JVMTI)
 #include "native/include/gnu_classpath_jdwp_event_EventRequest.h"
@@ -288,6 +289,9 @@ functionptr dummynativetable[] = {
 
        (functionptr) Java_java_security_VMAccessController_getStack,
 
+       (functionptr) Java_sun_misc_Unsafe_objectFieldOffset,
+       (functionptr) Java_sun_misc_Unsafe_compareAndSwapInt,
+
 #if defined(ENABLE_JVMTI)
        (functionptr) Java_gnu_classpath_jdwp_VMVirtualMachine_suspendThread,
        (functionptr) Java_gnu_classpath_jdwp_VMVirtualMachine_resumeThread,
index a916513ab56dbdc2c673f134d1fd9c9886f4b976..73a74a16629ca12c2c4e0d7d4d50077bacd60e05 100644 (file)
@@ -1,6 +1,6 @@
-/* src/native/vm/sun_misc_Unsafe.c - sun/misc/Unsafe
+/* src/native/vm/gnu/sun_misc_Unsafe.c - sun/misc/Unsafe
 
-   Copyright (C) 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+   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: java_lang_VMObject.c 5153 2006-07-18 08:19:24Z twisti $
 
 */
index ee50e7687bcadc35060f96c9f4f5f2e142826ba8..7aa114838cd183447777288e1bfd9144c06135ec 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: threads.c 7667 2007-04-05 00:16:05Z michi $
 
 */
 
@@ -2043,83 +2043,6 @@ void threads_yield(void)
 }
 
 
-/* threads_dump ****************************************************************
-
-   Dumps info for all threads running in the JVM. This function is
-   called when SIGQUIT (<ctrl>-\) is sent to CACAO.
-
-*******************************************************************************/
-
-void threads_dump(void)
-{
-       threadobject     *thread;
-       java_lang_Thread *t;
-       utf              *name;
-
-       thread = mainthreadobj;
-
-       /* XXX we should stop the world here */
-
-       printf("Full thread dump CACAO "VERSION":\n");
-
-       /* iterate over all started threads */
-
-       do {
-               /* get thread object */
-
-               t = thread->object;
-
-               /* the thread may be currently in initalization, don't print it */
-
-               if (t != NULL) {
-                       /* get thread name */
-
-#if defined(ENABLE_JAVASE)
-                       name = javastring_toutf(t->name, false);
-#elif defined(ENABLE_JAVAME_CLDC1_1)
-                       name = t->name;
-#endif
-
-                       printf("\n\"");
-                       utf_display_printable_ascii(name);
-                       printf("\" ");
-
-                       if (thread->suspended)
-                               printf("SUSPENDED(%d) ", thread->suspend_reason);
-
-                       if (thread->flags & THREAD_FLAG_JAVA)
-                               printf("java ");
-
-                       if (thread->flags & THREAD_FLAG_INTERNAL)
-                               printf("internal ");
-
-                       if (thread->flags & THREAD_FLAG_DAEMON)
-                               printf("daemon ");
-
-#if defined(ENABLE_GC_CACAO)
-                       if (thread->flags & THREAD_FLAG_IN_NATIVE)
-                               printf("in-native ");
-
-                       if (thread->gc_critical)
-                               printf("GC-CRITICAL");
-#endif
-
-#if SIZEOF_VOID_P == 8
-                       printf("prio=%d tid=0x%016lx\n", t->priority, (ptrint) thread->tid);
-#else
-                       printf("prio=%d tid=0x%08lx\n", t->priority, (ptrint) thread->tid);
-#endif
-
-                       /* dump trace of thread */
-
-                       stacktrace_dump_trace(thread);
-               }
-
-               thread = thread->next;
-       } while ((thread != NULL) && (thread != mainthreadobj));
-}
-
-
 /* threads_table_dump *********************************************************
 
    Dump the threads table for debugging purposes.
index 80772e290a4607f9f847e8b6faed1c6d699dcc96..6107047d9314ac5f8d1ff1d365d18a3b63921013 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads.h 7496 2007-03-12 00:19:05Z michi $
+   $Id: threads.h 7667 2007-04-05 00:16:05Z michi $
 
 */
 
@@ -201,7 +201,7 @@ struct threadobject {
 
 /* stackframeinfo *************************************************************/
 
-#define STACKFRAMEINFO    (&(THREADOBJECT->_stackframeinfo))
+#define STACKFRAMEINFO    (THREADOBJECT->_stackframeinfo)
 
 
 /* variables ******************************************************************/
@@ -248,8 +248,6 @@ void threads_stopworld(void);
 void threads_startworld(void);
 #endif
 
-void threads_dump(void);
-
 #endif /* _THREADS_H */
 
 
index 17410347fd2dfa0e1f4221d5fe1adccb9f4a7aaa..4216d8582d8225f052535a6b2b96e1d7d960ba88 100644 (file)
@@ -52,11 +52,12 @@ extern java_objectheader    *_no_threads_exceptionptr;
 
 
 /* stackframeinfo *************************************************************/
+
 struct stackframeinfo;
 
 extern struct stackframeinfo       *_no_threads_stackframeinfo;
 
-#define STACKFRAMEINFO      (&_no_threads_stackframeinfo)
+#define STACKFRAMEINFO      (_no_threads_stackframeinfo)
 
 #endif /* _THREADS_H */
 
index b6a6af207276c06188855d0b75ccda0502db712c..4016de79852ab287fc83573a1804f9b8f3e71196 100644 (file)
@@ -46,6 +46,8 @@
 #include "vm/builtin.h"
 #include "vm/stringlocal.h"
 
+#include "vm/jit/stacktrace.h"
+
 #include "vmcore/class.h"
 #include "vmcore/utf8.h"
 
@@ -133,6 +135,105 @@ ptrint threads_get_current_tid(void)
 }
 
 
+/* threads_dump ****************************************************************
+
+   Dumps info for all threads running in the JVM.  This function is
+   called when SIGQUIT (<ctrl>-\) is sent to CACAO.
+
+*******************************************************************************/
+
+void threads_dump(void)
+{
+       threadobject     *thread;
+       java_lang_Thread *t;
+       utf              *name;
+
+       thread = mainthreadobj;
+
+       /* XXX we should stop the world here */
+
+       printf("Full thread dump CACAO "VERSION":\n");
+
+       /* iterate over all started threads */
+
+       do {
+               /* get thread object */
+
+               t = thread->object;
+
+               /* the thread may be currently in initalization, don't print it */
+
+               if (t != NULL) {
+                       /* get thread name */
+
+#if defined(ENABLE_JAVASE)
+                       name = javastring_toutf(t->name, false);
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+                       name = t->name;
+#endif
+
+                       printf("\n\"");
+                       utf_display_printable_ascii(name);
+                       printf("\" ");
+
+                       if (thread->flags & THREAD_FLAG_DAEMON)
+                               printf("daemon ");
+
+#if SIZEOF_VOID_P == 8
+                       printf("prio=%d tid=0x%016lx\n", t->priority, (ptrint) thread->tid);
+#else
+                       printf("prio=%d tid=0x%08lx\n", t->priority, (ptrint) thread->tid);
+#endif
+
+                       /* print trace of thread */
+
+                       threads_print_stacktrace(thread);
+               }
+
+               thread = thread->next;
+       } while ((thread != NULL) && (thread != mainthreadobj));
+}
+
+
+/* threads_print_stacktrace ****************************************************
+
+   Print the current stacktrace of the given thread.
+
+*******************************************************************************/
+
+void threads_print_stacktrace(threadobject *thread)
+{
+       stackframeinfo   *sfi;
+       stacktracebuffer *stb;
+       s4                dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* create a stacktrace for the current thread */
+
+#if defined(ENABLE_THREADS)
+       sfi = thread->_stackframeinfo;
+#else
+       sfi = _no_threads_stackframeinfo;
+#endif
+
+       stb = stacktrace_create(sfi);
+
+       /* print stacktrace */
+
+       if (stb != NULL)
+               stacktrace_print_trace_from_buffer(stb);
+       else {
+               puts("\t<<No stacktrace available>>");
+               fflush(stdout);
+       }
+
+       dump_release(dumpsize);
+}
+
+
 /*
  * 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
index 1e4944128571aa24f3c5a354c4a859aad4188bc0..0afa115142871adf448acfcfb6a91a0824e6365b 100644 (file)
@@ -53,6 +53,8 @@
 
 threadobject *threads_create_thread(utf *name);
 ptrint        threads_get_current_tid(void);
+void          threads_dump(void);
+void          threads_print_stacktrace(threadobject *thread);
 
 #endif /* _THREADS_COMMON_H */
 
index bc7c151b7d0063f393f68b14b545d7e3b556d69e..014c89dd133839752cf511f02901fb9ac0c772cf 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: exceptions.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: exceptions.c 7654 2007-04-03 15:22:21Z twisti $
 
 */
 
@@ -1578,13 +1578,13 @@ void exceptions_clear_exception(void)
 
 java_objectheader *exceptions_fillinstacktrace(void)
 {
-       java_objectheader *e;
+       java_objectheader *o;
        methodinfo        *m;
 
        /* get exception */
 
-       e = *exceptionptr;
-       assert(e);
+       o = *exceptionptr;
+       assert(o);
 
        /* clear exception */
 
@@ -1592,17 +1592,25 @@ java_objectheader *exceptions_fillinstacktrace(void)
 
        /* resolve methodinfo pointer from exception object */
 
-       m = class_resolvemethod(e->vftbl->class,
+#if defined(ENABLE_JAVASE)
+       m = class_resolvemethod(o->vftbl->class,
                                                        utf_fillInStackTrace,
                                                        utf_void__java_lang_Throwable);
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+       m = class_resolvemethod(o->vftbl->class,
+                                                       utf_fillInStackTrace,
+                                                       utf_void__void);
+#else
+#error IMPLEMENT ME!
+#endif
 
        /* call function */
 
-       (void) vm_call_method(m, e);
+       (void) vm_call_method(m, o);
 
        /* return exception object */
 
-       return e;
+       return o;
 }
 
 
index d049cfd420a0ff8dbf19a9b45afd5c4cf7c28f6d..02bb914a967a1b15407a0c18497e1bbd90f14428 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.
 
-   $Id: simplereg.c 7483 2007-03-08 13:17:40Z michi $
+   $Id: simplereg.c 7645 2007-04-03 11:46:50Z twisti $
 
 */
 
@@ -1811,11 +1811,13 @@ void simplereg_make_statistics(jitdata *jd)
        methodinfo   *m;
        codegendata  *cd;
        registerdata *rd;
-       int i,type;
+       int i;
        s4 len;
+#if 0
        stackptr    src, src_old;
        stackptr    dst;
        instruction *iptr;
+#endif
        basicblock  *bptr;
        int size_interface; /* == maximum size of in/out stack at basic block boundaries */
        bool in_register;
index 41326486d54ef6702e16c62fd8f37c8e8f8d2459..25ceb1da460d34c07988017cc1f80f030117149d 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -851,9 +851,9 @@ asm_cacheflush:
        .end    asm_cacheflush
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index 561464c8232a2652a1d29f80234f53eb45e72d9d..3b7ffe30c3aed55f5b6412306060169f8cf543a1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -444,9 +444,9 @@ _crit_end:
        mov   pc, lr
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index 7bcb3e7543d5b3e27a54b24c9d998bf80501a230..3b8c80cd947d6ca7b7cb1d709d29a627eeb7ec5b 100644 (file)
@@ -514,112 +514,6 @@ void emit_exception_check(codegendata *cd, instruction *iptr)
 }
 
 
-/* emit_exception_stubs ********************************************************
-
-   Generates the code for the exception stubs.
-
-*******************************************************************************/
-
-#if 0
-void emit_exception_stubs(jitdata *jd)
-{
-       codegendata  *cd;
-       registerdata *rd;
-       exceptionref *er;
-       s4            branchmpc;
-       s4            targetmpc;
-       s4            targetdisp;
-       s4            disp;
-
-       /* get required compiler data */
-
-       cd = jd->cd;
-       rd = jd->rd;
-
-       /* generate exception stubs */
-
-       targetdisp = 0;
-
-       for (er = cd->exceptionrefs; er != NULL; er = er->next) {
-               /* back-patch the branch to this exception code */
-
-               branchmpc = er->branchmpc;
-               targetmpc = cd->mcodeptr - cd->mcodebase;
-
-               md_codegen_patch_branch(cd, branchmpc, targetmpc);
-
-               MCODECHECK(100);
-
-               /* Check if the exception is an
-                  ArrayIndexOutOfBoundsException.  If so, move index register
-                  into REG_ITMP1. */
-
-               if (er->reg != -1)
-                       M_MOV(REG_ITMP1, er->reg);
-
-               /* calcuate exception address */
-
-               assert((er->branchmpc - 4) % 4 == 0);
-               M_ADD_IMM_EXT_MUL4(REG_ITMP2_XPC, REG_PV, (er->branchmpc - 4) / 4);
-
-               /* move function to call into REG_ITMP3 */
-
-               disp = dseg_add_functionptr(cd, er->function);
-               M_DSEG_LOAD(REG_ITMP3, disp);
-
-               if (targetdisp == 0) {
-                       targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
-
-                       M_MOV(rd->argintregs[0], REG_PV);
-                       M_MOV(rd->argintregs[1], REG_SP);
-
-                       if (jd->isleafmethod)
-                               M_MOV(rd->argintregs[2], REG_LR);
-                       else
-                               M_LDR(rd->argintregs[2], REG_SP,
-                                         cd->stackframesize * 4 - SIZEOF_VOID_P);
-
-                       M_MOV(rd->argintregs[3], REG_ITMP2_XPC);
-
-                       /* save registers */
-                       /* TODO: we only need to save LR in leaf methods */
-
-                       M_STMFD(BITMASK_ARGS | 1<<REG_PV | 1<<REG_LR, REG_SP);
-
-                       /* move a3 to stack */
-
-                       M_STR_UPDATE(REG_ITMP1, REG_SP, -4);
-
-                       /* do the exception call */
-
-                       M_MOV(REG_LR, REG_PC);
-                       M_MOV(REG_PC, REG_ITMP3);
-
-                       M_ADD_IMM(REG_SP, REG_SP, 4);
-
-                       /* result of stacktrace is our XPTR */
-
-                       M_MOV(REG_ITMP1_XPTR, REG_RESULT);
-
-                       /* restore registers */
-
-                       M_LDMFD(BITMASK_ARGS | 1<<REG_PV | 1<<REG_LR, REG_SP);
-
-                       disp = dseg_add_functionptr(cd, asm_handle_exception);
-                       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);
-               }
-       }
-}
-#endif
-
-
 /* emit_patcher_stubs **********************************************************
 
    Generates the code for the patcher stubs.
index b169ff45436b5062379cf58d97dd5aa6aa6288ca..3bc9af9fe5f5be21a0b6cc6623ef35cb4978065e 100644 (file)
@@ -67,46 +67,52 @@ typedef struct ucontext {
 
 void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 {
-       ucontext_t *_uc;
-       /*mcontext_t *_mc;*/
-       scontext_t *_sc;
-       u4          instr;
-       ptrint      addr;
-       ptrint      base;
-       u1          *pv;
-       u1          *sp;
-       u1          *ra;
-       u1          *xpc;
+       ucontext_t        *_uc;
+       scontext_t        *_sc;
+       u1                *pv;
+       u1                *sp;
+       u1                *ra;
+       u1                *xpc;
+       u4                 mcode;
+       ptrint             addr;
+       s4                 type;
+       ptrint             val;
+       java_objectheader *o;
 
        _uc = (ucontext_t*) _p;
        _sc = &_uc->uc_mcontext;
 
-       /* ATTENTION: glibc included messed up kernel headers */
-       /* we needed a workaround for the ucontext structure */
+       /* ATTENTION: glibc included messed up kernel headers we needed a
+          workaround for the ucontext structure. */
+
+       pv  = (u1 *) _sc->arm_ip;
+       sp  = (u1 *) _sc->arm_sp;
+       ra  = (u1 *) _sc->arm_lr;                    /* this is correct for leafs */
+       xpc = (u1 *) _sc->arm_pc;
+
+       /* get exception-throwing instruction */
+
+       mcode = *((s4 *) xpc);
 
-       addr = (ptrint) siginfo->si_addr;
-       /*xpc = (u1*) _mc->gregs[REG_PC];*/
-       xpc = (u1*) _sc->arm_pc;
+       /* this is a NullPointerException */
 
-       instr = *((s4*) xpc);
-       base = *((s4*) _sc + OFFSET(scontext_t, arm_r0)/4 + ((instr >> 16) & 0x0f));
+/*     addr = _mc->gregs[s1]; */
+       addr = *((s4 *) _sc + OFFSET(scontext_t, arm_r0)/4 + ((mcode >> 16) & 0x0f));
+       type = EXCEPTION_HARDWARE_NULLPOINTER;
+       val  = 0;
 
-       if (base == 0) {
-               pv  = (u1*) _sc->arm_ip;
-               sp  = (u1*) _sc->arm_sp;
-               ra  = (u1*) _sc->arm_lr; /* this is correct for leafs */
+       if (addr != 0)
+               vm_abort("md_signal_handler_sigsegv: faulting address is not NULL: addr=%p", addr);
 
-               _sc->arm_r10 = (ptrint) stacktrace_hardware_nullpointerexception(pv, sp, ra, xpc);
-               _sc->arm_fp = (ptrint) xpc;
-               _sc->arm_pc = (ptrint) asm_handle_exception;
-       }
-       else {
-               codegen_get_pv_from_pc(xpc);
+       /* generate appropriate exception */
+
+       o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
 
-               /* this should not happen */
+       /* set registers */
 
-               assert(0);
-       }
+       _sc->arm_r10 = (ptrint) o;
+       _sc->arm_fp  = (ptrint) xpc;
+       _sc->arm_pc  = (ptrint) asm_handle_exception;
 }
 
 
@@ -135,10 +141,10 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
        /* ATTENTION: glibc included messed up kernel headers we needed a
           workaround for the ucontext structure. */
 
-       pv  = (u1*) _sc->arm_ip;
-       sp  = (u1*) _sc->arm_sp;
-       ra  = (u1*) _sc->arm_lr;                     /* this is correct for leafs */
-       xpc = (u1*) _sc->arm_pc;
+       pv  = (u1 *) _sc->arm_ip;
+       sp  = (u1 *) _sc->arm_sp;
+       ra  = (u1 *) _sc->arm_lr;                    /* this is correct for leafs */
+       xpc = (u1 *) _sc->arm_pc;
 
        /* get exception-throwing instruction */
 
@@ -164,6 +170,32 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
 }
 
 
+/* md_signal_handler_sigusr2 ***************************************************
+
+   Signal handler for profiling sampling.
+
+*******************************************************************************/
+
+#if defined(ENABLE_THREADS)
+void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p)
+{
+       threadobject *thread;
+       ucontext_t   *_uc;
+       scontext_t   *_sc;
+       u1           *pc;
+
+       thread = THREADOBJECT;
+
+       _uc = (ucontext_t*) _p;
+       _sc = &_uc->uc_mcontext;
+
+       pc = (u1 *) _sc->arm_pc;
+
+       thread->pc = pc;
+}
+#endif
+
+
 /* thread_restartcriticalsection ***********************************************
 
    TODO: document me
index 2df1784eb3c139de6931db410eb56e5f9e783cef..c8d08cf6edf3877316d66a9fb06378b2b3c18db1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: md.c 7653 2007-04-03 14:34:23Z twisti $
 
 */
 
@@ -56,38 +56,6 @@ void md_init(void)
 }
 
 
-/* md_codegen_patch_branch *****************************************************
-
-   Back-patches a branch instruction.
-
-*******************************************************************************/
-
-void md_codegen_patch_branch(codegendata *cd, s4 branchmpc, s4 targetmpc)
-{
-       s4 *mcodeptr;
-       s4  disp;                           /* branch displacement                */
-
-       /* calculate the patch position */
-
-       mcodeptr = (s4 *) (cd->mcodebase + branchmpc);
-
-       /* Calculate the branch displacement. */
-
-       disp = (targetmpc - branchmpc - 4) >> 2;
-
-       if ((disp < (s4) 0xff000000) || (disp > (s4) 0x00ffffff))
-               vm_abort("md_codegen_patch_branch: branch displacement out of range: %d > +/-%d", disp, 0x00ffffff);
-
-       /* sanity check: are we really patching a branch instruction */
-
-       assert((mcodeptr[-1] & 0x0e000000) == 0x0a000000);
-
-       /* patch the branch instruction before the mcodeptr */
-
-       mcodeptr[-1] |= (disp & 0x00ffffff);
-}
-
-
 /* md_stacktrace_get_returnaddress *********************************************
 
    Returns the return address of the current stackframe, specified by
@@ -99,14 +67,12 @@ u1 *md_stacktrace_get_returnaddress(u1 *sp, u4 framesize)
 {
        u1 *ra;
 
-       /*printf("md_stacktrace_get_returnaddress(): called (sp=%x, framesize=%d)\n", sp, framesize);*/
+       /* On ARM the return address is located on the top of the
+          stackframe. */
+       /* ATTENTION: This is only true for non-leaf methods!!! */
 
-       /* on ARM the return address is located on the top of the stackframe */
-       /* ATTENTION: this is only true for non-leaf methods !!! */
        ra = *((u1 **) (sp + framesize - SIZEOF_VOID_P));
 
-       /*printf("md_stacktrace_get_returnaddress(): result (ra=%x)\n", ra);*/
-
        return ra;
 }
 
index 9d81474fce8b304a3ffaa7f333d64206c7b7f34b..d0d89c58ea0669e3198ccf1522e8a0c72c466f96 100644 (file)
@@ -39,7 +39,7 @@
    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 7601 2007-03-28 23:02:50Z michi $
+   $Id: codegen-common.c 7667 2007-04-05 00:16:05Z michi $
 
 */
 
@@ -70,9 +70,7 @@
 #include "native/jni.h"
 #include "native/native.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
+#include "threads/threads-common.h"
 
 #include "vm/exceptions.h"
 #include "vm/stringlocal.h"
@@ -651,7 +649,7 @@ u1 *codegen_get_pv_from_pc(u1 *pc)
                log_println("");
                log_println("Dumping the current stacktrace:");
 
-               stacktrace_dump_trace(THREADOBJECT);
+               threads_print_stacktrace(THREADOBJECT);
 
                vm_abort("Exiting...");
        }
@@ -1181,7 +1179,7 @@ java_objectheader *codegen_finish_native_call(u1 *datasp)
 
        /* remove current stackframeinfo from chain */
 
-       psfi = STACKFRAMEINFO;
+       psfi = &STACKFRAMEINFO;
 
        *psfi = sfi->prev;
 
index cccd16d4c048d57bdb8ada097092c5ec86fb7c3b..43bdf314582b8e05185df068e94294aff838a3ff 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -708,9 +708,9 @@ asm_criticalsections:
        .long 0
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index e267c11cb515ae85aa7798156785d8e37ad41cf1..bf5d64804d820b0756a62cbffe0b6b09d2284c0a 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-os.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: md-os.c 7667 2007-04-05 00:16:05Z michi $
 
 */
 
 # include "mm/cacao-gc/gc.h"
 #endif
 
+#include "vm/jit/i386/codegen.h"
+
+#include "threads/threads-common.h"
+
 #include "vm/exceptions.h"
 #include "vm/signallocal.h"
 #include "vm/stringlocal.h"
@@ -46,8 +50,6 @@
 #include "vm/jit/asmpart.h"
 #include "vm/jit/stacktrace.h"
 
-#include "vm/jit/i386/codegen.h"
-
 
 /* md_signal_handler_sigsegv ***************************************************
 
@@ -70,7 +72,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
        s4                 disp;
        ptrint             val;
        s4                 type;
-       java_objectheader *e;
+       java_objectheader *o;
 
        _uc = (ucontext_t *) _p;
        _mc = &_uc->uc_mcontext;
@@ -113,11 +115,11 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 
        /* generate appropriate exception */
 
-       e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+       o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
 
        /* set registers */
 
-       _mc->gregs[REG_EAX] = (ptrint) e;
+       _mc->gregs[REG_EAX] = (ptrint) o;
        _mc->gregs[REG_ECX] = (ptrint) xpc;                      /* REG_ITMP2_XPC */
        _mc->gregs[REG_EIP] = (ptrint) asm_handle_exception;
 }
@@ -132,22 +134,34 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 
 void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
 {
-       ucontext_t *_uc;
-       mcontext_t *_mc;
-       u1         *sp;
-       u1         *ra;
-       u1         *xpc;
+       ucontext_t        *_uc;
+       mcontext_t        *_mc;
+       u1                *pv;
+       u1                *sp;
+       u1                *ra;
+       u1                *xpc;
+       s4                 type;
+       ptrint             val;
+       java_objectheader *o;
 
        _uc = (ucontext_t *) _p;
        _mc = &_uc->uc_mcontext;
 
+       pv  = NULL;                 /* is resolved during stackframeinfo creation */
        sp  = (u1 *) _mc->gregs[REG_ESP];
        xpc = (u1 *) _mc->gregs[REG_EIP];
        ra  = xpc;                          /* return address is equal to xpc     */
 
-       _mc->gregs[REG_EAX] =
-               (ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
+       /* this is an ArithmeticException */
+
+       type = EXCEPTION_HARDWARE_ARITHMETIC;
+       val  = 0;
+
+       /* generate appropriate exception */
+
+       o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
 
+       _mc->gregs[REG_EAX] = (ptrint) o;
        _mc->gregs[REG_ECX] = (ptrint) xpc;                      /* REG_ITMP2_XPC */
        _mc->gregs[REG_EIP] = (ptrint) asm_handle_exception;
 }
index 50c1b295e042275c8e52117faae96d6d9fd2c2a2..d5c44eddcbd1bc212653e5c43484b4836a4225b9 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jit.h 7628 2007-04-02 19:09:52Z michi $
+   $Id: jit.h 7663 2007-04-04 22:14:42Z twisti $
 
 */
 
@@ -47,6 +47,7 @@ typedef struct exception_entry exception_entry;
 #include "toolbox/chain.h"
 
 #include "vm/global.h"
+#include "vm/resolve.h"
 
 #include "vm/jit/codegen-common.h"
 #include "vm/jit/reg.h"
@@ -70,7 +71,6 @@ typedef struct exception_entry exception_entry;
 
 #include "vmcore/method.h"
 #include "vmcore/references.h"
-#include "vm/resolve.h"
 
 #if defined(ENABLE_STATISTICS)
 # include "vmcore/statistics.h"
@@ -114,8 +114,6 @@ struct jitdata {
 
        instruction     *instructions;    /* ICMDs, valid between parse and stack */
        basicblock      *basicblocks;     /* start of basic block list            */
-       s4              *basicblockindex; /* block index for each JavaPC          */
-                                      /* valid between parse and stack        */
        stackelement    *stack;           /* XXX should become stack.c internal   */
        s4               instructioncount;/* XXX remove this?                     */
        s4               basicblockcount; /* number of basic blocks               */
@@ -261,8 +259,8 @@ struct stackelement {
 /* branch_target_t: used in TABLESWITCH tables */
 
 typedef union {
-    s4                         insindex; /* used between parse and stack      */
-    basicblock                *block;    /* used from stack analysis onwards  */
+    s4                         insindex; /* used in parse                     */
+    basicblock                *block;    /* valid after parse                 */
 } branch_target_t;
 
 /* lookup_target_t: used in LOOKUPSWITCH tables */
@@ -325,10 +323,10 @@ typedef union {
 
 typedef union {
        s4                         varindex;
-    basicblock                *block;       /* valid after stack analysis     */
+    basicblock                *block;       /* valid after parse              */
     branch_target_t           *table;       /* for TABLESWITCH                */
     lookup_target_t           *lookup;      /* for LOOKUPSWITCH               */
-    s4                         insindex;    /* used between parse and stack   */
+    s4                         insindex;    /* used in parse                  */
 } dst_operand_t;
 
 /*** flags (32 bits) ***/
index 53a00f0fee0d973d0f85b93ba704463030c009f1..8ef900148aa777dd0923cebdf1b9efba5ed59c04 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/mips/asmpart.S - Java-C interface functions for MIPS
 
-   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: Andreas Krall
-
-   Changes: Christian Thalinger
-            Edwin Steiner
-
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -1077,9 +1070,9 @@ compare_and_swap:
        .end    compare_and_swap
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index 0e998f4b3a983a5337d658d1ee1e177e635853b0..f956298a736d7bd11fea11ba64de2505958c98bc 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-abi.h 7350 2007-02-13 21:30:13Z twisti $
+   $Id: md-abi.h 7659 2007-04-03 18:02:48Z twisti $
 
 */
 
 
 /* floating point registers */
 
-#define REG_FRESULT        /* to deliver floating point method results      */
+#define REG_FRESULT      0   /* to deliver floating point method results      */
 
-#define REG_IFTMP          /* temporary integer and floating point register */
+#define REG_IFTMP        1   /* temporary integer and floating point register */
 
 
 #if SIZEOF_VOID_P == 8
 
 /* MIPS64 defines */
 
-#define REG_FTMP1       1    /* temporary floating point register             */
-#define REG_FTMP2       2    /* temporary floating point register             */
-#define REG_FTMP3       3    /* temporary floating point register             */
+#define REG_FTMP1        1   /* temporary floating point register             */
+#define REG_FTMP2        2   /* temporary floating point register             */
+#define REG_FTMP3        3   /* temporary floating point register             */
+
+#define REG_FA0         12   /* define some argument registers                */
+#define REG_FA1         13
+#define REG_FA2         14
 
 #define INT_REG_CNT     32   /* number of integer registers                   */
-#define INT_SAV_CNT        /* number of int callee saved registers          */
-#define INT_ARG_CNT        /* number of int argument registers              */
-#define INT_TMP_CNT        /* number of integer temporary registers         */
-#define INT_RES_CNT    10    /* number of integer reserved registers          */
+#define INT_SAV_CNT      8   /* number of int callee saved registers          */
+#define INT_ARG_CNT      8   /* number of int argument registers              */
+#define INT_TMP_CNT      5   /* number of integer temporary registers         */
+#define INT_RES_CNT     10   /* number of integer reserved registers          */
                              /* + 1 REG_RET totals to 32                      */
 
 #define FLT_REG_CNT     32   /* number of float registers                     */
-#define FLT_SAV_CNT        /* number of flt callee saved registers          */
-#define FLT_ARG_CNT        /* number of flt argument registers              */
+#define FLT_SAV_CNT      4   /* number of flt callee saved registers          */
+#define FLT_ARG_CNT      8   /* number of flt argument registers              */
 #define FLT_TMP_CNT     16   /* number of float temporary registers           */
-#define FLT_RES_CNT        /* number of float reserved registers            */
+#define FLT_RES_CNT      3   /* number of float reserved registers            */
                              /* + 1 REG_RET totals to 32                      */
 
 #define TRACE_ARGS_NUM  8
index e60c2a36c89689cc025e1bb83b0cb69fd19bdc4f..fd9490a87fd267a5ccc1ec6b5ddacda61b2e6253 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: parse.c 7632 2007-04-02 20:05:05Z michi $
+   $Id: parse.c 7663 2007-04-04 22:14:42Z twisti $
 
 */
 
                                    /* allocate if space runs out              */
 
 
+/* local macros ***************************************************************/
+
+#define BYTECODEINDEX_TO_BASICBLOCK(dst) \
+    do { \
+        (dst).block = \
+            parse_bytecodeindex_to_basicblock(jd, &pd, (dst).insindex); \
+    } while (0)
+
+
 /* parserdata_t ***************************************************************/
 
 typedef struct parsedata_t parsedata_t;
 
 struct parsedata_t {
+       u1          *bytecodestart;         /* start of bytecode instructions     */
+       u1          *basicblockstart;       /* start of bytecode basic-blocks     */
+
+       s4          *bytecodemap;           /* bytecode to IR mapping             */
+       
        instruction *instructions;          /* instruction array                  */
        s4           instructionslength;    /* length of the instruction array    */
-       u1          *instructionstart;
+
+       s4          *instructionmap;        /* IR to basic-block mapping          */
 };
 
 
@@ -94,28 +109,35 @@ static void parse_setup(jitdata *jd, parsedata_t *pd)
 
        m = jd->m;
 
-       /* Allocate instruction array and block index table (1 additional
-          for end ipc). */
+       /* bytecode start array */
 
-       jd->basicblockindex = DMNEW(s4, m->jcodelength + 1);
-       pd->instructionstart = DMNEW(u1, m->jcodelength + 1);
+       pd->bytecodestart = DMNEW(u1, m->jcodelength + 1);
+       MZERO(pd->bytecodestart, u1, m->jcodelength + 1);
 
-       MZERO(jd->basicblockindex, s4, m->jcodelength + 1);
-       MZERO(pd->instructionstart, u1, m->jcodelength + 1);
+       /* bytecode basic-block start array */
 
-       /* Set the length of the instruction array.  We simply add 5 more
-          instruction, as this seems to be a reasonable value. */
+       pd->basicblockstart = DMNEW(u1, m->jcodelength + 1);
+       MZERO(pd->basicblockstart, u1, m->jcodelength + 1);
 
-       pd->instructionslength = m->jcodelength + 1;
+       /* bytecode instruction index to IR instruction mapping */
+
+       pd->bytecodemap = DMNEW(s4, m->jcodelength + 1);
+       MSET(pd->bytecodemap, -1, s4, m->jcodelength + 1);
 
        /* allocate the instruction array */
 
+       pd->instructionslength = m->jcodelength + 1;
        pd->instructions = DMNEW(instruction, pd->instructionslength);
 
        /* Zero the intermediate instructions array so we don't have any
           invalid pointers in it if we cannot finish stack_analyse(). */
 
        MZERO(pd->instructions, instruction, pd->instructionslength);
+
+       /* The instructionmap is allocated later when we know the count of
+          instructions. */
+
+       pd->instructionmap = NULL;
 }
 
 
@@ -148,6 +170,26 @@ static instruction *parse_realloc_instructions(parsedata_t *pd, s4 icount, s4 n)
 }
 
 
+/* parse_bytecodeindex_to_basicblock *******************************************
+
+   Resolves a bytecode index to the corresponding basic block.
+
+*******************************************************************************/
+
+static basicblock *parse_bytecodeindex_to_basicblock(jitdata *jd,
+                                                                                                        parsedata_t *pd,
+                                                                                                        s4 bcindex)
+{
+       s4          irindex;
+       basicblock *bb;
+
+       irindex = pd->bytecodemap[bcindex];
+       bb      = jd->basicblocks + pd->instructionmap[irindex];
+
+       return bb;
+}
+
+
 /* parse_mark_exception_boundaries *********************************************
 
    Mark exception handlers and the boundaries of the handled regions as
@@ -157,15 +199,14 @@ static instruction *parse_realloc_instructions(parsedata_t *pd, s4 icount, s4 n)
        jd...............current jitdata
 
    RETURN VALUE:
-       >= 0.............the number of new basic blocks marked
-          -1...............an exception has been thrown
+       true.............everything ok
+          false............an exception has been thrown
 
 *******************************************************************************/
 
-static int parse_mark_exception_boundaries(jitdata *jd)
+static bool parse_mark_exception_boundaries(jitdata *jd, parsedata_t *pd)
 {
-       s4                   b_count;
-       s4                   pc;
+       s4                   bcindex;
        s4                   i;
        s4                   len;
        raw_exception_entry *rex;
@@ -176,57 +217,55 @@ static int parse_mark_exception_boundaries(jitdata *jd)
        len = m->rawexceptiontablelength;
 
        if (len == 0)
-               return 0;
+               return true;
 
-       b_count = 0;
        rex = m->rawexceptiontable;
 
        for (i = 0; i < len; ++i, ++rex) {
 
                /* the start of the handled region becomes a basic block start */
 
-               pc = rex->startpc;
-               CHECK_BYTECODE_INDEX(pc);
-               MARK_BASICBLOCK(pc);
+               bcindex = rex->startpc;
+               CHECK_BYTECODE_INDEX(bcindex);
+               MARK_BASICBLOCK(pd, bcindex);
                
-               pc = rex->endpc; /* see JVM Spec 4.7.3 */
-               CHECK_BYTECODE_INDEX_EXCLUSIVE(pc);
+               bcindex = rex->endpc; /* see JVM Spec 4.7.3 */
+               CHECK_BYTECODE_INDEX_EXCLUSIVE(bcindex);
 
                /* check that the range is valid */
 
 #if defined(ENABLE_VERIFIER)
-               if (pc <= rex->startpc) {
-                       exceptions_throw_verifyerror(m,
-                               "Invalid exception handler range");
-                       return -1;
+               if (bcindex <= rex->startpc) {
+                       exceptions_throw_verifyerror(m, "Invalid exception handler range");
+                       return false;
                }
 #endif
                
-               /* end of handled region becomes a basic block boundary  */
-               /* (If it is the bytecode end, we'll use the special     */
-               /* end block that is created anyway.)                    */
+               /* End of handled region becomes a basic block boundary (if it
+                  is the bytecode end, we'll use the special end block that
+                  is created anyway). */
 
-               if (pc < m->jcodelength)
-                       MARK_BASICBLOCK(pc);
+               if (bcindex < m->jcodelength)
+                       MARK_BASICBLOCK(pd, bcindex);
                else
                        jd->branchtoend = true;
 
                /* the start of the handler becomes a basic block start  */
 
-               pc = rex->handlerpc;
-               CHECK_BYTECODE_INDEX(pc);
-               MARK_BASICBLOCK(pc);
+               bcindex = rex->handlerpc;
+               CHECK_BYTECODE_INDEX(bcindex);
+               MARK_BASICBLOCK(pd, bcindex);
        }
 
        /* everything ok */
 
-       return b_count;
+       return true;
 
 #if defined(ENABLE_VERIFIER)
 throw_invalid_bytecode_index:
        exceptions_throw_verifyerror(m,
                                                                 "Illegal bytecode index in exception table");
-       return -1;
+       return false;
 #endif
 }
 
@@ -245,7 +284,7 @@ throw_invalid_bytecode_index:
 
 *******************************************************************************/
 
-static bool parse_resolve_exception_table(jitdata *jd)
+static bool parse_resolve_exception_table(jitdata *jd, parsedata_t *pd)
 {
        methodinfo          *m;
        raw_exception_entry *rex;
@@ -276,9 +315,9 @@ static bool parse_resolve_exception_table(jitdata *jd)
        for (i = 0; i < len; ++i, ++rex, ++ex) {
                /* resolve instruction indices to basic blocks */
 
-               ex->start   = BLOCK_OF(rex->startpc);
-               ex->end     = BLOCK_OF(rex->endpc);
-               ex->handler = BLOCK_OF(rex->handlerpc);
+               ex->start   = parse_bytecodeindex_to_basicblock(jd, pd, rex->startpc);
+               ex->end     = parse_bytecodeindex_to_basicblock(jd, pd, rex->endpc);
+               ex->handler = parse_bytecodeindex_to_basicblock(jd, pd, rex->handlerpc);
 
                /* lazily resolve the catchtype */
 
@@ -338,23 +377,29 @@ bool parse(jitdata *jd)
        methodinfo  *m;                     /* method being parsed                */
        parsedata_t  pd;
        instruction *iptr;                  /* current ptr into instruction array */
-       s4           icount;                /* intermediate instruction counter   */
-       s4           p;                     /* java instruction counter           */
-       s4           nextp;                 /* start of next java instruction     */
-       s4           opcode;                /* java opcode                        */
-       s4           i;
-       s4           j;
-       int  b_count;               /* basic block counter                      */
-       int  s_count = 0;           /* stack element counter                    */
-       bool blockend = false;      /* true if basic block end has been reached */
-       bool iswide = false;        /* true if last instruction was a wide      */
+
+       s4           bcindex;               /* bytecode instruction index         */
+       s4           nextbc;                /* start of next bytecode instruction */
+       s4           opcode;                /* bytecode instruction opcode        */
+
+       s4           irindex;               /* IR instruction index               */
+       s4           ircount;               /* IR instruction count               */
+
+       s4           bbcount;               /* basic block count                  */
+
+       int  s_count = 0;             /* stack element counter                    */
+       bool blockend;                /* true if basic block end has been reached */
+       bool iswide;                  /* true if last instruction was a wide      */
+
        constant_classref  *cr;
        constant_classref  *compr;
        classinfo          *c;
        builtintable_entry *bte;
-       constant_FMIref    *mr;
+       constant_FMIref    *fmi;
        methoddesc         *md;
        unresolved_method  *um;
+       unresolved_field   *uf;
+
        resolve_result_t    result;
        u2                  lineindex = 0;
        u2                  currentline = 0;
@@ -364,12 +409,19 @@ bool parse(jitdata *jd)
 
        int                *local_map; /* local pointer to renaming structore     */
                                       /* is assigned to rd->local_map at the end */
+       branch_target_t *table;
+       lookup_target_t *lookup;
+       s4               i;
+       s4               j;
+
        /* get required compiler data */
 
-       m    = jd->m;
+       m = jd->m;
 
        /* allocate buffers for local variable renaming */
+
        local_map = DMNEW(int, m->maxlocals * 5);
+
        for (i = 0; i < m->maxlocals; i++) {
                local_map[i * 5 + 0] = 0;
                local_map[i * 5 + 1] = 0;
@@ -384,13 +436,15 @@ bool parse(jitdata *jd)
   
        /* initialize local variables */
   
-       iptr   = pd.instructions;
-       icount = 0;
-  
+       iptr     = pd.instructions;
+       ircount  = 0;
+       bbcount  = 0;
+       blockend = false;
+       iswide   = false;
+
        /* mark basic block boundaries for exception table */
 
-       b_count = parse_mark_exception_boundaries(jd);
-       if (b_count < 0)
+       if (!parse_mark_exception_boundaries(jd, &pd))
                return false;
 
        /* initialize stack element counter */
@@ -411,24 +465,24 @@ bool parse(jitdata *jd)
 
        /*** LOOP OVER ALL BYTECODE INSTRUCTIONS **********************************/
 
-       for (p = 0; p < m->jcodelength; p = nextp) {
+       for (bcindex = 0; bcindex < m->jcodelength; bcindex = nextbc) {
 
-               /* mark this position as a valid instruction start */
+               /* mark this position as a valid bytecode instruction start */
 
-               pd.instructionstart[p] = 1;
+               pd.bytecodestart[bcindex] = 1;
 
                /* change the current line number, if necessary */
 
                /* XXX rewrite this using pointer arithmetic */
 
-               if (linepcchange == p) {
+               if (linepcchange == bcindex) {
                        if (m->linenumbercount > lineindex) {
 next_linenumber:
                                currentline = m->linenumbers[lineindex].line_number;
                                lineindex++;
                                if (lineindex < m->linenumbercount) {
                                        linepcchange = m->linenumbers[lineindex].start_pc;
-                                       if (linepcchange == p)
+                                       if (linepcchange == bcindex)
                                                goto next_linenumber;
                                }
                        }
@@ -437,35 +491,43 @@ next_linenumber:
 fetch_opcode:
                /* fetch next opcode  */        
 
-               opcode = SUCK_BE_U1(m->jcode + p);
+               opcode = SUCK_BE_U1(m->jcode + bcindex);
 
-               /* some compilers put a JAVA_NOP after a blockend instruction */
+               /* If the previous instruction was a block-end instruction,
+                  mark the current bytecode instruction as basic-block
+                  starting instruction. */
 
-               if (blockend && (opcode != JAVA_NOP)) {
-                       /* start new block */
+               /* NOTE: Some compilers put a JAVA_NOP after a blockend
+                  instruction. */
 
-                       MARK_BASICBLOCK(p);
+               if (blockend && (opcode != JAVA_NOP)) {
+                       MARK_BASICBLOCK(&pd, bcindex);
                        blockend = false;
                }
 
-               /* We need a NOP as last instruction in each basic block
-                  for basic block reordering (may be replaced with a GOTO
-                  later). */
+               /* If the current bytecode instruction was marked as
+                  basic-block starting instruction before (e.g. blockend,
+                  forward-branch target), mark the current IR instruction
+                  too. */
+
+               if (pd.basicblockstart[bcindex] != 0) {
+                       /* We need a NOP as last instruction in each basic block
+                          for basic block reordering (may be replaced with a GOTO
+                          later). */
 
-               if (jd->basicblockindex[p] & 1) {
                        INSTRUCTIONS_CHECK(1);
                        OP(ICMD_NOP);
                }
 
                /* store intermediate instruction count (bit 0 mark block starts) */
 
-               jd->basicblockindex[p] |= (icount << 1);
+               pd.bytecodemap[bcindex] = ircount;
 
                /* compute next instruction start */
 
-               nextp = p + jcommandsize[opcode];
+               nextbc = bcindex + jcommandsize[opcode];
 
-               CHECK_END_OF_BYTECODE(nextp);
+               CHECK_END_OF_BYTECODE(nextbc);
 
                /* add stack elements produced by this instruction */
 
@@ -487,20 +549,20 @@ fetch_opcode:
                /* pushing constants onto the stack ***********************************/
 
                case JAVA_BIPUSH:
-                       OP_LOADCONST_I(SUCK_BE_S1(m->jcode + p + 1));
+                       OP_LOADCONST_I(SUCK_BE_S1(m->jcode + bcindex + 1));
                        break;
 
                case JAVA_SIPUSH:
-                       OP_LOADCONST_I(SUCK_BE_S2(m->jcode + p + 1));
+                       OP_LOADCONST_I(SUCK_BE_S2(m->jcode + bcindex + 1));
                        break;
 
                case JAVA_LDC1:
-                       i = SUCK_BE_U1(m->jcode + p + 1);
+                       i = SUCK_BE_U1(m->jcode + bcindex + 1);
                        goto pushconstantitem;
 
                case JAVA_LDC2:
                case JAVA_LDC2W:
-                       i = SUCK_BE_U2(m->jcode + p + 1);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
 
                pushconstantitem:
 
@@ -645,11 +707,11 @@ fetch_opcode:
                case JAVA_FLOAD:
                case JAVA_ALOAD:
                        if (iswide == false) {
-                               i = SUCK_BE_U1(m->jcode + p + 1);
+                               i = SUCK_BE_U1(m->jcode + bcindex + 1);
                        }
                        else {
-                               i = SUCK_BE_U2(m->jcode + p + 1);
-                               nextp = p + 3;
+                               i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                               nextbc = bcindex + 3;
                                iswide = false;
                        }
                        OP_LOAD_ONEWORD(opcode, i, opcode - JAVA_ILOAD);
@@ -658,11 +720,11 @@ fetch_opcode:
                case JAVA_LLOAD:
                case JAVA_DLOAD:
                        if (iswide == false) {
-                               i = SUCK_BE_U1(m->jcode + p + 1);
+                               i = SUCK_BE_U1(m->jcode + bcindex + 1);
                        }
                        else {
-                               i = SUCK_BE_U2(m->jcode + p + 1);
-                               nextp = p + 3;
+                               i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                               nextbc = bcindex + 3;
                                iswide = false;
                        }
                        OP_LOAD_TWOWORD(opcode, i, opcode - JAVA_ILOAD);
@@ -707,12 +769,12 @@ fetch_opcode:
                case JAVA_FSTORE:
                case JAVA_ASTORE:
                        if (iswide == false) {
-                               i = SUCK_BE_U1(m->jcode + p + 1);
+                               i = SUCK_BE_U1(m->jcode + bcindex + 1);
                        }
                        else {
-                               i = SUCK_BE_U2(m->jcode + p + 1);
+                               i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                               nextbc = bcindex + 3;
                                iswide = false;
-                               nextp = p + 3;
                        }
                        OP_STORE_ONEWORD(opcode, i, opcode - JAVA_ISTORE);
                        break;
@@ -720,12 +782,12 @@ fetch_opcode:
                case JAVA_LSTORE:
                case JAVA_DSTORE:
                        if (iswide == false) {
-                               i = SUCK_BE_U1(m->jcode + p + 1);
+                               i = SUCK_BE_U1(m->jcode + bcindex + 1);
                        }
                        else {
-                               i = SUCK_BE_U2(m->jcode + p + 1);
+                               i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                               nextbc = bcindex + 3;
                                iswide = false;
-                               nextp = p + 3;
                        }
                        OP_STORE_TWOWORD(opcode, i, opcode - JAVA_ISTORE);
                        break;
@@ -770,15 +832,15 @@ fetch_opcode:
                                int v;
 
                                if (iswide == false) {
-                                       i = SUCK_BE_U1(m->jcode + p + 1);
-                                       v = SUCK_BE_S1(m->jcode + p + 2);
+                                       i = SUCK_BE_U1(m->jcode + bcindex + 1);
+                                       v = SUCK_BE_S1(m->jcode + bcindex + 2);
 
                                }
                                else {
-                                       i = SUCK_BE_U2(m->jcode + p + 1);
-                                       v = SUCK_BE_S2(m->jcode + p + 3);
+                                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                                       v = SUCK_BE_S2(m->jcode + bcindex + 3);
+                                       nextbc = bcindex + 5;
                                        iswide = false;
-                                       nextp = p + 5;
                                }
                                INDEX_ONEWORD(i);
                                LOCALTYPE_USED(i, TYPE_INT);
@@ -789,14 +851,14 @@ fetch_opcode:
                /* wider index for loading, storing and incrementing ******************/
 
                case JAVA_WIDE:
+                       bcindex++;
                        iswide = true;
-                       p++;
                        goto fetch_opcode;
 
                /* managing arrays ****************************************************/
 
                case JAVA_NEWARRAY:
-                       switch (SUCK_BE_S1(m->jcode + p + 1)) {
+                       switch (SUCK_BE_S1(m->jcode + bcindex + 1)) {
                        case 4:
                                bte = builtintable_get_internal(BUILTIN_newarray_boolean);
                                break;
@@ -831,9 +893,9 @@ fetch_opcode:
                        break;
 
                case JAVA_ANEWARRAY:
-                       i = SUCK_BE_U2(m->jcode + p + 1);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
                        compr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
-                       if (!compr)
+                       if (compr == NULL)
                                return false;
 
                        if (!(cr = class_get_classref_multiarray_of(1, compr)))
@@ -851,8 +913,8 @@ fetch_opcode:
 
                case JAVA_MULTIANEWARRAY:
                        jd->isleafmethod = false;
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       j = SUCK_BE_U1(m->jcode + p + 3);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       j = SUCK_BE_U1(m->jcode + bcindex + 3);
   
                        cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
                        if (cr == NULL)
@@ -886,26 +948,26 @@ fetch_opcode:
                case JAVA_IF_ACMPEQ:
                case JAVA_IF_ACMPNE:
                case JAVA_GOTO:
-                       i = p + SUCK_BE_S2(m->jcode + p + 1);
+                       i = bcindex + SUCK_BE_S2(m->jcode + bcindex + 1);
                        CHECK_BYTECODE_INDEX(i);
-                       MARK_BASICBLOCK(i);
+                       MARK_BASICBLOCK(&pd, i);
                        blockend = true;
                        OP_INSINDEX(opcode, i);
                        break;
 
                case JAVA_GOTO_W:
-                       i = p + SUCK_BE_S4(m->jcode + p + 1);
+                       i = bcindex + SUCK_BE_S4(m->jcode + bcindex + 1);
                        CHECK_BYTECODE_INDEX(i);
-                       MARK_BASICBLOCK(i);
+                       MARK_BASICBLOCK(&pd, i);
                        blockend = true;
                        OP_INSINDEX(ICMD_GOTO, i);
                        break;
 
                case JAVA_JSR:
-                       i = p + SUCK_BE_S2(m->jcode + p + 1);
+                       i = bcindex + SUCK_BE_S2(m->jcode + bcindex + 1);
 jsr_tail:
                        CHECK_BYTECODE_INDEX(i);
-                       MARK_BASICBLOCK(i);
+                       MARK_BASICBLOCK(&pd, i);
                        blockend = true;
                        OP_PREPARE_ZEROFLAGS(JAVA_JSR);
                        iptr->sx.s23.s3.jsrtarget.insindex = i;
@@ -913,16 +975,16 @@ jsr_tail:
                        break;
 
                case JAVA_JSR_W:
-                       i = p + SUCK_BE_S4(m->jcode + p + 1);
+                       i = bcindex + SUCK_BE_S4(m->jcode + bcindex + 1);
                        goto jsr_tail;
 
                case JAVA_RET:
                        if (iswide == false) {
-                               i = SUCK_BE_U1(m->jcode + p + 1);
+                               i = SUCK_BE_U1(m->jcode + bcindex + 1);
                        }
                        else {
-                               i = SUCK_BE_U2(m->jcode + p + 1);
-                               nextp = p + 3;
+                               i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                               nextbc = bcindex + 3;
                                iswide = false;
                        }
                        blockend = true;
@@ -958,25 +1020,25 @@ jsr_tail:
                                s4 prevvalue = 0;
 #endif
                                blockend = true;
-                               nextp = MEMORY_ALIGN((p + 1), 4);
+                               nextbc = MEMORY_ALIGN((bcindex + 1), 4);
 
-                               CHECK_END_OF_BYTECODE(nextp + 8);
+                               CHECK_END_OF_BYTECODE(nextbc + 8);
 
                                OP_PREPARE_ZEROFLAGS(opcode);
 
                                /* default target */
 
-                               j = p + SUCK_BE_S4(m->jcode + nextp);
+                               j = bcindex + SUCK_BE_S4(m->jcode + nextbc);
                                iptr->sx.s23.s3.lookupdefault.insindex = j;
-                               nextp += 4;
+                               nextbc += 4;
                                CHECK_BYTECODE_INDEX(j);
-                               MARK_BASICBLOCK(j);
+                               MARK_BASICBLOCK(&pd, j);
 
                                /* number of pairs */
 
-                               num = SUCK_BE_U4(m->jcode + nextp);
+                               num = SUCK_BE_U4(m->jcode + nextbc);
                                iptr->sx.s23.s2.lookupcount = num;
-                               nextp += 4;
+                               nextbc += 4;
 
                                /* allocate the intermediate code table */
 
@@ -985,15 +1047,15 @@ jsr_tail:
 
                                /* iterate over the lookup table */
 
-                               CHECK_END_OF_BYTECODE(nextp + 8 * num);
+                               CHECK_END_OF_BYTECODE(nextbc + 8 * num);
 
                                for (i = 0; i < num; i++) {
                                        /* value */
 
-                                       j = SUCK_BE_S4(m->jcode + nextp);
+                                       j = SUCK_BE_S4(m->jcode + nextbc);
                                        lookup->value = j;
 
-                                       nextp += 4;
+                                       nextbc += 4;
 
 #if defined(ENABLE_VERIFIER)
                                        /* check if the lookup table is sorted correctly */
@@ -1006,12 +1068,12 @@ jsr_tail:
 #endif
                                        /* target */
 
-                                       j = p + SUCK_BE_S4(m->jcode + nextp);
+                                       j = bcindex + SUCK_BE_S4(m->jcode + nextbc);
                                        lookup->target.insindex = j;
                                        lookup++;
-                                       nextp += 4;
+                                       nextbc += 4;
                                        CHECK_BYTECODE_INDEX(j);
-                                       MARK_BASICBLOCK(j);
+                                       MARK_BASICBLOCK(&pd, j);
                                }
 
                                PINC;
@@ -1026,30 +1088,30 @@ jsr_tail:
                                branch_target_t *table;
 
                                blockend = true;
-                               nextp = MEMORY_ALIGN((p + 1), 4);
+                               nextbc = MEMORY_ALIGN((bcindex + 1), 4);
 
-                               CHECK_END_OF_BYTECODE(nextp + 12);
+                               CHECK_END_OF_BYTECODE(nextbc + 12);
 
                                OP_PREPARE_ZEROFLAGS(opcode);
 
                                /* default target */
 
-                               deftarget = p + SUCK_BE_S4(m->jcode + nextp);
-                               nextp += 4;
+                               deftarget = bcindex + SUCK_BE_S4(m->jcode + nextbc);
+                               nextbc += 4;
                                CHECK_BYTECODE_INDEX(deftarget);
-                               MARK_BASICBLOCK(deftarget);
+                               MARK_BASICBLOCK(&pd, deftarget);
 
                                /* lower bound */
 
-                               j = SUCK_BE_S4(m->jcode + nextp);
+                               j = SUCK_BE_S4(m->jcode + nextbc);
                                iptr->sx.s23.s2.tablelow = j;
-                               nextp += 4;
+                               nextbc += 4;
 
                                /* upper bound */
 
-                               num = SUCK_BE_S4(m->jcode + nextp);
+                               num = SUCK_BE_S4(m->jcode + nextbc);
                                iptr->sx.s23.s3.tablehigh = num;
-                               nextp += 4;
+                               nextbc += 4;
 
                                /* calculate the number of table entries */
 
@@ -1071,14 +1133,14 @@ jsr_tail:
 
                                /* iterate over the target table */
 
-                               CHECK_END_OF_BYTECODE(nextp + 4 * num);
+                               CHECK_END_OF_BYTECODE(nextbc + 4 * num);
 
                                for (i = 0; i < num; i++) {
-                                       j = p + SUCK_BE_S4(m->jcode + nextp);
+                                       j = bcindex + SUCK_BE_S4(m->jcode + nextbc);
                                        (table++)->insindex = j;
-                                       nextp += 4;
+                                       nextbc += 4;
                                        CHECK_BYTECODE_INDEX(j);
-                                       MARK_BASICBLOCK(j);
+                                       MARK_BASICBLOCK(&pd, j);
                                }
 
                                PINC;
@@ -1097,43 +1159,40 @@ jsr_tail:
                case JAVA_PUTSTATIC:
                case JAVA_GETFIELD:
                case JAVA_PUTFIELD:
-                       {
-                               constant_FMIref  *fr;
-                               unresolved_field *uf;
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       fmi = class_getconstant(m->class, i, CONSTANT_Fieldref);
 
-                               i = SUCK_BE_U2(m->jcode + p + 1);
-                               fr = class_getconstant(m->class, i, CONSTANT_Fieldref);
-                               if (!fr)
-                                       return false;
+                       if (fmi == NULL)
+                               return false;
 
-                               OP_PREPARE_ZEROFLAGS(opcode);
-                               iptr->sx.s23.s3.fmiref = fr;
+                       OP_PREPARE_ZEROFLAGS(opcode);
+                       iptr->sx.s23.s3.fmiref = fmi;
 
-                               /* only with -noverify, otherwise the typechecker does this */
+                       /* only with -noverify, otherwise the typechecker does this */
 
 #if defined(ENABLE_VERIFIER)
-                               if (!JITDATA_HAS_FLAG_VERIFY(jd)) {
+                       if (!JITDATA_HAS_FLAG_VERIFY(jd)) {
 #endif
-                                       result = resolve_field_lazy(m, fr);
-                                       if (result == resolveFailed)
-                                               return false;
+                               result = resolve_field_lazy(m, fmi);
+
+                               if (result == resolveFailed)
+                                       return false;
 
-                                       if (result != resolveSucceeded) {
-                                               uf = resolve_create_unresolved_field(m->class, m, iptr);
+                               if (result != resolveSucceeded) {
+                                       uf = resolve_create_unresolved_field(m->class, m, iptr);
 
-                                               if (uf == NULL)
-                                                       return false;
+                                       if (uf == NULL)
+                                               return false;
 
-                                               /* store the unresolved_field pointer */
+                                       /* store the unresolved_field pointer */
 
-                                               iptr->sx.s23.s3.uf = uf;
-                                               iptr->flags.bits |= INS_FLAG_UNRESOLVED;
-                                       }
-#if defined(ENABLE_VERIFIER)
+                                       iptr->sx.s23.s3.uf = uf;
+                                       iptr->flags.bits |= INS_FLAG_UNRESOLVED;
                                }
-#endif
-                               PINC;
+#if defined(ENABLE_VERIFIER)
                        }
+#endif
+                       PINC;
                        break;
 
 
@@ -1142,13 +1201,13 @@ jsr_tail:
                case JAVA_INVOKESTATIC:
                        OP_PREPARE_ZEROFLAGS(opcode);
 
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       mr = class_getconstant(m->class, i, CONSTANT_Methodref);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
 
-                       if (mr == NULL)
+                       if (fmi == NULL)
                                return false;
 
-                       md = mr->parseddesc.md;
+                       md = fmi->parseddesc.md;
 
                        if (md->params == NULL)
                                if (!descriptor_params_from_paramtypes(md, ACC_STATIC))
@@ -1159,30 +1218,30 @@ jsr_tail:
                case JAVA_INVOKESPECIAL:
                        OP_PREPARE_FLAGS(opcode, INS_FLAG_CHECK);
 
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       mr = class_getconstant(m->class, i, CONSTANT_Methodref);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
 
                        goto invoke_nonstatic_method;
 
                case JAVA_INVOKEINTERFACE:
                        OP_PREPARE_ZEROFLAGS(opcode);
 
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       mr = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       fmi = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
 
                        goto invoke_nonstatic_method;
 
                case JAVA_INVOKEVIRTUAL:
                        OP_PREPARE_ZEROFLAGS(opcode);
 
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       mr = class_getconstant(m->class, i, CONSTANT_Methodref);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
 
 invoke_nonstatic_method:
-                       if (mr == NULL)
+                       if (fmi == NULL)
                                return false;
 
-                       md = mr->parseddesc.md;
+                       md = fmi->parseddesc.md;
 
                        if (md->params == NULL)
                                if (!descriptor_params_from_paramtypes(md, 0))
@@ -1191,15 +1250,16 @@ invoke_nonstatic_method:
 invoke_method:
                        jd->isleafmethod = false;
 
-                       iptr->sx.s23.s3.fmiref = mr;
+                       iptr->sx.s23.s3.fmiref = fmi;
 
                        /* only with -noverify, otherwise the typechecker does this */
 
 #if defined(ENABLE_VERIFIER)
                        if (!JITDATA_HAS_FLAG_VERIFY(jd)) {
 #endif
-                               result = resolve_method_lazy(m, mr, 
-                                               (opcode == JAVA_INVOKESPECIAL));
+                               result = resolve_method_lazy(m, fmi, 
+                                                                                        (opcode == JAVA_INVOKESPECIAL));
+
                                if (result == resolveFailed)
                                        return false;
 
@@ -1219,11 +1279,11 @@ invoke_method:
                                        }
                                }
                                else {
-                                       um = resolve_create_unresolved_method(m->class, m, mr,
+                                       um = resolve_create_unresolved_method(m->class, m, fmi,
                                                        (opcode == JAVA_INVOKESTATIC),
                                                        (opcode == JAVA_INVOKESPECIAL));
 
-                                       if (!um)
+                                       if (um == NULL)
                                                return false;
 
                                        /* store the unresolved_method pointer */
@@ -1240,9 +1300,10 @@ invoke_method:
                /* instructions taking class arguments ********************************/
 
                case JAVA_NEW:
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
-                       if (!cr)
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       cr = class_getconstant(m->class, i, CONSTANT_Class);
+
+                       if (cr == NULL)
                                return false;
 
                        if (!resolve_classref(m, cr, resolveLazy, true, true, &c))
@@ -1256,8 +1317,9 @@ invoke_method:
                        break;
 
                case JAVA_CHECKCAST:
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       cr = class_getconstant(m->class, i, CONSTANT_Class);
+
                        if (cr == NULL)
                                return false;
 
@@ -1277,8 +1339,9 @@ invoke_method:
                        break;
 
                case JAVA_INSTANCEOF:
-                       i = SUCK_BE_U2(m->jcode + p + 1);
-                       cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
+                       i = SUCK_BE_U2(m->jcode + bcindex + 1);
+                       cr = class_getconstant(m->class, i, CONSTANT_Class);
+
                        if (cr == NULL)
                                return false;
 
@@ -1516,7 +1579,7 @@ invoke_method:
                case 254:
                case 255:
                        exceptions_throw_verifyerror(m, "Illegal opcode %d at instr %d\n",
-                                                                                opcode, icount);
+                                                                                opcode, ircount);
                        return false;
                        break;
 #endif /* defined(ENABLE_VERIFIER) */
@@ -1554,13 +1617,13 @@ invoke_method:
 
        /* assert that we did not write more ICMDs than allocated */
 
-       assert(icount <= pd.instructionslength);
-       assert(icount == (iptr - pd.instructions));
+       assert(ircount <= pd.instructionslength);
+       assert(ircount == (iptr - pd.instructions));
 
        /*** verifier checks ******************************************************/
 
 #if defined(ENABLE_VERIFIER)
-       if (p != m->jcodelength) {
+       if (bcindex != m->jcodelength) {
                exceptions_throw_verifyerror(m,
                                "Command-sequence crosses code-boundary");
                return false;
@@ -1576,91 +1639,89 @@ invoke_method:
 
        /* identify basic blocks */
 
-       /* First instruction always starts a basic block, but check if it
-          is already a branch target. */
-
-       if ((jd->basicblockindex[0] == 0) || (jd->basicblockindex[0] > 1)) {
-               iptr = pd.instructions;
-
-               iptr->flags.bits |= INS_FLAG_BASICBLOCK;
-
-               /* This is the first basic block. */
+       /* check if first instruction is a branch target */
 
-               b_count = 1;
+       if (pd.basicblockstart[0] == 1) {
+               jd->branchtoentry = true;
        }
        else {
-               jd->branchtoentry = true;
+               /* first instruction always starts a basic block */
 
-               /* In this case the loop below counts the first basic
-                  block. */
+               iptr = pd.instructions;
 
-               b_count = 0;
+               iptr->flags.bits |= INS_FLAG_BASICBLOCK;
        }
 
-       /* Iterate over all bytecode instructions and mark the
-          corresponding IR instruction as basic block starting
-          instruction. */
+       /* Iterate over all bytecode instructions and set missing
+          basic-block starts in IR instructions. */
+
+       for (bcindex = 0; bcindex < m->jcodelength; bcindex++) {
+               /* Does the current bytecode instruction start a basic
+                  block? */
 
-       for (i = 0; i < m->jcodelength; i++) {
-               if (jd->basicblockindex[i] & 0x1) {
+               if (pd.basicblockstart[bcindex] == 1) {
 #if defined(ENABLE_VERIFIER)
-                       /* Check if this block starts at the beginning of an
-                          instruction. */
+                       /* Check if this bytecode basic-block start at the
+                          beginning of a bytecode instruction. */
 
-                       if (pd.instructionstart[i] == 0) {
+                       if (pd.bytecodestart[bcindex] == 0) {
                                exceptions_throw_verifyerror(m,
-                                               "Branch into middle of instruction");
+                                                                                "Branch into middle of instruction");
                                return false;
                        }
 #endif
 
-                       /* Mark the IR instruction as basic block starting
-                          instruction. */
+                       /* Get the IR instruction mapped to the bytecode
+                          instruction and set the basic block flag. */
 
-                       iptr = pd.instructions + (jd->basicblockindex[i] >> 1);
+                       irindex = pd.bytecodemap[bcindex];
+                       iptr    = pd.instructions + irindex;
 
                        iptr->flags.bits |= INS_FLAG_BASICBLOCK;
-
-                       /* Store te basic block number in the array.  We need this
-                          information during stack analysis. */
-
-                       jd->basicblockindex[i] = b_count;
-
-                       /* basic block indices of course start with 0 */
-
-                       b_count++;
                }
        }
 
+       /* IR instruction index to basic-block index mapping */
+
+       pd.instructionmap = DMNEW(s4, ircount);
+       MZERO(pd.instructionmap, s4, ircount);
+
        /* Iterate over all IR instructions and count the basic blocks. */
 
        iptr = pd.instructions;
 
-       b_count = 0;
+       bbcount = 0;
 
-       for (i = 0; i < icount; i++, iptr++) {
+       for (i = 0; i < ircount; i++, iptr++) {
                if (INSTRUCTION_STARTS_BASICBLOCK(iptr)) {
-                       b_count++;
+                       /* store the basic-block number in the IR instruction
+                          map */
+
+                       pd.instructionmap[i] = bbcount;
+
+                       /* post-increment the basic-block count */
+
+                       bbcount++;
                }
        }
 
        /* Allocate basic block array (one more for end ipc). */
 
-       jd->basicblocks = DMNEW(basicblock, b_count + 1);
-
-       /* zero out all basic block structures */
-
-       MZERO(jd->basicblocks, basicblock, b_count + 1);
+       jd->basicblocks = DMNEW(basicblock, bbcount + 1);
+       MZERO(jd->basicblocks, basicblock, bbcount + 1);
 
        /* Now iterate again over all IR instructions and initialize the
-          basic block structures. */
+          basic block structures and, in the same loop, resolve the
+          branch-target instruction indices to basic blocks. */
 
        iptr = pd.instructions;
        bptr = jd->basicblocks;
 
-       b_count = 0;
+       bbcount = 0;
+
+       for (i = 0; i < ircount; i++, iptr++) {
+               /* check for basic block */
 
-       for (i = 0; i < icount; i++, iptr++) {
                if (INSTRUCTION_STARTS_BASICBLOCK(iptr)) {
                        /* intialize the basic block */
 
@@ -1668,34 +1729,87 @@ invoke_method:
 
                        bptr->iinstr = iptr;
 
-                       if (b_count > 0) {
+                       if (bbcount > 0) {
                                bptr[-1].icount = bptr->iinstr - bptr[-1].iinstr;
                        }
 
                        /* bptr->icount is set when the next block is allocated */
 
-                       bptr->nr = b_count++;
+                       bptr->nr = bbcount++;
                        bptr++;
                        bptr[-1].next = bptr;
                }
+
+               /* resolve instruction indices to basic blocks */
+
+               switch (iptr->opc) {
+               case JAVA_IFEQ:
+               case JAVA_IFLT:
+               case JAVA_IFLE:
+               case JAVA_IFNE:
+               case JAVA_IFGT:
+               case JAVA_IFGE:
+               case JAVA_IFNULL:
+               case JAVA_IFNONNULL:
+               case JAVA_IF_ICMPEQ:
+               case JAVA_IF_ICMPNE:
+               case JAVA_IF_ICMPLT:
+               case JAVA_IF_ICMPGT:
+               case JAVA_IF_ICMPLE:
+               case JAVA_IF_ICMPGE:
+               case JAVA_IF_ACMPEQ:
+               case JAVA_IF_ACMPNE:
+               case JAVA_GOTO:
+                       BYTECODEINDEX_TO_BASICBLOCK(iptr->dst);
+                       break;
+
+               case ICMD_JSR:
+                       BYTECODEINDEX_TO_BASICBLOCK(iptr->sx.s23.s3.jsrtarget);
+                       break;
+
+               case ICMD_TABLESWITCH:
+                       table = iptr->dst.table;
+
+                       BYTECODEINDEX_TO_BASICBLOCK(*table);
+                       table++;
+
+                       j = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
+
+                       while (--j >= 0) {
+                               BYTECODEINDEX_TO_BASICBLOCK(*table);
+                               table++;
+                       }
+                       break;
+
+               case ICMD_LOOKUPSWITCH:
+                       BYTECODEINDEX_TO_BASICBLOCK(iptr->sx.s23.s3.lookupdefault);
+
+                       lookup = iptr->dst.lookup;
+
+                       j = iptr->sx.s23.s2.lookupcount;
+
+                       while (--j >= 0) {
+                               BYTECODEINDEX_TO_BASICBLOCK(lookup->target);
+                               lookup++;
+                       }
+                       break;
+               }
        }
 
        /* set instruction count of last real block */
 
-       if (b_count > 0) {
-               bptr[-1].icount = (pd.instructions + icount) - bptr[-1].iinstr;
+       if (bbcount > 0) {
+               bptr[-1].icount = (pd.instructions + ircount) - bptr[-1].iinstr;
        }
 
        /* allocate additional block at end */
 
        BASICBLOCK_INIT(bptr, m);
-       bptr->nr = b_count;
-
-       jd->basicblockindex[m->jcodelength] = b_count;
+       bptr->nr = bbcount;
 
        /* set basicblock pointers in exception table */
 
-       if (!parse_resolve_exception_table(jd))
+       if (!parse_resolve_exception_table(jd, &pd))
                return false;
 
        /* store the local map */
@@ -1728,7 +1842,7 @@ invoke_method:
 
                jd->varcount = 
                          nlocals                                      /* local variables */
-                       + b_count * m->maxstack                                 /* invars */
+                       + bbcount * m->maxstack                                 /* invars */
                        + s_count;         /* variables created within blocks (non-invar) */
 
                /* reserve the first indices for local variables */
@@ -1762,9 +1876,9 @@ invoke_method:
        /* assign local variables to method variables */
 
        jd->instructions     = pd.instructions;
-       jd->instructioncount = icount;
-       jd->basicblockcount  = b_count;
-       jd->stackcount       = s_count + b_count * m->maxstack; /* in-stacks */
+       jd->instructioncount = ircount;
+       jd->basicblockcount  = bbcount;
+       jd->stackcount       = s_count + bbcount * m->maxstack; /* in-stacks */
 
        /* allocate stack table */
 
index 719510a5df476cc54ab29b117ccc10194822d420..d5c7438ec92ba62db625c61bfa65ac6cfd72ae68 100644 (file)
@@ -27,7 +27,7 @@
    Author:  Christian Thalinger
             Edwin Steiner
 
-   $Id: parse.h 7628 2007-04-02 19:09:52Z michi $
+   $Id: parse.h 7663 2007-04-04 22:14:42Z twisti $
 
 */
 
 
 /* basic block generating macro ***********************************************/
 
-#define MARK_BASICBLOCK(i)                                           \
+#define MARK_BASICBLOCK(pd, i)                                       \
     do {                                                             \
-        if (!(jd->basicblockindex[(i)] & 1)) {                   \
-            b_count++;                                               \
-            jd->basicblockindex[(i)] |= 1;                       \
-        }                                                            \
+        (pd)->basicblockstart[(i)] = 1;                              \
     } while (0)
 
 #define INSTRUCTIONS_CHECK(i)                                        \
-    if ((icount + (i)) > pd.instructionslength)                      \
-        iptr = parse_realloc_instructions(&pd, icount, (i))
+    if ((ircount + (i)) > pd.instructionslength)                     \
+        iptr = parse_realloc_instructions(&pd, ircount, (i))
 
 
 /* intermediate code generating macros ****************************************/
 /* afterwards.                                                                */
 
 #define PINC                                                         \
-    iptr++; icount++
+    iptr++; ircount++
 
 #define OP_PREPARE_FLAGS(o, f)                                       \
-    iptr->opc                = (o);                                  \
-    iptr->line               = currentline;                          \
-    iptr->flags.bits         = (f) | (icount << INS_FLAG_ID_SHIFT);
+    iptr->opc         = (o);                                         \
+    iptr->line        = currentline;                                 \
+    iptr->flags.bits |= (f) | (ircount << INS_FLAG_ID_SHIFT);
 
 #define OP_PREPARE_ZEROFLAGS(o)                                      \
     OP_PREPARE_FLAGS(o, 0)
     iptr->sx.s23.s3.fmiref   = (fmiref);
 
 
-/* external macros ************************************************************/
-
-#define BLOCK_OF(index)                                              \
-    (jd->basicblocks + jd->basicblockindex[index])
-
-
 /* function prototypes ********************************************************/
 
 bool parse(jitdata *jd);
index 615971eac016766f7895668a0fdb029f53cac9b9..b447f8090fb32f65b573bc4651057973445ddbee 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -1694,9 +1694,9 @@ L_replace_free_safestack$lazy_ptr:
 #endif /* defined(__DARWIN__) */
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index 142c9145898e74d17960c62df2879a57dde149c9..921eb938980d6ddc9c54b0c19a7ef4bd41225794 100644 (file)
@@ -1,6 +1,6 @@
-/* src/vm/jit/powerpc64/asmpart.S - Java-C interface functions for PowerPC
+/* src/vm/jit/powerpc64/asmpart.S - Java-C interface functions for PowerPC64
                
-   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: Roland Lezuo
-
-   Changes: Christian Thalinger
-            Edwin Steiner
-
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -1557,9 +1550,9 @@ L_replace_me$lazy_ptr:
 #endif /* defined(__DARWIN__) */
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index 04631f9684bd9e04f4d18044c241ca1240085ef1..8ab1bc898a117d8790636a99a7a0403800ca491f 100644 (file)
@@ -1,6 +1,6 @@
-/* vm/jit/replace.c - on-stack replacement of methods
+/* src/vm/jit/replace.c - on-stack replacement of methods
 
-   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: Edwin Steiner
-
    $Id$
 
 */
 #endif
 
 #include "mm/memory.h"
+
+#include "threads/threads-common.h"
+
 #include "toolbox/logging.h"
+
 #include "vm/stringlocal.h"
+
 #include "vm/jit/abi.h"
-#include "vm/jit/jit.h"
-#include "vm/jit/replace.h"
-#include "vm/jit/stack.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/disass.h"
-#include "vm/jit/show.h"
-#include "vm/jit/methodheader.h"
+#include "vm/jit/jit.h"
 #include "vm/jit/md.h"
+#include "vm/jit/methodheader.h"
+#include "vm/jit/replace.h"
+#include "vm/jit/show.h"
+#include "vm/jit/stack.h"
+
 #include "vmcore/options.h"
 #include "vmcore/classcache.h"
 
-#include "native/include/java_lang_String.h"
 
 #define REPLACE_PATCH_DYNAMIC_CALL
 /*#define REPLACE_PATCH_ALL*/
@@ -2738,7 +2739,7 @@ void replace_me(rplpoint *rp, executionstate_t *es)
        s4                   dumpsize;
        rplpoint            *origrp;
        replace_safestack_t *safestack;
-#if defined(ENABLE_GC_CACAO)
+#if defined(ENABLE_THREADS) && defined(ENABLE_GC_CACAO)
        threadobject        *thread;
 #endif
 
@@ -2761,7 +2762,7 @@ void replace_me(rplpoint *rp, executionstate_t *es)
 
        /* get the stackframeinfo for the current thread */
 
-       sfi = *(STACKFRAMEINFO);
+       sfi = STACKFRAMEINFO;
 
        /* recover source state */
 
@@ -2861,7 +2862,7 @@ void replace_gc_from_native(threadobject *thread, u1 *pc, u1 *sp)
 
        /* get the stackframeinfo of this thread */
        assert(thread == THREADOBJECT);
-       sfi = *( STACKFRAMEINFO );
+       sfi = STACKFRAMEINFO;
 
        /* create the execution state */
        es = DNEW(executionstate_t);
@@ -3228,7 +3229,7 @@ static void java_value_print(s4 type, replace_val_t value)
 
                if (obj->vftbl->class == class_java_lang_String) {
                        printf(" \"");
-                       u = javastring_toutf((java_lang_String *)obj, false);
+                       u = javastring_toutf(obj, false);
                        utf_display_printable_ascii(u);
                        printf("\"");
                }
index 86ebd5578e0f05bd3e2eae411c8d24701a637cd5..a63d0fe7a8548c95ec8a98be10d5e0996cbe13c6 100644 (file)
@@ -1,6 +1,6 @@
-/* vm/jit/replace.h - on-stack replacement of methods
+/* src/vm/jit/replace.h - on-stack replacement of methods
 
-   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: Edwin Steiner
-
-   Changes:
-
    $Id$
 
 */
 #include "config.h"
 #include "vm/types.h"
 
-#if defined(ENABLE_REPLACEMENT)
+#if !defined(ENABLE_REPLACEMENT)
+
+/*** macros for the codegens (disabled version) ************************/
+
+#define REPLACEMENT_POINTS_INIT(cd, jd)
+#define REPLACEMENT_POINTS_RESET(cd, jd)
+#define REPLACEMENT_POINT_BLOCK_START(cd, bptr)
+#define REPLACEMENT_POINT_INLINE_START(cd, iptr)
+#define REPLACEMENT_POINT_INLINE_BODY(cd, iptr)
+#define REPLACEMENT_POINT_RETURN(cd, iptr)
+#define REPLACEMENT_POINT_INVOKE(cd, iptr)
+#define REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr)
+#define REPLACEMENT_EMIT_STUBS(jd)
+
+#else /* defined(ENABLE_REPLACEMENT) */
 
 /* forward typedefs ***********************************************************/
 
@@ -287,23 +295,10 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp,
                                                                u1 *savedmcode);
 #endif
 
-#else /* !defined(ENABLE_REPLACEMENT) */
-
-/*** macros for the codegens (disabled version) ************************/
-
-#define REPLACEMENT_POINTS_INIT(cd, jd)
-#define REPLACEMENT_POINTS_RESET(cd, jd)
-#define REPLACEMENT_POINT_BLOCK_START(cd, bptr)
-#define REPLACEMENT_POINT_INLINE_START(cd, iptr)
-#define REPLACEMENT_POINT_INLINE_BODY(cd, iptr)
-#define REPLACEMENT_POINT_RETURN(cd, iptr)
-#define REPLACEMENT_POINT_INVOKE(cd, iptr)
-#define REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr)
-#define REPLACEMENT_EMIT_STUBS(jd)
-
 #endif /* defined(ENABLE_REPLACEMENT) */
 
-#endif
+#endif /* _REPLACE_H */
+
 
 /*
  * These are local overrides for various environment variables in Emacs.
index 2b97ee11adf77471a2f50027569a8c31aca39f13..0817e0abeffe2c6962abc6cf51c10f261236e24e 100644 (file)
@@ -1,6 +1,6 @@
-/* src/vm/jit/x86_64/asmpart.S - Java-C interface functions for x86_64
+/* src/vm/jit/s390/asmpart.S - Java-C interface functions for s390
 
-   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: Andreas Krall
-            Reinhard Grafl
-            Christian Thalinger
-
-   Changes: Edwin Steiner
-
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -1017,11 +1009,11 @@ asm_criticalsections:
        .long 0
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
 #if 0
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index caeec6970a822d8f1aae8e14b23ae2d40097025f..7900a7bdfa7a90f4fb523f16d7d5fa6fe200233d 100644 (file)
@@ -601,14 +601,9 @@ void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
 #if !defined(NDEBUG)
 
 #define SHOW_TARGET(target)                                          \
-        if (stage >= SHOW_STACK) {                                   \
+        if (stage >= SHOW_PARSE) {                                   \
             printf("--> L%03d ", (target).block->nr);                \
         }                                                            \
-        else if (stage >= SHOW_PARSE) {                              \
-            printf("--> insindex %d (L%03d) ", (target).insindex,    \
-                jd->basicblocks[jd->basicblockindex[         \
-                (target).insindex]].nr);                             \
-        }                                                            \
         else {                                                       \
             printf("--> insindex %d ", (target).insindex);           \
         }
@@ -1388,12 +1383,7 @@ void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
                printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
                while (--i >= 0) {
                        printf("\t\t%d --> ", (int) (table - iptr->dst.table));
-                       if (stage >= SHOW_STACK) {
-                               printf("L%03d\n", table->block->nr);
-                       }
-                       else {
-                               printf("insindex %d (L%03d)\n", table->insindex, BLOCK_OF(table->insindex)->nr);
-                       }
+                       printf("L%03d\n", table->block->nr);
                        table++;
                }
 
@@ -1402,24 +1392,17 @@ void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
        case ICMD_LOOKUPSWITCH:
                SHOW_S1(iptr);
 
-               printf("count=%d, default=", iptr->sx.s23.s2.lookupcount);
-               if (stage >= SHOW_STACK) {
-                       printf("L%03d\n", iptr->sx.s23.s3.lookupdefault.block->nr);
-               }
-               else {
-                       printf("insindex %d (L%03d)\n", iptr->sx.s23.s3.lookupdefault.insindex, BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->nr);
-               }
+               printf("count=%d, default=L%03d\n",
+                          iptr->sx.s23.s2.lookupcount,
+                          iptr->sx.s23.s3.lookupdefault.block->nr);
 
                lookup = iptr->dst.lookup;
                i = iptr->sx.s23.s2.lookupcount;
+
                while (--i >= 0) {
-                       printf("\t\t%d --> ", lookup->value);
-                       if (stage >= SHOW_STACK) {
-                               printf("L%03d\n", lookup->target.block->nr);
-                       }
-                       else {
-                               printf("insindex %d (L%03d)\n", lookup->target.insindex, BLOCK_OF(lookup->target.insindex)->nr);
-                       }
+                       printf("\t\t%d --> L%03d\n",
+                                  lookup->value,
+                                  lookup->target.block->nr);
                        lookup++;
                }
                break;
index e81c6410dd4ce03f8b4263eef2f541f0efb1a52a..c19e01e6280dc9b3438aba759e24628d944ccdd5 100644 (file)
@@ -1,6 +1,6 @@
-/* src/vm/jit/sparc64/asmpart.S - Java-C interface functions for Sparc
+/* src/vm/jit/sparc64/asmpart.S - Java-C interface functions for Sparc64
 
-   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: Andreas Krall
-            Reinhard Grafl
-            Alexander Jordan
-
-   Changes: 
-
    $Id: asmpart.S 4749 2006-04-11 10:20:18Z twisti $
 
 */
index 87a8087a4896c2242419b65017e73cd1f4ff2f08..938eea2128c36a0d6b3d94c769c6f774c5d00805 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: stack.c 7628 2007-04-02 19:09:52Z michi $
+   $Id: stack.c 7663 2007-04-04 22:14:42Z twisti $
 
 */
 
@@ -494,7 +494,7 @@ struct stackdata_t {
 
 #define BRANCH_TARGET(bt, tempbptr)                                  \
     do {                                                             \
-        tempbptr = BLOCK_OF((bt).insindex);                          \
+        tempbptr = (bt).block;                                       \
         tempbptr = stack_mark_reached(&sd, tempbptr, curstack,       \
                                       stackdepth);                   \
         if (tempbptr == NULL)                                        \
@@ -3003,7 +3003,7 @@ normal_ICONST:
 
                                                                        icmd_lconst_lcmp_tail:
                                                                                /* convert LCONST, LCMP, IFXX to IF_LXX */
-                                                                               iptr->dst.insindex = iptr[2].dst.insindex;
+                                                                               iptr->dst.block = iptr[2].dst.block;
                                                                                iptr[1].opc = ICMD_NOP;
                                                                                iptr[2].opc = ICMD_NOP;
 
@@ -4034,7 +4034,7 @@ icmd_DUP_X2:
                                                case ICMD_IFEQ:
                                                        iptr->opc = ICMD_IF_LCMPEQ;
                                                icmd_lcmp_if_tail:
-                                                       iptr->dst.insindex = iptr[1].dst.insindex;
+                                                       iptr->dst.block = iptr[1].dst.block;
                                                        iptr[1].opc = ICMD_NOP;
 
                                                        OP2_BRANCH(TYPE_LNG, TYPE_LNG);
@@ -4077,7 +4077,7 @@ normal_LCMP:
                                                case ICMD_IFEQ:
                                                        iptr->opc = ICMD_IF_FCMPEQ;
                                                icmd_if_fcmpl_tail:
-                                                       iptr->dst.insindex = iptr[1].dst.insindex;
+                                                       iptr->dst.block = iptr[1].dst.block;
                                                        iptr[1].opc = ICMD_NOP;
 
                                                        OP2_BRANCH(TYPE_FLT, TYPE_FLT);
@@ -4118,7 +4118,7 @@ normal_FCMPL:
                                                case ICMD_IFEQ:
                                                        iptr->opc = ICMD_IF_FCMPEQ;
                                                icmd_if_fcmpg_tail:
-                                                       iptr->dst.insindex = iptr[1].dst.insindex;
+                                                       iptr->dst.block = iptr[1].dst.block;
                                                        iptr[1].opc = ICMD_NOP;
 
                                                        OP2_BRANCH(TYPE_FLT, TYPE_FLT);
@@ -4159,7 +4159,7 @@ normal_FCMPG:
                                                case ICMD_IFEQ:
                                                        iptr->opc = ICMD_IF_DCMPEQ;
                                                icmd_if_dcmpl_tail:
-                                                       iptr->dst.insindex = iptr[1].dst.insindex;
+                                                       iptr->dst.block = iptr[1].dst.block;
                                                        iptr[1].opc = ICMD_NOP;
 
                                                        OP2_BRANCH(TYPE_DBL, TYPE_DBL);
@@ -4200,7 +4200,7 @@ normal_DCMPL:
                                                case ICMD_IFEQ:
                                                        iptr->opc = ICMD_IF_DCMPEQ;
                                                icmd_if_dcmpg_tail:
-                                                       iptr->dst.insindex = iptr[1].dst.insindex;
+                                                       iptr->dst.block = iptr[1].dst.block;
                                                        iptr[1].opc = ICMD_NOP;
 
                                                        OP2_BRANCH(TYPE_DBL, TYPE_DBL);
@@ -4378,7 +4378,7 @@ normal_DCMPG:
                                        case ICMD_JSR:
                                                OP0_1(TYPE_RET);
 
-                                               tbptr = BLOCK_OF(iptr->sx.s23.s3.jsrtarget.insindex);
+                                               tbptr = iptr->sx.s23.s3.jsrtarget.block;
                                                tbptr->type = BBTYPE_SBR;
 
                                                assert(sd.bptr->next);  /* XXX exception */
@@ -4388,7 +4388,7 @@ normal_DCMPG:
 #endif
 
                                                tbptr = stack_mark_reached(&sd, tbptr, curstack, stackdepth);
-                                               if (!tbptr)
+                                               if (tbptr == NULL)
                                                        return false;
 
                                                iptr->sx.s23.s3.jsrtarget.block = tbptr;
index 209e2846ffdfe9bcaa80462f22529ec350ca81ae..01f1fb797730d16fbbc9255a1e8096b8f058a029 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: stacktrace.c 7632 2007-04-02 20:05:05Z michi $
+   $Id: stacktrace.c 7657 2007-04-03 15:51:52Z twisti $
 
 */
 
@@ -100,7 +100,7 @@ void stacktrace_create_stackframeinfo(stackframeinfo *sfi, u1 *pv, u1 *sp,
 
        /* get current stackframe info pointer */
 
-       psfi = STACKFRAMEINFO;
+       psfi = &STACKFRAMEINFO;
 
        /* if we don't have pv handy */
 
@@ -144,46 +144,6 @@ void stacktrace_create_stackframeinfo(stackframeinfo *sfi, u1 *pv, u1 *sp,
 #endif /* defined(ENABLE_INTRP) */
 
 
-/* stacktrace_create_inline_stackframeinfo *************************************
-
-   Creates an stackframe info structure for an inline exception stub.
-
-*******************************************************************************/
-
-void stacktrace_create_inline_stackframeinfo(stackframeinfo *sfi, u1 *pv,
-                                                                                        u1 *sp, u1 *ra, u1 *xpc)
-{
-       stackframeinfo **psfi;
-
-       /* get current stackframe info pointer */
-
-       psfi = STACKFRAMEINFO;
-
-#if defined(ENABLE_INTRP)
-       if (opt_intrp) {
-               /* if we don't have pv handy */
-
-               if (pv == NULL)
-                       pv = codegen_get_pv_from_pc(ra);
-
-       }
-#endif
-
-       /* fill new stackframe info structure */
-
-       sfi->prev   = *psfi;
-       sfi->method = NULL;
-       sfi->pv     = pv;
-       sfi->sp     = sp;
-       sfi->ra     = ra;
-       sfi->xpc    = xpc;
-
-       /* store new stackframe info pointer */
-
-       *psfi = sfi;
-}
-
-
 /* stacktrace_create_extern_stackframeinfo *************************************
 
    Creates an stackframe info structure for an extern exception
@@ -204,7 +164,7 @@ void stacktrace_create_extern_stackframeinfo(stackframeinfo *sfi, u1 *pv,
 
        /* get current stackframe info pointer */
 
-       psfi = STACKFRAMEINFO;
+       psfi = &STACKFRAMEINFO;
 
        /* sometimes we don't have pv handy (e.g. in asmpart.S:
        L_asm_call_jit_compiler_exception or in the interpreter). */
@@ -298,7 +258,7 @@ void stacktrace_create_native_stackframeinfo(stackframeinfo *sfi, u1 *pv,
 
        /* get current stackframe info pointer */
 
-       psfi = STACKFRAMEINFO;
+       psfi = &STACKFRAMEINFO;
 
        /* fill new stackframe info structure */
 
@@ -327,7 +287,7 @@ void stacktrace_remove_stackframeinfo(stackframeinfo *sfi)
 
        /* get current stackframe info pointer */
 
-       psfi = STACKFRAMEINFO;
+       psfi = &STACKFRAMEINFO;
 
        /* restore the old pointer */
 
@@ -335,259 +295,6 @@ void stacktrace_remove_stackframeinfo(stackframeinfo *sfi)
 }
 
 
-/* stacktrace_inline_arithmeticexception ***************************************
-
-   Creates an ArithemticException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_arithmeticexception(u1 *pv, u1 *sp,
-                                                                                                                u1 *ra, u1 *xpc)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       o = exceptions_new_arithmeticexception();
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
-/* stacktrace_inline_arrayindexoutofboundsexception ****************************
-
-   Creates an ArrayIndexOutOfBoundsException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_arrayindexoutofboundsexception(u1 *pv,
-                                                                                                                                       u1 *sp,
-                                                                                                                                       u1 *ra,
-                                                                                                                                       u1 *xpc,
-                                                                                                                                       s4 index)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       o = exceptions_new_arrayindexoutofboundsexception(index);
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
-/* stacktrace_inline_arraystoreexception ***************************************
-
-   Creates an ArrayStoreException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_arraystoreexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                                u1 *xpc)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       o = exceptions_new_arraystoreexception();
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
-/* stacktrace_inline_classcastexception ****************************************
-
-   Creates an ClassCastException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                               u1 *xpc,
-                                                                                                               java_objectheader *o)
-{
-       stackframeinfo     sfi;
-       java_objectheader *e;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       e = exceptions_new_classcastexception(o);
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return e;
-}
-
-
-/* stacktrace_inline_nullpointerexception **************************************
-
-   Creates an NullPointerException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_nullpointerexception(u1 *pv, u1 *sp,
-                                                                                                                 u1 *ra, u1 *xpc)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       o = exceptions_new_nullpointerexception();
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
-/* stacktrace_inline_fillInStackTrace ******************************************
-
-   Fills in the correct stacktrace into an existing exception object
-   (this one is for inline exception stubs).
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                         u1 *xpc)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-       methodinfo        *m;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_inline_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* get exception */
-
-       o = *exceptionptr;
-       assert(o);
-
-       /* clear exception */
-
-       *exceptionptr = NULL;
-
-       /* resolve methodinfo pointer from exception object */
-
-#if defined(ENABLE_JAVASE)
-       m = class_resolvemethod(o->vftbl->class,
-                                                       utf_fillInStackTrace,
-                                                       utf_void__java_lang_Throwable);
-#elif defined(ENABLE_JAVAME_CLDC1_1)
-       m = class_resolvemethod(o->vftbl->class,
-                                                       utf_fillInStackTrace,
-                                                       utf_void__void);
-#else
-#error IMPLEMENT ME!
-#endif
-
-       /* call function */
-
-       (void) vm_call_method(m, o);
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
-/* stacktrace_hardware_arithmeticexception *************************************
-
-   Creates an ArithemticException for inline stub.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_hardware_arithmeticexception(u1 *pv, u1 *sp,
-                                                                                                                  u1 *ra, u1 *xpc)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       o = exceptions_new_arithmeticexception();
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
-/* stacktrace_hardware_nullpointerexception ************************************
-
-   Creates an NullPointerException for the SIGSEGV signal handler.
-
-*******************************************************************************/
-
-java_objectheader *stacktrace_hardware_nullpointerexception(u1 *pv, u1 *sp,
-                                                                                                                       u1 *ra, u1 *xpc)
-{
-       stackframeinfo     sfi;
-       java_objectheader *o;
-
-       /* create stackframeinfo */
-
-       stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* create exception */
-
-       o = exceptions_new_nullpointerexception();
-
-       /* remove stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       return o;
-}
-
-
 /* stacktrace_add_entry ********************************************************
 
    Adds a new entry to the stacktrace buffer.
@@ -669,6 +376,10 @@ static bool stacktrace_add_method(stacktracebuffer *stb, methodinfo *m, u1 *pv,
    Generates a stacktrace from the thread passed into a
    stacktracebuffer.  The stacktracebuffer is allocated on the
    dump memory.
+   
+   NOTE: The first element in the stackframe chain must always be a
+         native stackframeinfo (e.g. VMThrowable.fillInStackTrace() is
+         a native function).
 
    RETURN VALUE:
       pointer to the stacktracebuffer, or
@@ -677,10 +388,9 @@ static bool stacktrace_add_method(stacktracebuffer *stb, methodinfo *m, u1 *pv,
 
 *******************************************************************************/
 
-stacktracebuffer *stacktrace_create(threadobject* thread)
+stacktracebuffer *stacktrace_create(stackframeinfo *sfi)
 {
        stacktracebuffer *stb;
-       stackframeinfo   *sfi;
        methodinfo       *m;
        codeinfo         *code;
        u1               *pv;
@@ -703,19 +413,6 @@ stacktracebuffer *stacktrace_create(threadobject* thread)
        stb->used     = 0;
        stb->entries  = DMNEW(stacktrace_entry, STACKTRACE_CAPACITY_DEFAULT);
 
-       /* The first element in the stackframe chain must always be a
-          native stackframeinfo (VMThrowable.fillInStackTrace is a native
-          function). */
-
-       /* We don't use the STACKFRAMEINFO macro here, as we have to use
-          the passed thread. */
-
-#if defined(ENABLE_THREADS)
-       sfi = thread->_stackframeinfo;
-#else
-       sfi = _no_threads_stackframeinfo;
-#endif
-
 #define PRINTMETHODS 0
 
 #if PRINTMETHODS
@@ -985,8 +682,9 @@ stacktracecontainer *stacktrace_fillInStackTrace(void)
 
        /* create a stacktrace from the current thread */
 
-       stb = stacktrace_create(THREADOBJECT);
-       if (!stb)
+       stb = stacktrace_create(STACKFRAMEINFO);
+
+       if (stb == NULL)
                goto return_NULL;
 
        /* allocate memory from the GC heap and copy the stacktrace buffer */
@@ -1050,8 +748,9 @@ java_objectarray *stacktrace_getClassContext(void)
 
        /* create a stacktrace for the current thread */
 
-       stb = stacktrace_create(THREADOBJECT);
-       if (!stb)
+       stb = stacktrace_create(STACKFRAMEINFO);
+
+       if (stb == NULL)
                goto return_NULL;
 
        /* calculate the size of the Class array */
@@ -1134,8 +833,9 @@ classinfo *stacktrace_getCurrentClass(void)
 
        /* create a stacktrace for the current thread */
 
-       stb = stacktrace_create(THREADOBJECT);
-       if (!stb)
+       stb = stacktrace_create(STACKFRAMEINFO);
+
+       if (stb == NULL)
                goto return_NULL; /* XXX exception: how to distinguish from normal NULL return? */
 
        /* iterate over all stacktrace entries and find the first suitable
@@ -1201,7 +901,7 @@ java_objectarray *stacktrace_getStack(void)
 
        /* create a stacktrace for the current thread */
 
-       stb = stacktrace_create(THREADOBJECT);
+       stb = stacktrace_create(STACKFRAMEINFO);
 
        if (stb == NULL)
                goto return_NULL;
@@ -1306,39 +1006,6 @@ void stacktrace_print_trace_from_buffer(stacktracebuffer *stb)
 }
 
 
-/* stacktrace_dump_trace *******************************************************
-
-   This method is call from signal_handler_sigusr1 to dump the
-   stacktrace of the current thread to stdout.
-
-*******************************************************************************/
-
-void stacktrace_dump_trace(threadobject *thread)
-{
-       stacktracebuffer *stb;
-       s4                dumpsize;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
-
-       /* create a stacktrace for the current thread */
-
-       stb = stacktrace_create(thread);
-
-       /* print stacktrace */
-
-       if (stb != NULL)
-               stacktrace_print_trace_from_buffer(stb);
-       else {
-               puts("\t<<No stacktrace available>>");
-               fflush(stdout);
-       }
-
-       dump_release(dumpsize);
-}
-
-
 /* stacktrace_print_trace ******************************************************
 
    Print the stacktrace of a given exception. More or less a wrapper
index 2ff0be46752852f0c1952ed91f4c68a221627505..012b26c62eccd582b8857696a8f964f71649c806 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: stacktrace.h 7483 2007-03-08 13:17:40Z michi $
+   $Id: stacktrace.h 7667 2007-04-05 00:16:05Z michi $
 
 */
 
@@ -41,12 +41,6 @@ typedef struct stacktrace_entry stacktrace_entry;
 
 #include "md-abi.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#else
-# include "threads/none/threads.h"
-#endif
-
 #include "vmcore/class.h"
 #include "vmcore/method.h"
 
@@ -120,9 +114,6 @@ void stacktrace_create_stackframeinfo(stackframeinfo *sfi, u1 *pv, u1 *sp,
                                                                          u1 *ra);
 #endif
 
-void stacktrace_create_inline_stackframeinfo(stackframeinfo *sfi, u1 *pv,
-                                                                                        u1 *sp, u1 *ra, u1 *xpc);
-
 void stacktrace_create_extern_stackframeinfo(stackframeinfo *sfi, u1 *pv,
                                                                                         u1 *sp, u1 *ra, u1 *xpc);
 
@@ -131,51 +122,8 @@ void stacktrace_create_native_stackframeinfo(stackframeinfo *sfi, u1 *pv,
 
 void stacktrace_remove_stackframeinfo(stackframeinfo *sfi);
 
-/* inline exception creating functions */
-java_objectheader *stacktrace_inline_arithmeticexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                                u1 *xpc);
-#define STACKTRACE_inline_arithmeticexception \
-    (functionptr) stacktrace_inline_arithmeticexception
-                                                                                               
-
-java_objectheader *stacktrace_inline_arrayindexoutofboundsexception(u1 *pv,
-                                                                                                                                       u1 *sp,
-                                                                                                                                       u1 *ra,
-                                                                                                                                       u1 *xpc,
-                                                                                                                                       s4 index);
-#define STACKTRACE_inline_arrayindexoutofboundsexception \
-    (functionptr) stacktrace_inline_arrayindexoutofboundsexception
-
-java_objectheader *stacktrace_inline_arraystoreexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                                u1 *xpc);
-#define STACKTRACE_inline_arraystoreexception \
-    (functionptr) stacktrace_inline_arraystoreexception
-
-java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                               u1 *xpc,
-                                                                                                               java_objectheader *o);
-#define STACKTRACE_inline_classcastexception \
-    (functionptr) stacktrace_inline_classcastexception
-
-java_objectheader *stacktrace_inline_nullpointerexception(u1 *pv, u1 *sp,
-                                                                                                                 u1 *ra, u1 *xpc);
-#define STACKTRACE_inline_nullpointerexception \
-    (functionptr) stacktrace_inline_nullpointerexception
-
-/* refill the stacktrace of an existing exception */
-java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                         u1 *xpc);
-#define STACKTRACE_inline_fillInStackTrace \
-    (functionptr) stacktrace_inline_fillInStackTrace
-
-
-/* hardware exception creating functions */
-java_objectheader *stacktrace_hardware_arithmeticexception(u1 *pv, u1 *sp,
-                                                                                                                  u1 *ra, u1 *xpc);
-
-java_objectheader *stacktrace_hardware_nullpointerexception(u1 *pv, u1 *sp,
-                                                                                                                       u1 *ra, u1 *xpc);
 
+stacktracebuffer *stacktrace_create(stackframeinfo *sfi);
 
 stacktracecontainer *stacktrace_fillInStackTrace(void);
 
@@ -185,10 +133,9 @@ classinfo           *stacktrace_getCurrentClass(void);
 java_objectarray    *stacktrace_getStack(void);
 #endif
 
-void stacktrace_dump_trace(threadobject *thread);
+void stacktrace_print_trace_from_buffer(stacktracebuffer *stb);
 void stacktrace_print_trace(java_objectheader *xptr);
 
-
 /* machine dependent functions (code in ARCH_DIR/md.c) */
 
 #if defined(ENABLE_JIT)
index ac287d6bb98d1b2ea5b544c5f47e43aeac1ec950..e47c5f58bbc8a1ebc6edb4c13688aa3e8d810574 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/verify/icmds.c - ICMD-specific type checking code
 
-   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: Edwin Steiner
-
-   Changes:
-
    $Id$
 
 */
@@ -590,7 +584,7 @@ case ICMD_JSR: /* {VARIABLESBASED,TYPEINFERER} */
 
 case ICMD_JSR: /* {STACKBASED} */
        /* {RESULTNOW} */
-       tbptr = BLOCK_OF(IPTR->sx.s23.s3.jsrtarget.insindex);
+       tbptr = IPTR->sx.s23.s3.jsrtarget.block;
 
        TYPEINFO_INIT_RETURNADDRESS(stack[0].typeinfo, tbptr);
        REACH_BLOCK(tbptr);
index 49da6225a7ebb8b92cab7502a53aebf027ddb112..c81b7a9eea7d3ef7688279c84433d2c36c5fd26f 100644 (file)
@@ -14,7 +14,7 @@
   GENERATED    /* may use stack[1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 355 "src/vm/jit/verify/icmds.c"
+#              line 349 "src/vm/jit/verify/icmds.c"
   GENERATED    if (IPTR->flags.bits & INS_FLAG_CLASS) {
   GENERATED            /* a java.lang.Class reference */
   GENERATED            TYPEINFO_INIT_JAVA_LANG_CLASS(DST->typeinfo,IPTR->sx.val.c);
   GENERATED    /* may use stack[1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 99 "src/vm/jit/verify/icmds.c"
+#              line 93 "src/vm/jit/verify/icmds.c"
   GENERATED    TYPECHECK_COUNT(stat_ins_aload);
   GENERATED  
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 266 "src/vm/jit/verify/icmds.c"
+#              line 260 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_INT))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 276 "src/vm/jit/verify/icmds.c"
+#              line 270 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_LONG))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 261 "src/vm/jit/verify/icmds.c"
+#              line 255 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_FLOAT))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 256 "src/vm/jit/verify/icmds.c"
+#              line 250 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_DOUBLE))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 121 "src/vm/jit/verify/icmds.c"
+#              line 115 "src/vm/jit/verify/icmds.c"
   GENERATED  
 #            if !defined(TYPECHECK_TYPEINFERER)
   GENERATED    if (!TYPEINFO_MAYBE_ARRAY_OF_REFS(OP1->typeinfo))
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 245 "src/vm/jit/verify/icmds.c"
+#              line 239 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BOOLEAN)
   GENERATED                    && !TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BYTE))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 251 "src/vm/jit/verify/icmds.c"
+#              line 245 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_CHAR))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 271 "src/vm/jit/verify/icmds.c"
+#              line 265 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_SHORT))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 114 "src/vm/jit/verify/icmds.c"
+#              line 108 "src/vm/jit/verify/icmds.c"
   GENERATED    TYPEINFO_COPY(OP1->typeinfo, DST->typeinfo);
   GENERATED  
 #              line 479 "src/vm/jit/verify/typecheck-stackbased-gen.inc"
   GENERATED    /* may use stack[-2] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 302 "src/vm/jit/verify/icmds.c"
+#              line 296 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_INT))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-3] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 312 "src/vm/jit/verify/icmds.c"
+#              line 306 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_LONG))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-2] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 297 "src/vm/jit/verify/icmds.c"
+#              line 291 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_FLOAT))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-3] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 292 "src/vm/jit/verify/icmds.c"
+#              line 286 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_DOUBLE))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-2] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 317 "src/vm/jit/verify/icmds.c"
+#              line 311 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we just check the basic input types and that the           */
   GENERATED    /* destination is an array of references. Assignability to    */
   GENERATED    /* the actual array must be checked at runtime, each time the */
   GENERATED    /* may use stack[-2] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 281 "src/vm/jit/verify/icmds.c"
+#              line 275 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BOOLEAN)
   GENERATED                    && !TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_BYTE))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED    /* may use stack[-2] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 287 "src/vm/jit/verify/icmds.c"
+#              line 281 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_CHAR))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-2] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 307 "src/vm/jit/verify/icmds.c"
+#              line 301 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_PRIMITIVE_ARRAY(OP1->typeinfo,ARRAYTYPE_SHORT))
   GENERATED            VERIFY_ERROR("Array type mismatch");
   GENERATED  
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 710 "src/vm/jit/verify/icmds.c"
+#              line 704 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we pop 1 */
   GENERATED    CHECK_CAT1(stack[0]);
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 715 "src/vm/jit/verify/icmds.c"
+#              line 709 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we pop either 11 or 2 */
   GENERATED    if (IS_CAT1(stack[0]))
   GENERATED            CHECK_CAT1(stack[-1]);
   GENERATED    /* may use stack[0] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 730 "src/vm/jit/verify/icmds.c"
+#              line 724 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we dup 1 */
   GENERATED    CHECK_CAT1(stack[0]);
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 737 "src/vm/jit/verify/icmds.c"
+#              line 731 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we dup 1 */
   GENERATED    CHECK_CAT1(stack[0]);
   GENERATED    /* we skip 1 */
   GENERATED    /* may use stack[-2] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 748 "src/vm/jit/verify/icmds.c"
+#              line 742 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we dup 1 */
   GENERATED    CHECK_CAT1(stack[0]);
   GENERATED    /* we skip either 11 or 2 */
   GENERATED    /* may use stack[-1] ... stack[2] */
   GENERATED  
   GENERATED  
-#              line 761 "src/vm/jit/verify/icmds.c"
+#              line 755 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we dup either 11 or 2 */
   GENERATED    if (IS_CAT1(stack[0]))
   GENERATED            CHECK_CAT1(stack[-1]);
   GENERATED    /* may use stack[-2] ... stack[2] */
   GENERATED  
   GENERATED  
-#              line 770 "src/vm/jit/verify/icmds.c"
+#              line 764 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we dup either 11 or 2 */
   GENERATED    if (IS_CAT1(stack[0]))
   GENERATED            CHECK_CAT1(stack[-1]);
   GENERATED    /* may use stack[-3] ... stack[2] */
   GENERATED  
   GENERATED  
-#              line 784 "src/vm/jit/verify/icmds.c"
+#              line 778 "src/vm/jit/verify/icmds.c"
   GENERATED    /* we dup either 11 or 2 */
   GENERATED    if (IS_CAT1(stack[0]))
   GENERATED            CHECK_CAT1(stack[-1]);
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 721 "src/vm/jit/verify/icmds.c"
+#              line 715 "src/vm/jit/verify/icmds.c"
   GENERATED    CHECK_CAT1(stack[0]);
   GENERATED    CHECK_CAT1(stack[-1]);
   GENERATED  
   GENERATED    /* may use stack[1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 399 "src/vm/jit/verify/icmds.c"
+#              line 393 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_branch);
   GENERATED  
   GENERATED    /* may use stack[1] ... stack[2] */
   GENERATED  
   GENERATED  
-#              line 405 "src/vm/jit/verify/icmds.c"
+#              line 399 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_branch);
   GENERATED  
   GENERATED    /* may use stack[1] ... stack[2] */
   GENERATED  
   GENERATED  
-#              line 411 "src/vm/jit/verify/icmds.c"
+#              line 405 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_branch);
   GENERATED  
   GENERATED    superblockend = true;
   GENERATED  
   GENERATED  
-#              line 396 "src/vm/jit/verify/icmds.c"
+#              line 390 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_branch);
   GENERATED  
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 592 "src/vm/jit/verify/icmds.c"
+#              line 586 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
-  GENERATED    tbptr = BLOCK_OF(IPTR->sx.s23.s3.jsrtarget.insindex);
+  GENERATED    tbptr = IPTR->sx.s23.s3.jsrtarget.block;
   GENERATED  
   GENERATED    TYPEINFO_INIT_RETURNADDRESS(stack[0].typeinfo, tbptr);
   GENERATED    REACH_BLOCK(tbptr);
   GENERATED    superblockend = true;
   GENERATED  
   GENERATED  
-#              line 613 "src/vm/jit/verify/icmds.c"
+#              line 607 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    CHECK_LOCAL_TYPE(IPTR->s1.varindex, TYPE_RET);
   GENERATED    if (!TYPEINFO_IS_PRIMITIVE(STATE->locals[IPTR->s1.varindex].typeinfo))
   GENERATED    /* may use stack[1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 463 "src/vm/jit/verify/icmds.c"
+#              line 457 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_switch);
   GENERATED  
   GENERATED    /* may use stack[1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 479 "src/vm/jit/verify/icmds.c"
+#              line 473 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_switch);
   GENERATED  
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 545 "src/vm/jit/verify/icmds.c"
+#              line 539 "src/vm/jit/verify/icmds.c"
   GENERATED    if (STATE->returntype.type != TYPE_INT)
   GENERATED            VERIFY_ERROR("Return type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 550 "src/vm/jit/verify/icmds.c"
+#              line 544 "src/vm/jit/verify/icmds.c"
   GENERATED    if (STATE->returntype.type != TYPE_LNG)
   GENERATED            VERIFY_ERROR("Return type mismatch");
   GENERATED  
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 555 "src/vm/jit/verify/icmds.c"
+#              line 549 "src/vm/jit/verify/icmds.c"
   GENERATED    if (STATE->returntype.type != TYPE_FLT)
   GENERATED            VERIFY_ERROR("Return type mismatch");
   GENERATED  
   GENERATED    /* may use stack[-1] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 560 "src/vm/jit/verify/icmds.c"
+#              line 554 "src/vm/jit/verify/icmds.c"
   GENERATED    if (STATE->returntype.type != TYPE_DBL)
   GENERATED            VERIFY_ERROR("Return type mismatch");
   GENERATED  
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 520 "src/vm/jit/verify/icmds.c"
+#              line 514 "src/vm/jit/verify/icmds.c"
   GENERATED    TYPECHECK_COUNT(stat_ins_areturn);
   GENERATED    if (!TYPEINFO_IS_REFERENCE(OP1->typeinfo))
   GENERATED            VERIFY_ERROR("illegal instruction: ARETURN on non-reference");
   GENERATED    superblockend = true;
   GENERATED  
   GENERATED  
-#              line 565 "src/vm/jit/verify/icmds.c"
+#              line 559 "src/vm/jit/verify/icmds.c"
   GENERATED    if (STATE->returntype.type != TYPE_VOID)
   GENERATED            VERIFY_ERROR("Return type mismatch");
   GENERATED  
   GENERATED    /* variable number of outslots! */
   GENERATED  
   GENERATED  
-#              line 164 "src/vm/jit/verify/icmds.c"
+#              line 158 "src/vm/jit/verify/icmds.c"
   GENERATED    stack = typecheck_stackbased_verify_fieldaccess(STATE, NULL, NULL, stack);
   GENERATED    if (stack == NULL)
   GENERATED            EXCEPTION;
   GENERATED    /* variable number of inslots! */
   GENERATED  
   GENERATED  
-#              line 146 "src/vm/jit/verify/icmds.c"
+#              line 140 "src/vm/jit/verify/icmds.c"
   GENERATED    CHECK_STACK_DEPTH(1);
   GENERATED    if (!IS_CAT1(stack[0])) {
   GENERATED            /* (stack depth >= 2 is guaranteed) */
   GENERATED    /* variable number of outslots! */
   GENERATED  
   GENERATED  
-#              line 157 "src/vm/jit/verify/icmds.c"
+#              line 151 "src/vm/jit/verify/icmds.c"
   GENERATED    CHECK_STACK_TYPE(stack[0], TYPE_ADR);
   GENERATED    stack = typecheck_stackbased_verify_fieldaccess(STATE, stack, NULL, stack-1);
   GENERATED    if (stack == NULL)
   GENERATED    /* variable number of inslots! */
   GENERATED  
   GENERATED  
-#              line 134 "src/vm/jit/verify/icmds.c"
+#              line 128 "src/vm/jit/verify/icmds.c"
   GENERATED    CHECK_STACK_DEPTH(2);
   GENERATED    if (!IS_CAT1(stack[0])) {
   GENERATED            CHECK_STACK_DEPTH(3);
   GENERATED    /* variable number of outslots! */
   GENERATED  
   GENERATED  
-#              line 636 "src/vm/jit/verify/icmds.c"
+#              line 630 "src/vm/jit/verify/icmds.c"
   GENERATED    TYPECHECK_COUNT(stat_ins_invoke);
   GENERATED  
   GENERATED    INSTRUCTION_GET_METHODDESC(IPTR, md);
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 239 "src/vm/jit/verify/icmds.c"
+#              line 233 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!TYPEINFO_MAYBE_ARRAY(OP1->typeinfo)
   GENERATED                    && OP1->typeinfo.typeclass.cls != pseudo_class_Arraystub)
   GENERATED            VERIFY_ERROR("illegal instruction: ARRAYLENGTH on non-array");
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 499 "src/vm/jit/verify/icmds.c"
+#              line 493 "src/vm/jit/verify/icmds.c"
   GENERATED    TYPECHECK_COUNT(stat_ins_athrow);
   GENERATED    r = typeinfo_is_assignable_to_class(&OP1->typeinfo,
   GENERATED                    CLASSREF_OR_CLASSINFO(class_java_lang_Throwable));
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 373 "src/vm/jit/verify/icmds.c"
+#              line 367 "src/vm/jit/verify/icmds.c"
   GENERATED  
 #            if !defined(TYPECHECK_TYPEINFERER)
   GENERATED    /* returnAddress is not allowed */
   GENERATED    /* may use stack[0] ... stack[0] */
   GENERATED  
   GENERATED  
-#              line 385 "src/vm/jit/verify/icmds.c"
+#              line 379 "src/vm/jit/verify/icmds.c"
   GENERATED    /* returnAddress is not allowed */
   GENERATED    if (!TYPEINFO_IS_REFERENCE(OP1->typeinfo))
   GENERATED            VERIFY_ERROR("Illegal instruction: INSTANCEOF on non-reference");
   GENERATED    /* variable number of inslots! */
   GENERATED  
   GENERATED  
-#              line 674 "src/vm/jit/verify/icmds.c"
+#              line 668 "src/vm/jit/verify/icmds.c"
   GENERATED    if (!typecheck_stackbased_multianewarray(STATE, stack, stackfloor))
   GENERATED            EXCEPTION;
   GENERATED    stack -= (IPTR->s1.argcount - 1);
   GENERATED    /* may use stack[1] ... stack[1] */
   GENERATED  
   GENERATED  
-#              line 397 "src/vm/jit/verify/icmds.c"
+#              line 391 "src/vm/jit/verify/icmds.c"
   GENERATED    /* {RESULTNOW} */
   GENERATED    TYPECHECK_COUNT(stat_ins_branch);
   GENERATED  
   GENERATED    /* variable number of outslots! */
   GENERATED  
   GENERATED  
-#              line 690 "src/vm/jit/verify/icmds.c"
+#              line 684 "src/vm/jit/verify/icmds.c"
   GENERATED    TYPECHECK_COUNT(stat_ins_builtin);
   GENERATED    if (!typecheck_stackbased_verify_builtin(STATE, stack, stackfloor))
   GENERATED            EXCEPTION;
index a2c909dedf19acf879bf6dfc0d680306ee3c67c0..382d041a7adf908b117bb6f4c1bbe330f7b92a04 100644 (file)
@@ -141,8 +141,7 @@ static void typecheck_stackbased_show_state(verifier_state *state,
 
 #define REACH(target)                                                \
     do {                                                             \
-        tbptr = BLOCK_OF((target).insindex);                         \
-        REACH_BLOCK(tbptr);                                          \
+        REACH_BLOCK((target).block);                                 \
     } while (0)
 
 #undef TYPECHECK_INT
@@ -544,7 +543,7 @@ static typedescriptor *typecheck_stackbased_jsr(verifier_state *state,
 
        jd = state->jd;
 
-       tbptr = BLOCK_OF(state->iptr->sx.s23.s3.jsrtarget.insindex);
+       tbptr = state->iptr->sx.s23.s3.jsrtarget.block;
        jsr = state->jsrinfos[tbptr->nr];
 
        if (jsr && tbptr->flags == BBFINISHED) {
@@ -599,15 +598,18 @@ static typedescriptor *typecheck_stackbased_jsr(verifier_state *state,
                jsr->next = state->topjsr;
                state->topjsr = jsr;
 
-               /* XXX ugly */
-               assert(BLOCK_OF(state->iptr->sx.s23.s3.jsrtarget.insindex)->flags == BBTYPECHECK_REACHED);
+               assert(state->iptr->sx.s23.s3.jsrtarget.block->flags == BBTYPECHECK_REACHED);
+
                tbptr->flags = BBFINISHED;
+
                for (tbptr = state->basicblocks; tbptr != NULL; tbptr = tbptr->next) {
                        jsr->blockflags[tbptr->nr] = tbptr->flags;
+
                        if (tbptr->flags == BBTYPECHECK_REACHED)
                                tbptr->flags = BBFINISHED;
                }
-               BLOCK_OF(state->iptr->sx.s23.s3.jsrtarget.insindex)->flags = BBTYPECHECK_REACHED;
+
+               state->iptr->sx.s23.s3.jsrtarget.block->flags = BBTYPECHECK_REACHED;
        }
 
        /* register this block as a caller, if not already done */
index 4d7bfea8cdaf05cc25cc3d0f7ba2b198bf5fb547..68d17465b56b83fe8be68e748271921a9b2df062 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 7601 2007-03-28 23:02:50Z michi $
+   $Id: asmpart.S 7661 2007-04-03 22:29:59Z twisti $
 
 */
 
@@ -830,9 +830,9 @@ asm_criticalsections:
        .quad 0
 
 
-/* Disable exec-stacks, required for Gentoo ***********************************/
+/* disable exec-stacks ********************************************************/
 
-#if defined(__GCC__) && defined(__ELF__)
+#if defined(__linux__) && defined(__ELF__)
        .section .note.GNU-stack,"",@progbits
 #endif
 
index 4eee901f41b4f8173431a09507c3bdbf8ec200dd..1cfebca4e3b382fa16c83b14e32d717718974280 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: emit.c 7644 2007-04-03 11:37:30Z twisti $
 
 */
 
@@ -508,7 +508,6 @@ void emit_replacement_stubs(jitdata *jd)
        codegendata *cd;
        codeinfo    *code;
        rplpoint    *rplp;
-       s4           disp;
        s4           i;
 #if !defined(NDEBUG)
        u1          *savedmcodeptr;
index c8ec58b42ea59aa505851de338839cb9ff30be89..9a109c01ef3d224b3a52119707daeb80c49de49d 100644 (file)
@@ -68,8 +68,8 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
        u1                 rm;
        s4                 d;
        s4                 disp;
-       ptrint             val;
        s4                 type;
+       ptrint             val;
        java_objectheader *o;
 
        _uc = (ucontext_t *) _p;
@@ -178,11 +178,15 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 
 void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
 {
-       ucontext_t  *_uc;
-       mcontext_t  *_mc;
-       u1          *sp;
-       u1          *ra;
-       u1          *xpc;
+       ucontext_t        *_uc;
+       mcontext_t        *_mc;
+       u1                *pv;
+       u1                *sp;
+       u1                *ra;
+       u1                *xpc;
+       s4                 type;
+       ptrint             val;
+       java_objectheader *o;
 
        _uc = (ucontext_t *) _p;
        _mc = &_uc->uc_mcontext;
@@ -190,13 +194,23 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
        /* ATTENTION: Don't use CACAO's internal REG_* defines as they are
           different to the ones in <ucontext.h>. */
 
+       pv  = NULL;
        sp  = (u1 *) _mc->gregs[REG_RSP];
        xpc = (u1 *) _mc->gregs[REG_RIP];
        ra  = xpc;                          /* return address is equal to xpc     */
 
-       _mc->gregs[REG_RAX] =
-               (ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
+       /* this is an ArithmeticException */
+
+       type = EXCEPTION_HARDWARE_ARITHMETIC;
+       val  = 0;
+
+       /* generate appropriate exception */
+
+       o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+
+       /* set registers */
 
+       _mc->gregs[REG_RAX] = (ptrint) o;
        _mc->gregs[REG_R10] = (ptrint) xpc;                      /* REG_ITMP2_XPC */
        _mc->gregs[REG_RIP] = (ptrint) asm_handle_exception;
 }
index 44eb0977c1d81b178a87a821e9ed704a431d2207..4cf87f3a2974f369f5e8f5f394e7f2d1603aeccd 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: statistics.c 7601 2007-03-28 23:02:50Z michi $
+   $Id: statistics.c 7643 2007-04-03 11:35:40Z twisti $
 
 */
 
@@ -611,11 +611,11 @@ void statistics_print_memory_usage(void)
        printf("                        %10d\n", sum);
        printf("\n");
 
-       printf("classinfo  (%3d B):     %10d\n", sizeof(classinfo), size_classinfo);
-       printf("fieldinfo  (%3d B):     %10d\n", sizeof(fieldinfo), size_fieldinfo);
-       printf("methodinfo (%3d B):     %10d\n", sizeof(methodinfo), size_methodinfo);
-       printf("lineinfo   (%3d B):     %10d\n", sizeof(lineinfo), size_lineinfo);
-       printf("codeinfo   (%3d B):     %10d\n", sizeof(codeinfo), size_codeinfo);
+       printf("classinfo  (%3d B):     %10d\n", (int) sizeof(classinfo), size_classinfo);
+       printf("fieldinfo  (%3d B):     %10d\n", (int) sizeof(fieldinfo), size_fieldinfo);
+       printf("methodinfo (%3d B):     %10d\n", (int) sizeof(methodinfo), size_methodinfo);
+       printf("lineinfo   (%3d B):     %10d\n", (int) sizeof(lineinfo), size_lineinfo);
+       printf("codeinfo   (%3d B):     %10d\n", (int) sizeof(codeinfo), size_codeinfo);
        printf("                         ----------\n");
 
        sum =