comparison src/share/vm/prims/jvmtiEnv.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 04ade88d9712
children 18fb7da42534
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
28 #include "interpreter/bytecodeStream.hpp" 28 #include "interpreter/bytecodeStream.hpp"
29 #include "interpreter/interpreter.hpp" 29 #include "interpreter/interpreter.hpp"
30 #include "jvmtifiles/jvmtiEnv.hpp" 30 #include "jvmtifiles/jvmtiEnv.hpp"
31 #include "memory/resourceArea.hpp" 31 #include "memory/resourceArea.hpp"
32 #include "memory/universe.inline.hpp" 32 #include "memory/universe.inline.hpp"
33 #include "oops/cpCacheOop.hpp"
34 #include "oops/instanceKlass.hpp" 33 #include "oops/instanceKlass.hpp"
35 #include "prims/jniCheck.hpp" 34 #include "prims/jniCheck.hpp"
36 #include "prims/jvm_misc.hpp" 35 #include "prims/jvm_misc.hpp"
37 #include "prims/jvmtiAgentThread.hpp" 36 #include "prims/jvmtiAgentThread.hpp"
38 #include "prims/jvmtiClassFileReconstituter.hpp" 37 #include "prims/jvmtiClassFileReconstituter.hpp"
252 251
253 if (java_lang_Class::is_primitive(k_mirror)) { 252 if (java_lang_Class::is_primitive(k_mirror)) {
254 return JVMTI_ERROR_UNMODIFIABLE_CLASS; 253 return JVMTI_ERROR_UNMODIFIABLE_CLASS;
255 } 254 }
256 255
257 klassOop k_oop = java_lang_Class::as_klassOop(k_mirror); 256 Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
258 KlassHandle klass(current_thread, k_oop); 257 KlassHandle klass(current_thread, k_oop);
259 258
260 jint status = klass->jvmti_class_status(); 259 jint status = klass->jvmti_class_status();
261 if (status & (JVMTI_CLASS_STATUS_ERROR)) { 260 if (status & (JVMTI_CLASS_STATUS_ERROR)) {
262 return JVMTI_ERROR_INVALID_CLASS; 261 return JVMTI_ERROR_INVALID_CLASS;
267 266
268 instanceKlassHandle ikh(current_thread, k_oop); 267 instanceKlassHandle ikh(current_thread, k_oop);
269 if (ikh->get_cached_class_file_bytes() == NULL) { 268 if (ikh->get_cached_class_file_bytes() == NULL) {
270 // Not cached, we need to reconstitute the class file from the 269 // Not cached, we need to reconstitute the class file from the
271 // VM representation. We don't attach the reconstituted class 270 // VM representation. We don't attach the reconstituted class
272 // bytes to the instanceKlass here because they have not been 271 // bytes to the InstanceKlass here because they have not been
273 // validated and we're not at a safepoint. 272 // validated and we're not at a safepoint.
274 constantPoolHandle constants(current_thread, ikh->constants()); 273 constantPoolHandle constants(current_thread, ikh->constants());
275 ObjectLocker ol(constants, current_thread); // lock constant pool while we query it 274 MonitorLockerEx ml(constants->lock()); // lock constant pool while we query it
276 275
277 JvmtiClassFileReconstituter reconstituter(ikh); 276 JvmtiClassFileReconstituter reconstituter(ikh);
278 if (reconstituter.get_error() != JVMTI_ERROR_NONE) { 277 if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
279 return reconstituter.get_error(); 278 return reconstituter.get_error();
280 } 279 }
314 jvmtiError 313 jvmtiError
315 JvmtiEnv::GetObjectSize(jobject object, jlong* size_ptr) { 314 JvmtiEnv::GetObjectSize(jobject object, jlong* size_ptr) {
316 oop mirror = JNIHandles::resolve_external_guard(object); 315 oop mirror = JNIHandles::resolve_external_guard(object);
317 NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT); 316 NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
318 317
319 if (mirror->klass() == SystemDictionary::Class_klass()) { 318 if (mirror->klass() == SystemDictionary::Class_klass() &&
320 if (!java_lang_Class::is_primitive(mirror)) { 319 !java_lang_Class::is_primitive(mirror)) {
321 mirror = java_lang_Class::as_klassOop(mirror); 320 Klass* k = java_lang_Class::as_Klass(mirror);
322 assert(mirror != NULL, "class for non-primitive mirror must exist"); 321 assert(k != NULL, "class for non-primitive mirror must exist");
323 } 322 *size_ptr = k->size() * wordSize;
324 } 323 } else {
325 324 *size_ptr = mirror->size() * wordSize;
326 *size_ptr = mirror->size() * wordSize; 325 }
327 return JVMTI_ERROR_NONE; 326 return JVMTI_ERROR_NONE;
328 } /* end GetObjectSize */ 327 } /* end GetObjectSize */
329 328
330 // 329 //
331 // Method functions 330 // Method functions
550 vmSymbols::appendToClassPathForInstrumentation_name(), 549 vmSymbols::appendToClassPathForInstrumentation_name(),
551 vmSymbols::appendToClassPathForInstrumentation_signature(), 550 vmSymbols::appendToClassPathForInstrumentation_signature(),
552 path, 551 path,
553 THREAD); 552 THREAD);
554 if (HAS_PENDING_EXCEPTION) { 553 if (HAS_PENDING_EXCEPTION) {
555 Symbol* ex_name = PENDING_EXCEPTION->klass()->klass_part()->name(); 554 Symbol* ex_name = PENDING_EXCEPTION->klass()->name();
556 CLEAR_PENDING_EXCEPTION; 555 CLEAR_PENDING_EXCEPTION;
557 556
558 if (ex_name == vmSymbols::java_lang_NoSuchMethodError()) { 557 if (ex_name == vmSymbols::java_lang_NoSuchMethodError()) {
559 return JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED; 558 return JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED;
560 } else { 559 } else {
1618 // callbacks - pre-checked for NULL 1617 // callbacks - pre-checked for NULL
1619 // user_data - NULL is a valid value, must be checked 1618 // user_data - NULL is a valid value, must be checked
1620 jvmtiError 1619 jvmtiError
1621 JvmtiEnv::FollowReferences(jint heap_filter, jclass klass, jobject initial_object, const jvmtiHeapCallbacks* callbacks, const void* user_data) { 1620 JvmtiEnv::FollowReferences(jint heap_filter, jclass klass, jobject initial_object, const jvmtiHeapCallbacks* callbacks, const void* user_data) {
1622 // check klass if provided 1621 // check klass if provided
1623 klassOop k_oop = NULL; 1622 Klass* k_oop = NULL;
1624 if (klass != NULL) { 1623 if (klass != NULL) {
1625 oop k_mirror = JNIHandles::resolve_external_guard(klass); 1624 oop k_mirror = JNIHandles::resolve_external_guard(klass);
1626 if (k_mirror == NULL) { 1625 if (k_mirror == NULL) {
1627 return JVMTI_ERROR_INVALID_CLASS; 1626 return JVMTI_ERROR_INVALID_CLASS;
1628 } 1627 }
1629 if (java_lang_Class::is_primitive(k_mirror)) { 1628 if (java_lang_Class::is_primitive(k_mirror)) {
1630 return JVMTI_ERROR_NONE; 1629 return JVMTI_ERROR_NONE;
1631 } 1630 }
1632 k_oop = java_lang_Class::as_klassOop(k_mirror); 1631 k_oop = java_lang_Class::as_Klass(k_mirror);
1633 if (k_oop == NULL) { 1632 if (k_oop == NULL) {
1634 return JVMTI_ERROR_INVALID_CLASS; 1633 return JVMTI_ERROR_INVALID_CLASS;
1635 } 1634 }
1636 } 1635 }
1637 1636
1649 // callbacks - pre-checked for NULL 1648 // callbacks - pre-checked for NULL
1650 // user_data - NULL is a valid value, must be checked 1649 // user_data - NULL is a valid value, must be checked
1651 jvmtiError 1650 jvmtiError
1652 JvmtiEnv::IterateThroughHeap(jint heap_filter, jclass klass, const jvmtiHeapCallbacks* callbacks, const void* user_data) { 1651 JvmtiEnv::IterateThroughHeap(jint heap_filter, jclass klass, const jvmtiHeapCallbacks* callbacks, const void* user_data) {
1653 // check klass if provided 1652 // check klass if provided
1654 klassOop k_oop = NULL; 1653 Klass* k_oop = NULL;
1655 if (klass != NULL) { 1654 if (klass != NULL) {
1656 oop k_mirror = JNIHandles::resolve_external_guard(klass); 1655 oop k_mirror = JNIHandles::resolve_external_guard(klass);
1657 if (k_mirror == NULL) { 1656 if (k_mirror == NULL) {
1658 return JVMTI_ERROR_INVALID_CLASS; 1657 return JVMTI_ERROR_INVALID_CLASS;
1659 } 1658 }
1660 if (java_lang_Class::is_primitive(k_mirror)) { 1659 if (java_lang_Class::is_primitive(k_mirror)) {
1661 return JVMTI_ERROR_NONE; 1660 return JVMTI_ERROR_NONE;
1662 } 1661 }
1663 k_oop = java_lang_Class::as_klassOop(k_mirror); 1662 k_oop = java_lang_Class::as_Klass(k_mirror);
1664 if (k_oop == NULL) { 1663 if (k_oop == NULL) {
1665 return JVMTI_ERROR_INVALID_CLASS; 1664 return JVMTI_ERROR_INVALID_CLASS;
1666 } 1665 }
1667 } 1666 }
1668 1667
1760 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) { 1759 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
1761 if (java_lang_Class::is_primitive(k_mirror)) { 1760 if (java_lang_Class::is_primitive(k_mirror)) {
1762 // DO PRIMITIVE CLASS PROCESSING 1761 // DO PRIMITIVE CLASS PROCESSING
1763 return JVMTI_ERROR_NONE; 1762 return JVMTI_ERROR_NONE;
1764 } 1763 }
1765 klassOop k_oop = java_lang_Class::as_klassOop(k_mirror); 1764 Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
1766 if (k_oop == NULL) { 1765 if (k_oop == NULL) {
1767 return JVMTI_ERROR_INVALID_CLASS; 1766 return JVMTI_ERROR_INVALID_CLASS;
1768 } 1767 }
1769 Thread *thread = Thread::current(); 1768 Thread *thread = Thread::current();
1770 HandleMark hm(thread); 1769 HandleMark hm(thread);
1987 // Breakpoint functions 1986 // Breakpoint functions
1988 // 1987 //
1989 1988
1990 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 1989 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
1991 jvmtiError 1990 jvmtiError
1992 JvmtiEnv::SetBreakpoint(methodOop method_oop, jlocation location) { 1991 JvmtiEnv::SetBreakpoint(Method* method_oop, jlocation location) {
1993 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 1992 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
1994 if (location < 0) { // simple invalid location check first 1993 if (location < 0) { // simple invalid location check first
1995 return JVMTI_ERROR_INVALID_LOCATION; 1994 return JVMTI_ERROR_INVALID_LOCATION;
1996 } 1995 }
1997 // verify that the breakpoint is not past the end of the method 1996 // verify that the breakpoint is not past the end of the method
2013 } /* end SetBreakpoint */ 2012 } /* end SetBreakpoint */
2014 2013
2015 2014
2016 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2015 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2017 jvmtiError 2016 jvmtiError
2018 JvmtiEnv::ClearBreakpoint(methodOop method_oop, jlocation location) { 2017 JvmtiEnv::ClearBreakpoint(Method* method_oop, jlocation location) {
2019 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2018 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2020 2019
2021 if (location < 0) { // simple invalid location check first 2020 if (location < 0) { // simple invalid location check first
2022 return JVMTI_ERROR_INVALID_LOCATION; 2021 return JVMTI_ERROR_INVALID_LOCATION;
2023 } 2022 }
2102 // generic_ptr - NULL is a valid value, must be checked 2101 // generic_ptr - NULL is a valid value, must be checked
2103 jvmtiError 2102 jvmtiError
2104 JvmtiEnv::GetClassSignature(oop k_mirror, char** signature_ptr, char** generic_ptr) { 2103 JvmtiEnv::GetClassSignature(oop k_mirror, char** signature_ptr, char** generic_ptr) {
2105 ResourceMark rm; 2104 ResourceMark rm;
2106 bool isPrimitive = java_lang_Class::is_primitive(k_mirror); 2105 bool isPrimitive = java_lang_Class::is_primitive(k_mirror);
2107 klassOop k = NULL; 2106 Klass* k = NULL;
2108 if (!isPrimitive) { 2107 if (!isPrimitive) {
2109 k = java_lang_Class::as_klassOop(k_mirror); 2108 k = java_lang_Class::as_Klass(k_mirror);
2110 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2109 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2111 } 2110 }
2112 if (signature_ptr != NULL) { 2111 if (signature_ptr != NULL) {
2113 char* result = NULL; 2112 char* result = NULL;
2114 if (isPrimitive) { 2113 if (isPrimitive) {
2124 *signature_ptr = result; 2123 *signature_ptr = result;
2125 } 2124 }
2126 if (generic_ptr != NULL) { 2125 if (generic_ptr != NULL) {
2127 *generic_ptr = NULL; 2126 *generic_ptr = NULL;
2128 if (!isPrimitive && Klass::cast(k)->oop_is_instance()) { 2127 if (!isPrimitive && Klass::cast(k)->oop_is_instance()) {
2129 Symbol* soo = instanceKlass::cast(k)->generic_signature(); 2128 Symbol* soo = InstanceKlass::cast(k)->generic_signature();
2130 if (soo != NULL) { 2129 if (soo != NULL) {
2131 const char *gen_sig = soo->as_C_string(); 2130 const char *gen_sig = soo->as_C_string();
2132 if (gen_sig != NULL) { 2131 if (gen_sig != NULL) {
2133 char* gen_result; 2132 char* gen_result;
2134 jvmtiError err = allocate(strlen(gen_sig) + 1, 2133 jvmtiError err = allocate(strlen(gen_sig) + 1,
2152 JvmtiEnv::GetClassStatus(oop k_mirror, jint* status_ptr) { 2151 JvmtiEnv::GetClassStatus(oop k_mirror, jint* status_ptr) {
2153 jint result = 0; 2152 jint result = 0;
2154 if (java_lang_Class::is_primitive(k_mirror)) { 2153 if (java_lang_Class::is_primitive(k_mirror)) {
2155 result |= JVMTI_CLASS_STATUS_PRIMITIVE; 2154 result |= JVMTI_CLASS_STATUS_PRIMITIVE;
2156 } else { 2155 } else {
2157 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2156 Klass* k = java_lang_Class::as_Klass(k_mirror);
2158 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2157 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2159 result = Klass::cast(k)->jvmti_class_status(); 2158 result = Klass::cast(k)->jvmti_class_status();
2160 } 2159 }
2161 *status_ptr = result; 2160 *status_ptr = result;
2162 2161
2169 jvmtiError 2168 jvmtiError
2170 JvmtiEnv::GetSourceFileName(oop k_mirror, char** source_name_ptr) { 2169 JvmtiEnv::GetSourceFileName(oop k_mirror, char** source_name_ptr) {
2171 if (java_lang_Class::is_primitive(k_mirror)) { 2170 if (java_lang_Class::is_primitive(k_mirror)) {
2172 return JVMTI_ERROR_ABSENT_INFORMATION; 2171 return JVMTI_ERROR_ABSENT_INFORMATION;
2173 } 2172 }
2174 klassOop k_klass = java_lang_Class::as_klassOop(k_mirror); 2173 Klass* k_klass = java_lang_Class::as_Klass(k_mirror);
2175 NULL_CHECK(k_klass, JVMTI_ERROR_INVALID_CLASS); 2174 NULL_CHECK(k_klass, JVMTI_ERROR_INVALID_CLASS);
2176 2175
2177 if (!Klass::cast(k_klass)->oop_is_instance()) { 2176 if (!Klass::cast(k_klass)->oop_is_instance()) {
2178 return JVMTI_ERROR_ABSENT_INFORMATION; 2177 return JVMTI_ERROR_ABSENT_INFORMATION;
2179 } 2178 }
2180 2179
2181 Symbol* sfnOop = instanceKlass::cast(k_klass)->source_file_name(); 2180 Symbol* sfnOop = InstanceKlass::cast(k_klass)->source_file_name();
2182 NULL_CHECK(sfnOop, JVMTI_ERROR_ABSENT_INFORMATION); 2181 NULL_CHECK(sfnOop, JVMTI_ERROR_ABSENT_INFORMATION);
2183 { 2182 {
2184 JavaThread* current_thread = JavaThread::current(); 2183 JavaThread* current_thread = JavaThread::current();
2185 ResourceMark rm(current_thread); 2184 ResourceMark rm(current_thread);
2186 const char* sfncp = (const char*) sfnOop->as_C_string(); 2185 const char* sfncp = (const char*) sfnOop->as_C_string();
2197 jvmtiError 2196 jvmtiError
2198 JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) { 2197 JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) {
2199 JavaThread* current_thread = JavaThread::current(); 2198 JavaThread* current_thread = JavaThread::current();
2200 jint result = 0; 2199 jint result = 0;
2201 if (!java_lang_Class::is_primitive(k_mirror)) { 2200 if (!java_lang_Class::is_primitive(k_mirror)) {
2202 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2201 Klass* k = java_lang_Class::as_Klass(k_mirror);
2203 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2202 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2204 assert((Klass::cast(k)->oop_is_instance() || Klass::cast(k)->oop_is_array()), "should be an instance or an array klass");
2205 result = Klass::cast(k)->compute_modifier_flags(current_thread); 2203 result = Klass::cast(k)->compute_modifier_flags(current_thread);
2206 JavaThread* THREAD = current_thread; // pass to macros 2204 JavaThread* THREAD = current_thread; // pass to macros
2207 if (HAS_PENDING_EXCEPTION) { 2205 if (HAS_PENDING_EXCEPTION) {
2208 CLEAR_PENDING_EXCEPTION; 2206 CLEAR_PENDING_EXCEPTION;
2209 return JVMTI_ERROR_INTERNAL; 2207 return JVMTI_ERROR_INTERNAL;
2233 if (java_lang_Class::is_primitive(k_mirror)) { 2231 if (java_lang_Class::is_primitive(k_mirror)) {
2234 *method_count_ptr = 0; 2232 *method_count_ptr = 0;
2235 *methods_ptr = (jmethodID*) jvmtiMalloc(0 * sizeof(jmethodID)); 2233 *methods_ptr = (jmethodID*) jvmtiMalloc(0 * sizeof(jmethodID));
2236 return JVMTI_ERROR_NONE; 2234 return JVMTI_ERROR_NONE;
2237 } 2235 }
2238 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2236 Klass* k = java_lang_Class::as_Klass(k_mirror);
2239 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2237 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2240 2238
2241 // Return CLASS_NOT_PREPARED error as per JVMTI spec. 2239 // Return CLASS_NOT_PREPARED error as per JVMTI spec.
2242 if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) { 2240 if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) {
2243 return JVMTI_ERROR_CLASS_NOT_PREPARED; 2241 return JVMTI_ERROR_CLASS_NOT_PREPARED;
2255 int index; 2253 int index;
2256 if (JvmtiExport::can_maintain_original_method_order()) { 2254 if (JvmtiExport::can_maintain_original_method_order()) {
2257 // Use the original method ordering indices stored in the class, so we can emit 2255 // Use the original method ordering indices stored in the class, so we can emit
2258 // jmethodIDs in the order they appeared in the class file 2256 // jmethodIDs in the order they appeared in the class file
2259 for (index = 0; index < result_length; index++) { 2257 for (index = 0; index < result_length; index++) {
2260 methodOop m = methodOop(instanceK_h->methods()->obj_at(index)); 2258 Method* m = instanceK_h->methods()->at(index);
2261 int original_index = instanceK_h->method_ordering()->int_at(index); 2259 int original_index = instanceK_h->method_ordering()->at(index);
2262 assert(original_index >= 0 && original_index < result_length, "invalid original method index"); 2260 assert(original_index >= 0 && original_index < result_length, "invalid original method index");
2263 jmethodID id = m->jmethod_id(); 2261 jmethodID id = m->jmethod_id();
2264 result_list[original_index] = id; 2262 result_list[original_index] = id;
2265 } 2263 }
2266 } else { 2264 } else {
2267 // otherwise just copy in any order 2265 // otherwise just copy in any order
2268 for (index = 0; index < result_length; index++) { 2266 for (index = 0; index < result_length; index++) {
2269 methodOop m = methodOop(instanceK_h->methods()->obj_at(index)); 2267 Method* m = instanceK_h->methods()->at(index);
2270 jmethodID id = m->jmethod_id(); 2268 jmethodID id = m->jmethod_id();
2271 result_list[index] = id; 2269 result_list[index] = id;
2272 } 2270 }
2273 } 2271 }
2274 // Fill in return value. 2272 // Fill in return value.
2289 *fields_ptr = (jfieldID*) jvmtiMalloc(0 * sizeof(jfieldID)); 2287 *fields_ptr = (jfieldID*) jvmtiMalloc(0 * sizeof(jfieldID));
2290 return JVMTI_ERROR_NONE; 2288 return JVMTI_ERROR_NONE;
2291 } 2289 }
2292 JavaThread* current_thread = JavaThread::current(); 2290 JavaThread* current_thread = JavaThread::current();
2293 HandleMark hm(current_thread); 2291 HandleMark hm(current_thread);
2294 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2292 Klass* k = java_lang_Class::as_Klass(k_mirror);
2295 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2293 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2296 2294
2297 // Return CLASS_NOT_PREPARED error as per JVMTI spec. 2295 // Return CLASS_NOT_PREPARED error as per JVMTI spec.
2298 if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) { 2296 if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) {
2299 return JVMTI_ERROR_CLASS_NOT_PREPARED; 2297 return JVMTI_ERROR_CLASS_NOT_PREPARED;
2344 *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass)); 2342 *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
2345 return JVMTI_ERROR_NONE; 2343 return JVMTI_ERROR_NONE;
2346 } 2344 }
2347 JavaThread* current_thread = JavaThread::current(); 2345 JavaThread* current_thread = JavaThread::current();
2348 HandleMark hm(current_thread); 2346 HandleMark hm(current_thread);
2349 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2347 Klass* k = java_lang_Class::as_Klass(k_mirror);
2350 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2348 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2351 2349
2352 // Return CLASS_NOT_PREPARED error as per JVMTI spec. 2350 // Return CLASS_NOT_PREPARED error as per JVMTI spec.
2353 if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) )) 2351 if (!(Klass::cast(k)->jvmti_class_status() & (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY) ))
2354 return JVMTI_ERROR_CLASS_NOT_PREPARED; 2352 return JVMTI_ERROR_CLASS_NOT_PREPARED;
2357 *interface_count_ptr = 0; 2355 *interface_count_ptr = 0;
2358 *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass)); 2356 *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
2359 return JVMTI_ERROR_NONE; 2357 return JVMTI_ERROR_NONE;
2360 } 2358 }
2361 2359
2362 objArrayHandle interface_list(current_thread, instanceKlass::cast(k)->local_interfaces()); 2360 Array<Klass*>* interface_list = InstanceKlass::cast(k)->local_interfaces();
2363 const int result_length = (interface_list.is_null() ? 0 : interface_list->length()); 2361 const int result_length = (interface_list == NULL ? 0 : interface_list->length());
2364 jclass* result_list = (jclass*) jvmtiMalloc(result_length * sizeof(jclass)); 2362 jclass* result_list = (jclass*) jvmtiMalloc(result_length * sizeof(jclass));
2365 for (int i_index = 0; i_index < result_length; i_index += 1) { 2363 for (int i_index = 0; i_index < result_length; i_index += 1) {
2366 oop oop_at = interface_list->obj_at(i_index); 2364 Klass* klass_at = interface_list->at(i_index);
2367 assert(oop_at->is_klass(), "interfaces must be klassOops"); 2365 assert(klass_at->is_klass(), "interfaces must be Klass*s");
2368 klassOop klassOop_at = klassOop(oop_at); // ???: is there a better way? 2366 assert(Klass::cast(klass_at)->is_interface(), "interfaces must be interfaces");
2369 assert(Klass::cast(klassOop_at)->is_interface(), "interfaces must be interfaces"); 2367 oop mirror_at = Klass::cast(klass_at)->java_mirror();
2370 oop mirror_at = Klass::cast(klassOop_at)->java_mirror();
2371 Handle handle_at = Handle(current_thread, mirror_at); 2368 Handle handle_at = Handle(current_thread, mirror_at);
2372 result_list[i_index] = (jclass) jni_reference(handle_at); 2369 result_list[i_index] = (jclass) jni_reference(handle_at);
2373 } 2370 }
2374 *interface_count_ptr = result_length; 2371 *interface_count_ptr = result_length;
2375 *interfaces_ptr = result_list; 2372 *interfaces_ptr = result_list;
2385 jvmtiError 2382 jvmtiError
2386 JvmtiEnv::GetClassVersionNumbers(oop k_mirror, jint* minor_version_ptr, jint* major_version_ptr) { 2383 JvmtiEnv::GetClassVersionNumbers(oop k_mirror, jint* minor_version_ptr, jint* major_version_ptr) {
2387 if (java_lang_Class::is_primitive(k_mirror)) { 2384 if (java_lang_Class::is_primitive(k_mirror)) {
2388 return JVMTI_ERROR_ABSENT_INFORMATION; 2385 return JVMTI_ERROR_ABSENT_INFORMATION;
2389 } 2386 }
2390 klassOop k_oop = java_lang_Class::as_klassOop(k_mirror); 2387 Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
2391 Thread *thread = Thread::current(); 2388 Thread *thread = Thread::current();
2392 HandleMark hm(thread); 2389 HandleMark hm(thread);
2393 KlassHandle klass(thread, k_oop); 2390 KlassHandle klass(thread, k_oop);
2394 2391
2395 jint status = klass->jvmti_class_status(); 2392 jint status = klass->jvmti_class_status();
2416 JvmtiEnv::GetConstantPool(oop k_mirror, jint* constant_pool_count_ptr, jint* constant_pool_byte_count_ptr, unsigned char** constant_pool_bytes_ptr) { 2413 JvmtiEnv::GetConstantPool(oop k_mirror, jint* constant_pool_count_ptr, jint* constant_pool_byte_count_ptr, unsigned char** constant_pool_bytes_ptr) {
2417 if (java_lang_Class::is_primitive(k_mirror)) { 2414 if (java_lang_Class::is_primitive(k_mirror)) {
2418 return JVMTI_ERROR_ABSENT_INFORMATION; 2415 return JVMTI_ERROR_ABSENT_INFORMATION;
2419 } 2416 }
2420 2417
2421 klassOop k_oop = java_lang_Class::as_klassOop(k_mirror); 2418 Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
2422 Thread *thread = Thread::current(); 2419 Thread *thread = Thread::current();
2423 HandleMark hm(thread); 2420 HandleMark hm(thread);
2424 ResourceMark rm(thread); 2421 ResourceMark rm(thread);
2425 KlassHandle klass(thread, k_oop); 2422 KlassHandle klass(thread, k_oop);
2426 2423
2432 return JVMTI_ERROR_ABSENT_INFORMATION; 2429 return JVMTI_ERROR_ABSENT_INFORMATION;
2433 } 2430 }
2434 2431
2435 instanceKlassHandle ikh(thread, k_oop); 2432 instanceKlassHandle ikh(thread, k_oop);
2436 constantPoolHandle constants(thread, ikh->constants()); 2433 constantPoolHandle constants(thread, ikh->constants());
2437 ObjectLocker ol(constants, thread); // lock constant pool while we query it 2434 MonitorLockerEx ml(constants->lock()); // lock constant pool while we query it
2438 2435
2439 JvmtiConstantPoolReconstituter reconstituter(ikh); 2436 JvmtiConstantPoolReconstituter reconstituter(ikh);
2440 if (reconstituter.get_error() != JVMTI_ERROR_NONE) { 2437 if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
2441 return reconstituter.get_error(); 2438 return reconstituter.get_error();
2442 } 2439 }
2468 jvmtiError 2465 jvmtiError
2469 JvmtiEnv::IsInterface(oop k_mirror, jboolean* is_interface_ptr) { 2466 JvmtiEnv::IsInterface(oop k_mirror, jboolean* is_interface_ptr) {
2470 { 2467 {
2471 bool result = false; 2468 bool result = false;
2472 if (!java_lang_Class::is_primitive(k_mirror)) { 2469 if (!java_lang_Class::is_primitive(k_mirror)) {
2473 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2470 Klass* k = java_lang_Class::as_Klass(k_mirror);
2474 if (k != NULL && Klass::cast(k)->is_interface()) { 2471 if (k != NULL && Klass::cast(k)->is_interface()) {
2475 result = true; 2472 result = true;
2476 } 2473 }
2477 } 2474 }
2478 *is_interface_ptr = result; 2475 *is_interface_ptr = result;
2487 jvmtiError 2484 jvmtiError
2488 JvmtiEnv::IsArrayClass(oop k_mirror, jboolean* is_array_class_ptr) { 2485 JvmtiEnv::IsArrayClass(oop k_mirror, jboolean* is_array_class_ptr) {
2489 { 2486 {
2490 bool result = false; 2487 bool result = false;
2491 if (!java_lang_Class::is_primitive(k_mirror)) { 2488 if (!java_lang_Class::is_primitive(k_mirror)) {
2492 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2489 Klass* k = java_lang_Class::as_Klass(k_mirror);
2493 if (k != NULL && Klass::cast(k)->oop_is_array()) { 2490 if (k != NULL && Klass::cast(k)->oop_is_array()) {
2494 result = true; 2491 result = true;
2495 } 2492 }
2496 } 2493 }
2497 *is_array_class_ptr = result; 2494 *is_array_class_ptr = result;
2510 *classloader_ptr = (jclass) jni_reference(Handle()); 2507 *classloader_ptr = (jclass) jni_reference(Handle());
2511 return JVMTI_ERROR_NONE; 2508 return JVMTI_ERROR_NONE;
2512 } 2509 }
2513 JavaThread* current_thread = JavaThread::current(); 2510 JavaThread* current_thread = JavaThread::current();
2514 HandleMark hm(current_thread); 2511 HandleMark hm(current_thread);
2515 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2512 Klass* k = java_lang_Class::as_Klass(k_mirror);
2516 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2513 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2517 2514
2518 oop result_oop = Klass::cast(k)->class_loader(); 2515 oop result_oop = Klass::cast(k)->class_loader();
2519 if (result_oop == NULL) { 2516 if (result_oop == NULL) {
2520 *classloader_ptr = (jclass) jni_reference(Handle()); 2517 *classloader_ptr = (jclass) jni_reference(Handle());
2534 JvmtiEnv::GetSourceDebugExtension(oop k_mirror, char** source_debug_extension_ptr) { 2531 JvmtiEnv::GetSourceDebugExtension(oop k_mirror, char** source_debug_extension_ptr) {
2535 { 2532 {
2536 if (java_lang_Class::is_primitive(k_mirror)) { 2533 if (java_lang_Class::is_primitive(k_mirror)) {
2537 return JVMTI_ERROR_ABSENT_INFORMATION; 2534 return JVMTI_ERROR_ABSENT_INFORMATION;
2538 } 2535 }
2539 klassOop k = java_lang_Class::as_klassOop(k_mirror); 2536 Klass* k = java_lang_Class::as_Klass(k_mirror);
2540 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); 2537 NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2541 if (!Klass::cast(k)->oop_is_instance()) { 2538 if (!Klass::cast(k)->oop_is_instance()) {
2542 return JVMTI_ERROR_ABSENT_INFORMATION; 2539 return JVMTI_ERROR_ABSENT_INFORMATION;
2543 } 2540 }
2544 char* sde = instanceKlass::cast(k)->source_debug_extension(); 2541 char* sde = InstanceKlass::cast(k)->source_debug_extension();
2545 NULL_CHECK(sde, JVMTI_ERROR_ABSENT_INFORMATION); 2542 NULL_CHECK(sde, JVMTI_ERROR_ABSENT_INFORMATION);
2546 2543
2547 { 2544 {
2548 *source_debug_extension_ptr = (char *) jvmtiMalloc(strlen(sde)+1); 2545 *source_debug_extension_ptr = (char *) jvmtiMalloc(strlen(sde)+1);
2549 strcpy(*source_debug_extension_ptr, sde); 2546 strcpy(*source_debug_extension_ptr, sde);
2670 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2667 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2671 // name_ptr - NULL is a valid value, must be checked 2668 // name_ptr - NULL is a valid value, must be checked
2672 // signature_ptr - NULL is a valid value, must be checked 2669 // signature_ptr - NULL is a valid value, must be checked
2673 // generic_ptr - NULL is a valid value, must be checked 2670 // generic_ptr - NULL is a valid value, must be checked
2674 jvmtiError 2671 jvmtiError
2675 JvmtiEnv::GetMethodName(methodOop method_oop, char** name_ptr, char** signature_ptr, char** generic_ptr) { 2672 JvmtiEnv::GetMethodName(Method* method_oop, char** name_ptr, char** signature_ptr, char** generic_ptr) {
2676 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2673 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2677 JavaThread* current_thread = JavaThread::current(); 2674 JavaThread* current_thread = JavaThread::current();
2678 2675
2679 ResourceMark rm(current_thread); // get the utf8 name and signature 2676 ResourceMark rm(current_thread); // get the utf8 name and signature
2680 if (name_ptr == NULL) { 2677 if (name_ptr == NULL) {
2711 2708
2712 2709
2713 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2710 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2714 // declaring_class_ptr - pre-checked for NULL 2711 // declaring_class_ptr - pre-checked for NULL
2715 jvmtiError 2712 jvmtiError
2716 JvmtiEnv::GetMethodDeclaringClass(methodOop method_oop, jclass* declaring_class_ptr) { 2713 JvmtiEnv::GetMethodDeclaringClass(Method* method_oop, jclass* declaring_class_ptr) {
2717 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2714 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2718 (*declaring_class_ptr) = get_jni_class_non_null(method_oop->method_holder()); 2715 (*declaring_class_ptr) = get_jni_class_non_null(method_oop->method_holder());
2719 return JVMTI_ERROR_NONE; 2716 return JVMTI_ERROR_NONE;
2720 } /* end GetMethodDeclaringClass */ 2717 } /* end GetMethodDeclaringClass */
2721 2718
2722 2719
2723 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2720 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2724 // modifiers_ptr - pre-checked for NULL 2721 // modifiers_ptr - pre-checked for NULL
2725 jvmtiError 2722 jvmtiError
2726 JvmtiEnv::GetMethodModifiers(methodOop method_oop, jint* modifiers_ptr) { 2723 JvmtiEnv::GetMethodModifiers(Method* method_oop, jint* modifiers_ptr) {
2727 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2724 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2728 (*modifiers_ptr) = method_oop->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS; 2725 (*modifiers_ptr) = method_oop->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS;
2729 return JVMTI_ERROR_NONE; 2726 return JVMTI_ERROR_NONE;
2730 } /* end GetMethodModifiers */ 2727 } /* end GetMethodModifiers */
2731 2728
2732 2729
2733 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2730 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2734 // max_ptr - pre-checked for NULL 2731 // max_ptr - pre-checked for NULL
2735 jvmtiError 2732 jvmtiError
2736 JvmtiEnv::GetMaxLocals(methodOop method_oop, jint* max_ptr) { 2733 JvmtiEnv::GetMaxLocals(Method* method_oop, jint* max_ptr) {
2737 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2734 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2738 // get max stack 2735 // get max stack
2739 (*max_ptr) = method_oop->max_locals(); 2736 (*max_ptr) = method_oop->max_locals();
2740 return JVMTI_ERROR_NONE; 2737 return JVMTI_ERROR_NONE;
2741 } /* end GetMaxLocals */ 2738 } /* end GetMaxLocals */
2742 2739
2743 2740
2744 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2741 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2745 // size_ptr - pre-checked for NULL 2742 // size_ptr - pre-checked for NULL
2746 jvmtiError 2743 jvmtiError
2747 JvmtiEnv::GetArgumentsSize(methodOop method_oop, jint* size_ptr) { 2744 JvmtiEnv::GetArgumentsSize(Method* method_oop, jint* size_ptr) {
2748 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2745 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2749 // get size of arguments 2746 // get size of arguments
2750 2747
2751 (*size_ptr) = method_oop->size_of_parameters(); 2748 (*size_ptr) = method_oop->size_of_parameters();
2752 return JVMTI_ERROR_NONE; 2749 return JVMTI_ERROR_NONE;
2755 2752
2756 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2753 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2757 // entry_count_ptr - pre-checked for NULL 2754 // entry_count_ptr - pre-checked for NULL
2758 // table_ptr - pre-checked for NULL 2755 // table_ptr - pre-checked for NULL
2759 jvmtiError 2756 jvmtiError
2760 JvmtiEnv::GetLineNumberTable(methodOop method_oop, jint* entry_count_ptr, jvmtiLineNumberEntry** table_ptr) { 2757 JvmtiEnv::GetLineNumberTable(Method* method_oop, jint* entry_count_ptr, jvmtiLineNumberEntry** table_ptr) {
2761 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2758 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2762 if (!method_oop->has_linenumber_table()) { 2759 if (!method_oop->has_linenumber_table()) {
2763 return (JVMTI_ERROR_ABSENT_INFORMATION); 2760 return (JVMTI_ERROR_ABSENT_INFORMATION);
2764 } 2761 }
2765 2762
2797 2794
2798 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2795 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2799 // start_location_ptr - pre-checked for NULL 2796 // start_location_ptr - pre-checked for NULL
2800 // end_location_ptr - pre-checked for NULL 2797 // end_location_ptr - pre-checked for NULL
2801 jvmtiError 2798 jvmtiError
2802 JvmtiEnv::GetMethodLocation(methodOop method_oop, jlocation* start_location_ptr, jlocation* end_location_ptr) { 2799 JvmtiEnv::GetMethodLocation(Method* method_oop, jlocation* start_location_ptr, jlocation* end_location_ptr) {
2803 2800
2804 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2801 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2805 // get start and end location 2802 // get start and end location
2806 (*end_location_ptr) = (jlocation) (method_oop->code_size() - 1); 2803 (*end_location_ptr) = (jlocation) (method_oop->code_size() - 1);
2807 if (method_oop->code_size() == 0) { 2804 if (method_oop->code_size() == 0) {
2817 2814
2818 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2815 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2819 // entry_count_ptr - pre-checked for NULL 2816 // entry_count_ptr - pre-checked for NULL
2820 // table_ptr - pre-checked for NULL 2817 // table_ptr - pre-checked for NULL
2821 jvmtiError 2818 jvmtiError
2822 JvmtiEnv::GetLocalVariableTable(methodOop method_oop, jint* entry_count_ptr, jvmtiLocalVariableEntry** table_ptr) { 2819 JvmtiEnv::GetLocalVariableTable(Method* method_oop, jint* entry_count_ptr, jvmtiLocalVariableEntry** table_ptr) {
2823 2820
2824 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2821 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2825 JavaThread* current_thread = JavaThread::current(); 2822 JavaThread* current_thread = JavaThread::current();
2826 2823
2827 // does the klass have any local variable information? 2824 // does the klass have any local variable information?
2828 instanceKlass* ik = instanceKlass::cast(method_oop->method_holder()); 2825 InstanceKlass* ik = InstanceKlass::cast(method_oop->method_holder());
2829 if (!ik->access_flags().has_localvariable_table()) { 2826 if (!ik->access_flags().has_localvariable_table()) {
2830 return (JVMTI_ERROR_ABSENT_INFORMATION); 2827 return (JVMTI_ERROR_ABSENT_INFORMATION);
2831 } 2828 }
2832 2829
2833 constantPoolOop constants = method_oop->constants(); 2830 ConstantPool* constants = method_oop->constants();
2834 NULL_CHECK(constants, JVMTI_ERROR_ABSENT_INFORMATION); 2831 NULL_CHECK(constants, JVMTI_ERROR_ABSENT_INFORMATION);
2835 2832
2836 // in the vm localvariable table representation, 6 consecutive elements in the table 2833 // in the vm localvariable table representation, 6 consecutive elements in the table
2837 // represent a 6-tuple of shorts 2834 // represent a 6-tuple of shorts
2838 // [start_pc, length, name_index, descriptor_index, signature_index, index] 2835 // [start_pc, length, name_index, descriptor_index, signature_index, index]
2894 2891
2895 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2892 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2896 // bytecode_count_ptr - pre-checked for NULL 2893 // bytecode_count_ptr - pre-checked for NULL
2897 // bytecodes_ptr - pre-checked for NULL 2894 // bytecodes_ptr - pre-checked for NULL
2898 jvmtiError 2895 jvmtiError
2899 JvmtiEnv::GetBytecodes(methodOop method_oop, jint* bytecode_count_ptr, unsigned char** bytecodes_ptr) { 2896 JvmtiEnv::GetBytecodes(Method* method_oop, jint* bytecode_count_ptr, unsigned char** bytecodes_ptr) {
2900 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2897 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2901 2898
2902 HandleMark hm; 2899 HandleMark hm;
2903 methodHandle method(method_oop); 2900 methodHandle method(method_oop);
2904 jint size = (jint)method->code_size(); 2901 jint size = (jint)method->code_size();
2916 2913
2917 2914
2918 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2915 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2919 // is_native_ptr - pre-checked for NULL 2916 // is_native_ptr - pre-checked for NULL
2920 jvmtiError 2917 jvmtiError
2921 JvmtiEnv::IsMethodNative(methodOop method_oop, jboolean* is_native_ptr) { 2918 JvmtiEnv::IsMethodNative(Method* method_oop, jboolean* is_native_ptr) {
2922 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2919 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2923 (*is_native_ptr) = method_oop->is_native(); 2920 (*is_native_ptr) = method_oop->is_native();
2924 return JVMTI_ERROR_NONE; 2921 return JVMTI_ERROR_NONE;
2925 } /* end IsMethodNative */ 2922 } /* end IsMethodNative */
2926 2923
2927 2924
2928 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2925 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2929 // is_synthetic_ptr - pre-checked for NULL 2926 // is_synthetic_ptr - pre-checked for NULL
2930 jvmtiError 2927 jvmtiError
2931 JvmtiEnv::IsMethodSynthetic(methodOop method_oop, jboolean* is_synthetic_ptr) { 2928 JvmtiEnv::IsMethodSynthetic(Method* method_oop, jboolean* is_synthetic_ptr) {
2932 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID); 2929 NULL_CHECK(method_oop, JVMTI_ERROR_INVALID_METHODID);
2933 (*is_synthetic_ptr) = method_oop->is_synthetic(); 2930 (*is_synthetic_ptr) = method_oop->is_synthetic();
2934 return JVMTI_ERROR_NONE; 2931 return JVMTI_ERROR_NONE;
2935 } /* end IsMethodSynthetic */ 2932 } /* end IsMethodSynthetic */
2936 2933
2937 2934
2938 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method 2935 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
2939 // is_obsolete_ptr - pre-checked for NULL 2936 // is_obsolete_ptr - pre-checked for NULL
2940 jvmtiError 2937 jvmtiError
2941 JvmtiEnv::IsMethodObsolete(methodOop method_oop, jboolean* is_obsolete_ptr) { 2938 JvmtiEnv::IsMethodObsolete(Method* method_oop, jboolean* is_obsolete_ptr) {
2942 if (use_version_1_0_semantics() && 2939 if (use_version_1_0_semantics() &&
2943 get_capabilities()->can_redefine_classes == 0) { 2940 get_capabilities()->can_redefine_classes == 0) {
2944 // This JvmtiEnv requested version 1.0 semantics and this function 2941 // This JvmtiEnv requested version 1.0 semantics and this function
2945 // requires the can_redefine_classes capability in version 1.0 so 2942 // requires the can_redefine_classes capability in version 1.0 so
2946 // we need to return an error here. 2943 // we need to return an error here.