aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorKyle Galloway <kgallowa@redhat.com>2007-02-07 23:28:04 +0000
committerKyle Galloway <kgallowa@gcc.gnu.org>2007-02-07 23:28:04 +0000
commit04ab45732d614e660f0c82cfdf488b93e87a730b (patch)
tree2038b56ebfb3636da8769eab3a6f9a836e9d878c /libjava
parent304237321beb69a8b617f4118fbde440e7b8415a (diff)
downloadgcc-04ab45732d614e660f0c82cfdf488b93e87a730b.zip
gcc-04ab45732d614e660f0c82cfdf488b93e87a730b.tar.gz
gcc-04ab45732d614e660f0c82cfdf488b93e87a730b.tar.bz2
jvmti.cc (CHECK_FOR_NATIVE_METHOD): New macro.
2007-02-07 Kyle Galloway <kgallowa@redhat.com> * jvmti.cc (CHECK_FOR_NATIVE_METHOD): New macro. (_Jv_JVMTI_GetMaxLocals): New method. * include/java-interp.h (_Jv_InterpMethod::get_max_locals): New method. From-SVN: r121700
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/include/java-interp.h5
-rw-r--r--libjava/jvmti.cc39
3 files changed, 50 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 561f826..3ced148a 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2007-02-07 Kyle Galloway <kgallowa@redhat.com>
+
+ * jvmti.cc (CHECK_FOR_NATIVE_METHOD): New macro.
+ (_Jv_JVMTI_GetMaxLocals): New method.
+ * include/java-interp.h
+ (_Jv_InterpMethod::get_max_locals): New method.
+
2007-02-01 Marco Trudel <mtrudel@gmx.ch>
* jni.cc (_Jv_JNI_DeleteWeakGlobalRef): Check for NULL objects.
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h
index 3a43977..1370ef1 100644
--- a/libjava/include/java-interp.h
+++ b/libjava/include/java-interp.h
@@ -219,6 +219,11 @@ class _Jv_InterpMethod : public _Jv_MethodBase
*/
void get_line_table (jlong& start, jlong& end, jintArray& line_numbers,
jlongArray& code_indices);
+
+ int get_max_locals ()
+ {
+ return static_cast<int> (max_locals);
+ }
/* Installs a break instruction at the given code index. Returns
the pc_t of the breakpoint or NULL if index is invalid. */
diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc
index e14bd7c..ba4ee81 100644
--- a/libjava/jvmti.cc
+++ b/libjava/jvmti.cc
@@ -155,6 +155,18 @@ ReentrantReadWriteLock *_envListLock = NULL;
} \
while (0)
+#define CHECK_FOR_NATIVE_METHOD(AjmethodID) \
+ do \
+ { \
+ jboolean is_native; \
+ jvmtiError jerr = env->IsMethodNative (AjmethodID, &is_native); \
+ if (jerr != JVMTI_ERROR_NONE) \
+ return jerr; \
+ if (is_native) \
+ return JVMTI_ERROR_NATIVE_METHOD; \
+ } \
+ while (0)
+
static jvmtiError JNICALL
_Jv_JVMTI_SuspendThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread)
{
@@ -730,6 +742,31 @@ _Jv_JVMTI_IsMethodSynthetic (MAYBE_UNUSED jvmtiEnv *env, jmethodID method,
}
static jvmtiError JNICALL
+_Jv_JVMTI_GetMaxLocals (MAYBE_UNUSED jvmtiEnv *env, jmethodID method,
+ jint *max_locals)
+{
+ REQUIRE_PHASE (env, JVMTI_PHASE_START | JVMTI_PHASE_LIVE);
+ NULL_CHECK (max_locals);
+
+ CHECK_FOR_NATIVE_METHOD (method);
+
+ jclass klass;
+ jvmtiError jerr = env->GetMethodDeclaringClass (method, &klass);
+ if (jerr != JVMTI_ERROR_NONE)
+ return jerr;
+
+ _Jv_InterpMethod *imeth = reinterpret_cast<_Jv_InterpMethod *>
+ (_Jv_FindInterpreterMethod (klass, method));
+
+ if (imeth == NULL)
+ return JVMTI_ERROR_INVALID_METHODID;
+
+ *max_locals = imeth->get_max_locals ();
+
+ return JVMTI_ERROR_NONE;
+}
+
+static jvmtiError JNICALL
_Jv_JVMTI_GetMethodDeclaringClass (MAYBE_UNUSED jvmtiEnv *env,
jmethodID method,
jclass *declaring_class_ptr)
@@ -1656,7 +1693,7 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface =
_Jv_JVMTI_GetMethodDeclaringClass, // GetMethodDeclaringClass
_Jv_JVMTI_GetMethodModifiers, // GetMethodModifers
RESERVED, // reserved67
- UNIMPLEMENTED, // GetMaxLocals
+ _Jv_JVMTI_GetMaxLocals, // GetMaxLocals
UNIMPLEMENTED, // GetArgumentsSize
_Jv_JVMTI_GetLineNumberTable, // GetLineNumberTable
UNIMPLEMENTED, // GetMethodLocation