src/share/vm/prims/jvm.cpp

Print this page




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/javaAssertions.hpp"
  28 #include "classfile/javaClasses.hpp"
  29 #include "classfile/symbolTable.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "classfile/vmSymbols.hpp"
  32 #include "gc_interface/collectedHeap.inline.hpp"
  33 #include "memory/oopFactory.hpp"
  34 #include "memory/universe.inline.hpp"
  35 #include "oops/fieldStreams.hpp"
  36 #include "oops/instanceKlass.hpp"
  37 #include "oops/objArrayKlass.hpp"

  38 #include "prims/jvm.h"
  39 #include "prims/jvm_misc.hpp"
  40 #include "prims/jvmtiExport.hpp"
  41 #include "prims/jvmtiThreadState.hpp"
  42 #include "prims/nativeLookup.hpp"
  43 #include "prims/privilegedStack.hpp"
  44 #include "runtime/arguments.hpp"
  45 #include "runtime/dtraceJSDT.hpp"
  46 #include "runtime/handles.inline.hpp"
  47 #include "runtime/init.hpp"
  48 #include "runtime/interfaceSupport.hpp"
  49 #include "runtime/java.hpp"
  50 #include "runtime/javaCalls.hpp"
  51 #include "runtime/jfieldIDWorkaround.hpp"
  52 #include "runtime/os.hpp"
  53 #include "runtime/perfData.hpp"
  54 #include "runtime/reflection.hpp"
  55 #include "runtime/vframe.hpp"
  56 #include "runtime/vm_operations.hpp"
  57 #include "services/attachListener.hpp"


2162   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2163   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2164   memcpy(code, methodOop(method)->code_base(), methodOop(method)->code_size());
2165 JVM_END
2166 
2167 
2168 JVM_QUICK_ENTRY(jint, JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cls, jint method_index))
2169   JVMWrapper("JVM_GetMethodIxByteCodeLength");
2170   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2171   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2172   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2173   return methodOop(method)->code_size();
2174 JVM_END
2175 
2176 
2177 JVM_QUICK_ENTRY(void, JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cls, jint method_index, jint entry_index, JVM_ExceptionTableEntryType *entry))
2178   JVMWrapper("JVM_GetMethodIxExceptionTableEntry");
2179   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2180   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2181   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2182   typeArrayOop extable = methodOop(method)->exception_table();
2183   entry->start_pc   = extable->int_at(entry_index * 4);
2184   entry->end_pc     = extable->int_at(entry_index * 4 + 1);
2185   entry->handler_pc = extable->int_at(entry_index * 4 + 2);
2186   entry->catchType  = extable->int_at(entry_index * 4 + 3);
2187 JVM_END
2188 
2189 
2190 JVM_QUICK_ENTRY(jint, JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cls, int method_index))
2191   JVMWrapper("JVM_GetMethodIxExceptionTableLength");
2192   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2193   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2194   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2195   return methodOop(method)->exception_table()->length() / 4;
2196 JVM_END
2197 
2198 
2199 JVM_QUICK_ENTRY(jint, JVM_GetMethodIxModifiers(JNIEnv *env, jclass cls, int method_index))
2200   JVMWrapper("JVM_GetMethodIxModifiers");
2201   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2202   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2203   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2204   return methodOop(method)->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS;
2205 JVM_END
2206 
2207 
2208 JVM_QUICK_ENTRY(jint, JVM_GetFieldIxModifiers(JNIEnv *env, jclass cls, int field_index))
2209   JVMWrapper("JVM_GetFieldIxModifiers");
2210   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2211   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2212   return instanceKlass::cast(k)->field_access_flags(field_index) & JVM_RECOGNIZED_FIELD_MODIFIERS;
2213 JVM_END
2214 
2215 




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/javaAssertions.hpp"
  28 #include "classfile/javaClasses.hpp"
  29 #include "classfile/symbolTable.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "classfile/vmSymbols.hpp"
  32 #include "gc_interface/collectedHeap.inline.hpp"
  33 #include "memory/oopFactory.hpp"
  34 #include "memory/universe.inline.hpp"
  35 #include "oops/fieldStreams.hpp"
  36 #include "oops/instanceKlass.hpp"
  37 #include "oops/objArrayKlass.hpp"
  38 #include "oops/methodOop.hpp"
  39 #include "prims/jvm.h"
  40 #include "prims/jvm_misc.hpp"
  41 #include "prims/jvmtiExport.hpp"
  42 #include "prims/jvmtiThreadState.hpp"
  43 #include "prims/nativeLookup.hpp"
  44 #include "prims/privilegedStack.hpp"
  45 #include "runtime/arguments.hpp"
  46 #include "runtime/dtraceJSDT.hpp"
  47 #include "runtime/handles.inline.hpp"
  48 #include "runtime/init.hpp"
  49 #include "runtime/interfaceSupport.hpp"
  50 #include "runtime/java.hpp"
  51 #include "runtime/javaCalls.hpp"
  52 #include "runtime/jfieldIDWorkaround.hpp"
  53 #include "runtime/os.hpp"
  54 #include "runtime/perfData.hpp"
  55 #include "runtime/reflection.hpp"
  56 #include "runtime/vframe.hpp"
  57 #include "runtime/vm_operations.hpp"
  58 #include "services/attachListener.hpp"


2163   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2164   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2165   memcpy(code, methodOop(method)->code_base(), methodOop(method)->code_size());
2166 JVM_END
2167 
2168 
2169 JVM_QUICK_ENTRY(jint, JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cls, jint method_index))
2170   JVMWrapper("JVM_GetMethodIxByteCodeLength");
2171   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2172   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2173   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2174   return methodOop(method)->code_size();
2175 JVM_END
2176 
2177 
2178 JVM_QUICK_ENTRY(void, JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cls, jint method_index, jint entry_index, JVM_ExceptionTableEntryType *entry))
2179   JVMWrapper("JVM_GetMethodIxExceptionTableEntry");
2180   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2181   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2182   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2183   ExceptionTable extable((methodOop(method)));
2184   entry->start_pc   = extable.start_pc(entry_index);
2185   entry->end_pc     = extable.end_pc(entry_index);
2186   entry->handler_pc = extable.handler_pc(entry_index);
2187   entry->catchType  = extable.catch_type_index(entry_index);
2188 JVM_END
2189 
2190 
2191 JVM_QUICK_ENTRY(jint, JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cls, int method_index))
2192   JVMWrapper("JVM_GetMethodIxExceptionTableLength");
2193   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2194   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2195   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2196   return methodOop(method)->exception_table_length();
2197 JVM_END
2198 
2199 
2200 JVM_QUICK_ENTRY(jint, JVM_GetMethodIxModifiers(JNIEnv *env, jclass cls, int method_index))
2201   JVMWrapper("JVM_GetMethodIxModifiers");
2202   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2203   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2204   oop method = instanceKlass::cast(k)->methods()->obj_at(method_index);
2205   return methodOop(method)->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS;
2206 JVM_END
2207 
2208 
2209 JVM_QUICK_ENTRY(jint, JVM_GetFieldIxModifiers(JNIEnv *env, jclass cls, int field_index))
2210   JVMWrapper("JVM_GetFieldIxModifiers");
2211   klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls));
2212   k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
2213   return instanceKlass::cast(k)->field_access_flags(field_index) & JVM_RECOGNIZED_FIELD_MODIFIERS;
2214 JVM_END
2215 
2216