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 "c1/c1_Compilation.hpp"
27 #include "c1/c1_Instruction.hpp"
28 #include "c1/c1_InstructionPrinter.hpp"
29 #include "c1/c1_LIRAssembler.hpp"
30 #include "c1/c1_MacroAssembler.hpp"
31 #include "c1/c1_ValueStack.hpp"
32 #include "ci/ciInstance.hpp"
33 #include "gc/shared/collectedHeap.hpp"
34 #include "runtime/os.hpp"
35
36 void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
37 // We must have enough patching space so that call can be inserted.
38 // We cannot use fat nops here, since the concurrent code rewrite may transiently
39 // create the illegal instruction sequence.
40 while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeGeneralJump::instruction_size) {
41 _masm->nop();
42 }
43 patch->install(_masm, patch_code, obj, info);
44 append_code_stub(patch);
45
46 #ifdef ASSERT
47 Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());
48 if (patch->id() == PatchingStub::access_field_id) {
49 switch (code) {
50 case Bytecodes::_putstatic:
51 case Bytecodes::_getstatic:
52 case Bytecodes::_putfield:
53 case Bytecodes::_getfield:
83 ShouldNotReachHere();
84 }
85 #endif
86 }
87
88 PatchingStub::PatchID LIR_Assembler::patching_id(CodeEmitInfo* info) {
89 IRScope* scope = info->scope();
90 Bytecodes::Code bc_raw = scope->method()->raw_code_at_bci(info->stack()->bci());
91 if (Bytecodes::has_optional_appendix(bc_raw)) {
92 return PatchingStub::load_appendix_id;
93 }
94 return PatchingStub::load_mirror_id;
95 }
96
97 //---------------------------------------------------------------
98
99
100 LIR_Assembler::LIR_Assembler(Compilation* c):
101 _compilation(c)
102 , _masm(c->masm())
103 , _bs(Universe::heap()->barrier_set())
104 , _frame_map(c->frame_map())
105 , _current_block(NULL)
106 , _pending_non_safepoint(NULL)
107 , _pending_non_safepoint_offset(0)
108 {
109 _slow_case_stubs = new CodeStubList();
110 }
111
112
113 LIR_Assembler::~LIR_Assembler() {
114 }
115
116
117 void LIR_Assembler::check_codespace() {
118 CodeSection* cs = _masm->code_section();
119 if (cs->remaining() < (int)(NOT_LP64(1*K)LP64_ONLY(2*K))) {
120 BAILOUT("CodeBuffer overflow");
121 }
122 }
123
|
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 "c1/c1_Compilation.hpp"
27 #include "c1/c1_Instruction.hpp"
28 #include "c1/c1_InstructionPrinter.hpp"
29 #include "c1/c1_LIRAssembler.hpp"
30 #include "c1/c1_MacroAssembler.hpp"
31 #include "c1/c1_ValueStack.hpp"
32 #include "ci/ciInstance.hpp"
33 #include "gc/shared/barrierSet.hpp"
34 #include "runtime/os.hpp"
35
36 void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
37 // We must have enough patching space so that call can be inserted.
38 // We cannot use fat nops here, since the concurrent code rewrite may transiently
39 // create the illegal instruction sequence.
40 while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeGeneralJump::instruction_size) {
41 _masm->nop();
42 }
43 patch->install(_masm, patch_code, obj, info);
44 append_code_stub(patch);
45
46 #ifdef ASSERT
47 Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());
48 if (patch->id() == PatchingStub::access_field_id) {
49 switch (code) {
50 case Bytecodes::_putstatic:
51 case Bytecodes::_getstatic:
52 case Bytecodes::_putfield:
53 case Bytecodes::_getfield:
83 ShouldNotReachHere();
84 }
85 #endif
86 }
87
88 PatchingStub::PatchID LIR_Assembler::patching_id(CodeEmitInfo* info) {
89 IRScope* scope = info->scope();
90 Bytecodes::Code bc_raw = scope->method()->raw_code_at_bci(info->stack()->bci());
91 if (Bytecodes::has_optional_appendix(bc_raw)) {
92 return PatchingStub::load_appendix_id;
93 }
94 return PatchingStub::load_mirror_id;
95 }
96
97 //---------------------------------------------------------------
98
99
100 LIR_Assembler::LIR_Assembler(Compilation* c):
101 _compilation(c)
102 , _masm(c->masm())
103 , _bs(BarrierSet::barrier_set())
104 , _frame_map(c->frame_map())
105 , _current_block(NULL)
106 , _pending_non_safepoint(NULL)
107 , _pending_non_safepoint_offset(0)
108 {
109 _slow_case_stubs = new CodeStubList();
110 }
111
112
113 LIR_Assembler::~LIR_Assembler() {
114 }
115
116
117 void LIR_Assembler::check_codespace() {
118 CodeSection* cs = _masm->code_section();
119 if (cs->remaining() < (int)(NOT_LP64(1*K)LP64_ONLY(2*K))) {
120 BAILOUT("CodeBuffer overflow");
121 }
122 }
123
|