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. |
566 LIR_Opr result = new_register(T_INT); |
566 LIR_Opr result = new_register(T_INT); |
567 LIR_Opr t1 = FrameMap::G1_opr; |
567 LIR_Opr t1 = FrameMap::G1_opr; |
568 LIR_Opr t2 = FrameMap::G3_opr; |
568 LIR_Opr t2 = FrameMap::G3_opr; |
569 cmp_value.load_item(); |
569 cmp_value.load_item(); |
570 new_value.load_item(); |
570 new_value.load_item(); |
571 if (type == T_OBJECT || type == T_ARRAY) { |
571 if (is_reference_type(type)) { |
572 __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); |
572 __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); |
573 } else if (type == T_INT) { |
573 } else if (type == T_INT) { |
574 __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); |
574 __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); |
575 } else if (type == T_LONG) { |
575 } else if (type == T_LONG) { |
576 __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); |
576 __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); |
581 result, type); |
581 result, type); |
582 return result; |
582 return result; |
583 } |
583 } |
584 |
584 |
585 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) { |
585 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) { |
586 bool is_obj = type == T_OBJECT || type == T_ARRAY; |
586 bool is_obj = is_reference_type(type); |
587 LIR_Opr result = new_register(type); |
587 LIR_Opr result = new_register(type); |
588 LIR_Opr tmp = LIR_OprFact::illegalOpr; |
588 LIR_Opr tmp = LIR_OprFact::illegalOpr; |
589 |
589 |
590 value.load_item(); |
590 value.load_item(); |
591 |
591 |