src/share/vm/interpreter/bytecodeStream.cpp

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

author
twisti
date
Tue, 24 Jul 2012 10:51:00 -0700
changeset 3969
1d7922586cf6
parent 2462
8012aa3ccede
child 6876
710a3c8b516e
child 8498
9edc175ff3e6
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 /*
never@2462 2 * Copyright (c) 1997, 2011, 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 #include "precompiled.hpp"
stefank@2314 26 #include "interpreter/bytecodeStream.hpp"
stefank@2314 27 #include "interpreter/bytecodes.hpp"
duke@435 28
duke@435 29 Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) {
duke@435 30 assert(!is_last_bytecode(), "should have been checked");
duke@435 31 // set next bytecode position
kamg@848 32 address bcp = RawBytecodeStream::bcp();
kamg@848 33 address end = method()->code_base() + end_bci();
kamg@848 34 int l = Bytecodes::raw_special_length_at(bcp, end);
duke@435 35 if (l <= 0 || (_bci + l) > _end_bci) {
duke@435 36 code = Bytecodes::_illegal;
duke@435 37 } else {
duke@435 38 _next_bci += l;
duke@435 39 assert(_bci < _next_bci, "length must be > 0");
duke@435 40 // set attributes
duke@435 41 _is_wide = false;
duke@435 42 // check for special (uncommon) cases
duke@435 43 if (code == Bytecodes::_wide) {
kamg@848 44 if (bcp + 1 >= end) {
kamg@848 45 code = Bytecodes::_illegal;
kamg@848 46 } else {
kamg@848 47 code = (Bytecodes::Code)bcp[1];
kamg@848 48 _is_wide = true;
kamg@848 49 }
duke@435 50 }
duke@435 51 }
jrose@1920 52 _raw_code = code;
duke@435 53 return code;
duke@435 54 }
jrose@1920 55
jrose@1920 56 #ifdef ASSERT
jrose@1920 57 void BaseBytecodeStream::assert_raw_index_size(int size) const {
jrose@1920 58 if (raw_code() == Bytecodes::_invokedynamic && is_raw()) {
jrose@1920 59 // in raw mode, pretend indy is "bJJ__"
jrose@1920 60 assert(size == 2, "raw invokedynamic instruction has 2-byte index only");
jrose@1920 61 } else {
never@2462 62 bytecode().assert_index_size(size, raw_code(), is_wide());
jrose@1920 63 }
jrose@1920 64 }
jrose@1920 65
jrose@1920 66 void BaseBytecodeStream::assert_raw_stream(bool want_raw) const {
jrose@1920 67 if (want_raw) {
jrose@1920 68 assert( is_raw(), "this function only works on raw streams");
jrose@1920 69 } else {
jrose@1920 70 assert(!is_raw(), "this function only works on non-raw streams");
jrose@1920 71 }
jrose@1920 72 }
jrose@1920 73 #endif //ASSERT

mercurial