src/share/vm/asm/assembler.inline.hpp

Tue, 24 Jul 2012 10:51:00 -0700

author
twisti
date
Tue, 24 Jul 2012 10:51:00 -0700
changeset 3969
1d7922586cf6
parent 2350
2f644f85485d
child 4317
6ab62ad83507
permissions
-rw-r--r--

7023639: JSR 292 method handle invocation needs a fast path for compiled code
6984705: JSR 292 method handle creation should not go through JNI
Summary: remove assembly code for JDK 7 chained method handles
Reviewed-by: jrose, twisti, kvn, mhaupt
Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>

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

mercurial