Print this page
rev 1838 : 6961690: load oops from constant table on SPARC
Summary: oops should be loaded from the constant table of an nmethod instead of materializing them with a long code sequence.
Reviewed-by:
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/asm/assembler.inline.hpp
+++ new/src/share/vm/asm/assembler.inline.hpp
1 1 /*
2 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
2 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 inline void AbstractAssembler::sync() {
26 26 CodeSection* cs = code_section();
27 27 guarantee(cs->start() == _code_begin, "must not shift code buffer");
28 28 cs->set_end(_code_pos);
29 29 }
30 30
31 31 inline void AbstractAssembler::emit_byte(int x) {
32 32 assert(isByte(x), "not a byte");
33 33 *(unsigned char*)_code_pos = (unsigned char)x;
34 34 _code_pos += sizeof(unsigned char);
35 35 sync();
36 36 }
37 37
38 38
39 39 inline void AbstractAssembler::emit_word(int x) {
40 40 *(short*)_code_pos = (short)x;
41 41 _code_pos += sizeof(short);
42 42 sync();
43 43 }
44 44
45 45
46 46 inline void AbstractAssembler::emit_long(jint x) {
47 47 *(jint*)_code_pos = x;
48 48 _code_pos += sizeof(jint);
49 49 sync();
50 50 }
51 51
52 52 inline void AbstractAssembler::emit_address(address x) {
53 53 *(address*)_code_pos = x;
54 54 _code_pos += sizeof(address);
55 55 sync();
56 56 }
57 57
58 58 inline address AbstractAssembler::inst_mark() const {
59 59 return code_section()->mark();
60 60 }
61 61
62 62
63 63 inline void AbstractAssembler::set_inst_mark() {
64 64 code_section()->set_mark();
65 65 }
66 66
67 67
68 68 inline void AbstractAssembler::clear_inst_mark() {
69 69 code_section()->clear_mark();
70 70 }
71 71
72 72
73 73 inline void AbstractAssembler::relocate(RelocationHolder const& rspec, int format) {
74 74 assert(!pd_check_instruction_mark()
75 75 || inst_mark() == NULL || inst_mark() == _code_pos,
76 76 "call relocate() between instructions");
77 77 code_section()->relocate(_code_pos, rspec, format);
78 78 }
79 79
80 80
81 81 inline CodeBuffer* AbstractAssembler::code() const {
82 82 return code_section()->outer();
83 83 }
84 84
85 85 inline int AbstractAssembler::sect() const {
86 86 return code_section()->index();
87 87 }
88 88
89 89 inline int AbstractAssembler::locator() const {
90 90 return CodeBuffer::locator(offset(), sect());
91 91 }
92 92
93 93 inline address AbstractAssembler::target(Label& L) {
94 94 return code_section()->target(L, pc());
95 95 }
96 96
97 97 inline int Label::loc_pos() const {
↓ open down ↓ |
85 lines elided |
↑ open up ↑ |
98 98 return CodeBuffer::locator_pos(loc());
99 99 }
100 100
101 101 inline int Label::loc_sect() const {
102 102 return CodeBuffer::locator_sect(loc());
103 103 }
104 104
105 105 inline void Label::bind_loc(int pos, int sect) {
106 106 bind_loc(CodeBuffer::locator(pos, sect));
107 107 }
108 -
109 -address AbstractAssembler::address_constant(Label& L) {
110 - address c = NULL;
111 - address ptr = start_a_const(sizeof(c), sizeof(c));
112 - if (ptr != NULL) {
113 - relocate(Relocation::spec_simple(relocInfo::internal_word_type));
114 - *(address*)ptr = c = code_section()->target(L, ptr);
115 - _code_pos = ptr + sizeof(c);
116 - end_a_const();
117 - }
118 - return ptr;
119 -}
120 -
121 -address AbstractAssembler::address_table_constant(GrowableArray<Label*> labels) {
122 - int addressSize = sizeof(address);
123 - int sizeLabel = addressSize * labels.length();
124 - address ptr = start_a_const(sizeLabel, addressSize);
125 -
126 - if (ptr != NULL) {
127 - address *labelLoc = (address*)ptr;
128 - for (int i=0; i < labels.length(); i++) {
129 - emit_address(code_section()->target(*labels.at(i), (address)&labelLoc[i]));
130 - code_section()->relocate((address)&labelLoc[i], relocInfo::internal_word_type);
131 - }
132 - end_a_const();
133 - }
134 - return ptr;
135 -}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX