< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page
rev 64178 : 8252656: Replace RegisterArrayForGC mechanism with plain Handles
Reviewed-by: coleenp, tschatzl, dholmes


  59 #include "oops/oop.inline.hpp"
  60 #include "prims/jvm_misc.hpp"
  61 #include "prims/jvmtiExport.hpp"
  62 #include "prims/jvmtiThreadState.hpp"
  63 #include "prims/nativeLookup.hpp"
  64 #include "prims/stackwalk.hpp"
  65 #include "runtime/arguments.hpp"
  66 #include "runtime/atomic.hpp"
  67 #include "runtime/handles.inline.hpp"
  68 #include "runtime/init.hpp"
  69 #include "runtime/interfaceSupport.inline.hpp"
  70 #include "runtime/deoptimization.hpp"
  71 #include "runtime/handshake.hpp"
  72 #include "runtime/java.hpp"
  73 #include "runtime/javaCalls.hpp"
  74 #include "runtime/jfieldIDWorkaround.hpp"
  75 #include "runtime/jniHandles.inline.hpp"
  76 #include "runtime/os.inline.hpp"
  77 #include "runtime/perfData.hpp"
  78 #include "runtime/reflection.hpp"

  79 #include "runtime/synchronizer.hpp"
  80 #include "runtime/thread.inline.hpp"
  81 #include "runtime/threadSMR.hpp"
  82 #include "runtime/vframe.inline.hpp"
  83 #include "runtime/vmOperations.hpp"
  84 #include "runtime/vm_version.hpp"
  85 #include "services/attachListener.hpp"
  86 #include "services/management.hpp"
  87 #include "services/threadService.hpp"
  88 #include "utilities/copy.hpp"
  89 #include "utilities/defaultStream.hpp"
  90 #include "utilities/dtrace.hpp"
  91 #include "utilities/events.hpp"
  92 #include "utilities/histogram.hpp"
  93 #include "utilities/macros.hpp"
  94 #include "utilities/utf8.hpp"
  95 #if INCLUDE_CDS
  96 #include "classfile/systemDictionaryShared.hpp"
  97 #endif
  98 #if INCLUDE_JFR


 529 JVM_ENTRY_NO_ENV(jlong, JVM_MaxMemory(void))
 530   JVMWrapper("JVM_MaxMemory");
 531   size_t n = Universe::heap()->max_capacity();
 532   return convert_size_t_to_jlong(n);
 533 JVM_END
 534 
 535 
 536 JVM_ENTRY_NO_ENV(jint, JVM_ActiveProcessorCount(void))
 537   JVMWrapper("JVM_ActiveProcessorCount");
 538   return os::active_processor_count();
 539 JVM_END
 540 
 541 JVM_ENTRY_NO_ENV(jboolean, JVM_IsUseContainerSupport(void))
 542   JVMWrapper("JVM_IsUseContainerSupport");
 543 #ifdef LINUX
 544   if (UseContainerSupport) {
 545     return JNI_TRUE;
 546   }
 547 #endif
 548   return JNI_FALSE;


































































 549 JVM_END
 550 
 551 // java.lang.Throwable //////////////////////////////////////////////////////
 552 
 553 JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver))
 554   JVMWrapper("JVM_FillInStackTrace");
 555   Handle exception(thread, JNIHandles::resolve_non_null(receiver));
 556   java_lang_Throwable::fill_in_stack_trace(exception);
 557 JVM_END
 558 
 559 // java.lang.NullPointerException ///////////////////////////////////////////
 560 
 561 JVM_ENTRY(jstring, JVM_GetExtendedNPEMessage(JNIEnv *env, jthrowable throwable))
 562   if (!ShowCodeDetailsInExceptionMessages) return NULL;
 563 
 564   oop exc = JNIHandles::resolve_non_null(throwable);
 565 
 566   Method* method;
 567   int bci;
 568   if (!java_lang_Throwable::get_top_method_and_bci(exc, &method, &bci)) {




  59 #include "oops/oop.inline.hpp"
  60 #include "prims/jvm_misc.hpp"
  61 #include "prims/jvmtiExport.hpp"
  62 #include "prims/jvmtiThreadState.hpp"
  63 #include "prims/nativeLookup.hpp"
  64 #include "prims/stackwalk.hpp"
  65 #include "runtime/arguments.hpp"
  66 #include "runtime/atomic.hpp"
  67 #include "runtime/handles.inline.hpp"
  68 #include "runtime/init.hpp"
  69 #include "runtime/interfaceSupport.inline.hpp"
  70 #include "runtime/deoptimization.hpp"
  71 #include "runtime/handshake.hpp"
  72 #include "runtime/java.hpp"
  73 #include "runtime/javaCalls.hpp"
  74 #include "runtime/jfieldIDWorkaround.hpp"
  75 #include "runtime/jniHandles.inline.hpp"
  76 #include "runtime/os.inline.hpp"
  77 #include "runtime/perfData.hpp"
  78 #include "runtime/reflection.hpp"
  79 #include "runtime/sharedRuntime.hpp"
  80 #include "runtime/synchronizer.hpp"
  81 #include "runtime/thread.inline.hpp"
  82 #include "runtime/threadSMR.hpp"
  83 #include "runtime/vframe.inline.hpp"
  84 #include "runtime/vmOperations.hpp"
  85 #include "runtime/vm_version.hpp"
  86 #include "services/attachListener.hpp"
  87 #include "services/management.hpp"
  88 #include "services/threadService.hpp"
  89 #include "utilities/copy.hpp"
  90 #include "utilities/defaultStream.hpp"
  91 #include "utilities/dtrace.hpp"
  92 #include "utilities/events.hpp"
  93 #include "utilities/histogram.hpp"
  94 #include "utilities/macros.hpp"
  95 #include "utilities/utf8.hpp"
  96 #if INCLUDE_CDS
  97 #include "classfile/systemDictionaryShared.hpp"
  98 #endif
  99 #if INCLUDE_JFR


 530 JVM_ENTRY_NO_ENV(jlong, JVM_MaxMemory(void))
 531   JVMWrapper("JVM_MaxMemory");
 532   size_t n = Universe::heap()->max_capacity();
 533   return convert_size_t_to_jlong(n);
 534 JVM_END
 535 
 536 
 537 JVM_ENTRY_NO_ENV(jint, JVM_ActiveProcessorCount(void))
 538   JVMWrapper("JVM_ActiveProcessorCount");
 539   return os::active_processor_count();
 540 JVM_END
 541 
 542 JVM_ENTRY_NO_ENV(jboolean, JVM_IsUseContainerSupport(void))
 543   JVMWrapper("JVM_IsUseContainerSupport");
 544 #ifdef LINUX
 545   if (UseContainerSupport) {
 546     return JNI_TRUE;
 547   }
 548 #endif
 549   return JNI_FALSE;
 550 JVM_END
 551 
 552 JVM_ENTRY_NO_ENV(jlong, JVM_SizeOf(jobject obj))
 553   JVMWrapper("JVM_SizeOf");
 554   assert(obj != NULL, "object must not be NULL");
 555   if (!RuntimeSizeOf) return -1;
 556 
 557   oop o = JNIHandles::resolve_non_null(obj);
 558   return o->size()*HeapWordSize;
 559 JVM_END
 560 
 561 JVM_ENTRY_NO_ENV(jlong, JVM_AddressOf(jobject obj))
 562   JVMWrapper("JVM_AddressOf");
 563   assert(obj != NULL, "object must not be NULL");
 564   if (!RuntimeAddressOf) return -1;
 565 
 566   oop o = JNIHandles::resolve_non_null(obj);
 567   return cast_from_oop<jlong>(o) + Universe::non_heap_offset();
 568 JVM_END
 569 
 570 JVM_ENTRY_NO_ENV(jlong, JVM_FieldOffsetOf(jobject field))
 571   JVMWrapper("JVM_FieldOffsetOf");
 572   assert(field != NULL, "field must not be NULL");
 573   if (!RuntimeFieldOf) return -1;
 574 
 575   oop f    = JNIHandles::resolve_non_null(field);
 576   oop m    = java_lang_reflect_Field::clazz(f);
 577   Klass* k = java_lang_Class::as_Klass(m);
 578   int slot = java_lang_reflect_Field::slot(f);
 579 
 580   return InstanceKlass::cast(k)->field_offset(slot);
 581 JVM_END
 582 
 583 JVM_ENTRY_NO_ENV(jlong, JVM_FieldSizeOf(jobject field))
 584   JVMWrapper("JVM_FieldSizeOf");
 585   assert(field != NULL, "field must not be NULL");
 586   if (!RuntimeFieldOf) return -1;
 587 
 588   oop f    = JNIHandles::resolve_non_null(field);
 589   oop m    = java_lang_reflect_Field::clazz(f);
 590   Klass* k = java_lang_Class::as_Klass(m);
 591   int slot = java_lang_reflect_Field::slot(f);
 592 
 593   Symbol* sig = InstanceKlass::cast(k)->field_signature(slot);
 594   switch (sig->char_at(0)) {
 595     case JVM_SIGNATURE_CLASS    :
 596     case JVM_SIGNATURE_ARRAY    : return type2aelembytes(T_OBJECT);
 597     case JVM_SIGNATURE_BYTE     : return type2aelembytes(T_BYTE);
 598     case JVM_SIGNATURE_CHAR     : return type2aelembytes(T_CHAR);
 599     case JVM_SIGNATURE_FLOAT    : return type2aelembytes(T_FLOAT);
 600     case JVM_SIGNATURE_DOUBLE   : return type2aelembytes(T_DOUBLE);
 601     case JVM_SIGNATURE_INT      : return type2aelembytes(T_INT);
 602     case JVM_SIGNATURE_LONG     : return type2aelembytes(T_LONG);
 603     case JVM_SIGNATURE_SHORT    : return type2aelembytes(T_SHORT);
 604     case JVM_SIGNATURE_BOOLEAN  : return type2aelembytes(T_BOOLEAN);
 605   }
 606 
 607   ShouldNotReachHere();
 608   return 0;
 609 JVM_END
 610 
 611 JVM_ENTRY_NO_ENV(jint, JVM_GetReferencedObjects(jobject obj, jobjectArray ref_buf))
 612   JVMWrapper("JVM_GetReferencedObjects");
 613   oop obj_oop = JNIHandles::resolve_non_null(obj);
 614   objArrayOop ref_buf_oop = objArrayOop(JNIHandles::resolve_non_null(ref_buf));
 615   return SharedRuntime::get_referenced_objects(obj_oop, ref_buf_oop);
 616 JVM_END
 617 
 618 // java.lang.Throwable //////////////////////////////////////////////////////
 619 
 620 JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver))
 621   JVMWrapper("JVM_FillInStackTrace");
 622   Handle exception(thread, JNIHandles::resolve_non_null(receiver));
 623   java_lang_Throwable::fill_in_stack_trace(exception);
 624 JVM_END
 625 
 626 // java.lang.NullPointerException ///////////////////////////////////////////
 627 
 628 JVM_ENTRY(jstring, JVM_GetExtendedNPEMessage(JNIEnv *env, jthrowable throwable))
 629   if (!ShowCodeDetailsInExceptionMessages) return NULL;
 630 
 631   oop exc = JNIHandles::resolve_non_null(throwable);
 632 
 633   Method* method;
 634   int bci;
 635   if (!java_lang_Throwable::get_top_method_and_bci(exc, &method, &bci)) {


< prev index next >