author | eosterlund |
Tue, 16 Oct 2018 13:18:22 +0200 | |
changeset 52142 | ca0c25e01c5b |
parent 51484 | 2730e629e32d |
permissions | -rw-r--r-- |
49906 | 1 |
/* |
2 |
* Copyright (c) 2018, 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 |
||
25 |
#include "precompiled.hpp" |
|
26 |
#include "gc/shared/c1/modRefBarrierSetC1.hpp" |
|
27 |
#include "utilities/macros.hpp" |
|
28 |
||
29 |
#ifdef ASSERT |
|
30 |
#define __ gen->lir(__FILE__, __LINE__)-> |
|
31 |
#else |
|
32 |
#define __ gen->lir()-> |
|
33 |
#endif |
|
34 |
||
35 |
void ModRefBarrierSetC1::store_at_resolved(LIRAccess& access, LIR_Opr value) { |
|
36 |
DecoratorSet decorators = access.decorators(); |
|
50728 | 37 |
bool is_array = (decorators & IS_ARRAY) != 0; |
49906 | 38 |
bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0; |
39 |
||
40 |
if (access.is_oop()) { |
|
41 |
pre_barrier(access, access.resolved_addr(), |
|
42 |
LIR_OprFact::illegalOpr /* pre_val */, access.patch_emit_info()); |
|
43 |
} |
|
44 |
||
45 |
BarrierSetC1::store_at_resolved(access, value); |
|
46 |
||
47 |
if (access.is_oop()) { |
|
50728 | 48 |
bool precise = is_array || on_anonymous; |
49906 | 49 |
LIR_Opr post_addr = precise ? access.resolved_addr() : access.base().opr(); |
50 |
post_barrier(access, post_addr, value); |
|
51 |
} |
|
52 |
} |
|
53 |
||
54 |
LIR_Opr ModRefBarrierSetC1::atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value) { |
|
55 |
if (access.is_oop()) { |
|
56 |
pre_barrier(access, access.resolved_addr(), |
|
57 |
LIR_OprFact::illegalOpr /* pre_val */, NULL); |
|
58 |
} |
|
59 |
||
60 |
LIR_Opr result = BarrierSetC1::atomic_cmpxchg_at_resolved(access, cmp_value, new_value); |
|
61 |
||
62 |
if (access.is_oop()) { |
|
63 |
post_barrier(access, access.resolved_addr(), new_value.result()); |
|
64 |
} |
|
65 |
||
66 |
return result; |
|
67 |
} |
|
68 |
||
69 |
LIR_Opr ModRefBarrierSetC1::atomic_xchg_at_resolved(LIRAccess& access, LIRItem& value) { |
|
70 |
if (access.is_oop()) { |
|
71 |
pre_barrier(access, access.resolved_addr(), |
|
72 |
LIR_OprFact::illegalOpr /* pre_val */, NULL); |
|
73 |
} |
|
74 |
||
75 |
LIR_Opr result = BarrierSetC1::atomic_xchg_at_resolved(access, value); |
|
76 |
||
77 |
if (access.is_oop()) { |
|
78 |
post_barrier(access, access.resolved_addr(), value.result()); |
|
79 |
} |
|
80 |
||
81 |
return result; |
|
82 |
} |
|
83 |
||
84 |
// This overrides the default to resolve the address into a register, |
|
85 |
// assuming it will be used by a write barrier anyway. |
|
86 |
LIR_Opr ModRefBarrierSetC1::resolve_address(LIRAccess& access, bool resolve_in_register) { |
|
87 |
DecoratorSet decorators = access.decorators(); |
|
88 |
bool needs_patching = (decorators & C1_NEEDS_PATCHING) != 0; |
|
51484
2730e629e32d
8209801: Rename C1_WRITE_ACCESS and C1_READ_ACCESS decorators to ACCESS_READ and ACCESS_WRITE
rkennke
parents:
50728
diff
changeset
|
89 |
bool is_write = (decorators & ACCESS_WRITE) != 0; |
50728 | 90 |
bool is_array = (decorators & IS_ARRAY) != 0; |
50026
e81481fea884
8202565: C1 compilation crashes with "assert(is_double_stack() && !is_virtual()) failed: type check"
thartmann
parents:
49906
diff
changeset
|
91 |
bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0; |
50728 | 92 |
bool precise = is_array || on_anonymous; |
50026
e81481fea884
8202565: C1 compilation crashes with "assert(is_double_stack() && !is_virtual()) failed: type check"
thartmann
parents:
49906
diff
changeset
|
93 |
resolve_in_register |= !needs_patching && is_write && access.is_oop() && precise; |
49906 | 94 |
return BarrierSetC1::resolve_address(access, resolve_in_register); |
95 |
} |