diff options
author | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-23 01:06:10 +0000 |
---|---|---|
committer | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-23 01:06:10 +0000 |
commit | f5e8dfe885cf0ce5adcc395ddf3def9c8b76ce15 (patch) | |
tree | 416f41361ca12878d762b9b6efc9c9c439ca26eb /libjava | |
parent | 09a8846288b52f49777b05277a941804cf470530 (diff) | |
download | gcc-f5e8dfe885cf0ce5adcc395ddf3def9c8b76ce15.tar.gz |
* java/lang/Class.h (_Jv_GetClassStatus): Declare.
* java/lang/natClass.cc (_Jv_GetClassStatus): New function.
* jvmti.cc (_Jv_JVMTI_GetClassStatus): New function.
(_Jv_JVMTI_Interface): Define GetClassStatus.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121074 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 7 | ||||
-rw-r--r-- | libjava/java/lang/Class.h | 5 | ||||
-rw-r--r-- | libjava/java/lang/natClass.cc | 8 | ||||
-rw-r--r-- | libjava/jvmti.cc | 32 |
4 files changed, 49 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 87d1b9adea3..ff434f80d4c 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2007-01-22 Keith Seitz <keiths@redhat.com> + + * java/lang/Class.h (_Jv_GetClassStatus): Declare. + * java/lang/natClass.cc (_Jv_GetClassStatus): New function. + * jvmti.cc (_Jv_JVMTI_GetClassStatus): New function. + (_Jv_JVMTI_Interface): Define GetClassStatus. + 2007-01-22 Tom Tromey <tromey@redhat.com> * configure: Rebuilt. diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index d0cf5af7e9f..77e60aa5ccc 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -1,6 +1,6 @@ // Class.h - Header file for java.lang.Class. -*- c++ -*- -/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation This file is part of libgcj. @@ -257,6 +257,8 @@ class _Jv_MethodBase; _Jv_MethodBase *_Jv_FindInterpreterMethod (jclass, jmethodID); #endif +jbyte _Jv_GetClassState (jclass); + // Friend classes and functions to implement the ClassLoader class java::lang::ClassLoader; class java::lang::VMClassLoader; @@ -552,6 +554,7 @@ private: friend _Jv_MethodBase *(::_Jv_FindInterpreterMethod) (jclass klass, jmethodID desired_method); #endif + friend jbyte (::_Jv_GetClassState) (jclass klass); // Friends classes and functions to implement the ClassLoader friend class java::lang::ClassLoader; diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc index cf07e8642fe..8ac72a403a4 100644 --- a/libjava/java/lang/natClass.cc +++ b/libjava/java/lang/natClass.cc @@ -1,6 +1,6 @@ // natClass.cc - Implementation of java.lang.Class native methods. -/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation This file is part of libgcj. @@ -2004,3 +2004,9 @@ _Jv_GetMethodDeclaringClass (jmethodID method) return reinterpret_cast<jclass> (_Jv_StackTrace::ncodeMap->get (obj)); } +jbyte +_Jv_GetClassState (jclass klass) +{ + return klass->state; +} + diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index f6df8c56084..69cfda5ae75 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -420,6 +420,36 @@ _Jv_JVMTI_Deallocate (MAYBE_UNUSED jvmtiEnv *env, unsigned char *mem) } static jvmtiError JNICALL +_Jv_JVMTI_GetClassStatus (MAYBE_UNUSED jvmtiEnv *env, jclass klass, + jint *status_ptr) +{ + REQUIRE_PHASE (env, JVMTI_PHASE_START | JVMTI_PHASE_LIVE); + NULL_CHECK (status_ptr); + if (klass == NULL) + return JVMTI_ERROR_INVALID_CLASS; + + if (klass->isArray ()) + *status_ptr = JVMTI_CLASS_STATUS_ARRAY; + else if (klass->isPrimitive ()) + *status_ptr = JVMTI_CLASS_STATUS_PRIMITIVE; + else + { + jbyte state = _Jv_GetClassState (klass); + *status_ptr = 0; + if (state >= JV_STATE_LINKED) + (*status_ptr) |= JVMTI_CLASS_STATUS_VERIFIED; + if (state >= JV_STATE_PREPARED) + (*status_ptr) |= JVMTI_CLASS_STATUS_PREPARED; + if (state == JV_STATE_ERROR || state == JV_STATE_PHANTOM) + (*status_ptr) |= JVMTI_CLASS_STATUS_ERROR; + else if (state == JV_STATE_DONE) + (*status_ptr) |= JVMTI_CLASS_STATUS_INITIALIZED; + } + + return JVMTI_ERROR_NONE; +} + +static jvmtiError JNICALL _Jv_JVMTI_GetClassModifiers (MAYBE_UNUSED jvmtiEnv *env, jclass klass, jint *mods) { @@ -1452,7 +1482,7 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface = _Jv_JVMTI_Allocate, // Allocate _Jv_JVMTI_Deallocate, // Deallocate UNIMPLEMENTED, // GetClassSignature - UNIMPLEMENTED, // GetClassStatus + _Jv_JVMTI_GetClassStatus, // GetClassStatus UNIMPLEMENTED, // GetSourceFileName _Jv_JVMTI_GetClassModifiers, // GetClassModifiers _Jv_JVMTI_GetClassMethods, // GetClassMethods |