Merged trunk and subtype.
[cacao.git] / src / native / jvmti / jvmti.c
index b54df5651ebab26c3b02a9c6c37ad352a2982ecd..8c883e7d0c5dd03abf75aed6c0965e8cf8180202 100644 (file)
@@ -1,10 +1,8 @@
 /* src/native/jvmti/jvmti.c - implementation of the Java Virtual Machine 
                               Tool Interface functions
 
-   Copyright (C) 1996-2005, 2006 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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Author: Martin Platter
-
-   Changes: Edwin Steiner
-            Samuel Vinson
-            Christan Thalinger
-   
-   $Id: jvmti.c 5806 2006-10-19 10:10:23Z twisti $
-
 */
 
 
 #include <unistd.h>
 #include <sched.h>
 
-#include "native/jni.h"
+#include "native/jni.hpp"
 #include "native/native.h"
 #include "native/jvmti/cacaodbg.h"
 #include "native/jvmti/jvmti.h"
-#include "vm/jit/stacktrace.h"
+#include "vm/jit/stacktrace.hpp"
 #include "vm/global.h"
-#include "vm/loader.h"
-#include "vm/builtin.h"
+#include "vm/loader.hpp"
+#include "vm/jit/builtin.hpp"
 #include "vm/jit/asmpart.h"
 #include "vm/class.h"
 #include "vm/classcache.h"
-#include "mm/boehm.h"
+#include "mm/gc.hpp"
 #include "toolbox/logging.h"
 #include "vm/options.h"
-#include "vm/stringlocal.h"
+#include "vm/string.hpp"
 #include "mm/memory.h"
-#include "threads/native/threads.h"
-#include "threads/native/lock.h"
-#include "vm/exceptions.h"
-#include "native/include/java_util_Vector.h"
+#include "threads/mutex.h"
+#include "threads/thread.hpp"
+#include "threads/lock-common.h"
+#include "vm/exceptions.hpp"
 #include "native/include/java_io_PrintStream.h"
 #include "native/include/java_io_InputStream.h"
 #include "native/include/java_lang_Cloneable.h"
 #include "native/include/java_lang_VMObject.h"
 #include "native/include/java_lang_VMSystem.h"
 #include "native/include/java_lang_VMClass.h"
-#include "vm/suck.h"
+#include "vm/suck.hpp"
 #include "boehm-gc/include/gc.h"
 
 #if defined(ENABLE_THREADS)
-#include "threads/native/threads.h"
 #include <sched.h>
 #include <pthread.h>
 #endif 
@@ -89,7 +76,7 @@
 
 typedef struct _environment environment;
 static environment *envs=NULL;
-pthread_mutex_t dbgcomlock;
+mutex_t dbgcomlock;
 
 extern const struct JNIInvokeInterface _Jv_JNIInvokeInterface;
 
@@ -747,7 +734,7 @@ GetOwnedMonitorInfo (jvmtiEnv * env, jthread thread,
 
        om=MNEW(java_objectheader*,size);
 
-       pthread_mutex_lock(&lock_global_pool_lock);
+       mutex_lock(&lock_global_pool_lock);
        lrp=lock_global_pool;
 
        /* iterate over all lock record pools */
@@ -768,7 +755,7 @@ GetOwnedMonitorInfo (jvmtiEnv * env, jthread thread,
                lrp=lrp->header.next;
        }
 
-       pthread_mutex_unlock(&lock_global_pool_lock);
+       mutex_unlock(&lock_global_pool_lock);
 
        *owned_monitors_ptr     = 
                heap_allocate(sizeof(java_objectheader*) * i, true, NULL);
@@ -817,7 +804,7 @@ GetCurrentContendedMonitor (jvmtiEnv * env, jthread thread,
 
 #if defined(ENABLE_THREADS)
 
-       pthread_mutex_lock(&lock_global_pool_lock);
+       mutex_lock(&lock_global_pool_lock);
 
        lrp=lock_global_pool;
 
@@ -838,7 +825,7 @@ GetCurrentContendedMonitor (jvmtiEnv * env, jthread thread,
                lrp=lrp->header.next;
        }
 
-       pthread_mutex_unlock(&lock_global_pool_lock);
+       mutex_unlock(&lock_global_pool_lock);
 
 
 #endif
@@ -1170,7 +1157,7 @@ GetThreadState (jvmtiEnv * env, jthread thread, jint * thread_state_ptr)
                if (false) *thread_state_ptr |= JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT;
                if (false) *thread_state_ptr |= JVMTI_THREAD_STATE_IN_OBJECT_WAIT;
                if (false) *thread_state_ptr |= JVMTI_THREAD_STATE_PARKED;
-               if (t->sleeping) *thread_state_ptr |= JVMTI_THREAD_STATE_SLEEPING;
+               if (false) *thread_state_ptr |= JVMTI_THREAD_STATE_SLEEPING;
        }
 #else
        return JVMTI_ERROR_INTERNAL;
@@ -1190,7 +1177,7 @@ static jvmtiError
 GetFrameLocation (jvmtiEnv * env, jthread thread, jint depth,
                  jmethodID * method_ptr, jlocation * location_ptr)
 {
-       stackframeinfo   *sfi;
+       stackframeinfo_t *sfi;
        int i;
        threadobject* th;
                
@@ -1223,7 +1210,7 @@ GetFrameLocation (jvmtiEnv * env, jthread thread, jint depth,
        
        if (i>depth) return JVMTI_ERROR_NO_MORE_FRAMES;
 
-       *method_ptr=(jmethodID)sfi->method;
+       *method_ptr=(jmethodID)sfi->code->m;
        *location_ptr = 0; /* todo: location MachinePC not avilable - Linenumber not expected */
        
     return JVMTI_ERROR_NONE;