comparison src/share/vm/asm/assembler.inline.hpp @ 7206:d2f8c38e543d

Merge
author roland
date Fri, 07 Dec 2012 01:09:03 -0800
parents cd3d6a6b95d9
children
comparison
equal deleted inserted replaced
7191:816b7e5bf2ed 7206:d2f8c38e543d
24 24
25 #ifndef SHARE_VM_ASM_ASSEMBLER_INLINE_HPP 25 #ifndef SHARE_VM_ASM_ASSEMBLER_INLINE_HPP
26 #define SHARE_VM_ASM_ASSEMBLER_INLINE_HPP 26 #define SHARE_VM_ASM_ASSEMBLER_INLINE_HPP
27 27
28 #include "asm/assembler.hpp" 28 #include "asm/assembler.hpp"
29 #include "asm/codeBuffer.hpp"
30 #include "compiler/disassembler.hpp"
31 #include "runtime/threadLocalStorage.hpp"
32 29
33 inline void AbstractAssembler::sync() { 30 #ifdef TARGET_ARCH_x86
34 CodeSection* cs = code_section(); 31 # include "assembler_x86.inline.hpp"
35 guarantee(cs->start() == _code_begin, "must not shift code buffer"); 32 #endif
36 cs->set_end(_code_pos); 33 #ifdef TARGET_ARCH_sparc
37 } 34 # include "assembler_sparc.inline.hpp"
38 35 #endif
39 inline void AbstractAssembler::emit_byte(int x) { 36 #ifdef TARGET_ARCH_zero
40 assert(isByte(x), "not a byte"); 37 # include "assembler_zero.inline.hpp"
41 *(unsigned char*)_code_pos = (unsigned char)x; 38 #endif
42 _code_pos += sizeof(unsigned char); 39 #ifdef TARGET_ARCH_arm
43 sync(); 40 # include "assembler_arm.inline.hpp"
44 } 41 #endif
45 42 #ifdef TARGET_ARCH_ppc
46 43 # include "assembler_ppc.inline.hpp"
47 inline void AbstractAssembler::emit_word(int x) { 44 #endif
48 *(short*)_code_pos = (short)x;
49 _code_pos += sizeof(short);
50 sync();
51 }
52
53
54 inline void AbstractAssembler::emit_long(jint x) {
55 *(jint*)_code_pos = x;
56 _code_pos += sizeof(jint);
57 sync();
58 }
59
60 inline void AbstractAssembler::emit_address(address x) {
61 *(address*)_code_pos = x;
62 _code_pos += sizeof(address);
63 sync();
64 }
65
66 inline address AbstractAssembler::inst_mark() const {
67 return code_section()->mark();
68 }
69
70
71 inline void AbstractAssembler::set_inst_mark() {
72 code_section()->set_mark();
73 }
74
75
76 inline void AbstractAssembler::clear_inst_mark() {
77 code_section()->clear_mark();
78 }
79
80
81 inline void AbstractAssembler::relocate(RelocationHolder const& rspec, int format) {
82 assert(!pd_check_instruction_mark()
83 || inst_mark() == NULL || inst_mark() == _code_pos,
84 "call relocate() between instructions");
85 code_section()->relocate(_code_pos, rspec, format);
86 }
87
88
89 inline CodeBuffer* AbstractAssembler::code() const {
90 return code_section()->outer();
91 }
92
93 inline int AbstractAssembler::sect() const {
94 return code_section()->index();
95 }
96
97 inline int AbstractAssembler::locator() const {
98 return CodeBuffer::locator(offset(), sect());
99 }
100
101 inline address AbstractAssembler::target(Label& L) {
102 return code_section()->target(L, pc());
103 }
104
105 inline int Label::loc_pos() const {
106 return CodeBuffer::locator_pos(loc());
107 }
108
109 inline int Label::loc_sect() const {
110 return CodeBuffer::locator_sect(loc());
111 }
112
113 inline void Label::bind_loc(int pos, int sect) {
114 bind_loc(CodeBuffer::locator(pos, sect));
115 }
116 45
117 #endif // SHARE_VM_ASM_ASSEMBLER_INLINE_HPP 46 #endif // SHARE_VM_ASM_ASSEMBLER_INLINE_HPP