/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "interpreter/bytecodes.hpp"
#include "memory/resourceArea.hpp"
#include "oops/methodOop.hpp"
#ifdef TARGET_ARCH_x86
# include "bytes_x86.hpp"
#endif
#ifdef TARGET_ARCH_sparc
# include "bytes_sparc.hpp"
#endif
#ifdef TARGET_ARCH_zero
# include "bytes_zero.hpp"
#endif
#ifdef TARGET_ARCH_arm
# include "bytes_arm.hpp"
#endif
#ifdef TARGET_ARCH_ppc
# include "bytes_ppc.hpp"
#endif
// Windows AMD64 Compiler Hangs compiling this file
// unless optimization is off
#ifdef _M_AMD64
#endif
#endif
#ifdef ASSERT
}
#endif
// Some codes are conditionally rewriting. Look closely at them.
switch (code) {
// Even if RewriteFrequentPairs is turned on,
// the _aload_0 code might delay its rewrite until
// a following _getfield rewrites itself.
return false;
case Bytecodes::_lookupswitch:
return false; // the rewrite is not done by the interpreter
// (Could actually look at the class here, but the profit would be small.)
return false; // the rewrite is not always done
}
// No other special cases.
return true;
}
}
}
switch (code) {
case _wide:
return -1; // don't read past end of code buffer
}
case _tableswitch:
return -1; // don't read past end of code buffer
}
// only return len if it can be represented as a positive int;
// return -1 otherwise
}
case _lookupswitch: // fall through
case _fast_binaryswitch: // fall through
case _fast_linearswitch:
return -1; // don't read past end of code buffer
}
// only return len if it can be represented as a positive int;
// return -1 otherwise
}
}
// Note: Length functions must return <=0 for invalid bytecodes.
return 0;
}
// At a breakpoint instruction, this returns the breakpoint's length,
// otherwise, it's the same as special_length_at(). This is used by
// the RawByteCodeStream, which wants to see the actual bytecode
// values (including breakpoint). RawByteCodeStream is used by the
// verifier when reading in bytecode to verify. Other mechanisms that
// run at runtime (such as generateOopMaps) need to iterate over the code
// and don't expect to see breakpoints: they want to see the instruction
// which was replaced so that they can get the correct length and find
// the next bytecode.
//
// 'end' indicates the end of the code buffer, which we should not try to read
// past.
if (code == _breakpoint) {
return 1;
} else {
}
}
void Bytecodes::def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap) {
}
void 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) {
int bc_flags = 0;
}
// Format strings interpretation:
//
// b: bytecode
// c: signed constant, Java byte-ordering
// i: unsigned local index, Java byte-ordering (I = native byte ordering)
// j: unsigned CP cache index, Java byte-ordering (J = native byte ordering)
// k: unsigned CP index, Java byte-ordering
// o: branch offset, Java byte-ordering
// w: wide bytecode
//
// Note: The format strings are used for 2 purposes:
// 1. to specify the length of the bytecode
// (= number of characters in format string)
// 2. to derive bytecode format flags (_fmt_has_k, etc.)
//
// Note: For bytecodes with variable length, the format string is the empty string.
switch (*fp) {
case '\0':
break;
case 'b':
++fp; // skip 'b'
break;
case 'w':
++fp; // skip 'w'
++fp; // skip 'b'
break;
}
for (;;) {
int this_flag = 0;
switch (fc) {
case '\0': // end of string
return flags;
case '_': continue; // ignore these
// uppercase versions mark native byte order (from Rewriter)
// actually, only the 'J' case happens currently
default: guarantee(false, "bad char in format");
}
if (has_nbo)
flags |= _fmt_has_nbo;
// advance beyond run of the same characters
this_size = 2;
switch (this_size) {
default: guarantee(false, "bad rep count in format");
}
}
"mixed field sizes in format");
}
}
if (_is_initialized) return;
// initialize bytecode tables - didn't use static array initializers
// (such as {}) so we can do additional consistency checks and init-
// code is independent of actual bytecode numbering.
//
// Note 1: NULL for the format string means the bytecode doesn't exist
// in that form.
//
// Note 2: The result type is T_ILLEGAL for bytecodes where the top of stack
// type after execution is not only determined by the bytecode itself.
// Java bytecodes
// bytecode bytecode name format wide f. result tp stk traps
// JVM bytecodes
// bytecode bytecode name format wide f. result tp stk traps std code
// Faster method invocation.
def(_fast_invokevfinal , "fast_invokevfinal" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual );
def(_return_register_finalizer , "return_register_finalizer" , "b" , NULL , T_VOID , 0, true, _return);
// platform specific JVM bytecodes
// compare can_trap information for each bytecode with the
// can_trap information for the corresponding base bytecode
// (if a rewritten bytecode can trap, so must the base bytecode)
#ifdef ASSERT
{ for (int i = 0; i < number_of_codes; i++) {
if (is_defined(i)) {
}
}
}
#endif
// initialization successful
_is_initialized = true;
}
void bytecodes_init() {
Bytecodes::initialize();
}
// Restore optimization
#ifdef _M_AMD64
#endif