< prev index next >

src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp

Print this page
rev 47591 : Add Thread Local handshakes and thread local polling


  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_Compilation.hpp"
  27 #include "c1/c1_LIRAssembler.hpp"
  28 #include "c1/c1_MacroAssembler.hpp"
  29 #include "c1/c1_Runtime1.hpp"
  30 #include "c1/c1_ValueStack.hpp"
  31 #include "ci/ciArrayKlass.hpp"
  32 #include "ci/ciInstance.hpp"
  33 #include "gc/shared/barrierSet.hpp"
  34 #include "gc/shared/cardTableModRefBS.hpp"
  35 #include "gc/shared/collectedHeap.hpp"
  36 #include "nativeInst_sparc.hpp"
  37 #include "oops/objArrayKlass.hpp"

  38 #include "runtime/sharedRuntime.hpp"
  39 
  40 #define __ _masm->
  41 
  42 
  43 //------------------------------------------------------------
  44 
  45 
  46 bool LIR_Assembler::is_small_constant(LIR_Opr opr) {
  47   if (opr->is_constant()) {
  48     LIR_Const* constant = opr->as_constant_ptr();
  49     switch (constant->type()) {
  50       case T_INT: {
  51         jint value = constant->as_jint();
  52         return Assembler::is_simm13(value);
  53       }
  54 
  55       default:
  56         return false;
  57     }


1398   assert(disp_reg != noreg || Assembler::is_simm13(disp_value), "should have set this up");
1399   if (disp_reg == noreg) {
1400     offset = store(from_reg, src, disp_value, type, wide, unaligned);
1401   } else {
1402     assert(!unaligned, "can't handle this");
1403     offset = store(from_reg, src, disp_reg, type, wide);
1404   }
1405 
1406   if (patch != NULL) {
1407     patching_epilog(patch, patch_code, src, info);
1408   }
1409 
1410   if (info != NULL) add_debug_info_for_null_check(offset, info);
1411 }
1412 
1413 
1414 void LIR_Assembler::return_op(LIR_Opr result) {
1415   if (StackReservedPages > 0 && compilation()->has_reserved_stack_access()) {
1416     __ reserved_stack_check();
1417   }



1418   __ set((intptr_t)os::get_polling_page(), L0);

1419   __ relocate(relocInfo::poll_return_type);
1420   __ ld_ptr(L0, 0, G0);
1421   __ ret();
1422   __ delayed()->restore();
1423 }
1424 
1425 
1426 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {



1427   __ set((intptr_t)os::get_polling_page(), tmp->as_register());

1428   if (info != NULL) {
1429     add_debug_info_for_branch(info);
1430   }
1431   int offset = __ offset();

1432   __ relocate(relocInfo::poll_type);
1433   __ ld_ptr(tmp->as_register(), 0, G0);
1434   return offset;
1435 }
1436 
1437 
1438 void LIR_Assembler::emit_static_call_stub() {
1439   address call_pc = __ pc();
1440   address stub = __ start_a_stub(call_stub_size());
1441   if (stub == NULL) {
1442     bailout("static call stub overflow");
1443     return;
1444   }
1445 
1446   int start = __ offset();
1447   __ relocate(static_stub_Relocation::spec(call_pc));
1448 
1449   __ set_metadata(NULL, G5);
1450   // must be set to -1 at code generation time
1451   AddressLiteral addrlit(-1);




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_Compilation.hpp"
  27 #include "c1/c1_LIRAssembler.hpp"
  28 #include "c1/c1_MacroAssembler.hpp"
  29 #include "c1/c1_Runtime1.hpp"
  30 #include "c1/c1_ValueStack.hpp"
  31 #include "ci/ciArrayKlass.hpp"
  32 #include "ci/ciInstance.hpp"
  33 #include "gc/shared/barrierSet.hpp"
  34 #include "gc/shared/cardTableModRefBS.hpp"
  35 #include "gc/shared/collectedHeap.hpp"
  36 #include "nativeInst_sparc.hpp"
  37 #include "oops/objArrayKlass.hpp"
  38 #include "runtime/safepointMechanism.inline.hpp"
  39 #include "runtime/sharedRuntime.hpp"
  40 
  41 #define __ _masm->
  42 
  43 
  44 //------------------------------------------------------------
  45 
  46 
  47 bool LIR_Assembler::is_small_constant(LIR_Opr opr) {
  48   if (opr->is_constant()) {
  49     LIR_Const* constant = opr->as_constant_ptr();
  50     switch (constant->type()) {
  51       case T_INT: {
  52         jint value = constant->as_jint();
  53         return Assembler::is_simm13(value);
  54       }
  55 
  56       default:
  57         return false;
  58     }


1399   assert(disp_reg != noreg || Assembler::is_simm13(disp_value), "should have set this up");
1400   if (disp_reg == noreg) {
1401     offset = store(from_reg, src, disp_value, type, wide, unaligned);
1402   } else {
1403     assert(!unaligned, "can't handle this");
1404     offset = store(from_reg, src, disp_reg, type, wide);
1405   }
1406 
1407   if (patch != NULL) {
1408     patching_epilog(patch, patch_code, src, info);
1409   }
1410 
1411   if (info != NULL) add_debug_info_for_null_check(offset, info);
1412 }
1413 
1414 
1415 void LIR_Assembler::return_op(LIR_Opr result) {
1416   if (StackReservedPages > 0 && compilation()->has_reserved_stack_access()) {
1417     __ reserved_stack_check();
1418   }
1419   if (SafepointMechanism::uses_thread_local_poll()) {
1420     __ ld_ptr(Address(G2_thread, Thread::polling_page_offset()), L0);
1421   } else {
1422     __ set((intptr_t)os::get_polling_page(), L0);
1423   }
1424   __ relocate(relocInfo::poll_return_type);
1425   __ ld_ptr(L0, 0, G0);
1426   __ ret();
1427   __ delayed()->restore();
1428 }
1429 
1430 
1431 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
1432   if (SafepointMechanism::uses_thread_local_poll()) {
1433     __ ld_ptr(Address(G2_thread, Thread::polling_page_offset()), tmp->as_register());
1434   } else {
1435     __ set((intptr_t)os::get_polling_page(), tmp->as_register());
1436   }
1437   if (info != NULL) {
1438     add_debug_info_for_branch(info);
1439   }
1440   int offset = __ offset();
1441 
1442   __ relocate(relocInfo::poll_type);
1443   __ ld_ptr(tmp->as_register(), 0, G0);
1444   return offset;
1445 }
1446 
1447 
1448 void LIR_Assembler::emit_static_call_stub() {
1449   address call_pc = __ pc();
1450   address stub = __ start_a_stub(call_stub_size());
1451   if (stub == NULL) {
1452     bailout("static call stub overflow");
1453     return;
1454   }
1455 
1456   int start = __ offset();
1457   __ relocate(static_stub_Relocation::spec(call_pc));
1458 
1459   __ set_metadata(NULL, G5);
1460   // must be set to -1 at code generation time
1461   AddressLiteral addrlit(-1);


< prev index next >