1 /*
2 * Copyright (c) 1997, 2014, 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 *
39
40 #ifndef CC_INTERP
41 #define __ _masm->
42
43 // Misc helpers
44
45 // Do an oop store like *(base + index + offset) = val
46 // index can be noreg,
47 static void do_oop_store(InterpreterMacroAssembler* _masm,
48 Register base,
49 Register index,
50 int offset,
51 Register val,
52 Register tmp,
53 BarrierSet::Name barrier,
54 bool precise) {
55 assert(tmp != val && tmp != base && tmp != index, "register collision");
56 assert(index == noreg || offset == 0, "only one offset");
57 switch (barrier) {
58 #if INCLUDE_ALL_GCS
59 case BarrierSet::G1SATBCT:
60 case BarrierSet::G1SATBCTLogging:
61 {
62 // Load and record the previous value.
63 __ g1_write_barrier_pre(base, index, offset,
64 noreg /* pre_val */,
65 tmp, true /*preserve_o_regs*/);
66
67 // G1 barrier needs uncompressed oop for region cross check.
68 Register new_val = val;
69 if (UseCompressedOops && val != G0) {
70 new_val = tmp;
71 __ mov(val, new_val);
72 }
73
74 if (index == noreg ) {
75 assert(Assembler::is_simm13(offset), "fix this code");
76 __ store_heap_oop(val, base, offset);
77 } else {
78 __ store_heap_oop(val, base, index);
79 }
|
1 /*
2 * Copyright (c) 1997, 2015, 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 *
39
40 #ifndef CC_INTERP
41 #define __ _masm->
42
43 // Misc helpers
44
45 // Do an oop store like *(base + index + offset) = val
46 // index can be noreg,
47 static void do_oop_store(InterpreterMacroAssembler* _masm,
48 Register base,
49 Register index,
50 int offset,
51 Register val,
52 Register tmp,
53 BarrierSet::Name barrier,
54 bool precise) {
55 assert(tmp != val && tmp != base && tmp != index, "register collision");
56 assert(index == noreg || offset == 0, "only one offset");
57 switch (barrier) {
58 #if INCLUDE_ALL_GCS
59 case BarrierSet::G1SATBCTLogging:
60 {
61 // Load and record the previous value.
62 __ g1_write_barrier_pre(base, index, offset,
63 noreg /* pre_val */,
64 tmp, true /*preserve_o_regs*/);
65
66 // G1 barrier needs uncompressed oop for region cross check.
67 Register new_val = val;
68 if (UseCompressedOops && val != G0) {
69 new_val = tmp;
70 __ mov(val, new_val);
71 }
72
73 if (index == noreg ) {
74 assert(Assembler::is_simm13(offset), "fix this code");
75 __ store_heap_oop(val, base, offset);
76 } else {
77 __ store_heap_oop(val, base, index);
78 }
|