src/share/vm/interpreter/bytecodeStream.cpp

Sun, 25 Sep 2011 16:03:29 -0700

author
never
date
Sun, 25 Sep 2011 16:03:29 -0700
changeset 3156
f08d439fab8c
parent 2462
8012aa3ccede
child 6876
710a3c8b516e
child 8498
9edc175ff3e6
permissions
-rw-r--r--

7089790: integrate bsd-port changes
Reviewed-by: kvn, twisti, jrose
Contributed-by: Kurt Miller <kurt@intricatesoftware.com>, Greg Lewis <glewis@eyesbeyond.com>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, Landon Fuller <landonf@plausible.coop>, The FreeBSD Foundation <board@freebsdfoundation.org>, Michael Franz <mvfranz@gmail.com>, Roger Hoover <rhoover@apple.com>, Alexander Strange <astrange@apple.com>

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

mercurial