diff options
author | kgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-21 18:09:24 +0000 |
---|---|---|
committer | kgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-21 18:09:24 +0000 |
commit | a601999f27fc698ba2d07745ce618e7594be7e6b (patch) | |
tree | 4a03be322beab612524a3afa2a9533604dd18c36 /libjava/jvmti.cc | |
parent | e8831472157e89e7064020fe6f2e4215a9ad89ef (diff) | |
download | ppe42-gcc-a601999f27fc698ba2d07745ce618e7594be7e6b.tar.gz ppe42-gcc-a601999f27fc698ba2d07745ce618e7594be7e6b.zip |
2007-02-21 Kyle Galloway <kgallowa@redhat.com>
* jvmti.cc (_Jv_JVMTI_GetArgumentsSize): New function.
* testsuite/libjava.jvmti/interp/getargssize.java: New test.
* testsuite/libjava.jvmti/interp/getargssize.h: Ditto.
* testsuite/libjava.jvmti/interp/getargssize.jar: Ditto.
* testsuite/libjava.jvmti/interp/getargssize.out: Ditto.
* testsuite/libjava.jvmti/interp/natgetargssize.cc: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jvmti.cc')
-rw-r--r-- | libjava/jvmti.cc | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index 51f9d1d02b5..faa7401c1ce 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -1086,6 +1086,45 @@ _Jv_JVMTI_GetMaxLocals (jvmtiEnv *env, jmethodID method, jint *max_locals) } static jvmtiError JNICALL +_Jv_JVMTI_GetArgumentsSize (jvmtiEnv *env, jmethodID method, jint *size) +{ + REQUIRE_PHASE (env, JVMTI_PHASE_START | JVMTI_PHASE_LIVE); + NULL_CHECK (size); + + CHECK_FOR_NATIVE_METHOD (method); + + jvmtiError jerr; + char *sig; + jint num_slots = 0; + + jerr = env->GetMethodName (method, NULL, &sig, NULL); + if (jerr != JVMTI_ERROR_NONE) + return jerr; + + // If the method is non-static add a slot for the "this" pointer. + if ((method->accflags & java::lang::reflect::Modifier::STATIC) == 0) + num_slots++; + + for (int i = 0; sig[i] != ')'; i++) + { + if (sig[i] == 'Z' || sig[i] == 'B' || sig[i] == 'C' || sig[i] == 'S' + || sig[i] == 'I' || sig[i] == 'F') + num_slots++; + else if (sig[i] == 'J' || sig[i] == 'D') + num_slots+=2; + else if (sig[i] == 'L') + { + num_slots++; + while (sig[i] != ';') + i++; + } + } + + *size = num_slots; + return JVMTI_ERROR_NONE; +} + +static jvmtiError JNICALL _Jv_JVMTI_GetMethodDeclaringClass (MAYBE_UNUSED jvmtiEnv *env, jmethodID method, jclass *declaring_class_ptr) @@ -2011,7 +2050,7 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface = _Jv_JVMTI_GetMethodModifiers, // GetMethodModifers RESERVED, // reserved67 _Jv_JVMTI_GetMaxLocals, // GetMaxLocals - UNIMPLEMENTED, // GetArgumentsSize + _Jv_JVMTI_GetArgumentsSize, // GetArgumentsSize _Jv_JVMTI_GetLineNumberTable, // GetLineNumberTable UNIMPLEMENTED, // GetMethodLocation _Jv_JVMTI_GetLocalVariableTable, // GetLocalVariableTable |