< prev index next >

src/hotspot/share/jvmci/compilerRuntime.cpp

Print this page




  55   JRT_BLOCK_END
  56 JRT_END
  57 
  58 
  59 
  60 Klass* CompilerRuntime::resolve_klass_helper(JavaThread *thread, const char* name, int len, TRAPS) {
  61   ResourceMark rm(THREAD);
  62   // last java frame on stack (which includes native call frames)
  63   RegisterMap cbl_map(thread, false);
  64   // Skip stub
  65   frame caller_frame = thread->last_frame().sender(&cbl_map);
  66   CodeBlob* caller_cb = caller_frame.cb();
  67   guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method");
  68   CompiledMethod* caller_nm = caller_cb->as_compiled_method_or_null();
  69   methodHandle caller(THREAD, caller_nm->method());
  70 
  71   // Use class loader of aot method.
  72   Handle loader(THREAD, caller->method_holder()->class_loader());
  73   Handle protection_domain(THREAD, caller->method_holder()->protection_domain());
  74 


  75   // Ignore wrapping L and ;
  76   if (name[0] == JVM_SIGNATURE_CLASS) {
  77     assert(len > 2, "small name %s", name);
  78     name++;
  79     len -= 2;
  80   }
  81   TempNewSymbol sym = SymbolTable::new_symbol(name, len);
  82   if (sym == NULL) {
  83     return NULL;
  84   }
  85   Klass* k = SystemDictionary::resolve_or_fail(sym, loader, protection_domain, true, CHECK_NULL);
  86 
  87   return k;
  88 }
  89 
  90 // Resolve Klass
  91 JRT_BLOCK_ENTRY(Klass*, CompilerRuntime::resolve_klass_by_symbol(JavaThread *thread, Klass** klass_result, const char* name))
  92   Klass* k = NULL;
  93   JRT_BLOCK
  94     k = *klass_result; // Is it resolved already?
  95     if (k == NULL) { // Do resolution
  96       // First 2 bytes of name contains length (number of bytes).
  97       int len = Bytes::get_Java_u2((address)name);
  98       name += 2;
  99       k = CompilerRuntime::resolve_klass_helper(thread, name, len, CHECK_NULL);
 100       *klass_result = k; // Store result
 101     }




  55   JRT_BLOCK_END
  56 JRT_END
  57 
  58 
  59 
  60 Klass* CompilerRuntime::resolve_klass_helper(JavaThread *thread, const char* name, int len, TRAPS) {
  61   ResourceMark rm(THREAD);
  62   // last java frame on stack (which includes native call frames)
  63   RegisterMap cbl_map(thread, false);
  64   // Skip stub
  65   frame caller_frame = thread->last_frame().sender(&cbl_map);
  66   CodeBlob* caller_cb = caller_frame.cb();
  67   guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method");
  68   CompiledMethod* caller_nm = caller_cb->as_compiled_method_or_null();
  69   methodHandle caller(THREAD, caller_nm->method());
  70 
  71   // Use class loader of aot method.
  72   Handle loader(THREAD, caller->method_holder()->class_loader());
  73   Handle protection_domain(THREAD, caller->method_holder()->protection_domain());
  74 
  75   TempNewSymbol sym = SymbolTable::new_symbol(name, len);
  76   if (sym != NULL && Signature::has_envelope(sym)) {
  77     // Ignore wrapping L and ;
  78     sym = Signature::strip_envelope(sym);



  79   }

  80   if (sym == NULL) {
  81     return NULL;
  82   }
  83   Klass* k = SystemDictionary::resolve_or_fail(sym, loader, protection_domain, true, CHECK_NULL);
  84 
  85   return k;
  86 }
  87 
  88 // Resolve Klass
  89 JRT_BLOCK_ENTRY(Klass*, CompilerRuntime::resolve_klass_by_symbol(JavaThread *thread, Klass** klass_result, const char* name))
  90   Klass* k = NULL;
  91   JRT_BLOCK
  92     k = *klass_result; // Is it resolved already?
  93     if (k == NULL) { // Do resolution
  94       // First 2 bytes of name contains length (number of bytes).
  95       int len = Bytes::get_Java_u2((address)name);
  96       name += 2;
  97       k = CompilerRuntime::resolve_klass_helper(thread, name, len, CHECK_NULL);
  98       *klass_result = k; // Store result
  99     }


< prev index next >