< prev index next >

src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  *
  25  */
  26 
  27 #include "precompiled.hpp"
  28 #include "c1/c1_Compilation.hpp"
  29 #include "c1/c1_FrameMap.hpp"
  30 #include "c1/c1_Instruction.hpp"
  31 #include "c1/c1_LIRAssembler.hpp"
  32 #include "c1/c1_LIRGenerator.hpp"
  33 #include "c1/c1_Runtime1.hpp"
  34 #include "c1/c1_ValueStack.hpp"
  35 #include "ci/ciArray.hpp"
  36 #include "ci/ciObjArrayKlass.hpp"
  37 #include "ci/ciTypeArrayKlass.hpp"
  38 #include "runtime/sharedRuntime.hpp"
  39 #include "runtime/stubRoutines.hpp"
  40 #include "vmreg_aarch64.inline.hpp"
  41 




  42 #ifdef ASSERT
  43 #define __ gen()->lir(__FILE__, __LINE__)->
  44 #else
  45 #define __ gen()->lir()->
  46 #endif
  47 
  48 // Item will be loaded into a byte register; Intel only
  49 void LIRItem::load_byte_item() {
  50   load_item();
  51 }
  52 
  53 
  54 void LIRItem::load_nonconstant() {
  55   LIR_Opr r = value()->operand();
  56   if (r->is_constant()) {
  57     _result = r;
  58   } else {
  59     load_item();
  60   }
  61 }


 813     }
 814   } else {
 815     a = new LIR_Address(obj.result(),
 816                         offset.result(),
 817                         LIR_Address::times_1,
 818                         0,
 819                         as_BasicType(type));
 820   }
 821   LIR_Opr addr = new_pointer_register();
 822   __ leal(LIR_OprFact::address(a), addr);
 823 
 824   if (type == objectType) {  // Write-barrier needed for Object fields.
 825     // Do the pre-write barrier, if any.
 826     pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */,
 827                 true /* do_load */, false /* patch */, NULL);
 828   }
 829 
 830   LIR_Opr result = rlock_result(x);
 831 
 832   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
 833   if (type == objectType)

 834     __ cas_obj(addr, cmp.result(), val.result(), new_register(T_INT), new_register(T_INT),
 835                result);
 836   else if (type == intType)
 837     __ cas_int(addr, cmp.result(), val.result(), ill, ill);
 838   else if (type == longType)
 839     __ cas_long(addr, cmp.result(), val.result(), ill, ill);
 840   else {
 841     ShouldNotReachHere();
 842   }
 843 
 844   __ logical_xor(FrameMap::r8_opr, LIR_OprFact::intConst(1), result);
 845 
 846   if (type == objectType) {   // Write-barrier needed for Object fields.
 847     // Seems to be precise
 848     post_barrier(addr, val.result());
 849   }
 850 }
 851 
 852 void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
 853   switch (x->id()) {
 854     case vmIntrinsics::_dabs:
 855     case vmIntrinsics::_dsqrt: {
 856       assert(x->number_of_arguments() == 1, "wrong type");
 857       LIRItem value(x->argument_at(0), this);
 858       value.load_item();
 859       LIR_Opr dst = rlock_result(x);
 860 
 861       switch (x->id()) {
 862       case vmIntrinsics::_dsqrt: {
 863         __ sqrt(value.result(), dst, LIR_OprFact::illegalOpr);
 864         break;
 865       }


1420     jint c = (jint)l;
1421     addr = new LIR_Address(src.result(), c, type);
1422   } else {
1423     addr = new LIR_Address(src.result(), offset, type);
1424   }
1425 
1426   LIR_Opr tmp = new_register(T_INT);
1427   LIR_Opr ptr = LIR_OprFact::illegalOpr;
1428 
1429   if (x->is_add()) {
1430     __ xadd(LIR_OprFact::address(addr), data, dst, tmp);
1431   } else {
1432     if (is_obj) {
1433       // Do the pre-write barrier, if any.
1434       ptr = new_pointer_register();
1435       __ add(src.result(), off.result(), ptr);
1436       pre_barrier(ptr, LIR_OprFact::illegalOpr /* pre_val */,
1437                   true /* do_load */, false /* patch */, NULL);
1438     }
1439     __ xchg(LIR_OprFact::address(addr), data, dst, tmp);






1440     if (is_obj) {
1441       post_barrier(ptr, data);
1442     }
1443   }
1444 }


  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  *
  25  */
  26 
  27 #include "precompiled.hpp"
  28 #include "c1/c1_Compilation.hpp"
  29 #include "c1/c1_FrameMap.hpp"
  30 #include "c1/c1_Instruction.hpp"
  31 #include "c1/c1_LIRAssembler.hpp"
  32 #include "c1/c1_LIRGenerator.hpp"
  33 #include "c1/c1_Runtime1.hpp"
  34 #include "c1/c1_ValueStack.hpp"
  35 #include "ci/ciArray.hpp"
  36 #include "ci/ciObjArrayKlass.hpp"
  37 #include "ci/ciTypeArrayKlass.hpp"
  38 #include "runtime/sharedRuntime.hpp"
  39 #include "runtime/stubRoutines.hpp"
  40 #include "vmreg_aarch64.inline.hpp"
  41 
  42 #if INCLUDE_ALL_GCS
  43 #include "gc_implementation/shenandoah/c1/shenandoahBarrierSetC1.hpp"
  44 #endif
  45 
  46 #ifdef ASSERT
  47 #define __ gen()->lir(__FILE__, __LINE__)->
  48 #else
  49 #define __ gen()->lir()->
  50 #endif
  51 
  52 // Item will be loaded into a byte register; Intel only
  53 void LIRItem::load_byte_item() {
  54   load_item();
  55 }
  56 
  57 
  58 void LIRItem::load_nonconstant() {
  59   LIR_Opr r = value()->operand();
  60   if (r->is_constant()) {
  61     _result = r;
  62   } else {
  63     load_item();
  64   }
  65 }


 817     }
 818   } else {
 819     a = new LIR_Address(obj.result(),
 820                         offset.result(),
 821                         LIR_Address::times_1,
 822                         0,
 823                         as_BasicType(type));
 824   }
 825   LIR_Opr addr = new_pointer_register();
 826   __ leal(LIR_OprFact::address(a), addr);
 827 
 828   if (type == objectType) {  // Write-barrier needed for Object fields.
 829     // Do the pre-write barrier, if any.
 830     pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */,
 831                 true /* do_load */, false /* patch */, NULL);
 832   }
 833 
 834   LIR_Opr result = rlock_result(x);
 835 
 836   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
 837 
 838   if (type == objectType) {
 839     __ cas_obj(addr, cmp.result(), val.result(), new_register(T_INT), new_register(T_INT),
 840                result);
 841   } else if (type == intType)
 842     __ cas_int(addr, cmp.result(), val.result(), ill, ill, result);
 843   else if (type == longType)
 844     __ cas_long(addr, cmp.result(), val.result(), ill, ill, result);
 845   else {
 846     ShouldNotReachHere();
 847   }
 848 


 849   if (type == objectType) {   // Write-barrier needed for Object fields.
 850     // Seems to be precise
 851     post_barrier(addr, val.result());
 852   }
 853 }
 854 
 855 void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
 856   switch (x->id()) {
 857     case vmIntrinsics::_dabs:
 858     case vmIntrinsics::_dsqrt: {
 859       assert(x->number_of_arguments() == 1, "wrong type");
 860       LIRItem value(x->argument_at(0), this);
 861       value.load_item();
 862       LIR_Opr dst = rlock_result(x);
 863 
 864       switch (x->id()) {
 865       case vmIntrinsics::_dsqrt: {
 866         __ sqrt(value.result(), dst, LIR_OprFact::illegalOpr);
 867         break;
 868       }


1423     jint c = (jint)l;
1424     addr = new LIR_Address(src.result(), c, type);
1425   } else {
1426     addr = new LIR_Address(src.result(), offset, type);
1427   }
1428 
1429   LIR_Opr tmp = new_register(T_INT);
1430   LIR_Opr ptr = LIR_OprFact::illegalOpr;
1431 
1432   if (x->is_add()) {
1433     __ xadd(LIR_OprFact::address(addr), data, dst, tmp);
1434   } else {
1435     if (is_obj) {
1436       // Do the pre-write barrier, if any.
1437       ptr = new_pointer_register();
1438       __ add(src.result(), off.result(), ptr);
1439       pre_barrier(ptr, LIR_OprFact::illegalOpr /* pre_val */,
1440                   true /* do_load */, false /* patch */, NULL);
1441     }
1442     __ xchg(LIR_OprFact::address(addr), data, dst, tmp);
1443 #if INCLUDE_ALL_GCS
1444     if (UseShenandoahGC && is_obj) {
1445       LIR_Opr tmp = ShenandoahBarrierSet::barrier_set()->bsc1()->load_reference_barrier(this, dst, LIR_OprFact::addressConst(0));
1446       __ move(tmp, dst);
1447     }
1448 #endif
1449     if (is_obj) {
1450       post_barrier(ptr, data);
1451     }
1452   }
1453 }
< prev index next >