author | kvn |
Thu, 17 Jul 2014 15:40:04 -0700 | |
changeset 25916 | c5c22fab48fd |
parent 25715 | d5a8dbdc5150 |
child 27012 | f8fdfab4757b |
permissions | -rw-r--r-- |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1 |
/* |
25374
d7fb2af5d53c
8048169: Change 8037816 breaks HS build on PPC64 and CPP-Interpreter platforms
coleenp
parents:
23492
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
23492 | 3 |
* Copyright 2012, 2014 SAP AG. All rights reserved. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
5 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
9 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
14 |
* accompanied this code). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
15 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
19 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
22 |
* questions. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
23 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
24 |
*/ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
25 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
26 |
#include "precompiled.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
27 |
#include "asm/macroAssembler.inline.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
28 |
#include "compiler/disassembler.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
29 |
#include "gc_interface/collectedHeap.inline.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
30 |
#include "interpreter/interpreter.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
31 |
#include "memory/cardTableModRefBS.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
32 |
#include "memory/resourceArea.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
33 |
#include "prims/methodHandles.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
34 |
#include "runtime/biasedLocking.hpp" |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
25374
diff
changeset
|
35 |
#include "runtime/icache.hpp" |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
36 |
#include "runtime/interfaceSupport.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
37 |
#include "runtime/objectMonitor.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
38 |
#include "runtime/os.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
39 |
#include "runtime/sharedRuntime.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
40 |
#include "runtime/stubRoutines.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
41 |
#include "utilities/macros.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
42 |
#if INCLUDE_ALL_GCS |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
43 |
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
44 |
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
45 |
#include "gc_implementation/g1/heapRegion.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
46 |
#endif // INCLUDE_ALL_GCS |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
47 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
48 |
#ifdef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
49 |
#define BLOCK_COMMENT(str) // nothing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
50 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
51 |
#define BLOCK_COMMENT(str) block_comment(str) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
52 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
53 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
54 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
55 |
// On RISC, there's no benefit to verifying instruction boundaries. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
56 |
bool AbstractAssembler::pd_check_instruction_mark() { return false; } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
57 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
58 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
59 |
void MacroAssembler::ld_largeoffset_unchecked(Register d, int si31, Register a, int emit_filler_nop) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
60 |
assert(Assembler::is_simm(si31, 31) && si31 >= 0, "si31 out of range"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
61 |
if (Assembler::is_simm(si31, 16)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
62 |
ld(d, si31, a); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
63 |
if (emit_filler_nop) nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
64 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
65 |
const int hi = MacroAssembler::largeoffset_si16_si16_hi(si31); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
66 |
const int lo = MacroAssembler::largeoffset_si16_si16_lo(si31); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
67 |
addis(d, a, hi); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
68 |
ld(d, lo, d); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
69 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
70 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
71 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
72 |
void MacroAssembler::ld_largeoffset(Register d, int si31, Register a, int emit_filler_nop) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
73 |
assert_different_registers(d, a); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
74 |
ld_largeoffset_unchecked(d, si31, a, emit_filler_nop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
75 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
76 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
77 |
void MacroAssembler::load_sized_value(Register dst, RegisterOrConstant offs, Register base, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
78 |
size_t size_in_bytes, bool is_signed) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
79 |
switch (size_in_bytes) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
80 |
case 8: ld(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
81 |
case 4: is_signed ? lwa(dst, offs, base) : lwz(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
82 |
case 2: is_signed ? lha(dst, offs, base) : lhz(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
83 |
case 1: lbz(dst, offs, base); if (is_signed) extsb(dst, dst); break; // lba doesn't exist :( |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
84 |
default: ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
85 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
86 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
87 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
88 |
void MacroAssembler::store_sized_value(Register dst, RegisterOrConstant offs, Register base, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
89 |
size_t size_in_bytes) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
90 |
switch (size_in_bytes) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
91 |
case 8: std(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
92 |
case 4: stw(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
93 |
case 2: sth(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
94 |
case 1: stb(dst, offs, base); break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
95 |
default: ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
96 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
97 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
98 |
|
22861 | 99 |
void MacroAssembler::align(int modulus, int max, int rem) { |
100 |
int padding = (rem + modulus - (offset() % modulus)) % modulus; |
|
101 |
if (padding > max) return; |
|
102 |
for (int c = (padding >> 2); c > 0; --c) { nop(); } |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
103 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
104 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
105 |
// Issue instructions that calculate given TOC from global TOC. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
106 |
void MacroAssembler::calculate_address_from_global_toc(Register dst, address addr, bool hi16, bool lo16, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
107 |
bool add_relocation, bool emit_dummy_addr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
108 |
int offset = -1; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
109 |
if (emit_dummy_addr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
110 |
offset = -128; // dummy address |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
111 |
} else if (addr != (address)(intptr_t)-1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
112 |
offset = MacroAssembler::offset_to_global_toc(addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
113 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
114 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
115 |
if (hi16) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
116 |
addis(dst, R29, MacroAssembler::largeoffset_si16_si16_hi(offset)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
117 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
118 |
if (lo16) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
119 |
if (add_relocation) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
120 |
// Relocate at the addi to avoid confusion with a load from the method's TOC. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
121 |
relocate(internal_word_Relocation::spec(addr)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
122 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
123 |
addi(dst, dst, MacroAssembler::largeoffset_si16_si16_lo(offset)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
124 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
125 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
126 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
127 |
int MacroAssembler::patch_calculate_address_from_global_toc_at(address a, address bound, address addr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
128 |
const int offset = MacroAssembler::offset_to_global_toc(addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
129 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
130 |
const address inst2_addr = a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
131 |
const int inst2 = *(int *)inst2_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
132 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
133 |
// The relocation points to the second instruction, the addi, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
134 |
// and the addi reads and writes the same register dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
135 |
const int dst = inv_rt_field(inst2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
136 |
assert(is_addi(inst2) && inv_ra_field(inst2) == dst, "must be addi reading and writing dst"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
137 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
138 |
// Now, find the preceding addis which writes to dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
139 |
int inst1 = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
140 |
address inst1_addr = inst2_addr - BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
141 |
while (inst1_addr >= bound) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
142 |
inst1 = *(int *) inst1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
143 |
if (is_addis(inst1) && inv_rt_field(inst1) == dst) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
144 |
// Stop, found the addis which writes dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
145 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
146 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
147 |
inst1_addr -= BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
148 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
149 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
150 |
assert(is_addis(inst1) && inv_ra_field(inst1) == 29 /* R29 */, "source must be global TOC"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
151 |
set_imm((int *)inst1_addr, MacroAssembler::largeoffset_si16_si16_hi(offset)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
152 |
set_imm((int *)inst2_addr, MacroAssembler::largeoffset_si16_si16_lo(offset)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
153 |
return (int)((intptr_t)addr - (intptr_t)inst1_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
154 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
155 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
156 |
address MacroAssembler::get_address_of_calculate_address_from_global_toc_at(address a, address bound) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
157 |
const address inst2_addr = a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
158 |
const int inst2 = *(int *)inst2_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
159 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
160 |
// The relocation points to the second instruction, the addi, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
161 |
// and the addi reads and writes the same register dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
162 |
const int dst = inv_rt_field(inst2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
163 |
assert(is_addi(inst2) && inv_ra_field(inst2) == dst, "must be addi reading and writing dst"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
164 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
165 |
// Now, find the preceding addis which writes to dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
166 |
int inst1 = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
167 |
address inst1_addr = inst2_addr - BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
168 |
while (inst1_addr >= bound) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
169 |
inst1 = *(int *) inst1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
170 |
if (is_addis(inst1) && inv_rt_field(inst1) == dst) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
171 |
// stop, found the addis which writes dst |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
172 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
173 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
174 |
inst1_addr -= BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
175 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
176 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
177 |
assert(is_addis(inst1) && inv_ra_field(inst1) == 29 /* R29 */, "source must be global TOC"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
178 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
179 |
int offset = (get_imm(inst1_addr, 0) << 16) + get_imm(inst2_addr, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
180 |
// -1 is a special case |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
181 |
if (offset == -1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
182 |
return (address)(intptr_t)-1; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
183 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
184 |
return global_toc() + offset; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
185 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
186 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
187 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
188 |
#ifdef _LP64 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
189 |
// Patch compressed oops or klass constants. |
22861 | 190 |
// Assembler sequence is |
191 |
// 1) compressed oops: |
|
192 |
// lis rx = const.hi |
|
193 |
// ori rx = rx | const.lo |
|
194 |
// 2) compressed klass: |
|
195 |
// lis rx = const.hi |
|
196 |
// clrldi rx = rx & 0xFFFFffff // clearMS32b, optional |
|
197 |
// ori rx = rx | const.lo |
|
198 |
// Clrldi will be passed by. |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
199 |
int MacroAssembler::patch_set_narrow_oop(address a, address bound, narrowOop data) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
200 |
assert(UseCompressedOops, "Should only patch compressed oops"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
201 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
202 |
const address inst2_addr = a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
203 |
const int inst2 = *(int *)inst2_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
204 |
|
22861 | 205 |
// The relocation points to the second instruction, the ori, |
206 |
// and the ori reads and writes the same register dst. |
|
207 |
const int dst = inv_rta_field(inst2); |
|
22867 | 208 |
assert(is_ori(inst2) && inv_rs_field(inst2) == dst, "must be ori reading and writing dst"); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
209 |
// Now, find the preceding addis which writes to dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
210 |
int inst1 = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
211 |
address inst1_addr = inst2_addr - BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
212 |
bool inst1_found = false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
213 |
while (inst1_addr >= bound) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
214 |
inst1 = *(int *)inst1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
215 |
if (is_lis(inst1) && inv_rs_field(inst1) == dst) { inst1_found = true; break; } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
216 |
inst1_addr -= BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
217 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
218 |
assert(inst1_found, "inst is not lis"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
219 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
220 |
int xc = (data >> 16) & 0xffff; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
221 |
int xd = (data >> 0) & 0xffff; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
222 |
|
22861 | 223 |
set_imm((int *)inst1_addr, (short)(xc)); // see enc_load_con_narrow_hi/_lo |
22867 | 224 |
set_imm((int *)inst2_addr, (xd)); // unsigned int |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
225 |
return (int)((intptr_t)inst2_addr - (intptr_t)inst1_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
226 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
227 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
228 |
// Get compressed oop or klass constant. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
229 |
narrowOop MacroAssembler::get_narrow_oop(address a, address bound) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
230 |
assert(UseCompressedOops, "Should only patch compressed oops"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
231 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
232 |
const address inst2_addr = a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
233 |
const int inst2 = *(int *)inst2_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
234 |
|
22861 | 235 |
// The relocation points to the second instruction, the ori, |
236 |
// and the ori reads and writes the same register dst. |
|
237 |
const int dst = inv_rta_field(inst2); |
|
22867 | 238 |
assert(is_ori(inst2) && inv_rs_field(inst2) == dst, "must be ori reading and writing dst"); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
239 |
// Now, find the preceding lis which writes to dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
240 |
int inst1 = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
241 |
address inst1_addr = inst2_addr - BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
242 |
bool inst1_found = false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
243 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
244 |
while (inst1_addr >= bound) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
245 |
inst1 = *(int *) inst1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
246 |
if (is_lis(inst1) && inv_rs_field(inst1) == dst) { inst1_found = true; break;} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
247 |
inst1_addr -= BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
248 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
249 |
assert(inst1_found, "inst is not lis"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
250 |
|
22861 | 251 |
uint xl = ((unsigned int) (get_imm(inst2_addr, 0) & 0xffff)); |
252 |
uint xh = (((get_imm(inst1_addr, 0)) & 0xffff) << 16); |
|
253 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
254 |
return (int) (xl | xh); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
255 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
256 |
#endif // _LP64 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
257 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
258 |
void MacroAssembler::load_const_from_method_toc(Register dst, AddressLiteral& a, Register toc) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
259 |
int toc_offset = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
260 |
// Use RelocationHolder::none for the constant pool entry, otherwise |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
261 |
// we will end up with a failing NativeCall::verify(x) where x is |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
262 |
// the address of the constant pool entry. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
263 |
// FIXME: We should insert relocation information for oops at the constant |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
264 |
// pool entries instead of inserting it at the loads; patching of a constant |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
265 |
// pool entry should be less expensive. |
22861 | 266 |
address oop_address = address_constant((address)a.value(), RelocationHolder::none); |
267 |
// Relocate at the pc of the load. |
|
268 |
relocate(a.rspec()); |
|
269 |
toc_offset = (int)(oop_address - code()->consts()->start()); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
270 |
ld_largeoffset_unchecked(dst, toc_offset, toc, true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
271 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
272 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
273 |
bool MacroAssembler::is_load_const_from_method_toc_at(address a) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
274 |
const address inst1_addr = a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
275 |
const int inst1 = *(int *)inst1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
276 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
277 |
// The relocation points to the ld or the addis. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
278 |
return (is_ld(inst1)) || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
279 |
(is_addis(inst1) && inv_ra_field(inst1) != 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
280 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
281 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
282 |
int MacroAssembler::get_offset_of_load_const_from_method_toc_at(address a) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
283 |
assert(is_load_const_from_method_toc_at(a), "must be load_const_from_method_toc"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
284 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
285 |
const address inst1_addr = a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
286 |
const int inst1 = *(int *)inst1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
287 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
288 |
if (is_ld(inst1)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
289 |
return inv_d1_field(inst1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
290 |
} else if (is_addis(inst1)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
291 |
const int dst = inv_rt_field(inst1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
292 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
293 |
// Now, find the succeeding ld which reads and writes to dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
294 |
address inst2_addr = inst1_addr + BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
295 |
int inst2 = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
296 |
while (true) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
297 |
inst2 = *(int *) inst2_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
298 |
if (is_ld(inst2) && inv_ra_field(inst2) == dst && inv_rt_field(inst2) == dst) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
299 |
// Stop, found the ld which reads and writes dst. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
300 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
301 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
302 |
inst2_addr += BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
303 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
304 |
return (inv_d1_field(inst1) << 16) + inv_d1_field(inst2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
305 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
306 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
307 |
return 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
308 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
309 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
310 |
// Get the constant from a `load_const' sequence. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
311 |
long MacroAssembler::get_const(address a) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
312 |
assert(is_load_const_at(a), "not a load of a constant"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
313 |
const int *p = (const int*) a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
314 |
unsigned long x = (((unsigned long) (get_imm(a,0) & 0xffff)) << 48); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
315 |
if (is_ori(*(p+1))) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
316 |
x |= (((unsigned long) (get_imm(a,1) & 0xffff)) << 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
317 |
x |= (((unsigned long) (get_imm(a,3) & 0xffff)) << 16); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
318 |
x |= (((unsigned long) (get_imm(a,4) & 0xffff))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
319 |
} else if (is_lis(*(p+1))) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
320 |
x |= (((unsigned long) (get_imm(a,2) & 0xffff)) << 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
321 |
x |= (((unsigned long) (get_imm(a,1) & 0xffff)) << 16); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
322 |
x |= (((unsigned long) (get_imm(a,3) & 0xffff))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
323 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
324 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
325 |
return (long) 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
326 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
327 |
return (long) x; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
328 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
329 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
330 |
// Patch the 64 bit constant of a `load_const' sequence. This is a low |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
331 |
// level procedure. It neither flushes the instruction cache nor is it |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
332 |
// mt safe. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
333 |
void MacroAssembler::patch_const(address a, long x) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
334 |
assert(is_load_const_at(a), "not a load of a constant"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
335 |
int *p = (int*) a; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
336 |
if (is_ori(*(p+1))) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
337 |
set_imm(0 + p, (x >> 48) & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
338 |
set_imm(1 + p, (x >> 32) & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
339 |
set_imm(3 + p, (x >> 16) & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
340 |
set_imm(4 + p, x & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
341 |
} else if (is_lis(*(p+1))) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
342 |
set_imm(0 + p, (x >> 48) & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
343 |
set_imm(2 + p, (x >> 32) & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
344 |
set_imm(1 + p, (x >> 16) & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
345 |
set_imm(3 + p, x & 0xffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
346 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
347 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
348 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
349 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
350 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
351 |
AddressLiteral MacroAssembler::allocate_metadata_address(Metadata* obj) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
352 |
assert(oop_recorder() != NULL, "this assembler needs a Recorder"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
353 |
int index = oop_recorder()->allocate_metadata_index(obj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
354 |
RelocationHolder rspec = metadata_Relocation::spec(index); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
355 |
return AddressLiteral((address)obj, rspec); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
356 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
357 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
358 |
AddressLiteral MacroAssembler::constant_metadata_address(Metadata* obj) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
359 |
assert(oop_recorder() != NULL, "this assembler needs a Recorder"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
360 |
int index = oop_recorder()->find_index(obj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
361 |
RelocationHolder rspec = metadata_Relocation::spec(index); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
362 |
return AddressLiteral((address)obj, rspec); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
363 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
364 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
365 |
AddressLiteral MacroAssembler::allocate_oop_address(jobject obj) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
366 |
assert(oop_recorder() != NULL, "this assembler needs an OopRecorder"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
367 |
int oop_index = oop_recorder()->allocate_oop_index(obj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
368 |
return AddressLiteral(address(obj), oop_Relocation::spec(oop_index)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
369 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
370 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
371 |
AddressLiteral MacroAssembler::constant_oop_address(jobject obj) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
372 |
assert(oop_recorder() != NULL, "this assembler needs an OopRecorder"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
373 |
int oop_index = oop_recorder()->find_index(obj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
374 |
return AddressLiteral(address(obj), oop_Relocation::spec(oop_index)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
375 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
376 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
377 |
RegisterOrConstant MacroAssembler::delayed_value_impl(intptr_t* delayed_value_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
378 |
Register tmp, int offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
379 |
intptr_t value = *delayed_value_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
380 |
if (value != 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
381 |
return RegisterOrConstant(value + offset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
382 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
383 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
384 |
// Load indirectly to solve generation ordering problem. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
385 |
// static address, no relocation |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
386 |
int simm16_offset = load_const_optimized(tmp, delayed_value_addr, noreg, true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
387 |
ld(tmp, simm16_offset, tmp); // must be aligned ((xa & 3) == 0) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
388 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
389 |
if (offset != 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
390 |
addi(tmp, tmp, offset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
391 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
392 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
393 |
return RegisterOrConstant(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
394 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
395 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
396 |
#ifndef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
397 |
void MacroAssembler::pd_print_patched_instruction(address branch) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
398 |
Unimplemented(); // TODO: PPC port |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
399 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
400 |
#endif // ndef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
401 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
402 |
// Conditional far branch for destinations encodable in 24+2 bits. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
403 |
void MacroAssembler::bc_far(int boint, int biint, Label& dest, int optimize) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
404 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
405 |
// If requested by flag optimize, relocate the bc_far as a |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
406 |
// runtime_call and prepare for optimizing it when the code gets |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
407 |
// relocated. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
408 |
if (optimize == bc_far_optimize_on_relocate) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
409 |
relocate(relocInfo::runtime_call_type); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
410 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
411 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
412 |
// variant 2: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
413 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
414 |
// b!cxx SKIP |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
415 |
// bxx DEST |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
416 |
// SKIP: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
417 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
418 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
419 |
const int opposite_boint = add_bhint_to_boint(opposite_bhint(inv_boint_bhint(boint)), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
420 |
opposite_bcond(inv_boint_bcond(boint))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
421 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
422 |
// We emit two branches. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
423 |
// First, a conditional branch which jumps around the far branch. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
424 |
const address not_taken_pc = pc() + 2 * BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
425 |
const address bc_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
426 |
bc(opposite_boint, biint, not_taken_pc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
427 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
428 |
const int bc_instr = *(int*)bc_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
429 |
assert(not_taken_pc == (address)inv_bd_field(bc_instr, (intptr_t)bc_pc), "postcondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
430 |
assert(opposite_boint == inv_bo_field(bc_instr), "postcondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
431 |
assert(boint == add_bhint_to_boint(opposite_bhint(inv_boint_bhint(inv_bo_field(bc_instr))), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
432 |
opposite_bcond(inv_boint_bcond(inv_bo_field(bc_instr)))), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
433 |
"postcondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
434 |
assert(biint == inv_bi_field(bc_instr), "postcondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
435 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
436 |
// Second, an unconditional far branch which jumps to dest. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
437 |
// Note: target(dest) remembers the current pc (see CodeSection::target) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
438 |
// and returns the current pc if the label is not bound yet; when |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
439 |
// the label gets bound, the unconditional far branch will be patched. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
440 |
const address target_pc = target(dest); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
441 |
const address b_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
442 |
b(target_pc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
443 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
444 |
assert(not_taken_pc == pc(), "postcondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
445 |
assert(dest.is_bound() || target_pc == b_pc, "postcondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
446 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
447 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
448 |
bool MacroAssembler::is_bc_far_at(address instruction_addr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
449 |
return is_bc_far_variant1_at(instruction_addr) || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
450 |
is_bc_far_variant2_at(instruction_addr) || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
451 |
is_bc_far_variant3_at(instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
452 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
453 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
454 |
address MacroAssembler::get_dest_of_bc_far_at(address instruction_addr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
455 |
if (is_bc_far_variant1_at(instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
456 |
const address instruction_1_addr = instruction_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
457 |
const int instruction_1 = *(int*)instruction_1_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
458 |
return (address)inv_bd_field(instruction_1, (intptr_t)instruction_1_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
459 |
} else if (is_bc_far_variant2_at(instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
460 |
const address instruction_2_addr = instruction_addr + 4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
461 |
return bxx_destination(instruction_2_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
462 |
} else if (is_bc_far_variant3_at(instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
463 |
return instruction_addr + 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
464 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
465 |
// variant 4 ??? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
466 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
467 |
return NULL; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
468 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
469 |
void MacroAssembler::set_dest_of_bc_far_at(address instruction_addr, address dest) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
470 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
471 |
if (is_bc_far_variant3_at(instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
472 |
// variant 3, far cond branch to the next instruction, already patched to nops: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
473 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
474 |
// nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
475 |
// endgroup |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
476 |
// SKIP/DEST: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
477 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
478 |
return; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
479 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
480 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
481 |
// first, extract boint and biint from the current branch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
482 |
int boint = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
483 |
int biint = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
484 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
485 |
ResourceMark rm; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
486 |
const int code_size = 2 * BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
487 |
CodeBuffer buf(instruction_addr, code_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
488 |
MacroAssembler masm(&buf); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
489 |
if (is_bc_far_variant2_at(instruction_addr) && dest == instruction_addr + 8) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
490 |
// Far branch to next instruction: Optimize it by patching nops (produce variant 3). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
491 |
masm.nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
492 |
masm.endgroup(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
493 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
494 |
if (is_bc_far_variant1_at(instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
495 |
// variant 1, the 1st instruction contains the destination address: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
496 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
497 |
// bcxx DEST |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
498 |
// endgroup |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
499 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
500 |
const int instruction_1 = *(int*)(instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
501 |
boint = inv_bo_field(instruction_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
502 |
biint = inv_bi_field(instruction_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
503 |
} else if (is_bc_far_variant2_at(instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
504 |
// variant 2, the 2nd instruction contains the destination address: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
505 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
506 |
// b!cxx SKIP |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
507 |
// bxx DEST |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
508 |
// SKIP: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
509 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
510 |
const int instruction_1 = *(int*)(instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
511 |
boint = add_bhint_to_boint(opposite_bhint(inv_boint_bhint(inv_bo_field(instruction_1))), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
512 |
opposite_bcond(inv_boint_bcond(inv_bo_field(instruction_1)))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
513 |
biint = inv_bi_field(instruction_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
514 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
515 |
// variant 4??? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
516 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
517 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
518 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
519 |
// second, set the new branch destination and optimize the code |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
520 |
if (dest != instruction_addr + 4 && // the bc_far is still unbound! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
521 |
masm.is_within_range_of_bcxx(dest, instruction_addr)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
522 |
// variant 1: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
523 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
524 |
// bcxx DEST |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
525 |
// endgroup |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
526 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
527 |
masm.bc(boint, biint, dest); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
528 |
masm.endgroup(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
529 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
530 |
// variant 2: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
531 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
532 |
// b!cxx SKIP |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
533 |
// bxx DEST |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
534 |
// SKIP: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
535 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
536 |
const int opposite_boint = add_bhint_to_boint(opposite_bhint(inv_boint_bhint(boint)), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
537 |
opposite_bcond(inv_boint_bcond(boint))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
538 |
const address not_taken_pc = masm.pc() + 2 * BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
539 |
masm.bc(opposite_boint, biint, not_taken_pc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
540 |
masm.b(dest); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
541 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
542 |
} |
22861 | 543 |
ICache::ppc64_flush_icache_bytes(instruction_addr, code_size); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
544 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
545 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
546 |
// Emit a NOT mt-safe patchable 64 bit absolute call/jump. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
547 |
void MacroAssembler::bxx64_patchable(address dest, relocInfo::relocType rt, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
548 |
// get current pc |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
549 |
uint64_t start_pc = (uint64_t) pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
550 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
551 |
const address pc_of_bl = (address) (start_pc + (6*BytesPerInstWord)); // bl is last |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
552 |
const address pc_of_b = (address) (start_pc + (0*BytesPerInstWord)); // b is first |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
553 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
554 |
// relocate here |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
555 |
if (rt != relocInfo::none) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
556 |
relocate(rt); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
557 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
558 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
559 |
if ( ReoptimizeCallSequences && |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
560 |
(( link && is_within_range_of_b(dest, pc_of_bl)) || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
561 |
(!link && is_within_range_of_b(dest, pc_of_b)))) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
562 |
// variant 2: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
563 |
// Emit an optimized, pc-relative call/jump. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
564 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
565 |
if (link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
566 |
// some padding |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
567 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
568 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
569 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
570 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
571 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
572 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
573 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
574 |
// do the call |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
575 |
assert(pc() == pc_of_bl, "just checking"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
576 |
bl(dest, relocInfo::none); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
577 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
578 |
// do the jump |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
579 |
assert(pc() == pc_of_b, "just checking"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
580 |
b(dest, relocInfo::none); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
581 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
582 |
// some padding |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
583 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
584 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
585 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
586 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
587 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
588 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
589 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
590 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
591 |
// Assert that we can identify the emitted call/jump. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
592 |
assert(is_bxx64_patchable_variant2_at((address)start_pc, link), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
593 |
"can't identify emitted call"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
594 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
595 |
// variant 1: |
23211 | 596 |
#if defined(ABI_ELFv2) |
597 |
nop(); |
|
598 |
calculate_address_from_global_toc(R12, dest, true, true, false); |
|
599 |
mtctr(R12); |
|
600 |
nop(); |
|
601 |
nop(); |
|
602 |
#else |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
603 |
mr(R0, R11); // spill R11 -> R0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
604 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
605 |
// Load the destination address into CTR, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
606 |
// calculate destination relative to global toc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
607 |
calculate_address_from_global_toc(R11, dest, true, true, false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
608 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
609 |
mtctr(R11); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
610 |
mr(R11, R0); // spill R11 <- R0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
611 |
nop(); |
23211 | 612 |
#endif |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
613 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
614 |
// do the call/jump |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
615 |
if (link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
616 |
bctrl(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
617 |
} else{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
618 |
bctr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
619 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
620 |
// Assert that we can identify the emitted call/jump. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
621 |
assert(is_bxx64_patchable_variant1b_at((address)start_pc, link), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
622 |
"can't identify emitted call"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
623 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
624 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
625 |
// Assert that we can identify the emitted call/jump. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
626 |
assert(is_bxx64_patchable_at((address)start_pc, link), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
627 |
"can't identify emitted call"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
628 |
assert(get_dest_of_bxx64_patchable_at((address)start_pc, link) == dest, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
629 |
"wrong encoding of dest address"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
630 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
631 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
632 |
// Identify a bxx64_patchable instruction. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
633 |
bool MacroAssembler::is_bxx64_patchable_at(address instruction_addr, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
634 |
return is_bxx64_patchable_variant1b_at(instruction_addr, link) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
635 |
//|| is_bxx64_patchable_variant1_at(instruction_addr, link) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
636 |
|| is_bxx64_patchable_variant2_at(instruction_addr, link); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
637 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
638 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
639 |
// Does the call64_patchable instruction use a pc-relative encoding of |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
640 |
// the call destination? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
641 |
bool MacroAssembler::is_bxx64_patchable_pcrelative_at(address instruction_addr, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
642 |
// variant 2 is pc-relative |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
643 |
return is_bxx64_patchable_variant2_at(instruction_addr, link); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
644 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
645 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
646 |
// Identify variant 1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
647 |
bool MacroAssembler::is_bxx64_patchable_variant1_at(address instruction_addr, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
648 |
unsigned int* instr = (unsigned int*) instruction_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
649 |
return (link ? is_bctrl(instr[6]) : is_bctr(instr[6])) // bctr[l] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
650 |
&& is_mtctr(instr[5]) // mtctr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
651 |
&& is_load_const_at(instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
652 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
653 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
654 |
// Identify variant 1b: load destination relative to global toc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
655 |
bool MacroAssembler::is_bxx64_patchable_variant1b_at(address instruction_addr, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
656 |
unsigned int* instr = (unsigned int*) instruction_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
657 |
return (link ? is_bctrl(instr[6]) : is_bctr(instr[6])) // bctr[l] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
658 |
&& is_mtctr(instr[3]) // mtctr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
659 |
&& is_calculate_address_from_global_toc_at(instruction_addr + 2*BytesPerInstWord, instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
660 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
661 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
662 |
// Identify variant 2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
663 |
bool MacroAssembler::is_bxx64_patchable_variant2_at(address instruction_addr, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
664 |
unsigned int* instr = (unsigned int*) instruction_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
665 |
if (link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
666 |
return is_bl (instr[6]) // bl dest is last |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
667 |
&& is_nop(instr[0]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
668 |
&& is_nop(instr[1]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
669 |
&& is_nop(instr[2]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
670 |
&& is_nop(instr[3]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
671 |
&& is_nop(instr[4]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
672 |
&& is_nop(instr[5]); // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
673 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
674 |
return is_b (instr[0]) // b dest is first |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
675 |
&& is_nop(instr[1]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
676 |
&& is_nop(instr[2]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
677 |
&& is_nop(instr[3]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
678 |
&& is_nop(instr[4]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
679 |
&& is_nop(instr[5]) // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
680 |
&& is_nop(instr[6]); // nop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
681 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
682 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
683 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
684 |
// Set dest address of a bxx64_patchable instruction. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
685 |
void MacroAssembler::set_dest_of_bxx64_patchable_at(address instruction_addr, address dest, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
686 |
ResourceMark rm; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
687 |
int code_size = MacroAssembler::bxx64_patchable_size; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
688 |
CodeBuffer buf(instruction_addr, code_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
689 |
MacroAssembler masm(&buf); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
690 |
masm.bxx64_patchable(dest, relocInfo::none, link); |
22861 | 691 |
ICache::ppc64_flush_icache_bytes(instruction_addr, code_size); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
692 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
693 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
694 |
// Get dest address of a bxx64_patchable instruction. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
695 |
address MacroAssembler::get_dest_of_bxx64_patchable_at(address instruction_addr, bool link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
696 |
if (is_bxx64_patchable_variant1_at(instruction_addr, link)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
697 |
return (address) (unsigned long) get_const(instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
698 |
} else if (is_bxx64_patchable_variant2_at(instruction_addr, link)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
699 |
unsigned int* instr = (unsigned int*) instruction_addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
700 |
if (link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
701 |
const int instr_idx = 6; // bl is last |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
702 |
int branchoffset = branch_destination(instr[instr_idx], 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
703 |
return instruction_addr + branchoffset + instr_idx*BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
704 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
705 |
const int instr_idx = 0; // b is first |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
706 |
int branchoffset = branch_destination(instr[instr_idx], 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
707 |
return instruction_addr + branchoffset + instr_idx*BytesPerInstWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
708 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
709 |
// Load dest relative to global toc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
710 |
} else if (is_bxx64_patchable_variant1b_at(instruction_addr, link)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
711 |
return get_address_of_calculate_address_from_global_toc_at(instruction_addr + 2*BytesPerInstWord, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
712 |
instruction_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
713 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
714 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
715 |
return NULL; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
716 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
717 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
718 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
719 |
// Uses ordering which corresponds to ABI: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
720 |
// _savegpr0_14: std r14,-144(r1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
721 |
// _savegpr0_15: std r15,-136(r1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
722 |
// _savegpr0_16: std r16,-128(r1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
723 |
void MacroAssembler::save_nonvolatile_gprs(Register dst, int offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
724 |
std(R14, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
725 |
std(R15, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
726 |
std(R16, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
727 |
std(R17, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
728 |
std(R18, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
729 |
std(R19, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
730 |
std(R20, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
731 |
std(R21, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
732 |
std(R22, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
733 |
std(R23, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
734 |
std(R24, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
735 |
std(R25, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
736 |
std(R26, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
737 |
std(R27, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
738 |
std(R28, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
739 |
std(R29, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
740 |
std(R30, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
741 |
std(R31, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
742 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
743 |
stfd(F14, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
744 |
stfd(F15, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
745 |
stfd(F16, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
746 |
stfd(F17, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
747 |
stfd(F18, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
748 |
stfd(F19, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
749 |
stfd(F20, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
750 |
stfd(F21, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
751 |
stfd(F22, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
752 |
stfd(F23, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
753 |
stfd(F24, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
754 |
stfd(F25, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
755 |
stfd(F26, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
756 |
stfd(F27, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
757 |
stfd(F28, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
758 |
stfd(F29, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
759 |
stfd(F30, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
760 |
stfd(F31, offset, dst); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
761 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
762 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
763 |
// Uses ordering which corresponds to ABI: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
764 |
// _restgpr0_14: ld r14,-144(r1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
765 |
// _restgpr0_15: ld r15,-136(r1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
766 |
// _restgpr0_16: ld r16,-128(r1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
767 |
void MacroAssembler::restore_nonvolatile_gprs(Register src, int offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
768 |
ld(R14, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
769 |
ld(R15, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
770 |
ld(R16, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
771 |
ld(R17, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
772 |
ld(R18, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
773 |
ld(R19, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
774 |
ld(R20, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
775 |
ld(R21, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
776 |
ld(R22, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
777 |
ld(R23, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
778 |
ld(R24, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
779 |
ld(R25, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
780 |
ld(R26, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
781 |
ld(R27, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
782 |
ld(R28, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
783 |
ld(R29, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
784 |
ld(R30, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
785 |
ld(R31, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
786 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
787 |
// FP registers |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
788 |
lfd(F14, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
789 |
lfd(F15, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
790 |
lfd(F16, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
791 |
lfd(F17, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
792 |
lfd(F18, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
793 |
lfd(F19, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
794 |
lfd(F20, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
795 |
lfd(F21, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
796 |
lfd(F22, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
797 |
lfd(F23, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
798 |
lfd(F24, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
799 |
lfd(F25, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
800 |
lfd(F26, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
801 |
lfd(F27, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
802 |
lfd(F28, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
803 |
lfd(F29, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
804 |
lfd(F30, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
805 |
lfd(F31, offset, src); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
806 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
807 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
808 |
// For verify_oops. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
809 |
void MacroAssembler::save_volatile_gprs(Register dst, int offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
810 |
std(R3, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
811 |
std(R4, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
812 |
std(R5, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
813 |
std(R6, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
814 |
std(R7, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
815 |
std(R8, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
816 |
std(R9, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
817 |
std(R10, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
818 |
std(R11, offset, dst); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
819 |
std(R12, offset, dst); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
820 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
821 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
822 |
// For verify_oops. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
823 |
void MacroAssembler::restore_volatile_gprs(Register src, int offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
824 |
ld(R3, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
825 |
ld(R4, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
826 |
ld(R5, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
827 |
ld(R6, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
828 |
ld(R7, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
829 |
ld(R8, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
830 |
ld(R9, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
831 |
ld(R10, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
832 |
ld(R11, offset, src); offset += 8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
833 |
ld(R12, offset, src); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
834 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
835 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
836 |
void MacroAssembler::save_LR_CR(Register tmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
837 |
mfcr(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
838 |
std(tmp, _abi(cr), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
839 |
mflr(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
840 |
std(tmp, _abi(lr), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
841 |
// Tmp must contain lr on exit! (see return_addr and prolog in ppc64.ad) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
842 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
843 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
844 |
void MacroAssembler::restore_LR_CR(Register tmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
845 |
assert(tmp != R1_SP, "must be distinct"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
846 |
ld(tmp, _abi(lr), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
847 |
mtlr(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
848 |
ld(tmp, _abi(cr), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
849 |
mtcr(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
850 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
851 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
852 |
address MacroAssembler::get_PC_trash_LR(Register result) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
853 |
Label L; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
854 |
bl(L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
855 |
bind(L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
856 |
address lr_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
857 |
mflr(result); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
858 |
return lr_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
859 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
860 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
861 |
void MacroAssembler::resize_frame(Register offset, Register tmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
862 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
863 |
assert_different_registers(offset, tmp, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
864 |
andi_(tmp, offset, frame::alignment_in_bytes-1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
865 |
asm_assert_eq("resize_frame: unaligned", 0x204); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
866 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
867 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
868 |
// tmp <- *(SP) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
869 |
ld(tmp, _abi(callers_sp), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
870 |
// addr <- SP + offset; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
871 |
// *(addr) <- tmp; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
872 |
// SP <- addr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
873 |
stdux(tmp, R1_SP, offset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
874 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
875 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
876 |
void MacroAssembler::resize_frame(int offset, Register tmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
877 |
assert(is_simm(offset, 16), "too big an offset"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
878 |
assert_different_registers(tmp, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
879 |
assert((offset & (frame::alignment_in_bytes-1))==0, "resize_frame: unaligned"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
880 |
// tmp <- *(SP) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
881 |
ld(tmp, _abi(callers_sp), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
882 |
// addr <- SP + offset; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
883 |
// *(addr) <- tmp; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
884 |
// SP <- addr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
885 |
stdu(tmp, offset, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
886 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
887 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
888 |
void MacroAssembler::resize_frame_absolute(Register addr, Register tmp1, Register tmp2) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
889 |
// (addr == tmp1) || (addr == tmp2) is allowed here! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
890 |
assert(tmp1 != tmp2, "must be distinct"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
891 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
892 |
// compute offset w.r.t. current stack pointer |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
893 |
// tmp_1 <- addr - SP (!) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
894 |
subf(tmp1, R1_SP, addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
895 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
896 |
// atomically update SP keeping back link. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
897 |
resize_frame(tmp1/* offset */, tmp2/* tmp */); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
898 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
899 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
900 |
void MacroAssembler::push_frame(Register bytes, Register tmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
901 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
902 |
assert(bytes != R0, "r0 not allowed here"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
903 |
andi_(R0, bytes, frame::alignment_in_bytes-1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
904 |
asm_assert_eq("push_frame(Reg, Reg): unaligned", 0x203); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
905 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
906 |
neg(tmp, bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
907 |
stdux(R1_SP, R1_SP, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
908 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
909 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
910 |
// Push a frame of size `bytes'. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
911 |
void MacroAssembler::push_frame(unsigned int bytes, Register tmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
912 |
long offset = align_addr(bytes, frame::alignment_in_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
913 |
if (is_simm(-offset, 16)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
914 |
stdu(R1_SP, -offset, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
915 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
916 |
load_const(tmp, -offset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
917 |
stdux(R1_SP, R1_SP, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
918 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
919 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
920 |
|
23211 | 921 |
// Push a frame of size `bytes' plus abi_reg_args on top. |
922 |
void MacroAssembler::push_frame_reg_args(unsigned int bytes, Register tmp) { |
|
923 |
push_frame(bytes + frame::abi_reg_args_size, tmp); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
924 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
925 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
926 |
// Setup up a new C frame with a spill area for non-volatile GPRs and |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
927 |
// additional space for local variables. |
23211 | 928 |
void MacroAssembler::push_frame_reg_args_nonvolatiles(unsigned int bytes, |
929 |
Register tmp) { |
|
930 |
push_frame(bytes + frame::abi_reg_args_size + frame::spill_nonvolatiles_size, tmp); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
931 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
932 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
933 |
// Pop current C frame. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
934 |
void MacroAssembler::pop_frame() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
935 |
ld(R1_SP, _abi(callers_sp), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
936 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
937 |
|
23211 | 938 |
#if defined(ABI_ELFv2) |
939 |
address MacroAssembler::branch_to(Register r_function_entry, bool and_link) { |
|
940 |
// TODO(asmundak): make sure the caller uses R12 as function descriptor |
|
941 |
// most of the times. |
|
942 |
if (R12 != r_function_entry) { |
|
943 |
mr(R12, r_function_entry); |
|
944 |
} |
|
945 |
mtctr(R12); |
|
946 |
// Do a call or a branch. |
|
947 |
if (and_link) { |
|
948 |
bctrl(); |
|
949 |
} else { |
|
950 |
bctr(); |
|
951 |
} |
|
952 |
_last_calls_return_pc = pc(); |
|
953 |
||
954 |
return _last_calls_return_pc; |
|
955 |
} |
|
956 |
||
957 |
// Call a C function via a function descriptor and use full C |
|
958 |
// calling conventions. Updates and returns _last_calls_return_pc. |
|
959 |
address MacroAssembler::call_c(Register r_function_entry) { |
|
960 |
return branch_to(r_function_entry, /*and_link=*/true); |
|
961 |
} |
|
962 |
||
963 |
// For tail calls: only branch, don't link, so callee returns to caller of this function. |
|
964 |
address MacroAssembler::call_c_and_return_to_caller(Register r_function_entry) { |
|
965 |
return branch_to(r_function_entry, /*and_link=*/false); |
|
966 |
} |
|
967 |
||
968 |
address MacroAssembler::call_c(address function_entry, relocInfo::relocType rt) { |
|
969 |
load_const(R12, function_entry, R0); |
|
970 |
return branch_to(R12, /*and_link=*/true); |
|
971 |
} |
|
972 |
||
973 |
#else |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
974 |
// Generic version of a call to C function via a function descriptor |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
975 |
// with variable support for C calling conventions (TOC, ENV, etc.). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
976 |
// Updates and returns _last_calls_return_pc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
977 |
address MacroAssembler::branch_to(Register function_descriptor, bool and_link, bool save_toc_before_call, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
978 |
bool restore_toc_after_call, bool load_toc_of_callee, bool load_env_of_callee) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
979 |
// we emit standard ptrgl glue code here |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
980 |
assert((function_descriptor != R0), "function_descriptor cannot be R0"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
981 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
982 |
// retrieve necessary entries from the function descriptor |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
983 |
ld(R0, in_bytes(FunctionDescriptor::entry_offset()), function_descriptor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
984 |
mtctr(R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
985 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
986 |
if (load_toc_of_callee) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
987 |
ld(R2_TOC, in_bytes(FunctionDescriptor::toc_offset()), function_descriptor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
988 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
989 |
if (load_env_of_callee) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
990 |
ld(R11, in_bytes(FunctionDescriptor::env_offset()), function_descriptor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
991 |
} else if (load_toc_of_callee) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
992 |
li(R11, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
993 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
994 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
995 |
// do a call or a branch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
996 |
if (and_link) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
997 |
bctrl(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
998 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
999 |
bctr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1000 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1001 |
_last_calls_return_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1002 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1003 |
return _last_calls_return_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1004 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1005 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1006 |
// Call a C function via a function descriptor and use full C calling |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1007 |
// conventions. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1008 |
// We don't use the TOC in generated code, so there is no need to save |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1009 |
// and restore its value. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1010 |
address MacroAssembler::call_c(Register fd) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1011 |
return branch_to(fd, /*and_link=*/true, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1012 |
/*save toc=*/false, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1013 |
/*restore toc=*/false, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1014 |
/*load toc=*/true, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1015 |
/*load env=*/true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1016 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1017 |
|
22861 | 1018 |
address MacroAssembler::call_c_and_return_to_caller(Register fd) { |
1019 |
return branch_to(fd, /*and_link=*/false, |
|
1020 |
/*save toc=*/false, |
|
1021 |
/*restore toc=*/false, |
|
1022 |
/*load toc=*/true, |
|
1023 |
/*load env=*/true); |
|
1024 |
} |
|
1025 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1026 |
address MacroAssembler::call_c(const FunctionDescriptor* fd, relocInfo::relocType rt) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1027 |
if (rt != relocInfo::none) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1028 |
// this call needs to be relocatable |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1029 |
if (!ReoptimizeCallSequences |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1030 |
|| (rt != relocInfo::runtime_call_type && rt != relocInfo::none) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1031 |
|| fd == NULL // support code-size estimation |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1032 |
|| !fd->is_friend_function() |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1033 |
|| fd->entry() == NULL) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1034 |
// it's not a friend function as defined by class FunctionDescriptor, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1035 |
// so do a full call-c here. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1036 |
load_const(R11, (address)fd, R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1037 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1038 |
bool has_env = (fd != NULL && fd->env() != NULL); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1039 |
return branch_to(R11, /*and_link=*/true, |
22867 | 1040 |
/*save toc=*/false, |
1041 |
/*restore toc=*/false, |
|
1042 |
/*load toc=*/true, |
|
1043 |
/*load env=*/has_env); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1044 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1045 |
// It's a friend function. Load the entry point and don't care about |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1046 |
// toc and env. Use an optimizable call instruction, but ensure the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1047 |
// same code-size as in the case of a non-friend function. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1048 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1049 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1050 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1051 |
bl64_patchable(fd->entry(), rt); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1052 |
_last_calls_return_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1053 |
return _last_calls_return_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1054 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1055 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1056 |
// This call does not need to be relocatable, do more aggressive |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1057 |
// optimizations. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1058 |
if (!ReoptimizeCallSequences |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1059 |
|| !fd->is_friend_function()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1060 |
// It's not a friend function as defined by class FunctionDescriptor, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1061 |
// so do a full call-c here. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1062 |
load_const(R11, (address)fd, R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1063 |
return branch_to(R11, /*and_link=*/true, |
22867 | 1064 |
/*save toc=*/false, |
1065 |
/*restore toc=*/false, |
|
1066 |
/*load toc=*/true, |
|
1067 |
/*load env=*/true); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1068 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1069 |
// it's a friend function, load the entry point and don't care about |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1070 |
// toc and env. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1071 |
address dest = fd->entry(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1072 |
if (is_within_range_of_b(dest, pc())) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1073 |
bl(dest); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1074 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1075 |
bl64_patchable(dest, rt); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1076 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1077 |
_last_calls_return_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1078 |
return _last_calls_return_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1079 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1080 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1081 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1082 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1083 |
// Call a C function. All constants needed reside in TOC. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1084 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1085 |
// Read the address to call from the TOC. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1086 |
// Read env from TOC, if fd specifies an env. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1087 |
// Read new TOC from TOC. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1088 |
address MacroAssembler::call_c_using_toc(const FunctionDescriptor* fd, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1089 |
relocInfo::relocType rt, Register toc) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1090 |
if (!ReoptimizeCallSequences |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1091 |
|| (rt != relocInfo::runtime_call_type && rt != relocInfo::none) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1092 |
|| !fd->is_friend_function()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1093 |
// It's not a friend function as defined by class FunctionDescriptor, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1094 |
// so do a full call-c here. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1095 |
assert(fd->entry() != NULL, "function must be linked"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1096 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1097 |
AddressLiteral fd_entry(fd->entry()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1098 |
load_const_from_method_toc(R11, fd_entry, toc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1099 |
mtctr(R11); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1100 |
if (fd->env() == NULL) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1101 |
li(R11, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1102 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1103 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1104 |
AddressLiteral fd_env(fd->env()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1105 |
load_const_from_method_toc(R11, fd_env, toc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1106 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1107 |
AddressLiteral fd_toc(fd->toc()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1108 |
load_toc_from_toc(R2_TOC, fd_toc, toc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1109 |
// R2_TOC is killed. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1110 |
bctrl(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1111 |
_last_calls_return_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1112 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1113 |
// It's a friend function, load the entry point and don't care about |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1114 |
// toc and env. Use an optimizable call instruction, but ensure the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1115 |
// same code-size as in the case of a non-friend function. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1116 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1117 |
bl64_patchable(fd->entry(), rt); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1118 |
_last_calls_return_pc = pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1119 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1120 |
return _last_calls_return_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1121 |
} |
23492 | 1122 |
#endif // ABI_ELFv2 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1123 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1124 |
void MacroAssembler::call_VM_base(Register oop_result, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1125 |
Register last_java_sp, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1126 |
address entry_point, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1127 |
bool check_exceptions) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1128 |
BLOCK_COMMENT("call_VM {"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1129 |
// Determine last_java_sp register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1130 |
if (!last_java_sp->is_valid()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1131 |
last_java_sp = R1_SP; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1132 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1133 |
set_top_ijava_frame_at_SP_as_last_Java_frame(last_java_sp, R11_scratch1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1134 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1135 |
// ARG1 must hold thread address. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1136 |
mr(R3_ARG1, R16_thread); |
23211 | 1137 |
#if defined(ABI_ELFv2) |
1138 |
address return_pc = call_c(entry_point, relocInfo::none); |
|
1139 |
#else |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1140 |
address return_pc = call_c((FunctionDescriptor*)entry_point, relocInfo::none); |
23211 | 1141 |
#endif |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1142 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1143 |
reset_last_Java_frame(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1144 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1145 |
// Check for pending exceptions. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1146 |
if (check_exceptions) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1147 |
// We don't check for exceptions here. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1148 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1149 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1150 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1151 |
// Get oop result if there is one and reset the value in the thread. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1152 |
if (oop_result->is_valid()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1153 |
get_vm_result(oop_result); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1154 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1155 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1156 |
_last_calls_return_pc = return_pc; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1157 |
BLOCK_COMMENT("} call_VM"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1158 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1159 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1160 |
void MacroAssembler::call_VM_leaf_base(address entry_point) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1161 |
BLOCK_COMMENT("call_VM_leaf {"); |
23211 | 1162 |
#if defined(ABI_ELFv2) |
1163 |
call_c(entry_point, relocInfo::none); |
|
1164 |
#else |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1165 |
call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, entry_point), relocInfo::none); |
23211 | 1166 |
#endif |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1167 |
BLOCK_COMMENT("} call_VM_leaf"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1168 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1169 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1170 |
void MacroAssembler::call_VM(Register oop_result, address entry_point, bool check_exceptions) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1171 |
call_VM_base(oop_result, noreg, entry_point, check_exceptions); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1172 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1173 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1174 |
void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1175 |
bool check_exceptions) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1176 |
// R3_ARG1 is reserved for the thread. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1177 |
mr_if_needed(R4_ARG2, arg_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1178 |
call_VM(oop_result, entry_point, check_exceptions); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1179 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1180 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1181 |
void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1182 |
bool check_exceptions) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1183 |
// R3_ARG1 is reserved for the thread |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1184 |
mr_if_needed(R4_ARG2, arg_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1185 |
assert(arg_2 != R4_ARG2, "smashed argument"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1186 |
mr_if_needed(R5_ARG3, arg_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1187 |
call_VM(oop_result, entry_point, check_exceptions); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1188 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1189 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1190 |
void MacroAssembler::call_VM_leaf(address entry_point) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1191 |
call_VM_leaf_base(entry_point); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1192 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1193 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1194 |
void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1195 |
mr_if_needed(R3_ARG1, arg_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1196 |
call_VM_leaf(entry_point); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1197 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1198 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1199 |
void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register arg_2) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1200 |
mr_if_needed(R3_ARG1, arg_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1201 |
assert(arg_2 != R3_ARG1, "smashed argument"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1202 |
mr_if_needed(R4_ARG2, arg_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1203 |
call_VM_leaf(entry_point); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1204 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1205 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1206 |
void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1207 |
mr_if_needed(R3_ARG1, arg_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1208 |
assert(arg_2 != R3_ARG1, "smashed argument"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1209 |
mr_if_needed(R4_ARG2, arg_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1210 |
assert(arg_3 != R3_ARG1 && arg_3 != R4_ARG2, "smashed argument"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1211 |
mr_if_needed(R5_ARG3, arg_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1212 |
call_VM_leaf(entry_point); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1213 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1214 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1215 |
// Check whether instruction is a read access to the polling page |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1216 |
// which was emitted by load_from_polling_page(..). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1217 |
bool MacroAssembler::is_load_from_polling_page(int instruction, void* ucontext, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1218 |
address* polling_address_ptr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1219 |
if (!is_ld(instruction)) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1220 |
return false; // It's not a ld. Fail. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1221 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1222 |
int rt = inv_rt_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1223 |
int ra = inv_ra_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1224 |
int ds = inv_ds_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1225 |
if (!(ds == 0 && ra != 0 && rt == 0)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1226 |
return false; // It's not a ld(r0, X, ra). Fail. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1227 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1228 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1229 |
if (!ucontext) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1230 |
// Set polling address. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1231 |
if (polling_address_ptr != NULL) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1232 |
*polling_address_ptr = NULL; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1233 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1234 |
return true; // No ucontext given. Can't check value of ra. Assume true. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1235 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1236 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1237 |
#ifdef LINUX |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1238 |
// Ucontext given. Check that register ra contains the address of |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1239 |
// the safepoing polling page. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1240 |
ucontext_t* uc = (ucontext_t*) ucontext; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1241 |
// Set polling address. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1242 |
address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1243 |
if (polling_address_ptr != NULL) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1244 |
*polling_address_ptr = addr; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1245 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1246 |
return os::is_poll_address(addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1247 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1248 |
// Not on Linux, ucontext must be NULL. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1249 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1250 |
return false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1251 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1252 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1253 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1254 |
bool MacroAssembler::is_memory_serialization(int instruction, JavaThread* thread, void* ucontext) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1255 |
#ifdef LINUX |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1256 |
ucontext_t* uc = (ucontext_t*) ucontext; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1257 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1258 |
if (is_stwx(instruction) || is_stwux(instruction)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1259 |
int ra = inv_ra_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1260 |
int rb = inv_rb_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1261 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1262 |
// look up content of ra and rb in ucontext |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1263 |
address ra_val=(address)uc->uc_mcontext.regs->gpr[ra]; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1264 |
long rb_val=(long)uc->uc_mcontext.regs->gpr[rb]; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1265 |
return os::is_memory_serialize_page(thread, ra_val+rb_val); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1266 |
} else if (is_stw(instruction) || is_stwu(instruction)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1267 |
int ra = inv_ra_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1268 |
int d1 = inv_d1_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1269 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1270 |
// look up content of ra in ucontext |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1271 |
address ra_val=(address)uc->uc_mcontext.regs->gpr[ra]; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1272 |
return os::is_memory_serialize_page(thread, ra_val+d1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1273 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1274 |
return false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1275 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1276 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1277 |
// workaround not needed on !LINUX :-) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1278 |
ShouldNotCallThis(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1279 |
return false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1280 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1281 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1282 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1283 |
void MacroAssembler::bang_stack_with_offset(int offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1284 |
// When increasing the stack, the old stack pointer will be written |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1285 |
// to the new top of stack according to the PPC64 abi. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1286 |
// Therefore, stack banging is not necessary when increasing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1287 |
// the stack by <= os::vm_page_size() bytes. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1288 |
// When increasing the stack by a larger amount, this method is |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1289 |
// called repeatedly to bang the intermediate pages. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1290 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1291 |
// Stack grows down, caller passes positive offset. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1292 |
assert(offset > 0, "must bang with positive offset"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1293 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1294 |
long stdoffset = -offset; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1295 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1296 |
if (is_simm(stdoffset, 16)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1297 |
// Signed 16 bit offset, a simple std is ok. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1298 |
if (UseLoadInstructionsForStackBangingPPC64) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1299 |
ld(R0, (int)(signed short)stdoffset, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1300 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1301 |
std(R0,(int)(signed short)stdoffset, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1302 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1303 |
} else if (is_simm(stdoffset, 31)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1304 |
const int hi = MacroAssembler::largeoffset_si16_si16_hi(stdoffset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1305 |
const int lo = MacroAssembler::largeoffset_si16_si16_lo(stdoffset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1306 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1307 |
Register tmp = R11; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1308 |
addis(tmp, R1_SP, hi); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1309 |
if (UseLoadInstructionsForStackBangingPPC64) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1310 |
ld(R0, lo, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1311 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1312 |
std(R0, lo, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1313 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1314 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1315 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1316 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1317 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1318 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1319 |
// If instruction is a stack bang of the form |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1320 |
// std R0, x(Ry), (see bang_stack_with_offset()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1321 |
// stdu R1_SP, x(R1_SP), (see push_frame(), resize_frame()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1322 |
// or stdux R1_SP, Rx, R1_SP (see push_frame(), resize_frame()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1323 |
// return the banged address. Otherwise, return 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1324 |
address MacroAssembler::get_stack_bang_address(int instruction, void *ucontext) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1325 |
#ifdef LINUX |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1326 |
ucontext_t* uc = (ucontext_t*) ucontext; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1327 |
int rs = inv_rs_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1328 |
int ra = inv_ra_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1329 |
if ( (is_ld(instruction) && rs == 0 && UseLoadInstructionsForStackBangingPPC64) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1330 |
|| (is_std(instruction) && rs == 0 && !UseLoadInstructionsForStackBangingPPC64) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1331 |
|| (is_stdu(instruction) && rs == 1)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1332 |
int ds = inv_ds_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1333 |
// return banged address |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1334 |
return ds+(address)uc->uc_mcontext.regs->gpr[ra]; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1335 |
} else if (is_stdux(instruction) && rs == 1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1336 |
int rb = inv_rb_field(instruction); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1337 |
address sp = (address)uc->uc_mcontext.regs->gpr[1]; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1338 |
long rb_val = (long)uc->uc_mcontext.regs->gpr[rb]; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1339 |
return ra != 1 || rb_val >= 0 ? NULL // not a stack bang |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1340 |
: sp + rb_val; // banged address |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1341 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1342 |
return NULL; // not a stack bang |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1343 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1344 |
// workaround not needed on !LINUX :-) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1345 |
ShouldNotCallThis(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1346 |
return NULL; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1347 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1348 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1349 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1350 |
// CmpxchgX sets condition register to cmpX(current, compare). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1351 |
void MacroAssembler::cmpxchgw(ConditionRegister flag, Register dest_current_value, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1352 |
Register compare_value, Register exchange_value, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1353 |
Register addr_base, int semantics, bool cmpxchgx_hint, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1354 |
Register int_flag_success, bool contention_hint) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1355 |
Label retry; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1356 |
Label failed; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1357 |
Label done; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1358 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1359 |
// Save one branch if result is returned via register and |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1360 |
// result register is different from the other ones. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1361 |
bool use_result_reg = (int_flag_success != noreg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1362 |
bool preset_result_reg = (int_flag_success != dest_current_value && int_flag_success != compare_value && |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1363 |
int_flag_success != exchange_value && int_flag_success != addr_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1364 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1365 |
// release/fence semantics |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1366 |
if (semantics & MemBarRel) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1367 |
release(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1368 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1369 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1370 |
if (use_result_reg && preset_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1371 |
li(int_flag_success, 0); // preset (assume cas failed) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1372 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1373 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1374 |
// Add simple guard in order to reduce risk of starving under high contention (recommended by IBM). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1375 |
if (contention_hint) { // Don't try to reserve if cmp fails. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1376 |
lwz(dest_current_value, 0, addr_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1377 |
cmpw(flag, dest_current_value, compare_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1378 |
bne(flag, failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1379 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1380 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1381 |
// atomic emulation loop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1382 |
bind(retry); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1383 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1384 |
lwarx(dest_current_value, addr_base, cmpxchgx_hint); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1385 |
cmpw(flag, dest_current_value, compare_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1386 |
if (UseStaticBranchPredictionInCompareAndSwapPPC64) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1387 |
bne_predict_not_taken(flag, failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1388 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1389 |
bne( flag, failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1390 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1391 |
// branch to done => (flag == ne), (dest_current_value != compare_value) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1392 |
// fall through => (flag == eq), (dest_current_value == compare_value) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1393 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1394 |
stwcx_(exchange_value, addr_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1395 |
if (UseStaticBranchPredictionInCompareAndSwapPPC64) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1396 |
bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1397 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1398 |
bne( CCR0, retry); // StXcx_ sets CCR0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1399 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1400 |
// fall through => (flag == eq), (dest_current_value == compare_value), (swapped) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1401 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1402 |
// Result in register (must do this at the end because int_flag_success can be the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1403 |
// same register as one above). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1404 |
if (use_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1405 |
li(int_flag_success, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1406 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1407 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1408 |
if (semantics & MemBarFenceAfter) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1409 |
fence(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1410 |
} else if (semantics & MemBarAcq) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1411 |
isync(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1412 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1413 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1414 |
if (use_result_reg && !preset_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1415 |
b(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1416 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1417 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1418 |
bind(failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1419 |
if (use_result_reg && !preset_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1420 |
li(int_flag_success, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1421 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1422 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1423 |
bind(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1424 |
// (flag == ne) => (dest_current_value != compare_value), (!swapped) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1425 |
// (flag == eq) => (dest_current_value == compare_value), ( swapped) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1426 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1427 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1428 |
// Preforms atomic compare exchange: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1429 |
// if (compare_value == *addr_base) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1430 |
// *addr_base = exchange_value |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1431 |
// int_flag_success = 1; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1432 |
// else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1433 |
// int_flag_success = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1434 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1435 |
// ConditionRegister flag = cmp(compare_value, *addr_base) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1436 |
// Register dest_current_value = *addr_base |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1437 |
// Register compare_value Used to compare with value in memory |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1438 |
// Register exchange_value Written to memory if compare_value == *addr_base |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1439 |
// Register addr_base The memory location to compareXChange |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1440 |
// Register int_flag_success Set to 1 if exchange_value was written to *addr_base |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1441 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1442 |
// To avoid the costly compare exchange the value is tested beforehand. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1443 |
// Several special cases exist to avoid that unnecessary information is generated. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1444 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1445 |
void MacroAssembler::cmpxchgd(ConditionRegister flag, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1446 |
Register dest_current_value, Register compare_value, Register exchange_value, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1447 |
Register addr_base, int semantics, bool cmpxchgx_hint, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1448 |
Register int_flag_success, Label* failed_ext, bool contention_hint) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1449 |
Label retry; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1450 |
Label failed_int; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1451 |
Label& failed = (failed_ext != NULL) ? *failed_ext : failed_int; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1452 |
Label done; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1453 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1454 |
// Save one branch if result is returned via register and result register is different from the other ones. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1455 |
bool use_result_reg = (int_flag_success!=noreg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1456 |
bool preset_result_reg = (int_flag_success!=dest_current_value && int_flag_success!=compare_value && |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1457 |
int_flag_success!=exchange_value && int_flag_success!=addr_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1458 |
assert(int_flag_success == noreg || failed_ext == NULL, "cannot have both"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1459 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1460 |
// release/fence semantics |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1461 |
if (semantics & MemBarRel) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1462 |
release(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1463 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1464 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1465 |
if (use_result_reg && preset_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1466 |
li(int_flag_success, 0); // preset (assume cas failed) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1467 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1468 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1469 |
// Add simple guard in order to reduce risk of starving under high contention (recommended by IBM). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1470 |
if (contention_hint) { // Don't try to reserve if cmp fails. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1471 |
ld(dest_current_value, 0, addr_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1472 |
cmpd(flag, dest_current_value, compare_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1473 |
bne(flag, failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1474 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1475 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1476 |
// atomic emulation loop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1477 |
bind(retry); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1478 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1479 |
ldarx(dest_current_value, addr_base, cmpxchgx_hint); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1480 |
cmpd(flag, dest_current_value, compare_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1481 |
if (UseStaticBranchPredictionInCompareAndSwapPPC64) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1482 |
bne_predict_not_taken(flag, failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1483 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1484 |
bne( flag, failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1485 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1486 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1487 |
stdcx_(exchange_value, addr_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1488 |
if (UseStaticBranchPredictionInCompareAndSwapPPC64) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1489 |
bne_predict_not_taken(CCR0, retry); // stXcx_ sets CCR0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1490 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1491 |
bne( CCR0, retry); // stXcx_ sets CCR0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1492 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1493 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1494 |
// result in register (must do this at the end because int_flag_success can be the same register as one above) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1495 |
if (use_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1496 |
li(int_flag_success, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1497 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1498 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1499 |
// POWER6 doesn't need isync in CAS. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1500 |
// Always emit isync to be on the safe side. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1501 |
if (semantics & MemBarFenceAfter) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1502 |
fence(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1503 |
} else if (semantics & MemBarAcq) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1504 |
isync(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1505 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1506 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1507 |
if (use_result_reg && !preset_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1508 |
b(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1509 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1510 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1511 |
bind(failed_int); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1512 |
if (use_result_reg && !preset_result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1513 |
li(int_flag_success, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1514 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1515 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1516 |
bind(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1517 |
// (flag == ne) => (dest_current_value != compare_value), (!swapped) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1518 |
// (flag == eq) => (dest_current_value == compare_value), ( swapped) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1519 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1520 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1521 |
// Look up the method for a megamorphic invokeinterface call. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1522 |
// The target method is determined by <intf_klass, itable_index>. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1523 |
// The receiver klass is in recv_klass. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1524 |
// On success, the result will be in method_result, and execution falls through. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1525 |
// On failure, execution transfers to the given label. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1526 |
void MacroAssembler::lookup_interface_method(Register recv_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1527 |
Register intf_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1528 |
RegisterOrConstant itable_index, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1529 |
Register method_result, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1530 |
Register scan_temp, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1531 |
Register sethi_temp, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1532 |
Label& L_no_such_interface) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1533 |
assert_different_registers(recv_klass, intf_klass, method_result, scan_temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1534 |
assert(itable_index.is_constant() || itable_index.as_register() == method_result, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1535 |
"caller must use same register for non-constant itable index as for method"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1536 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1537 |
// Compute start of first itableOffsetEntry (which is at the end of the vtable). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1538 |
int vtable_base = InstanceKlass::vtable_start_offset() * wordSize; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1539 |
int itentry_off = itableMethodEntry::method_offset_in_bytes(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1540 |
int logMEsize = exact_log2(itableMethodEntry::size() * wordSize); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1541 |
int scan_step = itableOffsetEntry::size() * wordSize; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1542 |
int log_vte_size= exact_log2(vtableEntry::size() * wordSize); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1543 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1544 |
lwz(scan_temp, InstanceKlass::vtable_length_offset() * wordSize, recv_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1545 |
// %%% We should store the aligned, prescaled offset in the klassoop. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1546 |
// Then the next several instructions would fold away. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1547 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1548 |
sldi(scan_temp, scan_temp, log_vte_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1549 |
addi(scan_temp, scan_temp, vtable_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1550 |
add(scan_temp, recv_klass, scan_temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1551 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1552 |
// Adjust recv_klass by scaled itable_index, so we can free itable_index. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1553 |
if (itable_index.is_register()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1554 |
Register itable_offset = itable_index.as_register(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1555 |
sldi(itable_offset, itable_offset, logMEsize); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1556 |
if (itentry_off) addi(itable_offset, itable_offset, itentry_off); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1557 |
add(recv_klass, itable_offset, recv_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1558 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1559 |
long itable_offset = (long)itable_index.as_constant(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1560 |
load_const_optimized(sethi_temp, (itable_offset<<logMEsize)+itentry_off); // static address, no relocation |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1561 |
add(recv_klass, sethi_temp, recv_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1562 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1563 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1564 |
// for (scan = klass->itable(); scan->interface() != NULL; scan += scan_step) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1565 |
// if (scan->interface() == intf) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1566 |
// result = (klass + scan->offset() + itable_index); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1567 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1568 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1569 |
Label search, found_method; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1570 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1571 |
for (int peel = 1; peel >= 0; peel--) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1572 |
// %%%% Could load both offset and interface in one ldx, if they were |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1573 |
// in the opposite order. This would save a load. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1574 |
ld(method_result, itableOffsetEntry::interface_offset_in_bytes(), scan_temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1575 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1576 |
// Check that this entry is non-null. A null entry means that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1577 |
// the receiver class doesn't implement the interface, and wasn't the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1578 |
// same as when the caller was compiled. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1579 |
cmpd(CCR0, method_result, intf_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1580 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1581 |
if (peel) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1582 |
beq(CCR0, found_method); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1583 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1584 |
bne(CCR0, search); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1585 |
// (invert the test to fall through to found_method...) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1586 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1587 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1588 |
if (!peel) break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1589 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1590 |
bind(search); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1591 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1592 |
cmpdi(CCR0, method_result, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1593 |
beq(CCR0, L_no_such_interface); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1594 |
addi(scan_temp, scan_temp, scan_step); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1595 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1596 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1597 |
bind(found_method); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1598 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1599 |
// Got a hit. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1600 |
int ito_offset = itableOffsetEntry::offset_offset_in_bytes(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1601 |
lwz(scan_temp, ito_offset, scan_temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1602 |
ldx(method_result, scan_temp, recv_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1603 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1604 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1605 |
// virtual method calling |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1606 |
void MacroAssembler::lookup_virtual_method(Register recv_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1607 |
RegisterOrConstant vtable_index, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1608 |
Register method_result) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1609 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1610 |
assert_different_registers(recv_klass, method_result, vtable_index.register_or_noreg()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1611 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1612 |
const int base = InstanceKlass::vtable_start_offset() * wordSize; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1613 |
assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1614 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1615 |
if (vtable_index.is_register()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1616 |
sldi(vtable_index.as_register(), vtable_index.as_register(), LogBytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1617 |
add(recv_klass, vtable_index.as_register(), recv_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1618 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1619 |
addi(recv_klass, recv_klass, vtable_index.as_constant() << LogBytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1620 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1621 |
ld(R19_method, base + vtableEntry::method_offset_in_bytes(), recv_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1622 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1623 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1624 |
/////////////////////////////////////////// subtype checking //////////////////////////////////////////// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1625 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1626 |
void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1627 |
Register super_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1628 |
Register temp1_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1629 |
Register temp2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1630 |
Label& L_success, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1631 |
Label& L_failure) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1632 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1633 |
const Register check_cache_offset = temp1_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1634 |
const Register cached_super = temp2_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1635 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1636 |
assert_different_registers(sub_klass, super_klass, check_cache_offset, cached_super); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1637 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1638 |
int sco_offset = in_bytes(Klass::super_check_offset_offset()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1639 |
int sc_offset = in_bytes(Klass::secondary_super_cache_offset()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1640 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1641 |
// If the pointers are equal, we are done (e.g., String[] elements). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1642 |
// This self-check enables sharing of secondary supertype arrays among |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1643 |
// non-primary types such as array-of-interface. Otherwise, each such |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1644 |
// type would need its own customized SSA. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1645 |
// We move this check to the front of the fast path because many |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1646 |
// type checks are in fact trivially successful in this manner, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1647 |
// so we get a nicely predicted branch right at the start of the check. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1648 |
cmpd(CCR0, sub_klass, super_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1649 |
beq(CCR0, L_success); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1650 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1651 |
// Check the supertype display: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1652 |
lwz(check_cache_offset, sco_offset, super_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1653 |
// The loaded value is the offset from KlassOopDesc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1654 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1655 |
ldx(cached_super, check_cache_offset, sub_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1656 |
cmpd(CCR0, cached_super, super_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1657 |
beq(CCR0, L_success); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1658 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1659 |
// This check has worked decisively for primary supers. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1660 |
// Secondary supers are sought in the super_cache ('super_cache_addr'). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1661 |
// (Secondary supers are interfaces and very deeply nested subtypes.) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1662 |
// This works in the same check above because of a tricky aliasing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1663 |
// between the super_cache and the primary super display elements. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1664 |
// (The 'super_check_addr' can address either, as the case requires.) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1665 |
// Note that the cache is updated below if it does not help us find |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1666 |
// what we need immediately. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1667 |
// So if it was a primary super, we can just fail immediately. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1668 |
// Otherwise, it's the slow path for us (no success at this point). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1669 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1670 |
cmpwi(CCR0, check_cache_offset, sc_offset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1671 |
bne(CCR0, L_failure); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1672 |
// bind(slow_path); // fallthru |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1673 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1674 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1675 |
void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1676 |
Register super_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1677 |
Register temp1_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1678 |
Register temp2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1679 |
Label* L_success, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1680 |
Register result_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1681 |
const Register array_ptr = temp1_reg; // current value from cache array |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1682 |
const Register temp = temp2_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1683 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1684 |
assert_different_registers(sub_klass, super_klass, array_ptr, temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1685 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1686 |
int source_offset = in_bytes(Klass::secondary_supers_offset()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1687 |
int target_offset = in_bytes(Klass::secondary_super_cache_offset()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1688 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1689 |
int length_offset = Array<Klass*>::length_offset_in_bytes(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1690 |
int base_offset = Array<Klass*>::base_offset_in_bytes(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1691 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1692 |
Label hit, loop, failure, fallthru; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1693 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1694 |
ld(array_ptr, source_offset, sub_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1695 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1696 |
//assert(4 == arrayOopDesc::length_length_in_bytes(), "precondition violated."); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1697 |
lwz(temp, length_offset, array_ptr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1698 |
cmpwi(CCR0, temp, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1699 |
beq(CCR0, result_reg!=noreg ? failure : fallthru); // length 0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1700 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1701 |
mtctr(temp); // load ctr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1702 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1703 |
bind(loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1704 |
// Oops in table are NO MORE compressed. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1705 |
ld(temp, base_offset, array_ptr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1706 |
cmpd(CCR0, temp, super_klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1707 |
beq(CCR0, hit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1708 |
addi(array_ptr, array_ptr, BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1709 |
bdnz(loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1710 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1711 |
bind(failure); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1712 |
if (result_reg!=noreg) li(result_reg, 1); // load non-zero result (indicates a miss) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1713 |
b(fallthru); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1714 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1715 |
bind(hit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1716 |
std(super_klass, target_offset, sub_klass); // save result to cache |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1717 |
if (result_reg != noreg) li(result_reg, 0); // load zero result (indicates a hit) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1718 |
if (L_success != NULL) b(*L_success); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1719 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1720 |
bind(fallthru); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1721 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1722 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1723 |
// Try fast path, then go to slow one if not successful |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1724 |
void MacroAssembler::check_klass_subtype(Register sub_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1725 |
Register super_klass, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1726 |
Register temp1_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1727 |
Register temp2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1728 |
Label& L_success) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1729 |
Label L_failure; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1730 |
check_klass_subtype_fast_path(sub_klass, super_klass, temp1_reg, temp2_reg, L_success, L_failure); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1731 |
check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, temp2_reg, &L_success); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1732 |
bind(L_failure); // Fallthru if not successful. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1733 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1734 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1735 |
void MacroAssembler::check_method_handle_type(Register mtype_reg, Register mh_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1736 |
Register temp_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1737 |
Label& wrong_method_type) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1738 |
assert_different_registers(mtype_reg, mh_reg, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1739 |
// Compare method type against that of the receiver. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1740 |
load_heap_oop_not_null(temp_reg, delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg), mh_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1741 |
cmpd(CCR0, temp_reg, mtype_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1742 |
bne(CCR0, wrong_method_type); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1743 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1744 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1745 |
RegisterOrConstant MacroAssembler::argument_offset(RegisterOrConstant arg_slot, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1746 |
Register temp_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1747 |
int extra_slot_offset) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1748 |
// cf. TemplateTable::prepare_invoke(), if (load_receiver). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1749 |
int stackElementSize = Interpreter::stackElementSize; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1750 |
int offset = extra_slot_offset * stackElementSize; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1751 |
if (arg_slot.is_constant()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1752 |
offset += arg_slot.as_constant() * stackElementSize; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1753 |
return offset; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1754 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1755 |
assert(temp_reg != noreg, "must specify"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1756 |
sldi(temp_reg, arg_slot.as_register(), exact_log2(stackElementSize)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1757 |
if (offset != 0) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1758 |
addi(temp_reg, temp_reg, offset); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1759 |
return temp_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1760 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1761 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1762 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1763 |
void MacroAssembler::biased_locking_enter(ConditionRegister cr_reg, Register obj_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1764 |
Register mark_reg, Register temp_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1765 |
Register temp2_reg, Label& done, Label* slow_case) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1766 |
assert(UseBiasedLocking, "why call this otherwise?"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1767 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1768 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1769 |
assert_different_registers(obj_reg, mark_reg, temp_reg, temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1770 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1771 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1772 |
Label cas_label; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1773 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1774 |
// Branch to done if fast path fails and no slow_case provided. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1775 |
Label *slow_case_int = (slow_case != NULL) ? slow_case : &done; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1776 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1777 |
// Biased locking |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1778 |
// See whether the lock is currently biased toward our thread and |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1779 |
// whether the epoch is still valid |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1780 |
// Note that the runtime guarantees sufficient alignment of JavaThread |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1781 |
// pointers to allow age to be placed into low bits |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1782 |
assert(markOopDesc::age_shift == markOopDesc::lock_bits + markOopDesc::biased_lock_bits, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1783 |
"biased locking makes assumptions about bit layout"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1784 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1785 |
if (PrintBiasedLockingStatistics) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1786 |
load_const(temp_reg, (address) BiasedLocking::total_entry_count_addr(), temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1787 |
lwz(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1788 |
addi(temp2_reg, temp2_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1789 |
stw(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1790 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1791 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1792 |
andi(temp_reg, mark_reg, markOopDesc::biased_lock_mask_in_place); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1793 |
cmpwi(cr_reg, temp_reg, markOopDesc::biased_lock_pattern); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1794 |
bne(cr_reg, cas_label); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1795 |
|
23492 | 1796 |
load_klass(temp_reg, obj_reg); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1797 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1798 |
load_const_optimized(temp2_reg, ~((int) markOopDesc::age_mask_in_place)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1799 |
ld(temp_reg, in_bytes(Klass::prototype_header_offset()), temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1800 |
orr(temp_reg, R16_thread, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1801 |
xorr(temp_reg, mark_reg, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1802 |
andr(temp_reg, temp_reg, temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1803 |
cmpdi(cr_reg, temp_reg, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1804 |
if (PrintBiasedLockingStatistics) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1805 |
Label l; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1806 |
bne(cr_reg, l); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1807 |
load_const(mark_reg, (address) BiasedLocking::biased_lock_entry_count_addr()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1808 |
lwz(temp2_reg, 0, mark_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1809 |
addi(temp2_reg, temp2_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1810 |
stw(temp2_reg, 0, mark_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1811 |
// restore mark_reg |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1812 |
ld(mark_reg, oopDesc::mark_offset_in_bytes(), obj_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1813 |
bind(l); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1814 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1815 |
beq(cr_reg, done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1816 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1817 |
Label try_revoke_bias; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1818 |
Label try_rebias; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1819 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1820 |
// At this point we know that the header has the bias pattern and |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1821 |
// that we are not the bias owner in the current epoch. We need to |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1822 |
// figure out more details about the state of the header in order to |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1823 |
// know what operations can be legally performed on the object's |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1824 |
// header. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1825 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1826 |
// If the low three bits in the xor result aren't clear, that means |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1827 |
// the prototype header is no longer biased and we have to revoke |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1828 |
// the bias on this object. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1829 |
andi(temp2_reg, temp_reg, markOopDesc::biased_lock_mask_in_place); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1830 |
cmpwi(cr_reg, temp2_reg, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1831 |
bne(cr_reg, try_revoke_bias); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1832 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1833 |
// Biasing is still enabled for this data type. See whether the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1834 |
// epoch of the current bias is still valid, meaning that the epoch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1835 |
// bits of the mark word are equal to the epoch bits of the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1836 |
// prototype header. (Note that the prototype header's epoch bits |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1837 |
// only change at a safepoint.) If not, attempt to rebias the object |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1838 |
// toward the current thread. Note that we must be absolutely sure |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1839 |
// that the current epoch is invalid in order to do this because |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1840 |
// otherwise the manipulations it performs on the mark word are |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1841 |
// illegal. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1842 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1843 |
int shift_amount = 64 - markOopDesc::epoch_shift; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1844 |
// rotate epoch bits to right (little) end and set other bits to 0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1845 |
// [ big part | epoch | little part ] -> [ 0..0 | epoch ] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1846 |
rldicl_(temp2_reg, temp_reg, shift_amount, 64 - markOopDesc::epoch_bits); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1847 |
// branch if epoch bits are != 0, i.e. they differ, because the epoch has been incremented |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1848 |
bne(CCR0, try_rebias); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1849 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1850 |
// The epoch of the current bias is still valid but we know nothing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1851 |
// about the owner; it might be set or it might be clear. Try to |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1852 |
// acquire the bias of the object using an atomic operation. If this |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1853 |
// fails we will go in to the runtime to revoke the object's bias. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1854 |
// Note that we first construct the presumed unbiased header so we |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1855 |
// don't accidentally blow away another thread's valid bias. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1856 |
andi(mark_reg, mark_reg, (markOopDesc::biased_lock_mask_in_place | |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1857 |
markOopDesc::age_mask_in_place | |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1858 |
markOopDesc::epoch_mask_in_place)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1859 |
orr(temp_reg, R16_thread, mark_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1860 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1861 |
assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1862 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1863 |
// CmpxchgX sets cr_reg to cmpX(temp2_reg, mark_reg). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1864 |
fence(); // TODO: replace by MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq ? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1865 |
cmpxchgd(/*flag=*/cr_reg, /*current_value=*/temp2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1866 |
/*compare_value=*/mark_reg, /*exchange_value=*/temp_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1867 |
/*where=*/obj_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1868 |
MacroAssembler::MemBarAcq, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1869 |
MacroAssembler::cmpxchgx_hint_acquire_lock(), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1870 |
noreg, slow_case_int); // bail out if failed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1871 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1872 |
// If the biasing toward our thread failed, this means that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1873 |
// another thread succeeded in biasing it toward itself and we |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1874 |
// need to revoke that bias. The revocation will occur in the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1875 |
// interpreter runtime in the slow case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1876 |
if (PrintBiasedLockingStatistics) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1877 |
load_const(temp_reg, (address) BiasedLocking::anonymously_biased_lock_entry_count_addr(), temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1878 |
lwz(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1879 |
addi(temp2_reg, temp2_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1880 |
stw(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1881 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1882 |
b(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1883 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1884 |
bind(try_rebias); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1885 |
// At this point we know the epoch has expired, meaning that the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1886 |
// current "bias owner", if any, is actually invalid. Under these |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1887 |
// circumstances _only_, we are allowed to use the current header's |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1888 |
// value as the comparison value when doing the cas to acquire the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1889 |
// bias in the current epoch. In other words, we allow transfer of |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1890 |
// the bias from one thread to another directly in this situation. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1891 |
andi(temp_reg, mark_reg, markOopDesc::age_mask_in_place); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1892 |
orr(temp_reg, R16_thread, temp_reg); |
23492 | 1893 |
load_klass(temp2_reg, obj_reg); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1894 |
ld(temp2_reg, in_bytes(Klass::prototype_header_offset()), temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1895 |
orr(temp_reg, temp_reg, temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1896 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1897 |
assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1898 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1899 |
// CmpxchgX sets cr_reg to cmpX(temp2_reg, mark_reg). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1900 |
fence(); // TODO: replace by MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq ? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1901 |
cmpxchgd(/*flag=*/cr_reg, /*current_value=*/temp2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1902 |
/*compare_value=*/mark_reg, /*exchange_value=*/temp_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1903 |
/*where=*/obj_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1904 |
MacroAssembler::MemBarAcq, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1905 |
MacroAssembler::cmpxchgx_hint_acquire_lock(), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1906 |
noreg, slow_case_int); // bail out if failed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1907 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1908 |
// If the biasing toward our thread failed, this means that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1909 |
// another thread succeeded in biasing it toward itself and we |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1910 |
// need to revoke that bias. The revocation will occur in the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1911 |
// interpreter runtime in the slow case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1912 |
if (PrintBiasedLockingStatistics) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1913 |
load_const(temp_reg, (address) BiasedLocking::rebiased_lock_entry_count_addr(), temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1914 |
lwz(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1915 |
addi(temp2_reg, temp2_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1916 |
stw(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1917 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1918 |
b(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1919 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1920 |
bind(try_revoke_bias); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1921 |
// The prototype mark in the klass doesn't have the bias bit set any |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1922 |
// more, indicating that objects of this data type are not supposed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1923 |
// to be biased any more. We are going to try to reset the mark of |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1924 |
// this object to the prototype value and fall through to the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1925 |
// CAS-based locking scheme. Note that if our CAS fails, it means |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1926 |
// that another thread raced us for the privilege of revoking the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1927 |
// bias of this particular object, so it's okay to continue in the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1928 |
// normal locking code. |
23492 | 1929 |
load_klass(temp_reg, obj_reg); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1930 |
ld(temp_reg, in_bytes(Klass::prototype_header_offset()), temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1931 |
andi(temp2_reg, mark_reg, markOopDesc::age_mask_in_place); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1932 |
orr(temp_reg, temp_reg, temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1933 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1934 |
assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1935 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1936 |
// CmpxchgX sets cr_reg to cmpX(temp2_reg, mark_reg). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1937 |
fence(); // TODO: replace by MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq ? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1938 |
cmpxchgd(/*flag=*/cr_reg, /*current_value=*/temp2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1939 |
/*compare_value=*/mark_reg, /*exchange_value=*/temp_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1940 |
/*where=*/obj_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1941 |
MacroAssembler::MemBarAcq, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1942 |
MacroAssembler::cmpxchgx_hint_acquire_lock()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1943 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1944 |
// reload markOop in mark_reg before continuing with lightweight locking |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1945 |
ld(mark_reg, oopDesc::mark_offset_in_bytes(), obj_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1946 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1947 |
// Fall through to the normal CAS-based lock, because no matter what |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1948 |
// the result of the above CAS, some thread must have succeeded in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1949 |
// removing the bias bit from the object's header. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1950 |
if (PrintBiasedLockingStatistics) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1951 |
Label l; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1952 |
bne(cr_reg, l); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1953 |
load_const(temp_reg, (address) BiasedLocking::revoked_lock_entry_count_addr(), temp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1954 |
lwz(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1955 |
addi(temp2_reg, temp2_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1956 |
stw(temp2_reg, 0, temp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1957 |
bind(l); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1958 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1959 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1960 |
bind(cas_label); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1961 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1962 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1963 |
void MacroAssembler::biased_locking_exit (ConditionRegister cr_reg, Register mark_addr, Register temp_reg, Label& done) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1964 |
// Check for biased locking unlock case, which is a no-op |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1965 |
// Note: we do not have to check the thread ID for two reasons. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1966 |
// First, the interpreter checks for IllegalMonitorStateException at |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1967 |
// a higher level. Second, if the bias was revoked while we held the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1968 |
// lock, the object could not be rebiased toward another thread, so |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1969 |
// the bias bit would be clear. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1970 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1971 |
ld(temp_reg, 0, mark_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1972 |
andi(temp_reg, temp_reg, markOopDesc::biased_lock_mask_in_place); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1973 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1974 |
cmpwi(cr_reg, temp_reg, markOopDesc::biased_lock_pattern); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1975 |
beq(cr_reg, done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1976 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1977 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1978 |
// "The box" is the space on the stack where we copy the object mark. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1979 |
void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register oop, Register box, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1980 |
Register temp, Register displaced_header, Register current_header) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1981 |
assert_different_registers(oop, box, temp, displaced_header, current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1982 |
assert(flag != CCR0, "bad condition register"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1983 |
Label cont; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1984 |
Label object_has_monitor; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1985 |
Label cas_failed; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1986 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1987 |
// Load markOop from object into displaced_header. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1988 |
ld(displaced_header, oopDesc::mark_offset_in_bytes(), oop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1989 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1990 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1991 |
// Always do locking in runtime. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1992 |
if (EmitSync & 0x01) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1993 |
cmpdi(flag, oop, 0); // Oop can't be 0 here => always false. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1994 |
return; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1995 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1996 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1997 |
if (UseBiasedLocking) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1998 |
biased_locking_enter(flag, oop, displaced_header, temp, current_header, cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1999 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2000 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2001 |
// Handle existing monitor. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2002 |
if ((EmitSync & 0x02) == 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2003 |
// The object has an existing monitor iff (mark & monitor_value) != 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2004 |
andi_(temp, displaced_header, markOopDesc::monitor_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2005 |
bne(CCR0, object_has_monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2006 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2007 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2008 |
// Set displaced_header to be (markOop of object | UNLOCK_VALUE). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2009 |
ori(displaced_header, displaced_header, markOopDesc::unlocked_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2010 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2011 |
// Load Compare Value application register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2012 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2013 |
// Initialize the box. (Must happen before we update the object mark!) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2014 |
std(displaced_header, BasicLock::displaced_header_offset_in_bytes(), box); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2015 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2016 |
// Must fence, otherwise, preceding store(s) may float below cmpxchg. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2017 |
// Compare object markOop with mark and if equal exchange scratch1 with object markOop. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2018 |
// CmpxchgX sets cr_reg to cmpX(current, displaced). |
22867 | 2019 |
membar(Assembler::StoreStore); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2020 |
cmpxchgd(/*flag=*/flag, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2021 |
/*current_value=*/current_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2022 |
/*compare_value=*/displaced_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2023 |
/*exchange_value=*/box, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2024 |
/*where=*/oop, |
22867 | 2025 |
MacroAssembler::MemBarAcq, |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2026 |
MacroAssembler::cmpxchgx_hint_acquire_lock(), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2027 |
noreg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2028 |
&cas_failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2029 |
assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2030 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2031 |
// If the compare-and-exchange succeeded, then we found an unlocked |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2032 |
// object and we have now locked it. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2033 |
b(cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2034 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2035 |
bind(cas_failed); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2036 |
// We did not see an unlocked object so try the fast recursive case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2037 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2038 |
// Check if the owner is self by comparing the value in the markOop of object |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2039 |
// (current_header) with the stack pointer. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2040 |
sub(current_header, current_header, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2041 |
load_const_optimized(temp, (address) (~(os::vm_page_size()-1) | |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2042 |
markOopDesc::lock_mask_in_place)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2043 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2044 |
and_(R0/*==0?*/, current_header, temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2045 |
// If condition is true we are cont and hence we can store 0 as the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2046 |
// displaced header in the box, which indicates that it is a recursive lock. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2047 |
mcrf(flag,CCR0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2048 |
std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), box); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2049 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2050 |
// Handle existing monitor. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2051 |
if ((EmitSync & 0x02) == 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2052 |
b(cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2053 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2054 |
bind(object_has_monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2055 |
// The object's monitor m is unlocked iff m->owner == NULL, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2056 |
// otherwise m->owner may contain a thread or a stack address. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2057 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2058 |
// Try to CAS m->owner from NULL to current thread. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2059 |
addi(temp, displaced_header, ObjectMonitor::owner_offset_in_bytes()-markOopDesc::monitor_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2060 |
li(displaced_header, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2061 |
// CmpxchgX sets flag to cmpX(current, displaced). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2062 |
cmpxchgd(/*flag=*/flag, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2063 |
/*current_value=*/current_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2064 |
/*compare_value=*/displaced_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2065 |
/*exchange_value=*/R16_thread, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2066 |
/*where=*/temp, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2067 |
MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2068 |
MacroAssembler::cmpxchgx_hint_acquire_lock()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2069 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2070 |
// Store a non-null value into the box. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2071 |
std(box, BasicLock::displaced_header_offset_in_bytes(), box); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2072 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2073 |
# ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2074 |
bne(flag, cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2075 |
// We have acquired the monitor, check some invariants. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2076 |
addi(/*monitor=*/temp, temp, -ObjectMonitor::owner_offset_in_bytes()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2077 |
// Invariant 1: _recursions should be 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2078 |
//assert(ObjectMonitor::recursions_size_in_bytes() == 8, "unexpected size"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2079 |
asm_assert_mem8_is_zero(ObjectMonitor::recursions_offset_in_bytes(), temp, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2080 |
"monitor->_recursions should be 0", -1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2081 |
// Invariant 2: OwnerIsThread shouldn't be 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2082 |
//assert(ObjectMonitor::OwnerIsThread_size_in_bytes() == 4, "unexpected size"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2083 |
//asm_assert_mem4_isnot_zero(ObjectMonitor::OwnerIsThread_offset_in_bytes(), temp, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2084 |
// "monitor->OwnerIsThread shouldn't be 0", -1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2085 |
# endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2086 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2087 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2088 |
bind(cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2089 |
// flag == EQ indicates success |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2090 |
// flag == NE indicates failure |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2091 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2092 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2093 |
void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Register oop, Register box, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2094 |
Register temp, Register displaced_header, Register current_header) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2095 |
assert_different_registers(oop, box, temp, displaced_header, current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2096 |
assert(flag != CCR0, "bad condition register"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2097 |
Label cont; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2098 |
Label object_has_monitor; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2099 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2100 |
// Always do locking in runtime. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2101 |
if (EmitSync & 0x01) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2102 |
cmpdi(flag, oop, 0); // Oop can't be 0 here => always false. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2103 |
return; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2104 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2105 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2106 |
if (UseBiasedLocking) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2107 |
biased_locking_exit(flag, oop, current_header, cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2108 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2109 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2110 |
// Find the lock address and load the displaced header from the stack. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2111 |
ld(displaced_header, BasicLock::displaced_header_offset_in_bytes(), box); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2112 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2113 |
// If the displaced header is 0, we have a recursive unlock. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2114 |
cmpdi(flag, displaced_header, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2115 |
beq(flag, cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2116 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2117 |
// Handle existing monitor. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2118 |
if ((EmitSync & 0x02) == 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2119 |
// The object has an existing monitor iff (mark & monitor_value) != 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2120 |
ld(current_header, oopDesc::mark_offset_in_bytes(), oop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2121 |
andi(temp, current_header, markOopDesc::monitor_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2122 |
cmpdi(flag, temp, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2123 |
bne(flag, object_has_monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2124 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2125 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2126 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2127 |
// Check if it is still a light weight lock, this is is true if we see |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2128 |
// the stack address of the basicLock in the markOop of the object. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2129 |
// Cmpxchg sets flag to cmpd(current_header, box). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2130 |
cmpxchgd(/*flag=*/flag, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2131 |
/*current_value=*/current_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2132 |
/*compare_value=*/box, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2133 |
/*exchange_value=*/displaced_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2134 |
/*where=*/oop, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2135 |
MacroAssembler::MemBarRel, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2136 |
MacroAssembler::cmpxchgx_hint_release_lock(), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2137 |
noreg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2138 |
&cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2139 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2140 |
assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2141 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2142 |
// Handle existing monitor. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2143 |
if ((EmitSync & 0x02) == 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2144 |
b(cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2145 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2146 |
bind(object_has_monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2147 |
addi(current_header, current_header, -markOopDesc::monitor_value); // monitor |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2148 |
ld(temp, ObjectMonitor::owner_offset_in_bytes(), current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2149 |
ld(displaced_header, ObjectMonitor::recursions_offset_in_bytes(), current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2150 |
xorr(temp, R16_thread, temp); // Will be 0 if we are the owner. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2151 |
orr(temp, temp, displaced_header); // Will be 0 if there are 0 recursions. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2152 |
cmpdi(flag, temp, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2153 |
bne(flag, cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2154 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2155 |
ld(temp, ObjectMonitor::EntryList_offset_in_bytes(), current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2156 |
ld(displaced_header, ObjectMonitor::cxq_offset_in_bytes(), current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2157 |
orr(temp, temp, displaced_header); // Will be 0 if both are 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2158 |
cmpdi(flag, temp, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2159 |
bne(flag, cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2160 |
release(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2161 |
std(temp, ObjectMonitor::owner_offset_in_bytes(), current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2162 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2163 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2164 |
bind(cont); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2165 |
// flag == EQ indicates success |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2166 |
// flag == NE indicates failure |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2167 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2168 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2169 |
// Write serialization page so VM thread can do a pseudo remote membar. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2170 |
// We use the current thread pointer to calculate a thread specific |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2171 |
// offset to write to within the page. This minimizes bus traffic |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2172 |
// due to cache line collision. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2173 |
void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register tmp2) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2174 |
srdi(tmp2, thread, os::get_serialize_page_shift_count()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2175 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2176 |
int mask = os::vm_page_size() - sizeof(int); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2177 |
if (Assembler::is_simm(mask, 16)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2178 |
andi(tmp2, tmp2, mask); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2179 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2180 |
lis(tmp1, (int)((signed short) (mask >> 16))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2181 |
ori(tmp1, tmp1, mask & 0x0000ffff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2182 |
andr(tmp2, tmp2, tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2183 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2184 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2185 |
load_const(tmp1, (long) os::get_memory_serialize_page()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2186 |
release(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2187 |
stwx(R0, tmp1, tmp2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2188 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2189 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2190 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2191 |
// GC barrier helper macros |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2192 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2193 |
// Write the card table byte if needed. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2194 |
void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2195 |
CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2196 |
assert(bs->kind() == BarrierSet::CardTableModRef || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2197 |
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2198 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2199 |
cmpdi(CCR0, Rnew_val, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2200 |
asm_assert_ne("null oop not allowed", 0x321); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2201 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2202 |
card_table_write(bs->byte_map_base, Rtmp, Rstore_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2203 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2204 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2205 |
// Write the card table byte. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2206 |
void MacroAssembler::card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2207 |
assert_different_registers(Robj, Rtmp, R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2208 |
load_const_optimized(Rtmp, (address)byte_map_base, R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2209 |
srdi(Robj, Robj, CardTableModRefBS::card_shift); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2210 |
li(R0, 0); // dirty |
22867 | 2211 |
if (UseConcMarkSweepGC) membar(Assembler::StoreStore); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2212 |
stbx(R0, Rtmp, Robj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2213 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2214 |
|
23492 | 2215 |
#if INCLUDE_ALL_GCS |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2216 |
// General G1 pre-barrier generator. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2217 |
// Goal: record the previous value if it is not null. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2218 |
void MacroAssembler::g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2219 |
Register Rtmp1, Register Rtmp2, bool needs_frame) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2220 |
Label runtime, filtered; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2221 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2222 |
// Is marking active? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2223 |
if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2224 |
lwz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2225 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2226 |
guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2227 |
lbz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2228 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2229 |
cmpdi(CCR0, Rtmp1, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2230 |
beq(CCR0, filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2231 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2232 |
// Do we need to load the previous value? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2233 |
if (Robj != noreg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2234 |
// Load the previous value... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2235 |
if (UseCompressedOops) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2236 |
lwz(Rpre_val, offset, Robj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2237 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2238 |
ld(Rpre_val, offset, Robj); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2239 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2240 |
// Previous value has been loaded into Rpre_val. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2241 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2242 |
assert(Rpre_val != noreg, "must have a real register"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2243 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2244 |
// Is the previous value null? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2245 |
cmpdi(CCR0, Rpre_val, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2246 |
beq(CCR0, filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2247 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2248 |
if (Robj != noreg && UseCompressedOops) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2249 |
decode_heap_oop_not_null(Rpre_val); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2250 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2251 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2252 |
// OK, it's not filtered, so we'll need to call enqueue. In the normal |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2253 |
// case, pre_val will be a scratch G-reg, but there are some cases in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2254 |
// which it's an O-reg. In the first case, do a normal call. In the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2255 |
// latter, do a save here and call the frameless version. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2256 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2257 |
// Can we store original value in the thread's buffer? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2258 |
// Is index == 0? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2259 |
// (The index field is typed as size_t.) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2260 |
const Register Rbuffer = Rtmp1, Rindex = Rtmp2; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2261 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2262 |
ld(Rindex, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2263 |
cmpdi(CCR0, Rindex, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2264 |
beq(CCR0, runtime); // If index == 0, goto runtime. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2265 |
ld(Rbuffer, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2266 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2267 |
addi(Rindex, Rindex, -wordSize); // Decrement index. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2268 |
std(Rindex, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2269 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2270 |
// Record the previous value. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2271 |
stdx(Rpre_val, Rbuffer, Rindex); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2272 |
b(filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2273 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2274 |
bind(runtime); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2275 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2276 |
// VM call need frame to access(write) O register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2277 |
if (needs_frame) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2278 |
save_LR_CR(Rtmp1); |
23211 | 2279 |
push_frame_reg_args(0, Rtmp2); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2280 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2281 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2282 |
if (Rpre_val->is_volatile() && Robj == noreg) mr(R31, Rpre_val); // Save pre_val across C call if it was preloaded. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2283 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), Rpre_val, R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2284 |
if (Rpre_val->is_volatile() && Robj == noreg) mr(Rpre_val, R31); // restore |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2285 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2286 |
if (needs_frame) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2287 |
pop_frame(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2288 |
restore_LR_CR(Rtmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2289 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2290 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2291 |
bind(filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2292 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2293 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2294 |
// General G1 post-barrier generator |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2295 |
// Store cross-region card. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2296 |
void MacroAssembler::g1_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp1, Register Rtmp2, Register Rtmp3, Label *filtered_ext) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2297 |
Label runtime, filtered_int; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2298 |
Label& filtered = (filtered_ext != NULL) ? *filtered_ext : filtered_int; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2299 |
assert_different_registers(Rstore_addr, Rnew_val, Rtmp1, Rtmp2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2300 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2301 |
G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2302 |
assert(bs->kind() == BarrierSet::G1SATBCT || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2303 |
bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2304 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2305 |
// Does store cross heap regions? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2306 |
if (G1RSBarrierRegionFilter) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2307 |
xorr(Rtmp1, Rstore_addr, Rnew_val); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2308 |
srdi_(Rtmp1, Rtmp1, HeapRegion::LogOfHRGrainBytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2309 |
beq(CCR0, filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2310 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2311 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2312 |
// Crosses regions, storing NULL? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2313 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2314 |
cmpdi(CCR0, Rnew_val, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2315 |
asm_assert_ne("null oop not allowed (G1)", 0x322); // Checked by caller on PPC64, so following branch is obsolete: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2316 |
//beq(CCR0, filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2317 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2318 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2319 |
// Storing region crossing non-NULL, is card already dirty? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2320 |
assert(sizeof(*bs->byte_map_base) == sizeof(jbyte), "adjust this code"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2321 |
const Register Rcard_addr = Rtmp1; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2322 |
Register Rbase = Rtmp2; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2323 |
load_const_optimized(Rbase, (address)bs->byte_map_base, /*temp*/ Rtmp3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2324 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2325 |
srdi(Rcard_addr, Rstore_addr, CardTableModRefBS::card_shift); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2326 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2327 |
// Get the address of the card. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2328 |
lbzx(/*card value*/ Rtmp3, Rbase, Rcard_addr); |
23492 | 2329 |
cmpwi(CCR0, Rtmp3, (int)G1SATBCardTableModRefBS::g1_young_card_val()); |
2330 |
beq(CCR0, filtered); |
|
2331 |
||
2332 |
membar(Assembler::StoreLoad); |
|
2333 |
lbzx(/*card value*/ Rtmp3, Rbase, Rcard_addr); // Reload after membar. |
|
2334 |
cmpwi(CCR0, Rtmp3 /* card value */, CardTableModRefBS::dirty_card_val()); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2335 |
beq(CCR0, filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2336 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2337 |
// Storing a region crossing, non-NULL oop, card is clean. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2338 |
// Dirty card and log. |
23492 | 2339 |
li(Rtmp3, CardTableModRefBS::dirty_card_val()); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2340 |
//release(); // G1: oops are allowed to get visible after dirty marking. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2341 |
stbx(Rtmp3, Rbase, Rcard_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2342 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2343 |
add(Rcard_addr, Rbase, Rcard_addr); // This is the address which needs to get enqueued. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2344 |
Rbase = noreg; // end of lifetime |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2345 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2346 |
const Register Rqueue_index = Rtmp2, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2347 |
Rqueue_buf = Rtmp3; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2348 |
ld(Rqueue_index, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2349 |
cmpdi(CCR0, Rqueue_index, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2350 |
beq(CCR0, runtime); // index == 0 then jump to runtime |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2351 |
ld(Rqueue_buf, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2352 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2353 |
addi(Rqueue_index, Rqueue_index, -wordSize); // decrement index |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2354 |
std(Rqueue_index, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2355 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2356 |
stdx(Rcard_addr, Rqueue_buf, Rqueue_index); // store card |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2357 |
b(filtered); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2358 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2359 |
bind(runtime); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2360 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2361 |
// Save the live input values. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2362 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), Rcard_addr, R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2363 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2364 |
bind(filtered_int); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2365 |
} |
23492 | 2366 |
#endif // INCLUDE_ALL_GCS |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2367 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2368 |
// Values for last_Java_pc, and last_Java_sp must comply to the rules |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2369 |
// in frame_ppc64.hpp. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2370 |
void MacroAssembler::set_last_Java_frame(Register last_Java_sp, Register last_Java_pc) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2371 |
// Always set last_Java_pc and flags first because once last_Java_sp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2372 |
// is visible has_last_Java_frame is true and users will look at the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2373 |
// rest of the fields. (Note: flags should always be zero before we |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2374 |
// get here so doesn't need to be set.) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2375 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2376 |
// Verify that last_Java_pc was zeroed on return to Java |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2377 |
asm_assert_mem8_is_zero(in_bytes(JavaThread::last_Java_pc_offset()), R16_thread, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2378 |
"last_Java_pc not zeroed before leaving Java", 0x200); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2379 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2380 |
// When returning from calling out from Java mode the frame anchor's |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2381 |
// last_Java_pc will always be set to NULL. It is set here so that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2382 |
// if we are doing a call to native (not VM) that we capture the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2383 |
// known pc and don't have to rely on the native call having a |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2384 |
// standard frame linkage where we can find the pc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2385 |
if (last_Java_pc != noreg) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2386 |
std(last_Java_pc, in_bytes(JavaThread::last_Java_pc_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2387 |
|
22861 | 2388 |
// Set last_Java_sp last. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2389 |
std(last_Java_sp, in_bytes(JavaThread::last_Java_sp_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2390 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2391 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2392 |
void MacroAssembler::reset_last_Java_frame(void) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2393 |
asm_assert_mem8_isnot_zero(in_bytes(JavaThread::last_Java_sp_offset()), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2394 |
R16_thread, "SP was not set, still zero", 0x202); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2395 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2396 |
BLOCK_COMMENT("reset_last_Java_frame {"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2397 |
li(R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2398 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2399 |
// _last_Java_sp = 0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2400 |
std(R0, in_bytes(JavaThread::last_Java_sp_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2401 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2402 |
// _last_Java_pc = 0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2403 |
std(R0, in_bytes(JavaThread::last_Java_pc_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2404 |
BLOCK_COMMENT("} reset_last_Java_frame"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2405 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2406 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2407 |
void MacroAssembler::set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2408 |
assert_different_registers(sp, tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2409 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2410 |
// sp points to a TOP_IJAVA_FRAME, retrieve frame's PC via |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2411 |
// TOP_IJAVA_FRAME_ABI. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2412 |
// FIXME: assert that we really have a TOP_IJAVA_FRAME here! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2413 |
#ifdef CC_INTERP |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2414 |
ld(tmp1/*pc*/, _top_ijava_frame_abi(frame_manager_lr), sp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2415 |
#else |
23221 | 2416 |
address entry = pc(); |
2417 |
load_const_optimized(tmp1, entry); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2418 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2419 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2420 |
set_last_Java_frame(/*sp=*/sp, /*pc=*/tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2421 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2422 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2423 |
void MacroAssembler::get_vm_result(Register oop_result) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2424 |
// Read: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2425 |
// R16_thread |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2426 |
// R16_thread->in_bytes(JavaThread::vm_result_offset()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2427 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2428 |
// Updated: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2429 |
// oop_result |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2430 |
// R16_thread->in_bytes(JavaThread::vm_result_offset()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2431 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2432 |
ld(oop_result, in_bytes(JavaThread::vm_result_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2433 |
li(R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2434 |
std(R0, in_bytes(JavaThread::vm_result_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2435 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2436 |
verify_oop(oop_result); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2437 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2438 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2439 |
void MacroAssembler::get_vm_result_2(Register metadata_result) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2440 |
// Read: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2441 |
// R16_thread |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2442 |
// R16_thread->in_bytes(JavaThread::vm_result_2_offset()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2443 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2444 |
// Updated: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2445 |
// metadata_result |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2446 |
// R16_thread->in_bytes(JavaThread::vm_result_2_offset()) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2447 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2448 |
ld(metadata_result, in_bytes(JavaThread::vm_result_2_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2449 |
li(R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2450 |
std(R0, in_bytes(JavaThread::vm_result_2_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2451 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2452 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2453 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2454 |
void MacroAssembler::encode_klass_not_null(Register dst, Register src) { |
22867 | 2455 |
Register current = (src != noreg) ? src : dst; // Klass is in dst if no src provided. |
22843
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2456 |
if (Universe::narrow_klass_base() != 0) { |
23492 | 2457 |
// Use dst as temp if it is free. |
2458 |
load_const(R0, Universe::narrow_klass_base(), (dst != current && dst != R0) ? dst : noreg); |
|
22867 | 2459 |
sub(dst, current, R0); |
2460 |
current = dst; |
|
22843
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2461 |
} |
22867 | 2462 |
if (Universe::narrow_klass_shift() != 0) { |
2463 |
srdi(dst, current, Universe::narrow_klass_shift()); |
|
2464 |
current = dst; |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2465 |
} |
22867 | 2466 |
mr_if_needed(dst, current); // Move may be required. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2467 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2468 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2469 |
void MacroAssembler::store_klass(Register dst_oop, Register klass, Register ck) { |
22840
e544827769a7
8027965: Adapt PPC to 8015107: NPG: Use consistent naming for metaspace concepts
goetz
parents:
22829
diff
changeset
|
2470 |
if (UseCompressedClassPointers) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2471 |
encode_klass_not_null(ck, klass); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2472 |
stw(ck, oopDesc::klass_offset_in_bytes(), dst_oop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2473 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2474 |
std(klass, oopDesc::klass_offset_in_bytes(), dst_oop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2475 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2476 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2477 |
|
23221 | 2478 |
void MacroAssembler::store_klass_gap(Register dst_oop, Register val) { |
2479 |
if (UseCompressedClassPointers) { |
|
2480 |
if (val == noreg) { |
|
2481 |
val = R0; |
|
2482 |
li(val, 0); |
|
2483 |
} |
|
2484 |
stw(val, oopDesc::klass_gap_offset_in_bytes(), dst_oop); // klass gap if compressed |
|
2485 |
} |
|
2486 |
} |
|
2487 |
||
22843
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2488 |
int MacroAssembler::instr_size_for_decode_klass_not_null() { |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2489 |
if (!UseCompressedClassPointers) return 0; |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2490 |
int num_instrs = 1; // shift or move |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2491 |
if (Universe::narrow_klass_base() != 0) num_instrs = 7; // shift + load const + add |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2492 |
return num_instrs * BytesPerInstWord; |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2493 |
} |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2494 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2495 |
void MacroAssembler::decode_klass_not_null(Register dst, Register src) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2496 |
if (src == noreg) src = dst; |
22829 | 2497 |
Register shifted_src = src; |
22843
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2498 |
if (Universe::narrow_klass_shift() != 0 || |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2499 |
Universe::narrow_klass_base() == 0 && src != dst) { // Move required. |
22829 | 2500 |
shifted_src = dst; |
2501 |
sldi(shifted_src, src, Universe::narrow_klass_shift()); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2502 |
} |
22843
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2503 |
if (Universe::narrow_klass_base() != 0) { |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2504 |
load_const(R0, Universe::narrow_klass_base()); |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2505 |
add(dst, shifted_src, R0); |
b245fac3b6a4
8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents:
22840
diff
changeset
|
2506 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2507 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2508 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2509 |
void MacroAssembler::load_klass(Register dst, Register src) { |
22840
e544827769a7
8027965: Adapt PPC to 8015107: NPG: Use consistent naming for metaspace concepts
goetz
parents:
22829
diff
changeset
|
2510 |
if (UseCompressedClassPointers) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2511 |
lwz(dst, oopDesc::klass_offset_in_bytes(), src); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2512 |
// Attention: no null check here! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2513 |
decode_klass_not_null(dst, dst); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2514 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2515 |
ld(dst, oopDesc::klass_offset_in_bytes(), src); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2516 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2517 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2518 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2519 |
void MacroAssembler::load_klass_with_trap_null_check(Register dst, Register src) { |
22852
1063026e8cee
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents:
22843
diff
changeset
|
2520 |
if (!os::zero_page_read_protected()) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2521 |
if (TrapBasedNullChecks) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2522 |
trap_null_check(src); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2523 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2524 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2525 |
load_klass(dst, src); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2526 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2527 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2528 |
void MacroAssembler::reinit_heapbase(Register d, Register tmp) { |
22829 | 2529 |
if (Universe::heap() != NULL) { |
2530 |
if (Universe::narrow_oop_base() == NULL) { |
|
2531 |
Assembler::xorr(R30, R30, R30); |
|
2532 |
} else { |
|
2533 |
load_const(R30, Universe::narrow_ptrs_base(), tmp); |
|
2534 |
} |
|
2535 |
} else { |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2536 |
load_const(R30, Universe::narrow_ptrs_base_addr(), tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2537 |
ld(R30, 0, R30); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2538 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2539 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2540 |
|
22861 | 2541 |
// Clear Array |
2542 |
// Kills both input registers. tmp == R0 is allowed. |
|
2543 |
void MacroAssembler::clear_memory_doubleword(Register base_ptr, Register cnt_dwords, Register tmp) { |
|
2544 |
// Procedure for large arrays (uses data cache block zero instruction). |
|
2545 |
Label startloop, fast, fastloop, small_rest, restloop, done; |
|
2546 |
const int cl_size = VM_Version::get_cache_line_size(), |
|
2547 |
cl_dwords = cl_size>>3, |
|
2548 |
cl_dw_addr_bits = exact_log2(cl_dwords), |
|
2549 |
dcbz_min = 1; // Min count of dcbz executions, needs to be >0. |
|
2550 |
||
2551 |
//2: |
|
2552 |
cmpdi(CCR1, cnt_dwords, ((dcbz_min+1)<<cl_dw_addr_bits)-1); // Big enough? (ensure >=dcbz_min lines included). |
|
2553 |
blt(CCR1, small_rest); // Too small. |
|
2554 |
rldicl_(tmp, base_ptr, 64-3, 64-cl_dw_addr_bits); // Extract dword offset within first cache line. |
|
2555 |
beq(CCR0, fast); // Already 128byte aligned. |
|
2556 |
||
2557 |
subfic(tmp, tmp, cl_dwords); |
|
2558 |
mtctr(tmp); // Set ctr to hit 128byte boundary (0<ctr<cl_dwords). |
|
2559 |
subf(cnt_dwords, tmp, cnt_dwords); // rest. |
|
2560 |
li(tmp, 0); |
|
2561 |
//10: |
|
2562 |
bind(startloop); // Clear at the beginning to reach 128byte boundary. |
|
2563 |
std(tmp, 0, base_ptr); // Clear 8byte aligned block. |
|
2564 |
addi(base_ptr, base_ptr, 8); |
|
2565 |
bdnz(startloop); |
|
2566 |
//13: |
|
2567 |
bind(fast); // Clear 128byte blocks. |
|
2568 |
srdi(tmp, cnt_dwords, cl_dw_addr_bits); // Loop count for 128byte loop (>0). |
|
2569 |
andi(cnt_dwords, cnt_dwords, cl_dwords-1); // Rest in dwords. |
|
2570 |
mtctr(tmp); // Load counter. |
|
2571 |
//16: |
|
2572 |
bind(fastloop); |
|
2573 |
dcbz(base_ptr); // Clear 128byte aligned block. |
|
2574 |
addi(base_ptr, base_ptr, cl_size); |
|
2575 |
bdnz(fastloop); |
|
2576 |
if (InsertEndGroupPPC64) { endgroup(); } else { nop(); } |
|
2577 |
//20: |
|
2578 |
bind(small_rest); |
|
2579 |
cmpdi(CCR0, cnt_dwords, 0); // size 0? |
|
2580 |
beq(CCR0, done); // rest == 0 |
|
2581 |
li(tmp, 0); |
|
2582 |
mtctr(cnt_dwords); // Load counter. |
|
2583 |
//24: |
|
2584 |
bind(restloop); // Clear rest. |
|
2585 |
std(tmp, 0, base_ptr); // Clear 8byte aligned block. |
|
2586 |
addi(base_ptr, base_ptr, 8); |
|
2587 |
bdnz(restloop); |
|
2588 |
//27: |
|
2589 |
bind(done); |
|
2590 |
} |
|
2591 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2592 |
/////////////////////////////////////////// String intrinsics //////////////////////////////////////////// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2593 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2594 |
// Search for a single jchar in an jchar[]. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2595 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2596 |
// Assumes that result differs from all other registers. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2597 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2598 |
// Haystack, needle are the addresses of jchar-arrays. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2599 |
// NeedleChar is needle[0] if it is known at compile time. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2600 |
// Haycnt is the length of the haystack. We assume haycnt >=1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2601 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2602 |
// Preserves haystack, haycnt, kills all other registers. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2603 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2604 |
// If needle == R0, we search for the constant needleChar. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2605 |
void MacroAssembler::string_indexof_1(Register result, Register haystack, Register haycnt, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2606 |
Register needle, jchar needleChar, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2607 |
Register tmp1, Register tmp2) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2608 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2609 |
assert_different_registers(result, haystack, haycnt, needle, tmp1, tmp2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2610 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2611 |
Label L_InnerLoop, L_FinalCheck, L_Found1, L_Found2, L_Found3, L_NotFound, L_End; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2612 |
Register needle0 = needle, // Contains needle[0]. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2613 |
addr = tmp1, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2614 |
ch1 = tmp2, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2615 |
ch2 = R0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2616 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2617 |
//2 (variable) or 3 (const): |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2618 |
if (needle != R0) lhz(needle0, 0, needle); // Preload needle character, needle has len==1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2619 |
dcbtct(haystack, 0x00); // Indicate R/O access to haystack. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2620 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2621 |
srwi_(tmp2, haycnt, 1); // Shift right by exact_log2(UNROLL_FACTOR). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2622 |
mr(addr, haystack); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2623 |
beq(CCR0, L_FinalCheck); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2624 |
mtctr(tmp2); // Move to count register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2625 |
//8: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2626 |
bind(L_InnerLoop); // Main work horse (2x unrolled search loop). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2627 |
lhz(ch1, 0, addr); // Load characters from haystack. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2628 |
lhz(ch2, 2, addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2629 |
(needle != R0) ? cmpw(CCR0, ch1, needle0) : cmplwi(CCR0, ch1, needleChar); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2630 |
(needle != R0) ? cmpw(CCR1, ch2, needle0) : cmplwi(CCR1, ch2, needleChar); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2631 |
beq(CCR0, L_Found1); // Did we find the needle? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2632 |
beq(CCR1, L_Found2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2633 |
addi(addr, addr, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2634 |
bdnz(L_InnerLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2635 |
//16: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2636 |
bind(L_FinalCheck); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2637 |
andi_(R0, haycnt, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2638 |
beq(CCR0, L_NotFound); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2639 |
lhz(ch1, 0, addr); // One position left at which we have to compare. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2640 |
(needle != R0) ? cmpw(CCR1, ch1, needle0) : cmplwi(CCR1, ch1, needleChar); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2641 |
beq(CCR1, L_Found3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2642 |
//21: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2643 |
bind(L_NotFound); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2644 |
li(result, -1); // Not found. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2645 |
b(L_End); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2646 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2647 |
bind(L_Found2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2648 |
addi(addr, addr, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2649 |
//24: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2650 |
bind(L_Found1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2651 |
bind(L_Found3); // Return index ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2652 |
subf(addr, haystack, addr); // relative to haystack, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2653 |
srdi(result, addr, 1); // in characters. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2654 |
bind(L_End); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2655 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2656 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2657 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2658 |
// Implementation of IndexOf for jchar arrays. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2659 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2660 |
// The length of haystack and needle are not constant, i.e. passed in a register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2661 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2662 |
// Preserves registers haystack, needle. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2663 |
// Kills registers haycnt, needlecnt. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2664 |
// Assumes that result differs from all other registers. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2665 |
// Haystack, needle are the addresses of jchar-arrays. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2666 |
// Haycnt, needlecnt are the lengths of them, respectively. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2667 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2668 |
// Needlecntval must be zero or 15-bit unsigned immediate and > 1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2669 |
void MacroAssembler::string_indexof(Register result, Register haystack, Register haycnt, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2670 |
Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2671 |
Register tmp1, Register tmp2, Register tmp3, Register tmp4) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2672 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2673 |
// Ensure 0<needlecnt<=haycnt in ideal graph as prerequisite! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2674 |
Label L_TooShort, L_Found, L_NotFound, L_End; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2675 |
Register last_addr = haycnt, // Kill haycnt at the beginning. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2676 |
addr = tmp1, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2677 |
n_start = tmp2, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2678 |
ch1 = tmp3, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2679 |
ch2 = R0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2680 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2681 |
// ************************************************************************************************** |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2682 |
// Prepare for main loop: optimized for needle count >=2, bail out otherwise. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2683 |
// ************************************************************************************************** |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2684 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2685 |
//1 (variable) or 3 (const): |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2686 |
dcbtct(needle, 0x00); // Indicate R/O access to str1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2687 |
dcbtct(haystack, 0x00); // Indicate R/O access to str2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2688 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2689 |
// Compute last haystack addr to use if no match gets found. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2690 |
if (needlecntval == 0) { // variable needlecnt |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2691 |
//3: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2692 |
subf(ch1, needlecnt, haycnt); // Last character index to compare is haycnt-needlecnt. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2693 |
addi(addr, haystack, -2); // Accesses use pre-increment. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2694 |
cmpwi(CCR6, needlecnt, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2695 |
blt(CCR6, L_TooShort); // Variable needlecnt: handle short needle separately. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2696 |
slwi(ch1, ch1, 1); // Scale to number of bytes. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2697 |
lwz(n_start, 0, needle); // Load first 2 characters of needle. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2698 |
add(last_addr, haystack, ch1); // Point to last address to compare (haystack+2*(haycnt-needlecnt)). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2699 |
addi(needlecnt, needlecnt, -2); // Rest of needle. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2700 |
} else { // constant needlecnt |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2701 |
guarantee(needlecntval != 1, "IndexOf with single-character needle must be handled separately"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2702 |
assert((needlecntval & 0x7fff) == needlecntval, "wrong immediate"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2703 |
//5: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2704 |
addi(ch1, haycnt, -needlecntval); // Last character index to compare is haycnt-needlecnt. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2705 |
lwz(n_start, 0, needle); // Load first 2 characters of needle. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2706 |
addi(addr, haystack, -2); // Accesses use pre-increment. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2707 |
slwi(ch1, ch1, 1); // Scale to number of bytes. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2708 |
add(last_addr, haystack, ch1); // Point to last address to compare (haystack+2*(haycnt-needlecnt)). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2709 |
li(needlecnt, needlecntval-2); // Rest of needle. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2710 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2711 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2712 |
// Main Loop (now we have at least 3 characters). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2713 |
//11: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2714 |
Label L_OuterLoop, L_InnerLoop, L_FinalCheck, L_Comp1, L_Comp2, L_Comp3; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2715 |
bind(L_OuterLoop); // Search for 1st 2 characters. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2716 |
Register addr_diff = tmp4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2717 |
subf(addr_diff, addr, last_addr); // Difference between already checked address and last address to check. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2718 |
addi(addr, addr, 2); // This is the new address we want to use for comparing. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2719 |
srdi_(ch2, addr_diff, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2720 |
beq(CCR0, L_FinalCheck); // 2 characters left? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2721 |
mtctr(ch2); // addr_diff/4 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2722 |
//16: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2723 |
bind(L_InnerLoop); // Main work horse (2x unrolled search loop) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2724 |
lwz(ch1, 0, addr); // Load 2 characters of haystack (ignore alignment). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2725 |
lwz(ch2, 2, addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2726 |
cmpw(CCR0, ch1, n_start); // Compare 2 characters (1 would be sufficient but try to reduce branches to CompLoop). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2727 |
cmpw(CCR1, ch2, n_start); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2728 |
beq(CCR0, L_Comp1); // Did we find the needle start? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2729 |
beq(CCR1, L_Comp2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2730 |
addi(addr, addr, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2731 |
bdnz(L_InnerLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2732 |
//24: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2733 |
bind(L_FinalCheck); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2734 |
rldicl_(addr_diff, addr_diff, 64-1, 63); // Remaining characters not covered by InnerLoop: (addr_diff>>1)&1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2735 |
beq(CCR0, L_NotFound); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2736 |
lwz(ch1, 0, addr); // One position left at which we have to compare. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2737 |
cmpw(CCR1, ch1, n_start); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2738 |
beq(CCR1, L_Comp3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2739 |
//29: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2740 |
bind(L_NotFound); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2741 |
li(result, -1); // not found |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2742 |
b(L_End); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2743 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2744 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2745 |
// ************************************************************************************************** |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2746 |
// Special Case: unfortunately, the variable needle case can be called with needlecnt<2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2747 |
// ************************************************************************************************** |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2748 |
//31: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2749 |
if ((needlecntval>>1) !=1 ) { // Const needlecnt is 2 or 3? Reduce code size. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2750 |
int nopcnt = 5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2751 |
if (needlecntval !=0 ) ++nopcnt; // Balance alignment (other case: see below). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2752 |
if (needlecntval == 0) { // We have to handle these cases separately. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2753 |
Label L_OneCharLoop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2754 |
bind(L_TooShort); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2755 |
mtctr(haycnt); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2756 |
lhz(n_start, 0, needle); // First character of needle |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2757 |
bind(L_OneCharLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2758 |
lhzu(ch1, 2, addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2759 |
cmpw(CCR1, ch1, n_start); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2760 |
beq(CCR1, L_Found); // Did we find the one character needle? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2761 |
bdnz(L_OneCharLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2762 |
li(result, -1); // Not found. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2763 |
b(L_End); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2764 |
} // 8 instructions, so no impact on alignment. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2765 |
for (int x = 0; x < nopcnt; ++x) nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2766 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2767 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2768 |
// ************************************************************************************************** |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2769 |
// Regular Case Part II: compare rest of needle (first 2 characters have been compared already) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2770 |
// ************************************************************************************************** |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2771 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2772 |
// Compare the rest |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2773 |
//36 if needlecntval==0, else 37: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2774 |
bind(L_Comp2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2775 |
addi(addr, addr, 2); // First comparison has failed, 2nd one hit. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2776 |
bind(L_Comp1); // Addr points to possible needle start. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2777 |
bind(L_Comp3); // Could have created a copy and use a different return address but saving code size here. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2778 |
if (needlecntval != 2) { // Const needlecnt==2? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2779 |
if (needlecntval != 3) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2780 |
if (needlecntval == 0) beq(CCR6, L_Found); // Variable needlecnt==2? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2781 |
Register ind_reg = tmp4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2782 |
li(ind_reg, 2*2); // First 2 characters are already compared, use index 2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2783 |
mtctr(needlecnt); // Decremented by 2, still > 0. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2784 |
//40: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2785 |
Label L_CompLoop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2786 |
bind(L_CompLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2787 |
lhzx(ch2, needle, ind_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2788 |
lhzx(ch1, addr, ind_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2789 |
cmpw(CCR1, ch1, ch2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2790 |
bne(CCR1, L_OuterLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2791 |
addi(ind_reg, ind_reg, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2792 |
bdnz(L_CompLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2793 |
} else { // No loop required if there's only one needle character left. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2794 |
lhz(ch2, 2*2, needle); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2795 |
lhz(ch1, 2*2, addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2796 |
cmpw(CCR1, ch1, ch2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2797 |
bne(CCR1, L_OuterLoop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2798 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2799 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2800 |
// Return index ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2801 |
//46: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2802 |
bind(L_Found); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2803 |
subf(addr, haystack, addr); // relative to haystack, ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2804 |
srdi(result, addr, 1); // in characters. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2805 |
//48: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2806 |
bind(L_End); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2807 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2808 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2809 |
// Implementation of Compare for jchar arrays. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2810 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2811 |
// Kills the registers str1, str2, cnt1, cnt2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2812 |
// Kills cr0, ctr. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2813 |
// Assumes that result differes from the input registers. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2814 |
void MacroAssembler::string_compare(Register str1_reg, Register str2_reg, Register cnt1_reg, Register cnt2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2815 |
Register result_reg, Register tmp_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2816 |
assert_different_registers(result_reg, str1_reg, str2_reg, cnt1_reg, cnt2_reg, tmp_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2817 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2818 |
Label Ldone, Lslow_case, Lslow_loop, Lfast_loop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2819 |
Register cnt_diff = R0, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2820 |
limit_reg = cnt1_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2821 |
chr1_reg = result_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2822 |
chr2_reg = cnt2_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2823 |
addr_diff = str2_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2824 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2825 |
// Offset 0 should be 32 byte aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2826 |
//-4: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2827 |
dcbtct(str1_reg, 0x00); // Indicate R/O access to str1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2828 |
dcbtct(str2_reg, 0x00); // Indicate R/O access to str2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2829 |
//-2: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2830 |
// Compute min(cnt1, cnt2) and check if 0 (bail out if we don't need to compare characters). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2831 |
subf(result_reg, cnt2_reg, cnt1_reg); // difference between cnt1/2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2832 |
subf_(addr_diff, str1_reg, str2_reg); // alias? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2833 |
beq(CCR0, Ldone); // return cnt difference if both ones are identical |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2834 |
srawi(limit_reg, result_reg, 31); // generate signmask (cnt1/2 must be non-negative so cnt_diff can't overflow) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2835 |
mr(cnt_diff, result_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2836 |
andr(limit_reg, result_reg, limit_reg); // difference or zero (negative): cnt1<cnt2 ? cnt1-cnt2 : 0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2837 |
add_(limit_reg, cnt2_reg, limit_reg); // min(cnt1, cnt2)==0? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2838 |
beq(CCR0, Ldone); // return cnt difference if one has 0 length |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2839 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2840 |
lhz(chr1_reg, 0, str1_reg); // optional: early out if first characters mismatch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2841 |
lhzx(chr2_reg, str1_reg, addr_diff); // optional: early out if first characters mismatch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2842 |
addi(tmp_reg, limit_reg, -1); // min(cnt1, cnt2)-1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2843 |
subf_(result_reg, chr2_reg, chr1_reg); // optional: early out if first characters mismatch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2844 |
bne(CCR0, Ldone); // optional: early out if first characters mismatch |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2845 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2846 |
// Set loop counter by scaling down tmp_reg |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2847 |
srawi_(chr2_reg, tmp_reg, exact_log2(4)); // (min(cnt1, cnt2)-1)/4 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2848 |
ble(CCR0, Lslow_case); // need >4 characters for fast loop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2849 |
andi(limit_reg, tmp_reg, 4-1); // remaining characters |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2850 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2851 |
// Adapt str1_reg str2_reg for the first loop iteration |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2852 |
mtctr(chr2_reg); // (min(cnt1, cnt2)-1)/4 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2853 |
addi(limit_reg, limit_reg, 4+1); // compare last 5-8 characters in slow_case if mismatch found in fast_loop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2854 |
//16: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2855 |
// Compare the rest of the characters |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2856 |
bind(Lfast_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2857 |
ld(chr1_reg, 0, str1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2858 |
ldx(chr2_reg, str1_reg, addr_diff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2859 |
cmpd(CCR0, chr2_reg, chr1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2860 |
bne(CCR0, Lslow_case); // return chr1_reg |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2861 |
addi(str1_reg, str1_reg, 4*2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2862 |
bdnz(Lfast_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2863 |
addi(limit_reg, limit_reg, -4); // no mismatch found in fast_loop, only 1-4 characters missing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2864 |
//23: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2865 |
bind(Lslow_case); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2866 |
mtctr(limit_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2867 |
//24: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2868 |
bind(Lslow_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2869 |
lhz(chr1_reg, 0, str1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2870 |
lhzx(chr2_reg, str1_reg, addr_diff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2871 |
subf_(result_reg, chr2_reg, chr1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2872 |
bne(CCR0, Ldone); // return chr1_reg |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2873 |
addi(str1_reg, str1_reg, 1*2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2874 |
bdnz(Lslow_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2875 |
//30: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2876 |
// If strings are equal up to min length, return the length difference. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2877 |
mr(result_reg, cnt_diff); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2878 |
nop(); // alignment |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2879 |
//32: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2880 |
// Otherwise, return the difference between the first mismatched chars. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2881 |
bind(Ldone); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2882 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2883 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2884 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2885 |
// Compare char[] arrays. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2886 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2887 |
// str1_reg USE only |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2888 |
// str2_reg USE only |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2889 |
// cnt_reg USE_DEF, due to tmp reg shortage |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2890 |
// result_reg DEF only, might compromise USE only registers |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2891 |
void MacroAssembler::char_arrays_equals(Register str1_reg, Register str2_reg, Register cnt_reg, Register result_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2892 |
Register tmp1_reg, Register tmp2_reg, Register tmp3_reg, Register tmp4_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2893 |
Register tmp5_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2894 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2895 |
// Str1 may be the same register as str2 which can occur e.g. after scalar replacement. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2896 |
assert_different_registers(result_reg, str1_reg, cnt_reg, tmp1_reg, tmp2_reg, tmp3_reg, tmp4_reg, tmp5_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2897 |
assert_different_registers(result_reg, str2_reg, cnt_reg, tmp1_reg, tmp2_reg, tmp3_reg, tmp4_reg, tmp5_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2898 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2899 |
// Offset 0 should be 32 byte aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2900 |
Label Linit_cbc, Lcbc, Lloop, Ldone_true, Ldone_false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2901 |
Register index_reg = tmp5_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2902 |
Register cbc_iter = tmp4_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2903 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2904 |
//-1: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2905 |
dcbtct(str1_reg, 0x00); // Indicate R/O access to str1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2906 |
dcbtct(str2_reg, 0x00); // Indicate R/O access to str2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2907 |
//1: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2908 |
andi(cbc_iter, cnt_reg, 4-1); // Remaining iterations after 4 java characters per iteration loop. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2909 |
li(index_reg, 0); // init |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2910 |
li(result_reg, 0); // assume false |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2911 |
srwi_(tmp2_reg, cnt_reg, exact_log2(4)); // Div: 4 java characters per iteration (main loop). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2912 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2913 |
cmpwi(CCR1, cbc_iter, 0); // CCR1 = (cbc_iter==0) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2914 |
beq(CCR0, Linit_cbc); // too short |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2915 |
mtctr(tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2916 |
//8: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2917 |
bind(Lloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2918 |
ldx(tmp1_reg, str1_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2919 |
ldx(tmp2_reg, str2_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2920 |
cmpd(CCR0, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2921 |
bne(CCR0, Ldone_false); // Unequal char pair found -> done. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2922 |
addi(index_reg, index_reg, 4*sizeof(jchar)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2923 |
bdnz(Lloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2924 |
//14: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2925 |
bind(Linit_cbc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2926 |
beq(CCR1, Ldone_true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2927 |
mtctr(cbc_iter); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2928 |
//16: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2929 |
bind(Lcbc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2930 |
lhzx(tmp1_reg, str1_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2931 |
lhzx(tmp2_reg, str2_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2932 |
cmpw(CCR0, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2933 |
bne(CCR0, Ldone_false); // Unequal char pair found -> done. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2934 |
addi(index_reg, index_reg, 1*sizeof(jchar)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2935 |
bdnz(Lcbc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2936 |
nop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2937 |
bind(Ldone_true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2938 |
li(result_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2939 |
//24: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2940 |
bind(Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2941 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2942 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2943 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2944 |
void MacroAssembler::char_arrays_equalsImm(Register str1_reg, Register str2_reg, int cntval, Register result_reg, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2945 |
Register tmp1_reg, Register tmp2_reg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2946 |
// Str1 may be the same register as str2 which can occur e.g. after scalar replacement. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2947 |
assert_different_registers(result_reg, str1_reg, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2948 |
assert_different_registers(result_reg, str2_reg, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2949 |
assert(sizeof(jchar) == 2, "must be"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2950 |
assert(cntval >= 0 && ((cntval & 0x7fff) == cntval), "wrong immediate"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2951 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2952 |
Label Ldone_false; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2953 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2954 |
if (cntval < 16) { // short case |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2955 |
if (cntval != 0) li(result_reg, 0); // assume false |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2956 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2957 |
const int num_bytes = cntval*sizeof(jchar); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2958 |
int index = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2959 |
for (int next_index; (next_index = index + 8) <= num_bytes; index = next_index) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2960 |
ld(tmp1_reg, index, str1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2961 |
ld(tmp2_reg, index, str2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2962 |
cmpd(CCR0, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2963 |
bne(CCR0, Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2964 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2965 |
if (cntval & 2) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2966 |
lwz(tmp1_reg, index, str1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2967 |
lwz(tmp2_reg, index, str2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2968 |
cmpw(CCR0, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2969 |
bne(CCR0, Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2970 |
index += 4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2971 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2972 |
if (cntval & 1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2973 |
lhz(tmp1_reg, index, str1_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2974 |
lhz(tmp2_reg, index, str2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2975 |
cmpw(CCR0, tmp1_reg, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2976 |
bne(CCR0, Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2977 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2978 |
// fallthrough: true |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2979 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2980 |
Label Lloop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2981 |
Register index_reg = tmp1_reg; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2982 |
const int loopcnt = cntval/4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2983 |
assert(loopcnt > 0, "must be"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2984 |
// Offset 0 should be 32 byte aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2985 |
//2: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2986 |
dcbtct(str1_reg, 0x00); // Indicate R/O access to str1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2987 |
dcbtct(str2_reg, 0x00); // Indicate R/O access to str2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2988 |
li(tmp2_reg, loopcnt); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2989 |
li(index_reg, 0); // init |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2990 |
li(result_reg, 0); // assume false |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2991 |
mtctr(tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2992 |
//8: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2993 |
bind(Lloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2994 |
ldx(R0, str1_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2995 |
ldx(tmp2_reg, str2_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2996 |
cmpd(CCR0, R0, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2997 |
bne(CCR0, Ldone_false); // Unequal char pair found -> done. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2998 |
addi(index_reg, index_reg, 4*sizeof(jchar)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2999 |
bdnz(Lloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3000 |
//14: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3001 |
if (cntval & 2) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3002 |
lwzx(R0, str1_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3003 |
lwzx(tmp2_reg, str2_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3004 |
cmpw(CCR0, R0, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3005 |
bne(CCR0, Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3006 |
if (cntval & 1) addi(index_reg, index_reg, 2*sizeof(jchar)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3007 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3008 |
if (cntval & 1) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3009 |
lhzx(R0, str1_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3010 |
lhzx(tmp2_reg, str2_reg, index_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3011 |
cmpw(CCR0, R0, tmp2_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3012 |
bne(CCR0, Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3013 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3014 |
// fallthru: true |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3015 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3016 |
li(result_reg, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3017 |
bind(Ldone_false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3018 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3019 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3020 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3021 |
void MacroAssembler::asm_assert(bool check_equal, const char *msg, int id) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3022 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3023 |
Label ok; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3024 |
if (check_equal) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3025 |
beq(CCR0, ok); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3026 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3027 |
bne(CCR0, ok); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3028 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3029 |
stop(msg, id); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3030 |
bind(ok); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3031 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3032 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3033 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3034 |
void MacroAssembler::asm_assert_mems_zero(bool check_equal, int size, int mem_offset, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3035 |
Register mem_base, const char* msg, int id) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3036 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3037 |
switch (size) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3038 |
case 4: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3039 |
lwz(R0, mem_offset, mem_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3040 |
cmpwi(CCR0, R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3041 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3042 |
case 8: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3043 |
ld(R0, mem_offset, mem_base); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3044 |
cmpdi(CCR0, R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3045 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3046 |
default: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3047 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3048 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3049 |
asm_assert(check_equal, msg, id); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3050 |
#endif // ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3051 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3052 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3053 |
void MacroAssembler::verify_thread() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3054 |
if (VerifyThread) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3055 |
unimplemented("'VerifyThread' currently not implemented on PPC"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3056 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3057 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3058 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3059 |
// READ: oop. KILL: R0. Volatile floats perhaps. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3060 |
void MacroAssembler::verify_oop(Register oop, const char* msg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3061 |
if (!VerifyOops) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3062 |
return; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3063 |
} |
22861 | 3064 |
// Will be preserved. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3065 |
Register tmp = R11; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3066 |
assert(oop != tmp, "precondition"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3067 |
unsigned int nbytes_save = 10*8; // 10 volatile gprs |
22861 | 3068 |
address/* FunctionDescriptor** */fd = StubRoutines::verify_oop_subroutine_entry_address(); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3069 |
// save tmp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3070 |
mr(R0, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3071 |
// kill tmp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3072 |
save_LR_CR(tmp); |
23211 | 3073 |
push_frame_reg_args(nbytes_save, tmp); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3074 |
// restore tmp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3075 |
mr(tmp, R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3076 |
save_volatile_gprs(R1_SP, 112); // except R0 |
23211 | 3077 |
// load FunctionDescriptor** / entry_address * |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3078 |
load_const(tmp, fd); |
23211 | 3079 |
// load FunctionDescriptor* / entry_address |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3080 |
ld(tmp, 0, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3081 |
mr(R4_ARG2, oop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3082 |
load_const(R3_ARG1, (address)msg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3083 |
// call destination for its side effect |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3084 |
call_c(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3085 |
restore_volatile_gprs(R1_SP, 112); // except R0 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3086 |
pop_frame(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3087 |
// save tmp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3088 |
mr(R0, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3089 |
// kill tmp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3090 |
restore_LR_CR(tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3091 |
// restore tmp |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3092 |
mr(tmp, R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3093 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3094 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3095 |
const char* stop_types[] = { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3096 |
"stop", |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3097 |
"untested", |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3098 |
"unimplemented", |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3099 |
"shouldnotreachhere" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3100 |
}; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3101 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3102 |
static void stop_on_request(int tp, const char* msg) { |
25374
d7fb2af5d53c
8048169: Change 8037816 breaks HS build on PPC64 and CPP-Interpreter platforms
coleenp
parents:
23492
diff
changeset
|
3103 |
tty->print("PPC assembly code requires stop: (%s) %s\n", stop_types[tp%/*stop_end*/4], msg); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3104 |
guarantee(false, err_msg("PPC assembly code requires stop: %s", msg)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3105 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3106 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3107 |
// Call a C-function that prints output. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3108 |
void MacroAssembler::stop(int type, const char* msg, int id) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3109 |
#ifndef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3110 |
block_comment(err_msg("stop: %s %s {", stop_types[type%stop_end], msg)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3111 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3112 |
block_comment("stop {"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3113 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3114 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3115 |
// setup arguments |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3116 |
load_const_optimized(R3_ARG1, type); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3117 |
load_const_optimized(R4_ARG2, (void *)msg, /*tmp=*/R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3118 |
call_VM_leaf(CAST_FROM_FN_PTR(address, stop_on_request), R3_ARG1, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3119 |
illtrap(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3120 |
emit_int32(id); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3121 |
block_comment("} stop;"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3122 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3123 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3124 |
#ifndef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3125 |
// Write pattern 0x0101010101010101 in memory region [low-before, high+after]. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3126 |
// Val, addr are temp registers. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3127 |
// If low == addr, addr is killed. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3128 |
// High is preserved. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3129 |
void MacroAssembler::zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3130 |
if (!ZapMemory) return; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3131 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3132 |
assert_different_registers(low, val); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3133 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3134 |
BLOCK_COMMENT("zap memory region {"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3135 |
load_const_optimized(val, 0x0101010101010101); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3136 |
int size = before + after; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3137 |
if (low == high && size < 5 && size > 0) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3138 |
int offset = -before*BytesPerWord; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3139 |
for (int i = 0; i < size; ++i) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3140 |
std(val, offset, low); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3141 |
offset += (1*BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3142 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3143 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3144 |
addi(addr, low, -before*BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3145 |
assert_different_registers(high, val); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3146 |
if (after) addi(high, high, after * BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3147 |
Label loop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3148 |
bind(loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3149 |
std(val, 0, addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3150 |
addi(addr, addr, 8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3151 |
cmpd(CCR6, addr, high); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3152 |
ble(CCR6, loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3153 |
if (after) addi(high, high, -after * BytesPerWord); // Correct back to old value. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3154 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3155 |
BLOCK_COMMENT("} zap memory region"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3156 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3157 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3158 |
#endif // !PRODUCT |
23221 | 3159 |
|
3160 |
SkipIfEqualZero::SkipIfEqualZero(MacroAssembler* masm, Register temp, const bool* flag_addr) : _masm(masm), _label() { |
|
3161 |
int simm16_offset = masm->load_const_optimized(temp, (address)flag_addr, R0, true); |
|
3162 |
assert(sizeof(bool) == 1, "PowerPC ABI"); |
|
3163 |
masm->lbz(temp, simm16_offset, temp); |
|
3164 |
masm->cmpwi(CCR0, temp, 0); |
|
3165 |
masm->beq(CCR0, _label); |
|
3166 |
} |
|
3167 |
||
3168 |
SkipIfEqualZero::~SkipIfEqualZero() { |
|
3169 |
_masm->bind(_label); |
|
3170 |
} |