hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
changeset 38209 b2a58604e046
parent 38190 ff9ac612c723
child 40010 e32d5e545789
equal deleted inserted replaced
38208:ff63d43b0480 38209:b2a58604e046
   224 extern "C" void Fetch32Resume () ;
   224 extern "C" void Fetch32Resume () ;
   225 extern "C" void FetchNPFI () ;
   225 extern "C" void FetchNPFI () ;
   226 extern "C" void FetchNResume () ;
   226 extern "C" void FetchNResume () ;
   227 #endif
   227 #endif
   228 
   228 
   229 // An operation in Unsafe has faulted.  We're going to return to the
       
   230 // instruction after the faulting load or store.  We also set
       
   231 // pending_unsafe_access_error so that at some point in the future our
       
   232 // user will get a helpful message.
       
   233 static address handle_unsafe_access(JavaThread* thread, address pc) {
       
   234   // pc is the instruction which we must emulate
       
   235   // doing a no-op is fine:  return garbage from the load
       
   236   // therefore, compute npc
       
   237   address npc = pc + NativeCall::instruction_size;
       
   238 
       
   239   // request an async exception
       
   240   thread->set_pending_unsafe_access_error();
       
   241 
       
   242   // return address of next instruction to execute
       
   243   return npc;
       
   244 }
       
   245 
       
   246 extern "C" JNIEXPORT int
   229 extern "C" JNIEXPORT int
   247 JVM_handle_linux_signal(int sig,
   230 JVM_handle_linux_signal(int sig,
   248                         siginfo_t* info,
   231                         siginfo_t* info,
   249                         void* ucVoid,
   232                         void* ucVoid,
   250                         int abort_if_unrecognized) {
   233                         int abort_if_unrecognized) {
   385         // here if the underlying file has been truncated.
   368         // here if the underlying file has been truncated.
   386         // Do not crash the VM in such a case.
   369         // Do not crash the VM in such a case.
   387         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
   370         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
   388         CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
   371         CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
   389         if (nm != NULL && nm->has_unsafe_access()) {
   372         if (nm != NULL && nm->has_unsafe_access()) {
   390           stub = handle_unsafe_access(thread, pc);
   373           address next_pc = pc + NativeCall::instruction_size;
       
   374           stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
   391         }
   375         }
   392       }
   376       }
   393       else
   377       else
   394 
   378 
   395       if (sig == SIGFPE  &&
   379       if (sig == SIGFPE  &&
   406           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
   390           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
   407       }
   391       }
   408     } else if (thread->thread_state() == _thread_in_vm &&
   392     } else if (thread->thread_state() == _thread_in_vm &&
   409                sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
   393                sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
   410                thread->doing_unsafe_access()) {
   394                thread->doing_unsafe_access()) {
   411         stub = handle_unsafe_access(thread, pc);
   395       address next_pc = pc + NativeCall::instruction_size;
       
   396       stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
   412     }
   397     }
   413 
   398 
   414     // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
   399     // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
   415     // and the heap gets shrunk before the field access.
   400     // and the heap gets shrunk before the field access.
   416     if ((sig == SIGSEGV) || (sig == SIGBUS)) {
   401     if ((sig == SIGSEGV) || (sig == SIGBUS)) {