42664
|
1 |
/*
|
|
2 |
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include "precompiled.hpp"
|
|
26 |
#include "asm/assembler.hpp"
|
|
27 |
#include "asm/assembler.inline.hpp"
|
|
28 |
#include "ci/ciEnv.hpp"
|
|
29 |
#include "gc/shared/cardTableModRefBS.hpp"
|
|
30 |
#include "gc/shared/collectedHeap.inline.hpp"
|
|
31 |
#include "interpreter/interpreter.hpp"
|
|
32 |
#include "interpreter/interpreterRuntime.hpp"
|
|
33 |
#include "interpreter/templateInterpreterGenerator.hpp"
|
|
34 |
#include "memory/resourceArea.hpp"
|
|
35 |
#include "prims/jvm_misc.hpp"
|
|
36 |
#include "prims/methodHandles.hpp"
|
|
37 |
#include "runtime/biasedLocking.hpp"
|
|
38 |
#include "runtime/interfaceSupport.hpp"
|
|
39 |
#include "runtime/objectMonitor.hpp"
|
|
40 |
#include "runtime/os.hpp"
|
|
41 |
#include "runtime/sharedRuntime.hpp"
|
|
42 |
#include "runtime/stubRoutines.hpp"
|
|
43 |
#include "utilities/hashtable.hpp"
|
|
44 |
#include "utilities/macros.hpp"
|
|
45 |
#if INCLUDE_ALL_GCS
|
|
46 |
#include "gc/g1/g1CollectedHeap.inline.hpp"
|
|
47 |
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
|
|
48 |
#include "gc/g1/heapRegion.hpp"
|
|
49 |
#endif // INCLUDE_ALL_GCS
|
|
50 |
|
|
51 |
#ifdef COMPILER2
|
|
52 |
// Convert the raw encoding form into the form expected by the
|
|
53 |
// constructor for Address.
|
|
54 |
Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {
|
|
55 |
RelocationHolder rspec;
|
|
56 |
if (disp_reloc != relocInfo::none) {
|
|
57 |
rspec = Relocation::spec_simple(disp_reloc);
|
|
58 |
}
|
|
59 |
|
|
60 |
Register rindex = as_Register(index);
|
|
61 |
if (rindex != PC) {
|
|
62 |
assert(disp == 0, "unsupported");
|
|
63 |
Address madr(as_Register(base), rindex, lsl, scale);
|
|
64 |
madr._rspec = rspec;
|
|
65 |
return madr;
|
|
66 |
} else {
|
|
67 |
assert(scale == 0, "not supported");
|
|
68 |
Address madr(as_Register(base), disp);
|
|
69 |
madr._rspec = rspec;
|
|
70 |
return madr;
|
|
71 |
}
|
|
72 |
}
|
|
73 |
#endif
|
|
74 |
|
|
75 |
void AsmOperand::initialize_rotated_imm(unsigned int imm) {
|
|
76 |
for (int shift = 2; shift <= 24; shift += 2) {
|
|
77 |
if ((imm & ~(0xff << shift)) == 0) {
|
|
78 |
_encoding = 1 << 25 | (32 - shift) << 7 | imm >> shift;
|
|
79 |
return;
|
|
80 |
}
|
|
81 |
}
|
|
82 |
assert((imm & 0x0ffffff0) == 0, "too complicated constant: %d (%x)", imm, imm);
|
|
83 |
_encoding = 1 << 25 | 4 << 7 | imm >> 28 | imm << 4;
|
|
84 |
}
|
|
85 |
|
|
86 |
bool AsmOperand::is_rotated_imm(unsigned int imm) {
|
|
87 |
if ((imm >> 8) == 0) {
|
|
88 |
return true;
|
|
89 |
}
|
|
90 |
for (int shift = 2; shift <= 24; shift += 2) {
|
|
91 |
if ((imm & ~(0xff << shift)) == 0) {
|
|
92 |
return true;
|
|
93 |
}
|
|
94 |
}
|
|
95 |
if ((imm & 0x0ffffff0) == 0) {
|
|
96 |
return true;
|
|
97 |
}
|
|
98 |
return false;
|
|
99 |
}
|