< prev index next >

src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp


339   //%note os_trap_1                                                                                                                  
340   if (info != NULL && uc != NULL && thread != NULL) {                                                                                
341     pc = (address) os::Linux::ucontext_get_pc(uc);                                                                                   
342 
343 #ifdef BUILTIN_SIM                                                                                                                   
344     if (pc == (address) Fetch32PFI) {                                                                                                
345        uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ;                                                                     
346        return 1 ;                                                                                                                    
347     }                                                                                                                                
348     if (pc == (address) FetchNPFI) {                                                                                                 
349        uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ;                                                                     
350        return 1 ;                                                                                                                    
351     }                                                                                                                                
352 #else                                                                                                                                
353     if (StubRoutines::is_safefetch_fault(pc)) {                                                                                      
354       os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));                                            
355       return 1;                                                                                                                      
356     }                                                                                                                                
357 #endif                                                                                                                               
358 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
359     // Handle ALL stack overflow variations here                                                                                     
360     if (sig == SIGSEGV) {                                                                                                            
361       address addr = (address) info->si_addr;                                                                                        
362                                                                                                                                      
363       // check if fault address is within thread stack                                                                               
364       if (thread->on_local_stack(addr)) {                                                                                            
365         // stack overflow                                                                                                            
366         if (thread->in_stack_yellow_reserved_zone(addr)) {                                                                           
367           thread->disable_stack_yellow_reserved_zone();                                                                              
368           if (thread->thread_state() == _thread_in_Java) {                                                                           
369             if (thread->in_stack_reserved_zone(addr)) {                                                                              
370               frame fr;                                                                                                              
371               if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) {                                                    
372                 assert(fr.is_java_frame(), "Must be a Java frame");                                                                  
373                 frame activation =                                                                                                   
374                   SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);                                               
375                 if (activation.sp() != NULL) {                                                                                       
376                   thread->disable_stack_reserved_zone();                                                                             
377                   if (activation.is_interpreted_frame()) {                                                                           
378                     thread->set_reserved_stack_activation((address)(                                                                 
379                       activation.fp() + frame::interpreter_frame_initial_sp_offset));                                                
380                   } else {                                                                                                           
381                     thread->set_reserved_stack_activation((address)activation.unextended_sp());                                      

339   //%note os_trap_1
340   if (info != NULL && uc != NULL && thread != NULL) {
341     pc = (address) os::Linux::ucontext_get_pc(uc);
342 
343 #ifdef BUILTIN_SIM
344     if (pc == (address) Fetch32PFI) {
345        uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ;
346        return 1 ;
347     }
348     if (pc == (address) FetchNPFI) {
349        uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ;
350        return 1 ;
351     }
352 #else
353     if (StubRoutines::is_safefetch_fault(pc)) {
354       os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
355       return 1;
356     }
357 #endif
358 
359     address addr = (address) info->si_addr;
360 
361     // Make sure the high order byte is sign extended, as it may be masked away by the hardware.
362     if ((uintptr_t(addr) & (uintptr_t(1) << 55)) != 0) {
363       addr = address(uintptr_t(addr) | (uintptr_t(0xFF) << 56));
364     }
365 
366     // Handle ALL stack overflow variations here
367     if (sig == SIGSEGV) {


368       // check if fault address is within thread stack
369       if (thread->on_local_stack(addr)) {
370         // stack overflow
371         if (thread->in_stack_yellow_reserved_zone(addr)) {
372           thread->disable_stack_yellow_reserved_zone();
373           if (thread->thread_state() == _thread_in_Java) {
374             if (thread->in_stack_reserved_zone(addr)) {
375               frame fr;
376               if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) {
377                 assert(fr.is_java_frame(), "Must be a Java frame");
378                 frame activation =
379                   SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);
380                 if (activation.sp() != NULL) {
381                   thread->disable_stack_reserved_zone();
382                   if (activation.is_interpreted_frame()) {
383                     thread->set_reserved_stack_activation((address)(
384                       activation.fp() + frame::interpreter_frame_initial_sp_offset));
385                   } else {
386                     thread->set_reserved_stack_activation((address)activation.unextended_sp());

438         // here if the underlying file has been truncated.                                                                           
439         // Do not crash the VM in such a case.                                                                                       
440         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);                                                                              
441         CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;                                                 
442         if (nm != NULL && nm->has_unsafe_access()) {                                                                                 
443           address next_pc = pc + NativeCall::instruction_size;                                                                       
444           stub = SharedRuntime::handle_unsafe_access(thread, next_pc);                                                               
445         }                                                                                                                            
446       }                                                                                                                              
447       else                                                                                                                           
448 
449       if (sig == SIGFPE  &&                                                                                                          
450           (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {                                                            
451         stub =                                                                                                                       
452           SharedRuntime::                                                                                                            
453           continuation_for_implicit_exception(thread,                                                                                
454                                               pc,                                                                                    
455                                               SharedRuntime::                                                                        
456                                               IMPLICIT_DIVIDE_BY_ZERO);                                                              
457       } else if (sig == SIGSEGV &&                                                                                                   
458                !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {                                                
459           // Determination of interpreter/vtable stub/compiled code null exception                                                   
460           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);                       
461       }                                                                                                                              
462     } else if (thread->thread_state() == _thread_in_vm &&                                                                            
463                sig == SIGBUS && /* info->si_code == BUS_OBJERR && */                                                                 
464                thread->doing_unsafe_access()) {                                                                                      
465       address next_pc = pc + NativeCall::instruction_size;                                                                           
466       stub = SharedRuntime::handle_unsafe_access(thread, next_pc);                                                                   
467     }                                                                                                                                
468 
469     // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in                                                        
470     // and the heap gets shrunk before the field access.                                                                             
471     if ((sig == SIGSEGV) || (sig == SIGBUS)) {                                                                                       
472       address addr = JNI_FastGetField::find_slowcase_pc(pc);                                                                         
473       if (addr != (address)-1) {                                                                                                     
474         stub = addr;                                                                                                                 
475       }                                                                                                                              
476     }                                                                                                                                
477 

443         // here if the underlying file has been truncated.
444         // Do not crash the VM in such a case.
445         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
446         CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
447         if (nm != NULL && nm->has_unsafe_access()) {
448           address next_pc = pc + NativeCall::instruction_size;
449           stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
450         }
451       }
452       else
453 
454       if (sig == SIGFPE  &&
455           (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
456         stub =
457           SharedRuntime::
458           continuation_for_implicit_exception(thread,
459                                               pc,
460                                               SharedRuntime::
461                                               IMPLICIT_DIVIDE_BY_ZERO);
462       } else if (sig == SIGSEGV &&
463                  MacroAssembler::uses_implicit_null_check(info->si_addr)) {
464           // Determination of interpreter/vtable stub/compiled code null exception
465           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
466       }
467     } else if (thread->thread_state() == _thread_in_vm &&
468                sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
469                thread->doing_unsafe_access()) {
470       address next_pc = pc + NativeCall::instruction_size;
471       stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
472     }
473 
474     // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
475     // and the heap gets shrunk before the field access.
476     if ((sig == SIGSEGV) || (sig == SIGBUS)) {
477       address addr = JNI_FastGetField::find_slowcase_pc(pc);
478       if (addr != (address)-1) {
479         stub = addr;
480       }
481     }
482 
< prev index next >