1 | /* |
2 | * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | * |
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 |
7 | * published by the Free Software Foundation. |
8 | * |
9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12 | * version 2 for more details (a copy is included in the LICENSE file that |
13 | * accompanied this code). |
14 | * |
15 | * You should have received a copy of the GNU General Public License version |
16 | * 2 along with this work; if not, write to the Free Software Foundation, |
17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
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 | #ifndef SHARE_GC_Z_C1_ZBARRIERSETC1_HPP |
25 | #define SHARE_GC_Z_C1_ZBARRIERSETC1_HPP |
26 | |
27 | #include "c1/c1_CodeStubs.hpp" |
28 | #include "c1/c1_IR.hpp" |
29 | #include "c1/c1_LIR.hpp" |
30 | #include "gc/shared/c1/barrierSetC1.hpp" |
31 | #include "oops/accessDecorators.hpp" |
32 | |
33 | class ZLoadBarrierStubC1 : public CodeStub { |
34 | private: |
35 | DecoratorSet _decorators; |
36 | LIR_Opr _ref_addr; |
37 | LIR_Opr _ref; |
38 | LIR_Opr _tmp; |
39 | address _runtime_stub; |
40 | |
41 | public: |
42 | ZLoadBarrierStubC1(LIRAccess& access, LIR_Opr ref, address runtime_stub); |
43 | |
44 | DecoratorSet decorators() const; |
45 | LIR_Opr ref() const; |
46 | LIR_Opr ref_addr() const; |
47 | LIR_Opr tmp() const; |
48 | address runtime_stub() const; |
49 | |
50 | virtual void emit_code(LIR_Assembler* ce); |
51 | virtual void visit(LIR_OpVisitState* visitor); |
52 | |
53 | #ifndef PRODUCT |
54 | virtual void print_name(outputStream* out) const; |
55 | #endif // PRODUCT |
56 | }; |
57 | |
58 | class ZBarrierSetC1 : public BarrierSetC1 { |
59 | private: |
60 | address _load_barrier_on_oop_field_preloaded_runtime_stub; |
61 | address _load_barrier_on_weak_oop_field_preloaded_runtime_stub; |
62 | |
63 | address load_barrier_on_oop_field_preloaded_runtime_stub(DecoratorSet decorators) const; |
64 | void load_barrier(LIRAccess& access, LIR_Opr result) const; |
65 | |
66 | protected: |
67 | virtual LIR_Opr resolve_address(LIRAccess& access, bool resolve_in_register); |
68 | virtual void load_at_resolved(LIRAccess& access, LIR_Opr result); |
69 | virtual LIR_Opr atomic_xchg_at_resolved(LIRAccess& access, LIRItem& value); |
70 | virtual LIR_Opr atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value); |
71 | |
72 | public: |
73 | ZBarrierSetC1(); |
74 | |
75 | virtual void generate_c1_runtime_stubs(BufferBlob* blob); |
76 | }; |
77 | |
78 | #endif // SHARE_GC_Z_C1_ZBARRIERSETC1_HPP |
79 | |