< prev index next >

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Print this page
rev 47413 : Introduce SafepointMechanism


  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "asm/register.hpp"
  26 #include "classfile/vmSymbols.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "code/vmreg.inline.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/disassembler.hpp"
  31 #include "jvmci/jvmciEnv.hpp"
  32 #include "jvmci/jvmciCompiler.hpp"
  33 #include "jvmci/jvmciCodeInstaller.hpp"
  34 #include "jvmci/jvmciJavaClasses.hpp"
  35 #include "jvmci/jvmciCompilerToVM.hpp"
  36 #include "jvmci/jvmciRuntime.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "oops/objArrayOop.inline.hpp"
  39 #include "runtime/javaCalls.hpp"

  40 #include "utilities/align.hpp"
  41 
  42 // frequently used constants
  43 // Allocate them with new so they are never destroyed (otherwise, a
  44 // forced exit could destroy these objects while they are still in
  45 // use).
  46 ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL);
  47 ConstantIntValue*      CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1);
  48 ConstantIntValue*      CodeInstaller::_int_0_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0);
  49 ConstantIntValue*      CodeInstaller::_int_1_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1);
  50 ConstantIntValue*      CodeInstaller::_int_2_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2);
  51 LocationValue*         CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
  52 
  53 Method* getMethodFromHotSpotMethod(oop hotspot_method) {
  54   assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity");
  55   return CompilerToVM::asMethod(hotspot_method);
  56 }
  57 
  58 VMReg getVMRegFromLocation(Handle location, int total_frame_size, TRAPS) {
  59   if (location.is_null()) {


 842           JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot");
 843         }
 844       } else {
 845         TRACE_jvmci_4("infopoint at %i", pc_offset);
 846         site_Infopoint(buffer, pc_offset, site, CHECK_OK);
 847       }
 848     } else if (site->is_a(site_DataPatch::klass())) {
 849       TRACE_jvmci_4("datapatch at %i", pc_offset);
 850       site_DataPatch(buffer, pc_offset, site, CHECK_OK);
 851     } else if (site->is_a(site_Mark::klass())) {
 852       TRACE_jvmci_4("mark at %i", pc_offset);
 853       site_Mark(buffer, pc_offset, site, CHECK_OK);
 854     } else if (site->is_a(site_ExceptionHandler::klass())) {
 855       TRACE_jvmci_4("exceptionhandler at %i", pc_offset);
 856       site_ExceptionHandler(pc_offset, site);
 857     } else {
 858       JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name());
 859     }
 860     last_pc_offset = pc_offset;
 861 
 862     if (SafepointSynchronize::do_call_back()) {
 863       // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
 864       ThreadToNativeFromVM ttnfv(JavaThread::current());
 865     }
 866   }
 867 
 868 #ifndef PRODUCT
 869   if (comments() != NULL) {
 870     for (int i = 0; i < comments()->length(); i++) {
 871       oop comment = comments()->obj_at(i);
 872       assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce");
 873       jint offset = HotSpotCompiledCode_Comment::pcOffset(comment);
 874       char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment));
 875       buffer.block_comment(offset, text);
 876     }
 877   }
 878 #endif
 879   return JVMCIEnv::ok;
 880 }
 881 
 882 void CodeInstaller::assumption_NoFinalizableSubclass(Thread* thread, Handle assumption) {




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "asm/register.hpp"
  26 #include "classfile/vmSymbols.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "code/vmreg.inline.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/disassembler.hpp"
  31 #include "jvmci/jvmciEnv.hpp"
  32 #include "jvmci/jvmciCompiler.hpp"
  33 #include "jvmci/jvmciCodeInstaller.hpp"
  34 #include "jvmci/jvmciJavaClasses.hpp"
  35 #include "jvmci/jvmciCompilerToVM.hpp"
  36 #include "jvmci/jvmciRuntime.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "oops/objArrayOop.inline.hpp"
  39 #include "runtime/javaCalls.hpp"
  40 #include "runtime/safepointMechanism.inline.hpp"
  41 #include "utilities/align.hpp"
  42 
  43 // frequently used constants
  44 // Allocate them with new so they are never destroyed (otherwise, a
  45 // forced exit could destroy these objects while they are still in
  46 // use).
  47 ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL);
  48 ConstantIntValue*      CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1);
  49 ConstantIntValue*      CodeInstaller::_int_0_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0);
  50 ConstantIntValue*      CodeInstaller::_int_1_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1);
  51 ConstantIntValue*      CodeInstaller::_int_2_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2);
  52 LocationValue*         CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
  53 
  54 Method* getMethodFromHotSpotMethod(oop hotspot_method) {
  55   assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity");
  56   return CompilerToVM::asMethod(hotspot_method);
  57 }
  58 
  59 VMReg getVMRegFromLocation(Handle location, int total_frame_size, TRAPS) {
  60   if (location.is_null()) {


 843           JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot");
 844         }
 845       } else {
 846         TRACE_jvmci_4("infopoint at %i", pc_offset);
 847         site_Infopoint(buffer, pc_offset, site, CHECK_OK);
 848       }
 849     } else if (site->is_a(site_DataPatch::klass())) {
 850       TRACE_jvmci_4("datapatch at %i", pc_offset);
 851       site_DataPatch(buffer, pc_offset, site, CHECK_OK);
 852     } else if (site->is_a(site_Mark::klass())) {
 853       TRACE_jvmci_4("mark at %i", pc_offset);
 854       site_Mark(buffer, pc_offset, site, CHECK_OK);
 855     } else if (site->is_a(site_ExceptionHandler::klass())) {
 856       TRACE_jvmci_4("exceptionhandler at %i", pc_offset);
 857       site_ExceptionHandler(pc_offset, site);
 858     } else {
 859       JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name());
 860     }
 861     last_pc_offset = pc_offset;
 862 
 863     if (SafepointMechanism::poll()) {
 864       // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
 865       ThreadToNativeFromVM ttnfv(JavaThread::current());
 866     }
 867   }
 868 
 869 #ifndef PRODUCT
 870   if (comments() != NULL) {
 871     for (int i = 0; i < comments()->length(); i++) {
 872       oop comment = comments()->obj_at(i);
 873       assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce");
 874       jint offset = HotSpotCompiledCode_Comment::pcOffset(comment);
 875       char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment));
 876       buffer.block_comment(offset, text);
 877     }
 878   }
 879 #endif
 880   return JVMCIEnv::ok;
 881 }
 882 
 883 void CodeInstaller::assumption_NoFinalizableSubclass(Thread* thread, Handle assumption) {


< prev index next >