1 /* 2 * Copyright (c) 1997, 2009, 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 "incls/_precompiled.incl" 26 #include "incls/_assembler.cpp.incl" 27 28 29 // Implementation of AbstractAssembler 30 // 31 // The AbstractAssembler is generating code into a CodeBuffer. To make code generation faster, 32 // the assembler keeps a copy of the code buffers boundaries & modifies them when 33 // emitting bytes rather than using the code buffers accessor functions all the time. 34 // The code buffer is updated via set_code_end(...) after emitting a whole instruction. 35 36 AbstractAssembler::AbstractAssembler(CodeBuffer* code) { 37 if (code == NULL) return; 38 CodeSection* cs = code->insts(); 39 cs->clear_mark(); // new assembler kills old mark 40 _code_section = cs; 41 _code_begin = cs->start(); 42 _code_limit = cs->limit(); 43 _code_pos = cs->end(); 44 _oop_recorder= code->oop_recorder(); 45 if (_code_begin == NULL) { 46 vm_exit_out_of_memory(0, err_msg("CodeCache: no room for %s", | 1 /* 2 * Copyright (c) 1997, 2010, 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 "asm/codeBuffer.hpp" 29 #include "runtime/icache.hpp" 30 #include "runtime/os.hpp" 31 #ifdef TARGET_ARCH_x86 32 # include "assembler_x86.inline.hpp" 33 #endif 34 #ifdef TARGET_ARCH_sparc 35 # include "assembler_sparc.inline.hpp" 36 #endif 37 #ifdef TARGET_ARCH_zero 38 # include "assembler_zero.inline.hpp" 39 #endif 40 41 42 // Implementation of AbstractAssembler 43 // 44 // The AbstractAssembler is generating code into a CodeBuffer. To make code generation faster, 45 // the assembler keeps a copy of the code buffers boundaries & modifies them when 46 // emitting bytes rather than using the code buffers accessor functions all the time. 47 // The code buffer is updated via set_code_end(...) after emitting a whole instruction. 48 49 AbstractAssembler::AbstractAssembler(CodeBuffer* code) { 50 if (code == NULL) return; 51 CodeSection* cs = code->insts(); 52 cs->clear_mark(); // new assembler kills old mark 53 _code_section = cs; 54 _code_begin = cs->start(); 55 _code_limit = cs->limit(); 56 _code_pos = cs->end(); 57 _oop_recorder= code->oop_recorder(); 58 if (_code_begin == NULL) { 59 vm_exit_out_of_memory(0, err_msg("CodeCache: no room for %s", |