* src/vm/jit/arm/codegen.c: removed unused ICMD_GETSTATIC branch
[cacao.git] / contrib / vmlog / vmlog_jamvm.patch
1 diff -u -r jamvm-1.4.2/src/excep.c vmlog-jamvm-1.4.2/src/excep.c
2 --- jamvm-1.4.2/src/excep.c     2005-12-31 08:12:55.000000000 +0100
3 +++ vmlog-jamvm-1.4.2/src/excep.c       2006-03-12 00:42:34.000000000 +0100
4 @@ -23,6 +23,8 @@
5  #include "jam.h"
6  #include "lock.h"
7  
8 +#include <vmlog_jamvm.h>
9 +
10  extern char VM_initing;
11  
12  static Class *ste_class, *ste_array_class, *throw_class, *vmthrow_class;
13 @@ -83,6 +85,7 @@
14                  }
15  
16                  getExecEnv()->exception = exp;
17 +               vmlog_jamvm_throw(getExecEnv()->thread,exp);
18              }
19          }
20      }
21 @@ -90,11 +93,15 @@
22  
23  void setException(Object *exp) {
24      getExecEnv()->exception = exp;
25 +    vmlog_jamvm_throw(getExecEnv()->thread,exp);
26  }
27  
28  void clearException() {
29      ExecEnv *ee = getExecEnv();
30  
31 +    if (ee->exception)
32 +       vmlog_jamvm_catch(ee->thread,ee->exception);
33 +
34      if(ee->overflow) {
35          ee->overflow = FALSE;
36          ee->stack_end -= STACK_RED_ZONE_SIZE;
37 @@ -157,6 +164,8 @@
38      while(((handler_pc = findCatchBlockInMethod(frame->mb, exception, frame->last_pc)) == NULL)
39                      && (frame->prev->mb != NULL)) {
40  
41 +       vmlog_jamvm_unwnd_method(getExecEnv()->thread,frame->mb);
42 +
43          if(frame->mb->access_flags & ACC_SYNCHRONIZED) {
44              Object *sync_ob = frame->mb->access_flags & ACC_STATIC ?
45                      (Object*)frame->mb->class : (Object*)frame->lvars[0];
46 diff -u -r jamvm-1.4.2/src/frame.h vmlog-jamvm-1.4.2/src/frame.h
47 --- jamvm-1.4.2/src/frame.h     2005-09-05 02:02:45.000000000 +0200
48 +++ vmlog-jamvm-1.4.2/src/frame.h       2006-03-14 00:26:07.000000000 +0100
49 @@ -53,7 +53,12 @@
50                                                                  \
51      new_frame->prev = dummy;                                    \
52      ee->last_frame = new_frame;                                 \
53 +    vmlog_jamvm_enter_method(ee->thread,mb);                    \
54  }
55  
56  #define POP_TOP_FRAME(ee)                                       \
57 +    if (ee->exception)                                          \
58 +        vmlog_jamvm_unwnd_method(ee->thread,mb);                \
59 +    else                                                        \
60 +        vmlog_jamvm_leave_method(ee->thread,mb);                \
61      ee->last_frame = ee->last_frame->prev->prev;
62 diff -u -r jamvm-1.4.2/src/interp.c vmlog-jamvm-1.4.2/src/interp.c
63 --- jamvm-1.4.2/src/interp.c    2006-01-22 23:32:38.000000000 +0100
64 +++ vmlog-jamvm-1.4.2/src/interp.c      2006-03-13 04:21:48.000000000 +0100
65 @@ -59,6 +59,8 @@
66      }                                                                      \
67  }
68  
69 +#include "vmlog_jamvm.c"
70 +
71  uintptr_t *executeJava() {
72      CodePntr pc;
73      ExecEnv *ee = getExecEnv();
74 @@ -2220,6 +2222,8 @@
75  
76      ee->last_frame = new_frame;
77  
78 +    vmlog_jamvm_enter_method(ee->thread,new_mb);
79 +
80      if(new_mb->access_flags & ACC_SYNCHRONIZED) {
81          sync_ob = new_mb->access_flags & ACC_STATIC ? (Object*)new_mb->class : (Object*)*arg1;
82          objectLock(sync_ob);
83 @@ -2229,6 +2233,11 @@
84          ostack = (*(uintptr_t *(*)(Class*, MethodBlock*, uintptr_t*))
85                       new_mb->native_invoker)(new_mb->class, new_mb, arg1);
86  
87 +       if (exceptionOccured0(ee))
88 +               vmlog_jamvm_unwnd_method(ee->thread,new_mb);
89 +       else
90 +               vmlog_jamvm_leave_method(ee->thread,new_mb);
91 +
92          if(sync_ob)
93              objectUnlock(sync_ob);
94  
95 @@ -2262,6 +2271,8 @@
96          return ostack;
97      }
98  
99 +    vmlog_jamvm_leave_method(ee->thread,mb);
100 +
101      if(mb->access_flags & ACC_SYNCHRONIZED) {
102          Object *sync_ob = mb->access_flags & ACC_STATIC ? (Object*)mb->class : this;
103          objectUnlock(sync_ob);
104 @@ -2294,6 +2305,8 @@
105              return NULL;
106          }
107  
108 +       vmlog_jamvm_catch(ee->thread,excep);
109 +
110          /* If we're handling a stack overflow, reduce the stack
111             back past the red zone to enable handling of further
112             overflows */
113 diff -u -r jamvm-1.4.2/src/jam.c vmlog-jamvm-1.4.2/src/jam.c
114 --- jamvm-1.4.2/src/jam.c       2006-01-17 01:36:59.000000000 +0100
115 +++ vmlog-jamvm-1.4.2/src/jam.c 2006-03-13 04:32:16.000000000 +0100
116 @@ -25,6 +25,8 @@
117  
118  #include "jam.h"
119  
120 +#include <vmlog_jamvm.h>
121 +
122  /* Setup default values for command line args */
123  
124  static int noasyncgc = FALSE;
125 @@ -282,6 +284,8 @@
126      int status;
127      int i;
128  
129 +    vmlog_jamvm_init(&argc,argv);
130 +
131      int class_arg = parseCommandLine(argc, argv);
132  
133      initVM();