Path: blob/master/src/hotspot/share/interpreter/bytecodes.cpp
40949 views
/*1* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "interpreter/bytecodes.hpp"26#include "memory/resourceArea.hpp"27#include "oops/method.hpp"28#include "utilities/align.hpp"29#include "utilities/bytes.hpp"303132#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER < 1600))33// Windows AMD64 Compiler Hangs compiling this file34// unless optimization is off35#ifdef _M_AMD6436#pragma optimize ("", off)37#endif38#endif394041bool Bytecodes::_is_initialized = false;42const char* Bytecodes::_name [Bytecodes::number_of_codes];43BasicType Bytecodes::_result_type [Bytecodes::number_of_codes];44s_char Bytecodes::_depth [Bytecodes::number_of_codes];45u_char Bytecodes::_lengths [Bytecodes::number_of_codes];46Bytecodes::Code Bytecodes::_java_code [Bytecodes::number_of_codes];47unsigned short Bytecodes::_flags [(1<<BitsPerByte)*2];4849#ifdef ASSERT50bool Bytecodes::check_method(const Method* method, address bcp) {51return method->contains(bcp);52}53#endif5455bool Bytecodes::check_must_rewrite(Bytecodes::Code code) {56assert(can_rewrite(code), "post-check only");5758// Some codes are conditionally rewriting. Look closely at them.59switch (code) {60case Bytecodes::_aload_0:61// Even if RewriteFrequentPairs is turned on,62// the _aload_0 code might delay its rewrite until63// a following _getfield rewrites itself.64return false;6566case Bytecodes::_lookupswitch:67return false; // the rewrite is not done by the interpreter6869case Bytecodes::_new:70// (Could actually look at the class here, but the profit would be small.)71return false; // the rewrite is not always done7273default:74// No other special cases.75return true;76}77}7879Bytecodes::Code Bytecodes::code_at(Method* method, int bci) {80return code_at(method, method->bcp_from(bci));81}8283Bytecodes::Code Bytecodes::non_breakpoint_code_at(const Method* method, address bcp) {84assert(method != NULL, "must have the method for breakpoint conversion");85assert(method->contains(bcp), "must be valid bcp in method");86return method->orig_bytecode_at(method->bci_from(bcp));87}8889int Bytecodes::special_length_at(Bytecodes::Code code, address bcp, address end) {90switch (code) {91case _wide:92if (end != NULL && bcp + 1 >= end) {93return -1; // don't read past end of code buffer94}95return wide_length_for(cast(*(bcp + 1)));96case _tableswitch:97{ address aligned_bcp = align_up(bcp + 1, jintSize);98if (end != NULL && aligned_bcp + 3*jintSize >= end) {99return -1; // don't read past end of code buffer100}101jlong lo = (jint)Bytes::get_Java_u4(aligned_bcp + 1*jintSize);102jlong hi = (jint)Bytes::get_Java_u4(aligned_bcp + 2*jintSize);103jlong len = (aligned_bcp - bcp) + (3 + hi - lo + 1)*jintSize;104// only return len if it can be represented as a positive int;105// return -1 otherwise106return (len > 0 && len == (int)len) ? len : -1;107}108109case _lookupswitch: // fall through110case _fast_binaryswitch: // fall through111case _fast_linearswitch:112{ address aligned_bcp = align_up(bcp + 1, jintSize);113if (end != NULL && aligned_bcp + 2*jintSize >= end) {114return -1; // don't read past end of code buffer115}116jlong npairs = (jint)Bytes::get_Java_u4(aligned_bcp + jintSize);117jlong len = (aligned_bcp - bcp) + (2 + 2*npairs)*jintSize;118// only return len if it can be represented as a positive int;119// return -1 otherwise120return (len > 0 && len == (int)len) ? len : -1;121}122default:123// Note: Length functions must return <=0 for invalid bytecodes.124return 0;125}126}127128// At a breakpoint instruction, this returns the breakpoint's length,129// otherwise, it's the same as special_length_at(). This is used by130// the RawByteCodeStream, which wants to see the actual bytecode131// values (including breakpoint). RawByteCodeStream is used by the132// verifier when reading in bytecode to verify. Other mechanisms that133// run at runtime (such as generateOopMaps) need to iterate over the code134// and don't expect to see breakpoints: they want to see the instruction135// which was replaced so that they can get the correct length and find136// the next bytecode.137//138// 'end' indicates the end of the code buffer, which we should not try to read139// past.140int Bytecodes::raw_special_length_at(address bcp, address end) {141Code code = code_or_bp_at(bcp);142if (code == _breakpoint) {143return 1;144} else {145return special_length_at(code, bcp, end);146}147}148149150151void Bytecodes::def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap) {152def(code, name, format, wide_format, result_type, depth, can_trap, code);153}154155156void Bytecodes::def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap, Code java_code) {157assert(wide_format == NULL || format != NULL, "short form must exist if there's a wide form");158int len = (format != NULL ? (int) strlen(format) : 0);159int wlen = (wide_format != NULL ? (int) strlen(wide_format) : 0);160_name [code] = name;161_result_type [code] = result_type;162_depth [code] = depth;163_lengths [code] = (wlen << 4) | (len & 0xF);164_java_code [code] = java_code;165int bc_flags = 0;166if (can_trap) bc_flags |= _bc_can_trap;167if (java_code != code) bc_flags |= _bc_can_rewrite;168_flags[(u1)code+0*(1<<BitsPerByte)] = compute_flags(format, bc_flags);169_flags[(u1)code+1*(1<<BitsPerByte)] = compute_flags(wide_format, bc_flags);170assert(is_defined(code) == (format != NULL), "");171assert(wide_is_defined(code) == (wide_format != NULL), "");172assert(length_for(code) == len, "");173assert(wide_length_for(code) == wlen, "");174}175176177// Format strings interpretation:178//179// b: bytecode180// c: signed constant, Java byte-ordering181// i: unsigned local index, Java byte-ordering (I = native byte ordering)182// j: unsigned CP cache index, Java byte-ordering (J = native byte ordering)183// k: unsigned CP index, Java byte-ordering184// o: branch offset, Java byte-ordering185// _: unused/ignored186// w: wide bytecode187//188// Note: The format strings are used for 2 purposes:189// 1. to specify the length of the bytecode190// (= number of characters in format string)191// 2. to derive bytecode format flags (_fmt_has_k, etc.)192//193// Note: For bytecodes with variable length, the format string is the empty string.194195int Bytecodes::compute_flags(const char* format, int more_flags) {196if (format == NULL) return 0; // not even more_flags197int flags = more_flags;198const char* fp = format;199switch (*fp) {200case '\0':201flags |= _fmt_not_simple; // but variable202break;203case 'b':204flags |= _fmt_not_variable; // but simple205++fp; // skip 'b'206break;207case 'w':208flags |= _fmt_not_variable | _fmt_not_simple;209++fp; // skip 'w'210guarantee(*fp == 'b', "wide format must start with 'wb'");211++fp; // skip 'b'212break;213}214215int has_nbo = 0, has_jbo = 0, has_size = 0;216for (;;) {217int this_flag = 0;218char fc = *fp++;219switch (fc) {220case '\0': // end of string221assert(flags == (jchar)flags, "change _format_flags");222return flags;223224case '_': continue; // ignore these225226case 'j': this_flag = _fmt_has_j; has_jbo = 1; break;227case 'k': this_flag = _fmt_has_k; has_jbo = 1; break;228case 'i': this_flag = _fmt_has_i; has_jbo = 1; break;229case 'c': this_flag = _fmt_has_c; has_jbo = 1; break;230case 'o': this_flag = _fmt_has_o; has_jbo = 1; break;231232// uppercase versions mark native byte order (from Rewriter)233// actually, only the 'J' case happens currently234case 'J': this_flag = _fmt_has_j; has_nbo = 1; break;235case 'K': this_flag = _fmt_has_k; has_nbo = 1; break;236case 'I': this_flag = _fmt_has_i; has_nbo = 1; break;237case 'C': this_flag = _fmt_has_c; has_nbo = 1; break;238case 'O': this_flag = _fmt_has_o; has_nbo = 1; break;239default: guarantee(false, "bad char in format");240}241242flags |= this_flag;243244guarantee(!(has_jbo && has_nbo), "mixed byte orders in format");245if (has_nbo)246flags |= _fmt_has_nbo;247248int this_size = 1;249if (*fp == fc) {250// advance beyond run of the same characters251this_size = 2;252while (*++fp == fc) this_size++;253switch (this_size) {254case 2: flags |= _fmt_has_u2; break;255case 4: flags |= _fmt_has_u4; break;256default: guarantee(false, "bad rep count in format");257}258}259guarantee(has_size == 0 || // no field yet260this_size == has_size || // same size261this_size < has_size && *fp == '\0', // last field can be short262"mixed field sizes in format");263has_size = this_size;264}265}266267void Bytecodes::initialize() {268if (_is_initialized) return;269assert(number_of_codes <= 256, "too many bytecodes");270271// initialize bytecode tables - didn't use static array initializers272// (such as {}) so we can do additional consistency checks and init-273// code is independent of actual bytecode numbering.274//275// Note 1: NULL for the format string means the bytecode doesn't exist276// in that form.277//278// Note 2: The result type is T_ILLEGAL for bytecodes where the top of stack279// type after execution is not only determined by the bytecode itself.280281// Java bytecodes282// bytecode bytecode name format wide f. result tp stk traps283def(_nop , "nop" , "b" , NULL , T_VOID , 0, false);284def(_aconst_null , "aconst_null" , "b" , NULL , T_OBJECT , 1, false);285def(_iconst_m1 , "iconst_m1" , "b" , NULL , T_INT , 1, false);286def(_iconst_0 , "iconst_0" , "b" , NULL , T_INT , 1, false);287def(_iconst_1 , "iconst_1" , "b" , NULL , T_INT , 1, false);288def(_iconst_2 , "iconst_2" , "b" , NULL , T_INT , 1, false);289def(_iconst_3 , "iconst_3" , "b" , NULL , T_INT , 1, false);290def(_iconst_4 , "iconst_4" , "b" , NULL , T_INT , 1, false);291def(_iconst_5 , "iconst_5" , "b" , NULL , T_INT , 1, false);292def(_lconst_0 , "lconst_0" , "b" , NULL , T_LONG , 2, false);293def(_lconst_1 , "lconst_1" , "b" , NULL , T_LONG , 2, false);294def(_fconst_0 , "fconst_0" , "b" , NULL , T_FLOAT , 1, false);295def(_fconst_1 , "fconst_1" , "b" , NULL , T_FLOAT , 1, false);296def(_fconst_2 , "fconst_2" , "b" , NULL , T_FLOAT , 1, false);297def(_dconst_0 , "dconst_0" , "b" , NULL , T_DOUBLE , 2, false);298def(_dconst_1 , "dconst_1" , "b" , NULL , T_DOUBLE , 2, false);299def(_bipush , "bipush" , "bc" , NULL , T_INT , 1, false);300def(_sipush , "sipush" , "bcc" , NULL , T_INT , 1, false);301def(_ldc , "ldc" , "bk" , NULL , T_ILLEGAL, 1, true );302def(_ldc_w , "ldc_w" , "bkk" , NULL , T_ILLEGAL, 1, true );303def(_ldc2_w , "ldc2_w" , "bkk" , NULL , T_ILLEGAL, 2, true );304def(_iload , "iload" , "bi" , "wbii" , T_INT , 1, false);305def(_lload , "lload" , "bi" , "wbii" , T_LONG , 2, false);306def(_fload , "fload" , "bi" , "wbii" , T_FLOAT , 1, false);307def(_dload , "dload" , "bi" , "wbii" , T_DOUBLE , 2, false);308def(_aload , "aload" , "bi" , "wbii" , T_OBJECT , 1, false);309def(_iload_0 , "iload_0" , "b" , NULL , T_INT , 1, false);310def(_iload_1 , "iload_1" , "b" , NULL , T_INT , 1, false);311def(_iload_2 , "iload_2" , "b" , NULL , T_INT , 1, false);312def(_iload_3 , "iload_3" , "b" , NULL , T_INT , 1, false);313def(_lload_0 , "lload_0" , "b" , NULL , T_LONG , 2, false);314def(_lload_1 , "lload_1" , "b" , NULL , T_LONG , 2, false);315def(_lload_2 , "lload_2" , "b" , NULL , T_LONG , 2, false);316def(_lload_3 , "lload_3" , "b" , NULL , T_LONG , 2, false);317def(_fload_0 , "fload_0" , "b" , NULL , T_FLOAT , 1, false);318def(_fload_1 , "fload_1" , "b" , NULL , T_FLOAT , 1, false);319def(_fload_2 , "fload_2" , "b" , NULL , T_FLOAT , 1, false);320def(_fload_3 , "fload_3" , "b" , NULL , T_FLOAT , 1, false);321def(_dload_0 , "dload_0" , "b" , NULL , T_DOUBLE , 2, false);322def(_dload_1 , "dload_1" , "b" , NULL , T_DOUBLE , 2, false);323def(_dload_2 , "dload_2" , "b" , NULL , T_DOUBLE , 2, false);324def(_dload_3 , "dload_3" , "b" , NULL , T_DOUBLE , 2, false);325def(_aload_0 , "aload_0" , "b" , NULL , T_OBJECT , 1, true ); // rewriting in interpreter326def(_aload_1 , "aload_1" , "b" , NULL , T_OBJECT , 1, false);327def(_aload_2 , "aload_2" , "b" , NULL , T_OBJECT , 1, false);328def(_aload_3 , "aload_3" , "b" , NULL , T_OBJECT , 1, false);329def(_iaload , "iaload" , "b" , NULL , T_INT , -1, true );330def(_laload , "laload" , "b" , NULL , T_LONG , 0, true );331def(_faload , "faload" , "b" , NULL , T_FLOAT , -1, true );332def(_daload , "daload" , "b" , NULL , T_DOUBLE , 0, true );333def(_aaload , "aaload" , "b" , NULL , T_OBJECT , -1, true );334def(_baload , "baload" , "b" , NULL , T_INT , -1, true );335def(_caload , "caload" , "b" , NULL , T_INT , -1, true );336def(_saload , "saload" , "b" , NULL , T_INT , -1, true );337def(_istore , "istore" , "bi" , "wbii" , T_VOID , -1, false);338def(_lstore , "lstore" , "bi" , "wbii" , T_VOID , -2, false);339def(_fstore , "fstore" , "bi" , "wbii" , T_VOID , -1, false);340def(_dstore , "dstore" , "bi" , "wbii" , T_VOID , -2, false);341def(_astore , "astore" , "bi" , "wbii" , T_VOID , -1, false);342def(_istore_0 , "istore_0" , "b" , NULL , T_VOID , -1, false);343def(_istore_1 , "istore_1" , "b" , NULL , T_VOID , -1, false);344def(_istore_2 , "istore_2" , "b" , NULL , T_VOID , -1, false);345def(_istore_3 , "istore_3" , "b" , NULL , T_VOID , -1, false);346def(_lstore_0 , "lstore_0" , "b" , NULL , T_VOID , -2, false);347def(_lstore_1 , "lstore_1" , "b" , NULL , T_VOID , -2, false);348def(_lstore_2 , "lstore_2" , "b" , NULL , T_VOID , -2, false);349def(_lstore_3 , "lstore_3" , "b" , NULL , T_VOID , -2, false);350def(_fstore_0 , "fstore_0" , "b" , NULL , T_VOID , -1, false);351def(_fstore_1 , "fstore_1" , "b" , NULL , T_VOID , -1, false);352def(_fstore_2 , "fstore_2" , "b" , NULL , T_VOID , -1, false);353def(_fstore_3 , "fstore_3" , "b" , NULL , T_VOID , -1, false);354def(_dstore_0 , "dstore_0" , "b" , NULL , T_VOID , -2, false);355def(_dstore_1 , "dstore_1" , "b" , NULL , T_VOID , -2, false);356def(_dstore_2 , "dstore_2" , "b" , NULL , T_VOID , -2, false);357def(_dstore_3 , "dstore_3" , "b" , NULL , T_VOID , -2, false);358def(_astore_0 , "astore_0" , "b" , NULL , T_VOID , -1, false);359def(_astore_1 , "astore_1" , "b" , NULL , T_VOID , -1, false);360def(_astore_2 , "astore_2" , "b" , NULL , T_VOID , -1, false);361def(_astore_3 , "astore_3" , "b" , NULL , T_VOID , -1, false);362def(_iastore , "iastore" , "b" , NULL , T_VOID , -3, true );363def(_lastore , "lastore" , "b" , NULL , T_VOID , -4, true );364def(_fastore , "fastore" , "b" , NULL , T_VOID , -3, true );365def(_dastore , "dastore" , "b" , NULL , T_VOID , -4, true );366def(_aastore , "aastore" , "b" , NULL , T_VOID , -3, true );367def(_bastore , "bastore" , "b" , NULL , T_VOID , -3, true );368def(_castore , "castore" , "b" , NULL , T_VOID , -3, true );369def(_sastore , "sastore" , "b" , NULL , T_VOID , -3, true );370def(_pop , "pop" , "b" , NULL , T_VOID , -1, false);371def(_pop2 , "pop2" , "b" , NULL , T_VOID , -2, false);372def(_dup , "dup" , "b" , NULL , T_VOID , 1, false);373def(_dup_x1 , "dup_x1" , "b" , NULL , T_VOID , 1, false);374def(_dup_x2 , "dup_x2" , "b" , NULL , T_VOID , 1, false);375def(_dup2 , "dup2" , "b" , NULL , T_VOID , 2, false);376def(_dup2_x1 , "dup2_x1" , "b" , NULL , T_VOID , 2, false);377def(_dup2_x2 , "dup2_x2" , "b" , NULL , T_VOID , 2, false);378def(_swap , "swap" , "b" , NULL , T_VOID , 0, false);379def(_iadd , "iadd" , "b" , NULL , T_INT , -1, false);380def(_ladd , "ladd" , "b" , NULL , T_LONG , -2, false);381def(_fadd , "fadd" , "b" , NULL , T_FLOAT , -1, false);382def(_dadd , "dadd" , "b" , NULL , T_DOUBLE , -2, false);383def(_isub , "isub" , "b" , NULL , T_INT , -1, false);384def(_lsub , "lsub" , "b" , NULL , T_LONG , -2, false);385def(_fsub , "fsub" , "b" , NULL , T_FLOAT , -1, false);386def(_dsub , "dsub" , "b" , NULL , T_DOUBLE , -2, false);387def(_imul , "imul" , "b" , NULL , T_INT , -1, false);388def(_lmul , "lmul" , "b" , NULL , T_LONG , -2, false);389def(_fmul , "fmul" , "b" , NULL , T_FLOAT , -1, false);390def(_dmul , "dmul" , "b" , NULL , T_DOUBLE , -2, false);391def(_idiv , "idiv" , "b" , NULL , T_INT , -1, true );392def(_ldiv , "ldiv" , "b" , NULL , T_LONG , -2, true );393def(_fdiv , "fdiv" , "b" , NULL , T_FLOAT , -1, false);394def(_ddiv , "ddiv" , "b" , NULL , T_DOUBLE , -2, false);395def(_irem , "irem" , "b" , NULL , T_INT , -1, true );396def(_lrem , "lrem" , "b" , NULL , T_LONG , -2, true );397def(_frem , "frem" , "b" , NULL , T_FLOAT , -1, false);398def(_drem , "drem" , "b" , NULL , T_DOUBLE , -2, false);399def(_ineg , "ineg" , "b" , NULL , T_INT , 0, false);400def(_lneg , "lneg" , "b" , NULL , T_LONG , 0, false);401def(_fneg , "fneg" , "b" , NULL , T_FLOAT , 0, false);402def(_dneg , "dneg" , "b" , NULL , T_DOUBLE , 0, false);403def(_ishl , "ishl" , "b" , NULL , T_INT , -1, false);404def(_lshl , "lshl" , "b" , NULL , T_LONG , -1, false);405def(_ishr , "ishr" , "b" , NULL , T_INT , -1, false);406def(_lshr , "lshr" , "b" , NULL , T_LONG , -1, false);407def(_iushr , "iushr" , "b" , NULL , T_INT , -1, false);408def(_lushr , "lushr" , "b" , NULL , T_LONG , -1, false);409def(_iand , "iand" , "b" , NULL , T_INT , -1, false);410def(_land , "land" , "b" , NULL , T_LONG , -2, false);411def(_ior , "ior" , "b" , NULL , T_INT , -1, false);412def(_lor , "lor" , "b" , NULL , T_LONG , -2, false);413def(_ixor , "ixor" , "b" , NULL , T_INT , -1, false);414def(_lxor , "lxor" , "b" , NULL , T_LONG , -2, false);415def(_iinc , "iinc" , "bic" , "wbiicc", T_VOID , 0, false);416def(_i2l , "i2l" , "b" , NULL , T_LONG , 1, false);417def(_i2f , "i2f" , "b" , NULL , T_FLOAT , 0, false);418def(_i2d , "i2d" , "b" , NULL , T_DOUBLE , 1, false);419def(_l2i , "l2i" , "b" , NULL , T_INT , -1, false);420def(_l2f , "l2f" , "b" , NULL , T_FLOAT , -1, false);421def(_l2d , "l2d" , "b" , NULL , T_DOUBLE , 0, false);422def(_f2i , "f2i" , "b" , NULL , T_INT , 0, false);423def(_f2l , "f2l" , "b" , NULL , T_LONG , 1, false);424def(_f2d , "f2d" , "b" , NULL , T_DOUBLE , 1, false);425def(_d2i , "d2i" , "b" , NULL , T_INT , -1, false);426def(_d2l , "d2l" , "b" , NULL , T_LONG , 0, false);427def(_d2f , "d2f" , "b" , NULL , T_FLOAT , -1, false);428def(_i2b , "i2b" , "b" , NULL , T_BYTE , 0, false);429def(_i2c , "i2c" , "b" , NULL , T_CHAR , 0, false);430def(_i2s , "i2s" , "b" , NULL , T_SHORT , 0, false);431def(_lcmp , "lcmp" , "b" , NULL , T_VOID , -3, false);432def(_fcmpl , "fcmpl" , "b" , NULL , T_VOID , -1, false);433def(_fcmpg , "fcmpg" , "b" , NULL , T_VOID , -1, false);434def(_dcmpl , "dcmpl" , "b" , NULL , T_VOID , -3, false);435def(_dcmpg , "dcmpg" , "b" , NULL , T_VOID , -3, false);436def(_ifeq , "ifeq" , "boo" , NULL , T_VOID , -1, false);437def(_ifne , "ifne" , "boo" , NULL , T_VOID , -1, false);438def(_iflt , "iflt" , "boo" , NULL , T_VOID , -1, false);439def(_ifge , "ifge" , "boo" , NULL , T_VOID , -1, false);440def(_ifgt , "ifgt" , "boo" , NULL , T_VOID , -1, false);441def(_ifle , "ifle" , "boo" , NULL , T_VOID , -1, false);442def(_if_icmpeq , "if_icmpeq" , "boo" , NULL , T_VOID , -2, false);443def(_if_icmpne , "if_icmpne" , "boo" , NULL , T_VOID , -2, false);444def(_if_icmplt , "if_icmplt" , "boo" , NULL , T_VOID , -2, false);445def(_if_icmpge , "if_icmpge" , "boo" , NULL , T_VOID , -2, false);446def(_if_icmpgt , "if_icmpgt" , "boo" , NULL , T_VOID , -2, false);447def(_if_icmple , "if_icmple" , "boo" , NULL , T_VOID , -2, false);448def(_if_acmpeq , "if_acmpeq" , "boo" , NULL , T_VOID , -2, false);449def(_if_acmpne , "if_acmpne" , "boo" , NULL , T_VOID , -2, false);450def(_goto , "goto" , "boo" , NULL , T_VOID , 0, false);451def(_jsr , "jsr" , "boo" , NULL , T_INT , 0, false);452def(_ret , "ret" , "bi" , "wbii" , T_VOID , 0, false);453def(_tableswitch , "tableswitch" , "" , NULL , T_VOID , -1, false); // may have backward branches454def(_lookupswitch , "lookupswitch" , "" , NULL , T_VOID , -1, false); // rewriting in interpreter455def(_ireturn , "ireturn" , "b" , NULL , T_INT , -1, true);456def(_lreturn , "lreturn" , "b" , NULL , T_LONG , -2, true);457def(_freturn , "freturn" , "b" , NULL , T_FLOAT , -1, true);458def(_dreturn , "dreturn" , "b" , NULL , T_DOUBLE , -2, true);459def(_areturn , "areturn" , "b" , NULL , T_OBJECT , -1, true);460def(_return , "return" , "b" , NULL , T_VOID , 0, true);461def(_getstatic , "getstatic" , "bJJ" , NULL , T_ILLEGAL, 1, true );462def(_putstatic , "putstatic" , "bJJ" , NULL , T_ILLEGAL, -1, true );463def(_getfield , "getfield" , "bJJ" , NULL , T_ILLEGAL, 0, true );464def(_putfield , "putfield" , "bJJ" , NULL , T_ILLEGAL, -2, true );465def(_invokevirtual , "invokevirtual" , "bJJ" , NULL , T_ILLEGAL, -1, true);466def(_invokespecial , "invokespecial" , "bJJ" , NULL , T_ILLEGAL, -1, true);467def(_invokestatic , "invokestatic" , "bJJ" , NULL , T_ILLEGAL, 0, true);468def(_invokeinterface , "invokeinterface" , "bJJ__", NULL , T_ILLEGAL, -1, true);469def(_invokedynamic , "invokedynamic" , "bJJJJ", NULL , T_ILLEGAL, 0, true );470def(_new , "new" , "bkk" , NULL , T_OBJECT , 1, true );471def(_newarray , "newarray" , "bc" , NULL , T_OBJECT , 0, true );472def(_anewarray , "anewarray" , "bkk" , NULL , T_OBJECT , 0, true );473def(_arraylength , "arraylength" , "b" , NULL , T_VOID , 0, true );474def(_athrow , "athrow" , "b" , NULL , T_VOID , -1, true );475def(_checkcast , "checkcast" , "bkk" , NULL , T_OBJECT , 0, true );476def(_instanceof , "instanceof" , "bkk" , NULL , T_INT , 0, true );477def(_monitorenter , "monitorenter" , "b" , NULL , T_VOID , -1, true );478def(_monitorexit , "monitorexit" , "b" , NULL , T_VOID , -1, true );479def(_wide , "wide" , "" , NULL , T_VOID , 0, false);480def(_multianewarray , "multianewarray" , "bkkc" , NULL , T_OBJECT , 1, true );481def(_ifnull , "ifnull" , "boo" , NULL , T_VOID , -1, false);482def(_ifnonnull , "ifnonnull" , "boo" , NULL , T_VOID , -1, false);483def(_goto_w , "goto_w" , "boooo", NULL , T_VOID , 0, false);484def(_jsr_w , "jsr_w" , "boooo", NULL , T_INT , 0, false);485def(_breakpoint , "breakpoint" , "" , NULL , T_VOID , 0, true);486487// JVM bytecodes488// bytecode bytecode name format wide f. result tp stk traps std code489490def(_fast_agetfield , "fast_agetfield" , "bJJ" , NULL , T_OBJECT , 0, true , _getfield );491def(_fast_bgetfield , "fast_bgetfield" , "bJJ" , NULL , T_INT , 0, true , _getfield );492def(_fast_cgetfield , "fast_cgetfield" , "bJJ" , NULL , T_CHAR , 0, true , _getfield );493def(_fast_dgetfield , "fast_dgetfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _getfield );494def(_fast_fgetfield , "fast_fgetfield" , "bJJ" , NULL , T_FLOAT , 0, true , _getfield );495def(_fast_igetfield , "fast_igetfield" , "bJJ" , NULL , T_INT , 0, true , _getfield );496def(_fast_lgetfield , "fast_lgetfield" , "bJJ" , NULL , T_LONG , 0, true , _getfield );497def(_fast_sgetfield , "fast_sgetfield" , "bJJ" , NULL , T_SHORT , 0, true , _getfield );498499def(_fast_aputfield , "fast_aputfield" , "bJJ" , NULL , T_OBJECT , 0, true , _putfield );500def(_fast_bputfield , "fast_bputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );501def(_fast_zputfield , "fast_zputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );502def(_fast_cputfield , "fast_cputfield" , "bJJ" , NULL , T_CHAR , 0, true , _putfield );503def(_fast_dputfield , "fast_dputfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _putfield );504def(_fast_fputfield , "fast_fputfield" , "bJJ" , NULL , T_FLOAT , 0, true , _putfield );505def(_fast_iputfield , "fast_iputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );506def(_fast_lputfield , "fast_lputfield" , "bJJ" , NULL , T_LONG , 0, true , _putfield );507def(_fast_sputfield , "fast_sputfield" , "bJJ" , NULL , T_SHORT , 0, true , _putfield );508509def(_fast_aload_0 , "fast_aload_0" , "b" , NULL , T_OBJECT , 1, true , _aload_0 );510def(_fast_iaccess_0 , "fast_iaccess_0" , "b_JJ" , NULL , T_INT , 1, true , _aload_0 );511def(_fast_aaccess_0 , "fast_aaccess_0" , "b_JJ" , NULL , T_OBJECT , 1, true , _aload_0 );512def(_fast_faccess_0 , "fast_faccess_0" , "b_JJ" , NULL , T_OBJECT , 1, true , _aload_0 );513514def(_fast_iload , "fast_iload" , "bi" , NULL , T_INT , 1, false, _iload);515def(_fast_iload2 , "fast_iload2" , "bi_i" , NULL , T_INT , 2, false, _iload);516def(_fast_icaload , "fast_icaload" , "bi_" , NULL , T_INT , 0, false, _iload);517518// Faster method invocation.519def(_fast_invokevfinal , "fast_invokevfinal" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual );520521def(_fast_linearswitch , "fast_linearswitch" , "" , NULL , T_VOID , -1, false, _lookupswitch );522def(_fast_binaryswitch , "fast_binaryswitch" , "" , NULL , T_VOID , -1, false, _lookupswitch );523524def(_return_register_finalizer , "return_register_finalizer" , "b" , NULL , T_VOID , 0, true, _return);525526def(_invokehandle , "invokehandle" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual );527528def(_fast_aldc , "fast_aldc" , "bj" , NULL , T_OBJECT, 1, true, _ldc );529def(_fast_aldc_w , "fast_aldc_w" , "bJJ" , NULL , T_OBJECT, 1, true, _ldc_w );530531def(_nofast_getfield , "nofast_getfield" , "bJJ" , NULL , T_ILLEGAL, 0, true, _getfield );532def(_nofast_putfield , "nofast_putfield" , "bJJ" , NULL , T_ILLEGAL, -2, true , _putfield );533534def(_nofast_aload_0 , "nofast_aload_0" , "b" , NULL , T_OBJECT, 1, true , _aload_0 );535def(_nofast_iload , "nofast_iload" , "bi" , NULL , T_INT, 1, false, _iload );536537def(_shouldnotreachhere , "_shouldnotreachhere" , "b" , NULL , T_VOID , 0, false);538539// compare can_trap information for each bytecode with the540// can_trap information for the corresponding base bytecode541// (if a rewritten bytecode can trap, so must the base bytecode)542#ifdef ASSERT543{ for (int i = 0; i < number_of_codes; i++) {544if (is_defined(i)) {545Code code = cast(i);546Code java = java_code(code);547if (can_trap(code) && !can_trap(java))548fatal("%s can trap => %s can trap, too", name(code), name(java));549}550}551}552#endif553554// initialization successful555_is_initialized = true;556}557558559void bytecodes_init() {560Bytecodes::initialize();561}562563// Restore optimization564#ifdef _M_AMD64565#pragma optimize ("", on)566#endif567568569