annotate src/share/vm/asm/assembler.inline.hpp @ 4710:41406797186b

7113012: G1: rename not-fully-young GCs as "mixed" Summary: Renamed partially-young GCs as mixed and fully-young GCs as young. Change all external output that includes those terms (GC log and GC ergo log) as well as any comments, fields, methods, etc. The changeset also includes very minor code tidying up (added some curly brackets). Reviewed-by: johnc, brutisso
author tonyp
date Fri, 16 Dec 2011 02:14:27 -0500
parents 2f644f85485d
children 6ab62ad83507
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_ASM_ASSEMBLER_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_ASM_ASSEMBLER_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "asm/assembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "asm/codeBuffer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "compiler/disassembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "runtime/threadLocalStorage.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 inline void AbstractAssembler::sync() {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 CodeSection* cs = code_section();
a61af66fc99e Initial load
duke
parents:
diff changeset
35 guarantee(cs->start() == _code_begin, "must not shift code buffer");
a61af66fc99e Initial load
duke
parents:
diff changeset
36 cs->set_end(_code_pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
37 }
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 inline void AbstractAssembler::emit_byte(int x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 assert(isByte(x), "not a byte");
a61af66fc99e Initial load
duke
parents:
diff changeset
41 *(unsigned char*)_code_pos = (unsigned char)x;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 _code_pos += sizeof(unsigned char);
a61af66fc99e Initial load
duke
parents:
diff changeset
43 sync();
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 inline void AbstractAssembler::emit_word(int x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 *(short*)_code_pos = (short)x;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _code_pos += sizeof(short);
a61af66fc99e Initial load
duke
parents:
diff changeset
50 sync();
a61af66fc99e Initial load
duke
parents:
diff changeset
51 }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 inline void AbstractAssembler::emit_long(jint x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 *(jint*)_code_pos = x;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 _code_pos += sizeof(jint);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 sync();
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 inline void AbstractAssembler::emit_address(address x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 *(address*)_code_pos = x;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 _code_pos += sizeof(address);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 sync();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 inline address AbstractAssembler::inst_mark() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 return code_section()->mark();
a61af66fc99e Initial load
duke
parents:
diff changeset
68 }
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 inline void AbstractAssembler::set_inst_mark() {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 code_section()->set_mark();
a61af66fc99e Initial load
duke
parents:
diff changeset
73 }
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 inline void AbstractAssembler::clear_inst_mark() {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 code_section()->clear_mark();
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 inline void AbstractAssembler::relocate(RelocationHolder const& rspec, int format) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 assert(!pd_check_instruction_mark()
a61af66fc99e Initial load
duke
parents:
diff changeset
83 || inst_mark() == NULL || inst_mark() == _code_pos,
a61af66fc99e Initial load
duke
parents:
diff changeset
84 "call relocate() between instructions");
a61af66fc99e Initial load
duke
parents:
diff changeset
85 code_section()->relocate(_code_pos, rspec, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 inline CodeBuffer* AbstractAssembler::code() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 return code_section()->outer();
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 inline int AbstractAssembler::sect() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return code_section()->index();
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 inline int AbstractAssembler::locator() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 return CodeBuffer::locator(offset(), sect());
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 inline address AbstractAssembler::target(Label& L) {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 return code_section()->target(L, pc());
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 inline int Label::loc_pos() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return CodeBuffer::locator_pos(loc());
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 inline int Label::loc_sect() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return CodeBuffer::locator_sect(loc());
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 inline void Label::bind_loc(int pos, int sect) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 bind_loc(CodeBuffer::locator(pos, sect));
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
116
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
117 #endif // SHARE_VM_ASM_ASSEMBLER_INLINE_HPP