Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/interpreter/bytecodes.cpp
32285 views
/*1* Copyright (c) 1997, 2016, 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#ifdef TARGET_ARCH_x8629# include "bytes_x86.hpp"30#endif31#ifdef TARGET_ARCH_aarch3232# include "bytes_aarch32.hpp"33#endif34#ifdef TARGET_ARCH_aarch6435# include "bytes_aarch64.hpp"36#endif37#ifdef TARGET_ARCH_sparc38# include "bytes_sparc.hpp"39#endif40#ifdef TARGET_ARCH_zero41# include "bytes_zero.hpp"42#endif43#ifdef TARGET_ARCH_arm44# include "bytes_arm.hpp"45#endif46#ifdef TARGET_ARCH_ppc47# include "bytes_ppc.hpp"48#endif495051#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER < 1600))52// Windows AMD64 Compiler Hangs compiling this file53// unless optimization is off54#ifdef _M_AMD6455#pragma optimize ("", off)56#endif57#endif585960bool Bytecodes::_is_initialized = false;61const char* Bytecodes::_name [Bytecodes::number_of_codes];62BasicType Bytecodes::_result_type [Bytecodes::number_of_codes];63s_char Bytecodes::_depth [Bytecodes::number_of_codes];64u_char Bytecodes::_lengths [Bytecodes::number_of_codes];65Bytecodes::Code Bytecodes::_java_code [Bytecodes::number_of_codes];66u_short Bytecodes::_flags [(1<<BitsPerByte)*2];6768#ifdef ASSERT69bool Bytecodes::check_method(const Method* method, address bcp) {70return method->contains(bcp);71}72#endif7374bool Bytecodes::check_must_rewrite(Bytecodes::Code code) {75assert(can_rewrite(code), "post-check only");7677// Some codes are conditionally rewriting. Look closely at them.78switch (code) {79case Bytecodes::_aload_0:80// Even if RewriteFrequentPairs is turned on,81// the _aload_0 code might delay its rewrite until82// a following _getfield rewrites itself.83return false;8485case Bytecodes::_lookupswitch:86return false; // the rewrite is not done by the interpreter8788case Bytecodes::_new:89// (Could actually look at the class here, but the profit would be small.)90return false; // the rewrite is not always done91}9293// No other special cases.94return true;95}9697Bytecodes::Code Bytecodes::code_at(Method* method, int bci) {98return code_at(method, method->bcp_from(bci));99}100101Bytecodes::Code Bytecodes::non_breakpoint_code_at(const Method* method, address bcp) {102assert(method != NULL, "must have the method for breakpoint conversion");103assert(method->contains(bcp), "must be valid bcp in method");104return method->orig_bytecode_at(method->bci_from(bcp));105}106107int Bytecodes::special_length_at(Bytecodes::Code code, address bcp, address end) {108switch (code) {109case _wide:110if (end != NULL && bcp + 1 >= end) {111return -1; // don't read past end of code buffer112}113return wide_length_for(cast(*(bcp + 1)));114case _tableswitch:115{ address aligned_bcp = (address)round_to((intptr_t)bcp + 1, jintSize);116if (end != NULL && aligned_bcp + 3*jintSize >= end) {117return -1; // don't read past end of code buffer118}119jlong lo = (jint)Bytes::get_Java_u4(aligned_bcp + 1*jintSize);120jlong hi = (jint)Bytes::get_Java_u4(aligned_bcp + 2*jintSize);121jlong len = (aligned_bcp - bcp) + (3 + hi - lo + 1)*jintSize;122// only return len if it can be represented as a positive int;123// return -1 otherwise124return (len > 0 && len == (int)len) ? len : -1;125}126127case _lookupswitch: // fall through128case _fast_binaryswitch: // fall through129case _fast_linearswitch:130{ address aligned_bcp = (address)round_to((intptr_t)bcp + 1, jintSize);131if (end != NULL && aligned_bcp + 2*jintSize >= end) {132return -1; // don't read past end of code buffer133}134jlong npairs = (jint)Bytes::get_Java_u4(aligned_bcp + jintSize);135jlong len = (aligned_bcp - bcp) + (2 + 2*npairs)*jintSize;136// only return len if it can be represented as a positive int;137// return -1 otherwise138return (len > 0 && len == (int)len) ? len : -1;139}140}141// Note: Length functions must return <=0 for invalid bytecodes.142return 0;143}144145// At a breakpoint instruction, this returns the breakpoint's length,146// otherwise, it's the same as special_length_at(). This is used by147// the RawByteCodeStream, which wants to see the actual bytecode148// values (including breakpoint). RawByteCodeStream is used by the149// verifier when reading in bytecode to verify. Other mechanisms that150// run at runtime (such as generateOopMaps) need to iterate over the code151// and don't expect to see breakpoints: they want to see the instruction152// which was replaced so that they can get the correct length and find153// the next bytecode.154//155// 'end' indicates the end of the code buffer, which we should not try to read156// past.157int Bytecodes::raw_special_length_at(address bcp, address end) {158Code code = code_or_bp_at(bcp);159if (code == _breakpoint) {160return 1;161} else {162return special_length_at(code, bcp, end);163}164}165166167168void Bytecodes::def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap) {169def(code, name, format, wide_format, result_type, depth, can_trap, code);170}171172173void 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) {174assert(wide_format == NULL || format != NULL, "short form must exist if there's a wide form");175int len = (format != NULL ? (int) strlen(format) : 0);176int wlen = (wide_format != NULL ? (int) strlen(wide_format) : 0);177_name [code] = name;178_result_type [code] = result_type;179_depth [code] = depth;180_lengths [code] = (wlen << 4) | (len & 0xF);181_java_code [code] = java_code;182int bc_flags = 0;183if (can_trap) bc_flags |= _bc_can_trap;184if (java_code != code) bc_flags |= _bc_can_rewrite;185_flags[(u1)code+0*(1<<BitsPerByte)] = compute_flags(format, bc_flags);186_flags[(u1)code+1*(1<<BitsPerByte)] = compute_flags(wide_format, bc_flags);187assert(is_defined(code) == (format != NULL), "");188assert(wide_is_defined(code) == (wide_format != NULL), "");189assert(length_for(code) == len, "");190assert(wide_length_for(code) == wlen, "");191}192193194// Format strings interpretation:195//196// b: bytecode197// c: signed constant, Java byte-ordering198// i: unsigned local index, Java byte-ordering (I = native byte ordering)199// j: unsigned CP cache index, Java byte-ordering (J = native byte ordering)200// k: unsigned CP index, Java byte-ordering201// o: branch offset, Java byte-ordering202// _: unused/ignored203// w: wide bytecode204//205// Note: The format strings are used for 2 purposes:206// 1. to specify the length of the bytecode207// (= number of characters in format string)208// 2. to derive bytecode format flags (_fmt_has_k, etc.)209//210// Note: For bytecodes with variable length, the format string is the empty string.211212int Bytecodes::compute_flags(const char* format, int more_flags) {213if (format == NULL) return 0; // not even more_flags214int flags = more_flags;215const char* fp = format;216switch (*fp) {217case '\0':218flags |= _fmt_not_simple; // but variable219break;220case 'b':221flags |= _fmt_not_variable; // but simple222++fp; // skip 'b'223break;224case 'w':225flags |= _fmt_not_variable | _fmt_not_simple;226++fp; // skip 'w'227guarantee(*fp == 'b', "wide format must start with 'wb'");228++fp; // skip 'b'229break;230}231232int has_nbo = 0, has_jbo = 0, has_size = 0;233for (;;) {234int this_flag = 0;235char fc = *fp++;236switch (fc) {237case '\0': // end of string238assert(flags == (jchar)flags, "change _format_flags");239return flags;240241case '_': continue; // ignore these242243case 'j': this_flag = _fmt_has_j; has_jbo = 1; break;244case 'k': this_flag = _fmt_has_k; has_jbo = 1; break;245case 'i': this_flag = _fmt_has_i; has_jbo = 1; break;246case 'c': this_flag = _fmt_has_c; has_jbo = 1; break;247case 'o': this_flag = _fmt_has_o; has_jbo = 1; break;248249// uppercase versions mark native byte order (from Rewriter)250// actually, only the 'J' case happens currently251case 'J': this_flag = _fmt_has_j; has_nbo = 1; break;252case 'K': this_flag = _fmt_has_k; has_nbo = 1; break;253case 'I': this_flag = _fmt_has_i; has_nbo = 1; break;254case 'C': this_flag = _fmt_has_c; has_nbo = 1; break;255case 'O': this_flag = _fmt_has_o; has_nbo = 1; break;256default: guarantee(false, "bad char in format");257}258259flags |= this_flag;260261guarantee(!(has_jbo && has_nbo), "mixed byte orders in format");262if (has_nbo)263flags |= _fmt_has_nbo;264265int this_size = 1;266if (*fp == fc) {267// advance beyond run of the same characters268this_size = 2;269while (*++fp == fc) this_size++;270switch (this_size) {271case 2: flags |= _fmt_has_u2; break;272case 4: flags |= _fmt_has_u4; break;273default: guarantee(false, "bad rep count in format");274}275}276guarantee(has_size == 0 || // no field yet277this_size == has_size || // same size278this_size < has_size && *fp == '\0', // last field can be short279"mixed field sizes in format");280has_size = this_size;281}282}283284void Bytecodes::initialize() {285if (_is_initialized) return;286assert(number_of_codes <= 256, "too many bytecodes");287288// initialize bytecode tables - didn't use static array initializers289// (such as {}) so we can do additional consistency checks and init-290// code is independent of actual bytecode numbering.291//292// Note 1: NULL for the format string means the bytecode doesn't exist293// in that form.294//295// Note 2: The result type is T_ILLEGAL for bytecodes where the top of stack296// type after execution is not only determined by the bytecode itself.297298// Java bytecodes299// bytecode bytecode name format wide f. result tp stk traps300def(_nop , "nop" , "b" , NULL , T_VOID , 0, false);301def(_aconst_null , "aconst_null" , "b" , NULL , T_OBJECT , 1, false);302def(_iconst_m1 , "iconst_m1" , "b" , NULL , T_INT , 1, false);303def(_iconst_0 , "iconst_0" , "b" , NULL , T_INT , 1, false);304def(_iconst_1 , "iconst_1" , "b" , NULL , T_INT , 1, false);305def(_iconst_2 , "iconst_2" , "b" , NULL , T_INT , 1, false);306def(_iconst_3 , "iconst_3" , "b" , NULL , T_INT , 1, false);307def(_iconst_4 , "iconst_4" , "b" , NULL , T_INT , 1, false);308def(_iconst_5 , "iconst_5" , "b" , NULL , T_INT , 1, false);309def(_lconst_0 , "lconst_0" , "b" , NULL , T_LONG , 2, false);310def(_lconst_1 , "lconst_1" , "b" , NULL , T_LONG , 2, false);311def(_fconst_0 , "fconst_0" , "b" , NULL , T_FLOAT , 1, false);312def(_fconst_1 , "fconst_1" , "b" , NULL , T_FLOAT , 1, false);313def(_fconst_2 , "fconst_2" , "b" , NULL , T_FLOAT , 1, false);314def(_dconst_0 , "dconst_0" , "b" , NULL , T_DOUBLE , 2, false);315def(_dconst_1 , "dconst_1" , "b" , NULL , T_DOUBLE , 2, false);316def(_bipush , "bipush" , "bc" , NULL , T_INT , 1, false);317def(_sipush , "sipush" , "bcc" , NULL , T_INT , 1, false);318def(_ldc , "ldc" , "bk" , NULL , T_ILLEGAL, 1, true );319def(_ldc_w , "ldc_w" , "bkk" , NULL , T_ILLEGAL, 1, true );320def(_ldc2_w , "ldc2_w" , "bkk" , NULL , T_ILLEGAL, 2, true );321def(_iload , "iload" , "bi" , "wbii" , T_INT , 1, false);322def(_lload , "lload" , "bi" , "wbii" , T_LONG , 2, false);323def(_fload , "fload" , "bi" , "wbii" , T_FLOAT , 1, false);324def(_dload , "dload" , "bi" , "wbii" , T_DOUBLE , 2, false);325def(_aload , "aload" , "bi" , "wbii" , T_OBJECT , 1, false);326def(_iload_0 , "iload_0" , "b" , NULL , T_INT , 1, false);327def(_iload_1 , "iload_1" , "b" , NULL , T_INT , 1, false);328def(_iload_2 , "iload_2" , "b" , NULL , T_INT , 1, false);329def(_iload_3 , "iload_3" , "b" , NULL , T_INT , 1, false);330def(_lload_0 , "lload_0" , "b" , NULL , T_LONG , 2, false);331def(_lload_1 , "lload_1" , "b" , NULL , T_LONG , 2, false);332def(_lload_2 , "lload_2" , "b" , NULL , T_LONG , 2, false);333def(_lload_3 , "lload_3" , "b" , NULL , T_LONG , 2, false);334def(_fload_0 , "fload_0" , "b" , NULL , T_FLOAT , 1, false);335def(_fload_1 , "fload_1" , "b" , NULL , T_FLOAT , 1, false);336def(_fload_2 , "fload_2" , "b" , NULL , T_FLOAT , 1, false);337def(_fload_3 , "fload_3" , "b" , NULL , T_FLOAT , 1, false);338def(_dload_0 , "dload_0" , "b" , NULL , T_DOUBLE , 2, false);339def(_dload_1 , "dload_1" , "b" , NULL , T_DOUBLE , 2, false);340def(_dload_2 , "dload_2" , "b" , NULL , T_DOUBLE , 2, false);341def(_dload_3 , "dload_3" , "b" , NULL , T_DOUBLE , 2, false);342def(_aload_0 , "aload_0" , "b" , NULL , T_OBJECT , 1, true ); // rewriting in interpreter343def(_aload_1 , "aload_1" , "b" , NULL , T_OBJECT , 1, false);344def(_aload_2 , "aload_2" , "b" , NULL , T_OBJECT , 1, false);345def(_aload_3 , "aload_3" , "b" , NULL , T_OBJECT , 1, false);346def(_iaload , "iaload" , "b" , NULL , T_INT , -1, true );347def(_laload , "laload" , "b" , NULL , T_LONG , 0, true );348def(_faload , "faload" , "b" , NULL , T_FLOAT , -1, true );349def(_daload , "daload" , "b" , NULL , T_DOUBLE , 0, true );350def(_aaload , "aaload" , "b" , NULL , T_OBJECT , -1, true );351def(_baload , "baload" , "b" , NULL , T_INT , -1, true );352def(_caload , "caload" , "b" , NULL , T_INT , -1, true );353def(_saload , "saload" , "b" , NULL , T_INT , -1, true );354def(_istore , "istore" , "bi" , "wbii" , T_VOID , -1, false);355def(_lstore , "lstore" , "bi" , "wbii" , T_VOID , -2, false);356def(_fstore , "fstore" , "bi" , "wbii" , T_VOID , -1, false);357def(_dstore , "dstore" , "bi" , "wbii" , T_VOID , -2, false);358def(_astore , "astore" , "bi" , "wbii" , T_VOID , -1, false);359def(_istore_0 , "istore_0" , "b" , NULL , T_VOID , -1, false);360def(_istore_1 , "istore_1" , "b" , NULL , T_VOID , -1, false);361def(_istore_2 , "istore_2" , "b" , NULL , T_VOID , -1, false);362def(_istore_3 , "istore_3" , "b" , NULL , T_VOID , -1, false);363def(_lstore_0 , "lstore_0" , "b" , NULL , T_VOID , -2, false);364def(_lstore_1 , "lstore_1" , "b" , NULL , T_VOID , -2, false);365def(_lstore_2 , "lstore_2" , "b" , NULL , T_VOID , -2, false);366def(_lstore_3 , "lstore_3" , "b" , NULL , T_VOID , -2, false);367def(_fstore_0 , "fstore_0" , "b" , NULL , T_VOID , -1, false);368def(_fstore_1 , "fstore_1" , "b" , NULL , T_VOID , -1, false);369def(_fstore_2 , "fstore_2" , "b" , NULL , T_VOID , -1, false);370def(_fstore_3 , "fstore_3" , "b" , NULL , T_VOID , -1, false);371def(_dstore_0 , "dstore_0" , "b" , NULL , T_VOID , -2, false);372def(_dstore_1 , "dstore_1" , "b" , NULL , T_VOID , -2, false);373def(_dstore_2 , "dstore_2" , "b" , NULL , T_VOID , -2, false);374def(_dstore_3 , "dstore_3" , "b" , NULL , T_VOID , -2, false);375def(_astore_0 , "astore_0" , "b" , NULL , T_VOID , -1, false);376def(_astore_1 , "astore_1" , "b" , NULL , T_VOID , -1, false);377def(_astore_2 , "astore_2" , "b" , NULL , T_VOID , -1, false);378def(_astore_3 , "astore_3" , "b" , NULL , T_VOID , -1, false);379def(_iastore , "iastore" , "b" , NULL , T_VOID , -3, true );380def(_lastore , "lastore" , "b" , NULL , T_VOID , -4, true );381def(_fastore , "fastore" , "b" , NULL , T_VOID , -3, true );382def(_dastore , "dastore" , "b" , NULL , T_VOID , -4, true );383def(_aastore , "aastore" , "b" , NULL , T_VOID , -3, true );384def(_bastore , "bastore" , "b" , NULL , T_VOID , -3, true );385def(_castore , "castore" , "b" , NULL , T_VOID , -3, true );386def(_sastore , "sastore" , "b" , NULL , T_VOID , -3, true );387def(_pop , "pop" , "b" , NULL , T_VOID , -1, false);388def(_pop2 , "pop2" , "b" , NULL , T_VOID , -2, false);389def(_dup , "dup" , "b" , NULL , T_VOID , 1, false);390def(_dup_x1 , "dup_x1" , "b" , NULL , T_VOID , 1, false);391def(_dup_x2 , "dup_x2" , "b" , NULL , T_VOID , 1, false);392def(_dup2 , "dup2" , "b" , NULL , T_VOID , 2, false);393def(_dup2_x1 , "dup2_x1" , "b" , NULL , T_VOID , 2, false);394def(_dup2_x2 , "dup2_x2" , "b" , NULL , T_VOID , 2, false);395def(_swap , "swap" , "b" , NULL , T_VOID , 0, false);396def(_iadd , "iadd" , "b" , NULL , T_INT , -1, false);397def(_ladd , "ladd" , "b" , NULL , T_LONG , -2, false);398def(_fadd , "fadd" , "b" , NULL , T_FLOAT , -1, false);399def(_dadd , "dadd" , "b" , NULL , T_DOUBLE , -2, false);400def(_isub , "isub" , "b" , NULL , T_INT , -1, false);401def(_lsub , "lsub" , "b" , NULL , T_LONG , -2, false);402def(_fsub , "fsub" , "b" , NULL , T_FLOAT , -1, false);403def(_dsub , "dsub" , "b" , NULL , T_DOUBLE , -2, false);404def(_imul , "imul" , "b" , NULL , T_INT , -1, false);405def(_lmul , "lmul" , "b" , NULL , T_LONG , -2, false);406def(_fmul , "fmul" , "b" , NULL , T_FLOAT , -1, false);407def(_dmul , "dmul" , "b" , NULL , T_DOUBLE , -2, false);408def(_idiv , "idiv" , "b" , NULL , T_INT , -1, true );409def(_ldiv , "ldiv" , "b" , NULL , T_LONG , -2, true );410def(_fdiv , "fdiv" , "b" , NULL , T_FLOAT , -1, false);411def(_ddiv , "ddiv" , "b" , NULL , T_DOUBLE , -2, false);412def(_irem , "irem" , "b" , NULL , T_INT , -1, true );413def(_lrem , "lrem" , "b" , NULL , T_LONG , -2, true );414def(_frem , "frem" , "b" , NULL , T_FLOAT , -1, false);415def(_drem , "drem" , "b" , NULL , T_DOUBLE , -2, false);416def(_ineg , "ineg" , "b" , NULL , T_INT , 0, false);417def(_lneg , "lneg" , "b" , NULL , T_LONG , 0, false);418def(_fneg , "fneg" , "b" , NULL , T_FLOAT , 0, false);419def(_dneg , "dneg" , "b" , NULL , T_DOUBLE , 0, false);420def(_ishl , "ishl" , "b" , NULL , T_INT , -1, false);421def(_lshl , "lshl" , "b" , NULL , T_LONG , -1, false);422def(_ishr , "ishr" , "b" , NULL , T_INT , -1, false);423def(_lshr , "lshr" , "b" , NULL , T_LONG , -1, false);424def(_iushr , "iushr" , "b" , NULL , T_INT , -1, false);425def(_lushr , "lushr" , "b" , NULL , T_LONG , -1, false);426def(_iand , "iand" , "b" , NULL , T_INT , -1, false);427def(_land , "land" , "b" , NULL , T_LONG , -2, false);428def(_ior , "ior" , "b" , NULL , T_INT , -1, false);429def(_lor , "lor" , "b" , NULL , T_LONG , -2, false);430def(_ixor , "ixor" , "b" , NULL , T_INT , -1, false);431def(_lxor , "lxor" , "b" , NULL , T_LONG , -2, false);432def(_iinc , "iinc" , "bic" , "wbiicc", T_VOID , 0, false);433def(_i2l , "i2l" , "b" , NULL , T_LONG , 1, false);434def(_i2f , "i2f" , "b" , NULL , T_FLOAT , 0, false);435def(_i2d , "i2d" , "b" , NULL , T_DOUBLE , 1, false);436def(_l2i , "l2i" , "b" , NULL , T_INT , -1, false);437def(_l2f , "l2f" , "b" , NULL , T_FLOAT , -1, false);438def(_l2d , "l2d" , "b" , NULL , T_DOUBLE , 0, false);439def(_f2i , "f2i" , "b" , NULL , T_INT , 0, false);440def(_f2l , "f2l" , "b" , NULL , T_LONG , 1, false);441def(_f2d , "f2d" , "b" , NULL , T_DOUBLE , 1, false);442def(_d2i , "d2i" , "b" , NULL , T_INT , -1, false);443def(_d2l , "d2l" , "b" , NULL , T_LONG , 0, false);444def(_d2f , "d2f" , "b" , NULL , T_FLOAT , -1, false);445def(_i2b , "i2b" , "b" , NULL , T_BYTE , 0, false);446def(_i2c , "i2c" , "b" , NULL , T_CHAR , 0, false);447def(_i2s , "i2s" , "b" , NULL , T_SHORT , 0, false);448def(_lcmp , "lcmp" , "b" , NULL , T_VOID , -3, false);449def(_fcmpl , "fcmpl" , "b" , NULL , T_VOID , -1, false);450def(_fcmpg , "fcmpg" , "b" , NULL , T_VOID , -1, false);451def(_dcmpl , "dcmpl" , "b" , NULL , T_VOID , -3, false);452def(_dcmpg , "dcmpg" , "b" , NULL , T_VOID , -3, false);453def(_ifeq , "ifeq" , "boo" , NULL , T_VOID , -1, false);454def(_ifne , "ifne" , "boo" , NULL , T_VOID , -1, false);455def(_iflt , "iflt" , "boo" , NULL , T_VOID , -1, false);456def(_ifge , "ifge" , "boo" , NULL , T_VOID , -1, false);457def(_ifgt , "ifgt" , "boo" , NULL , T_VOID , -1, false);458def(_ifle , "ifle" , "boo" , NULL , T_VOID , -1, false);459def(_if_icmpeq , "if_icmpeq" , "boo" , NULL , T_VOID , -2, false);460def(_if_icmpne , "if_icmpne" , "boo" , NULL , T_VOID , -2, false);461def(_if_icmplt , "if_icmplt" , "boo" , NULL , T_VOID , -2, false);462def(_if_icmpge , "if_icmpge" , "boo" , NULL , T_VOID , -2, false);463def(_if_icmpgt , "if_icmpgt" , "boo" , NULL , T_VOID , -2, false);464def(_if_icmple , "if_icmple" , "boo" , NULL , T_VOID , -2, false);465def(_if_acmpeq , "if_acmpeq" , "boo" , NULL , T_VOID , -2, false);466def(_if_acmpne , "if_acmpne" , "boo" , NULL , T_VOID , -2, false);467def(_goto , "goto" , "boo" , NULL , T_VOID , 0, false);468def(_jsr , "jsr" , "boo" , NULL , T_INT , 0, false);469def(_ret , "ret" , "bi" , "wbii" , T_VOID , 0, false);470def(_tableswitch , "tableswitch" , "" , NULL , T_VOID , -1, false); // may have backward branches471def(_lookupswitch , "lookupswitch" , "" , NULL , T_VOID , -1, false); // rewriting in interpreter472def(_ireturn , "ireturn" , "b" , NULL , T_INT , -1, true);473def(_lreturn , "lreturn" , "b" , NULL , T_LONG , -2, true);474def(_freturn , "freturn" , "b" , NULL , T_FLOAT , -1, true);475def(_dreturn , "dreturn" , "b" , NULL , T_DOUBLE , -2, true);476def(_areturn , "areturn" , "b" , NULL , T_OBJECT , -1, true);477def(_return , "return" , "b" , NULL , T_VOID , 0, true);478def(_getstatic , "getstatic" , "bJJ" , NULL , T_ILLEGAL, 1, true );479def(_putstatic , "putstatic" , "bJJ" , NULL , T_ILLEGAL, -1, true );480def(_getfield , "getfield" , "bJJ" , NULL , T_ILLEGAL, 0, true );481def(_putfield , "putfield" , "bJJ" , NULL , T_ILLEGAL, -2, true );482def(_invokevirtual , "invokevirtual" , "bJJ" , NULL , T_ILLEGAL, -1, true);483def(_invokespecial , "invokespecial" , "bJJ" , NULL , T_ILLEGAL, -1, true);484def(_invokestatic , "invokestatic" , "bJJ" , NULL , T_ILLEGAL, 0, true);485def(_invokeinterface , "invokeinterface" , "bJJ__", NULL , T_ILLEGAL, -1, true);486def(_invokedynamic , "invokedynamic" , "bJJJJ", NULL , T_ILLEGAL, 0, true );487def(_new , "new" , "bkk" , NULL , T_OBJECT , 1, true );488def(_newarray , "newarray" , "bc" , NULL , T_OBJECT , 0, true );489def(_anewarray , "anewarray" , "bkk" , NULL , T_OBJECT , 0, true );490def(_arraylength , "arraylength" , "b" , NULL , T_VOID , 0, true );491def(_athrow , "athrow" , "b" , NULL , T_VOID , -1, true );492def(_checkcast , "checkcast" , "bkk" , NULL , T_OBJECT , 0, true );493def(_instanceof , "instanceof" , "bkk" , NULL , T_INT , 0, true );494def(_monitorenter , "monitorenter" , "b" , NULL , T_VOID , -1, true );495def(_monitorexit , "monitorexit" , "b" , NULL , T_VOID , -1, true );496def(_wide , "wide" , "" , NULL , T_VOID , 0, false);497def(_multianewarray , "multianewarray" , "bkkc" , NULL , T_OBJECT , 1, true );498def(_ifnull , "ifnull" , "boo" , NULL , T_VOID , -1, false);499def(_ifnonnull , "ifnonnull" , "boo" , NULL , T_VOID , -1, false);500def(_goto_w , "goto_w" , "boooo", NULL , T_VOID , 0, false);501def(_jsr_w , "jsr_w" , "boooo", NULL , T_INT , 0, false);502def(_breakpoint , "breakpoint" , "" , NULL , T_VOID , 0, true);503504// JVM bytecodes505// bytecode bytecode name format wide f. result tp stk traps std code506507def(_fast_agetfield , "fast_agetfield" , "bJJ" , NULL , T_OBJECT , 0, true , _getfield );508def(_fast_bgetfield , "fast_bgetfield" , "bJJ" , NULL , T_INT , 0, true , _getfield );509def(_fast_cgetfield , "fast_cgetfield" , "bJJ" , NULL , T_CHAR , 0, true , _getfield );510def(_fast_dgetfield , "fast_dgetfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _getfield );511def(_fast_fgetfield , "fast_fgetfield" , "bJJ" , NULL , T_FLOAT , 0, true , _getfield );512def(_fast_igetfield , "fast_igetfield" , "bJJ" , NULL , T_INT , 0, true , _getfield );513def(_fast_lgetfield , "fast_lgetfield" , "bJJ" , NULL , T_LONG , 0, true , _getfield );514def(_fast_sgetfield , "fast_sgetfield" , "bJJ" , NULL , T_SHORT , 0, true , _getfield );515516def(_fast_aputfield , "fast_aputfield" , "bJJ" , NULL , T_OBJECT , 0, true , _putfield );517def(_fast_bputfield , "fast_bputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );518def(_fast_zputfield , "fast_zputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );519def(_fast_cputfield , "fast_cputfield" , "bJJ" , NULL , T_CHAR , 0, true , _putfield );520def(_fast_dputfield , "fast_dputfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _putfield );521def(_fast_fputfield , "fast_fputfield" , "bJJ" , NULL , T_FLOAT , 0, true , _putfield );522def(_fast_iputfield , "fast_iputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield );523def(_fast_lputfield , "fast_lputfield" , "bJJ" , NULL , T_LONG , 0, true , _putfield );524def(_fast_sputfield , "fast_sputfield" , "bJJ" , NULL , T_SHORT , 0, true , _putfield );525526def(_fast_aload_0 , "fast_aload_0" , "b" , NULL , T_OBJECT , 1, true , _aload_0 );527def(_fast_iaccess_0 , "fast_iaccess_0" , "b_JJ" , NULL , T_INT , 1, true , _aload_0 );528def(_fast_aaccess_0 , "fast_aaccess_0" , "b_JJ" , NULL , T_OBJECT , 1, true , _aload_0 );529def(_fast_faccess_0 , "fast_faccess_0" , "b_JJ" , NULL , T_OBJECT , 1, true , _aload_0 );530531def(_fast_iload , "fast_iload" , "bi" , NULL , T_INT , 1, false, _iload);532def(_fast_iload2 , "fast_iload2" , "bi_i" , NULL , T_INT , 2, false, _iload);533def(_fast_icaload , "fast_icaload" , "bi_" , NULL , T_INT , 0, false, _iload);534535// Faster method invocation.536def(_fast_invokevfinal , "fast_invokevfinal" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual );537538def(_fast_linearswitch , "fast_linearswitch" , "" , NULL , T_VOID , -1, false, _lookupswitch );539def(_fast_binaryswitch , "fast_binaryswitch" , "" , NULL , T_VOID , -1, false, _lookupswitch );540541def(_return_register_finalizer , "return_register_finalizer" , "b" , NULL , T_VOID , 0, true, _return);542543def(_invokehandle , "invokehandle" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual );544545def(_fast_aldc , "fast_aldc" , "bj" , NULL , T_OBJECT, 1, true, _ldc );546def(_fast_aldc_w , "fast_aldc_w" , "bJJ" , NULL , T_OBJECT, 1, true, _ldc_w );547548def(_shouldnotreachhere , "_shouldnotreachhere" , "b" , NULL , T_VOID , 0, false);549550// platform specific JVM bytecodes551pd_initialize();552553// compare can_trap information for each bytecode with the554// can_trap information for the corresponding base bytecode555// (if a rewritten bytecode can trap, so must the base bytecode)556#ifdef ASSERT557{ for (int i = 0; i < number_of_codes; i++) {558if (is_defined(i)) {559Code code = cast(i);560Code java = java_code(code);561if (can_trap(code) && !can_trap(java))562fatal(err_msg("%s can trap => %s can trap, too", name(code),563name(java)));564}565}566}567#endif568569// initialization successful570_is_initialized = true;571}572573574void bytecodes_init() {575Bytecodes::initialize();576}577578// Restore optimization579#ifdef _M_AMD64580#pragma optimize ("", on)581#endif582583584