hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
changeset 4748 3fa8d8a7c0ea
parent 4430 95b539dfa1e8
child 4749 f26b30116e3a
equal deleted inserted replaced
4747:9b03cd97f2fb 4748:3fa8d8a7c0ea
     1 /*
     1 /*
     2  * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   355   // done
   355   // done
   356   __ bind(*slow_case->continuation());
   356   __ bind(*slow_case->continuation());
   357 }
   357 }
   358 
   358 
   359 
   359 
   360 void LIR_Assembler::emit_exception_handler() {
   360 int LIR_Assembler::emit_exception_handler() {
   361   // if the last instruction is a call (typically to do a throw which
   361   // if the last instruction is a call (typically to do a throw which
   362   // is coming at the end after block reordering) the return address
   362   // is coming at the end after block reordering) the return address
   363   // must still point into the code area in order to avoid assertion
   363   // must still point into the code area in order to avoid assertion
   364   // failures when searching for the corresponding bci => add a nop
   364   // failures when searching for the corresponding bci => add a nop
   365   // (was bug 5/14/1999 - gri)
   365   // (was bug 5/14/1999 - gri)
   371   address handler_base = __ start_a_stub(exception_handler_size);
   371   address handler_base = __ start_a_stub(exception_handler_size);
   372 
   372 
   373   if (handler_base == NULL) {
   373   if (handler_base == NULL) {
   374     // not enough space left for the handler
   374     // not enough space left for the handler
   375     bailout("exception handler overflow");
   375     bailout("exception handler overflow");
   376     return;
   376     return -1;
   377   }
   377   }
   378 #ifdef ASSERT
   378 
   379   int offset = code_offset();
   379   int offset = code_offset();
   380 #endif // ASSERT
       
   381   compilation()->offsets()->set_value(CodeOffsets::Exceptions, code_offset());
       
   382 
       
   383 
   380 
   384   if (compilation()->has_exception_handlers() || compilation()->env()->jvmti_can_post_exceptions()) {
   381   if (compilation()->has_exception_handlers() || compilation()->env()->jvmti_can_post_exceptions()) {
   385     __ call(Runtime1::entry_for(Runtime1::handle_exception_id), relocInfo::runtime_call_type);
   382     __ call(Runtime1::entry_for(Runtime1::handle_exception_id), relocInfo::runtime_call_type);
   386     __ delayed()->nop();
   383     __ delayed()->nop();
   387   }
   384   }
   388 
   385 
   389   __ call(Runtime1::entry_for(Runtime1::unwind_exception_id), relocInfo::runtime_call_type);
   386   __ call(Runtime1::entry_for(Runtime1::unwind_exception_id), relocInfo::runtime_call_type);
   390   __ delayed()->nop();
   387   __ delayed()->nop();
   391   debug_only(__ stop("should have gone to the caller");)
   388   debug_only(__ stop("should have gone to the caller");)
   392   assert(code_offset() - offset <= exception_handler_size, "overflow");
   389   assert(code_offset() - offset <= exception_handler_size, "overflow");
   393 
       
   394   __ end_a_stub();
   390   __ end_a_stub();
   395 }
   391 
   396 
   392   return offset;
   397 void LIR_Assembler::emit_deopt_handler() {
   393 }
       
   394 
       
   395 
       
   396 int LIR_Assembler::emit_deopt_handler() {
   398   // if the last instruction is a call (typically to do a throw which
   397   // if the last instruction is a call (typically to do a throw which
   399   // is coming at the end after block reordering) the return address
   398   // is coming at the end after block reordering) the return address
   400   // must still point into the code area in order to avoid assertion
   399   // must still point into the code area in order to avoid assertion
   401   // failures when searching for the corresponding bci => add a nop
   400   // failures when searching for the corresponding bci => add a nop
   402   // (was bug 5/14/1999 - gri)
   401   // (was bug 5/14/1999 - gri)
   406   ciMethod* method = compilation()->method();
   405   ciMethod* method = compilation()->method();
   407   address handler_base = __ start_a_stub(deopt_handler_size);
   406   address handler_base = __ start_a_stub(deopt_handler_size);
   408   if (handler_base == NULL) {
   407   if (handler_base == NULL) {
   409     // not enough space left for the handler
   408     // not enough space left for the handler
   410     bailout("deopt handler overflow");
   409     bailout("deopt handler overflow");
   411     return;
   410     return -1;
   412   }
   411   }
   413 #ifdef ASSERT
   412 
   414   int offset = code_offset();
   413   int offset = code_offset();
   415 #endif // ASSERT
       
   416   compilation()->offsets()->set_value(CodeOffsets::Deopt, code_offset());
       
   417 
       
   418   AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack());
   414   AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack());
   419 
       
   420   __ JUMP(deopt_blob, G3_scratch, 0); // sethi;jmp
   415   __ JUMP(deopt_blob, G3_scratch, 0); // sethi;jmp
   421   __ delayed()->nop();
   416   __ delayed()->nop();
   422 
       
   423   assert(code_offset() - offset <= deopt_handler_size, "overflow");
   417   assert(code_offset() - offset <= deopt_handler_size, "overflow");
   424 
       
   425   debug_only(__ stop("should have gone to the caller");)
   418   debug_only(__ stop("should have gone to the caller");)
   426 
       
   427   __ end_a_stub();
   419   __ end_a_stub();
       
   420 
       
   421   return offset;
   428 }
   422 }
   429 
   423 
   430 
   424 
   431 void LIR_Assembler::jobject2reg(jobject o, Register reg) {
   425 void LIR_Assembler::jobject2reg(jobject o, Register reg) {
   432   if (o == NULL) {
   426   if (o == NULL) {