equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. 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. |
669 } |
669 } |
670 } |
670 } |
671 |
671 |
672 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) { |
672 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) { |
673 LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience |
673 LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience |
674 if (type == T_OBJECT || type == T_ARRAY) { |
674 if (is_reference_type(type)) { |
675 cmp_value.load_item_force(FrameMap::rax_oop_opr); |
675 cmp_value.load_item_force(FrameMap::rax_oop_opr); |
676 new_value.load_item(); |
676 new_value.load_item(); |
677 __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill); |
677 __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill); |
678 } else if (type == T_INT) { |
678 } else if (type == T_INT) { |
679 cmp_value.load_item_force(FrameMap::rax_opr); |
679 cmp_value.load_item_force(FrameMap::rax_opr); |
691 result, T_INT); |
691 result, T_INT); |
692 return result; |
692 return result; |
693 } |
693 } |
694 |
694 |
695 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) { |
695 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) { |
696 bool is_oop = type == T_OBJECT || type == T_ARRAY; |
696 bool is_oop = is_reference_type(type); |
697 LIR_Opr result = new_register(type); |
697 LIR_Opr result = new_register(type); |
698 value.load_item(); |
698 value.load_item(); |
699 // Because we want a 2-arg form of xchg and xadd |
699 // Because we want a 2-arg form of xchg and xadd |
700 __ move(value.result(), result); |
700 __ move(value.result(), result); |
701 assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type"); |
701 assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type"); |