< prev index next >
src/share/vm/interpreter/bytecodes.cpp
Print this page
*** 37,52 ****
#endif
#endif
bool Bytecodes::_is_initialized = false;
! const char* Bytecodes::_name [Bytecodes::number_of_codes];
! BasicType Bytecodes::_result_type [Bytecodes::number_of_codes];
! s_char Bytecodes::_depth [Bytecodes::number_of_codes];
! u_char Bytecodes::_lengths [Bytecodes::number_of_codes];
! Bytecodes::Code Bytecodes::_java_code [Bytecodes::number_of_codes];
! u_short Bytecodes::_flags [(1<<BitsPerByte)*2];
#ifdef ASSERT
bool Bytecodes::check_method(const Method* method, address bcp) {
return method->contains(bcp);
}
--- 37,60 ----
#endif
#endif
bool Bytecodes::_is_initialized = false;
! Bytecodes Bytecodes::_codes [Bytecodes::number_of_bcset][1<<BitsPerByte];
!
! const char* Bytecodes::_bcset2name_tab[Bytecodes::number_of_bcset] = {
! "",
! "typed B",
! "typed S",
! "typed I",
! "typed J",
! "typed C",
! "typed F",
! "typed D",
! "typed L",
! "typed ["
! };
#ifdef ASSERT
bool Bytecodes::check_method(const Method* method, address bcp) {
return method->contains(bcp);
}
*** 158,177 ****
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) {
assert(wide_format == NULL || format != NULL, "short form must exist if there's a wide form");
int len = (format != NULL ? (int) strlen(format) : 0);
int wlen = (wide_format != NULL ? (int) strlen(wide_format) : 0);
! _name [code] = name;
! _result_type [code] = result_type;
! _depth [code] = depth;
! _lengths [code] = (wlen << 4) | (len & 0xF);
! _java_code [code] = java_code;
int bc_flags = 0;
if (can_trap) bc_flags |= _bc_can_trap;
if (java_code != code) bc_flags |= _bc_can_rewrite;
! _flags[(u1)code+0*(1<<BitsPerByte)] = compute_flags(format, bc_flags);
! _flags[(u1)code+1*(1<<BitsPerByte)] = compute_flags(wide_format, bc_flags);
assert(is_defined(code) == (format != NULL), "");
assert(wide_is_defined(code) == (wide_format != NULL), "");
assert(length_for(code) == len, "");
assert(wide_length_for(code) == wlen, "");
}
--- 166,185 ----
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) {
assert(wide_format == NULL || format != NULL, "short form must exist if there's a wide form");
int len = (format != NULL ? (int) strlen(format) : 0);
int wlen = (wide_format != NULL ? (int) strlen(wide_format) : 0);
! _codes BCSET_BYTECODE_INDEXES(code)._name = name;
! _codes BCSET_BYTECODE_INDEXES(code)._result_type = result_type;
! _codes BCSET_BYTECODE_INDEXES(code)._depth = depth;
! _codes BCSET_BYTECODE_INDEXES(code)._lengths = (wlen << 4) | (len & 0xF);
! _codes BCSET_BYTECODE_INDEXES(code)._java_code = java_code;
int bc_flags = 0;
if (can_trap) bc_flags |= _bc_can_trap;
if (java_code != code) bc_flags |= _bc_can_rewrite;
! _codes BCSET_BYTECODE_INDEXES(code)._flags[0] = compute_flags(format, bc_flags);
! _codes BCSET_BYTECODE_INDEXES(code)._flags[1] = compute_flags(wide_format, bc_flags);
assert(is_defined(code) == (format != NULL), "");
assert(wide_is_defined(code) == (wide_format != NULL), "");
assert(length_for(code) == len, "");
assert(wide_length_for(code) == wlen, "");
}
*** 269,278 ****
--- 277,293 ----
void Bytecodes::initialize() {
if (_is_initialized) return;
assert(number_of_codes <= 256, "too many bytecodes");
+ // Note: could be optimized with a memset
+ for (int i = 0; i < number_of_bcset; i++) {
+ for (int j = 0; j < 1<<BitsPerByte; j++) {
+ _codes[i][j]._java_code = _illegal;
+ }
+ }
+
// 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
*** 566,583 ****
--- 581,641 ----
}
}
}
#endif
+ define_typed_bytecodes_sets();
+
// initialization successful
_is_initialized = true;
}
void bytecodes_init() {
Bytecodes::initialize();
}
+ void Bytecodes::define_typed_I_bytecodes() {
+ def(cast(_typed_I_aload) , "typed_I_aload" , "bi" , "wbii" , T_INT , 1, false);
+ def(cast(_typed_I_aload_0) , "typed_I_aload_0" , "b" , NULL , T_INT , 1, false);
+ def(cast(_typed_I_aload_1) , "typed_I_aload_1" , "b" , NULL , T_INT , 1, false);
+ def(cast(_typed_I_aload_2) , "typed_I_aload_2" , "b" , NULL , T_INT , 1, false);
+ def(cast(_typed_I_aload_3) , "typed_I_aload_3" , "b" , NULL , T_INT , 1, false);
+ def(cast(_typed_I_astore) , "typed_I_astore" , "bi" , "wbii" , T_VOID , -1, false);
+ def(cast(_typed_I_astore_0) , "typed_I_astore_0" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_I_astore_1) , "typed_I_astore_1" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_I_astore_2) , "typed_I_astore_2" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_I_astore_3) , "typed_I_astore_3" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_I_aaload) , "typed_I_aaload" , "b" , NULL , T_INT , -1, true );
+ def(cast(_typed_I_aastore) , "typed_I_aastore" , "b" , NULL , T_VOID , -3, true );
+ def(cast(_typed_I_areturn) , "typed_I_areturn" , "b" , NULL , T_INT , -1, true);
+ def(cast(_typed_I_anewarray) , "typed_I_anewarray" , "bkk" , NULL , T_OBJECT , 0, true );
+ def(cast(_typed_I_aconst_null), "typed_I_aconst_null", "b" , NULL , T_INT , 1, false);
+ }
+
+ void Bytecodes::define_typed_F_bytecodes() {
+ def(cast(_typed_F_aload) , "typed_F_aload" , "bi" , "wbii" , T_FLOAT , 1, false);
+ def(cast(_typed_F_aload_0) , "typed_F_aload_0" , "b" , NULL , T_FLOAT , 1, false);
+ def(cast(_typed_F_aload_1) , "typed_F_aload_1" , "b" , NULL , T_FLOAT , 1, false);
+ def(cast(_typed_F_aload_2) , "typed_F_aload_2" , "b" , NULL , T_FLOAT , 1, false);
+ def(cast(_typed_F_aload_3) , "typed_F_aload_3" , "b" , NULL , T_FLOAT , 1, false);
+ def(cast(_typed_F_astore) , "typed_F_astore" , "bi" , "wbii" , T_VOID , -1, false);
+ def(cast(_typed_F_astore_0) , "typed_F_astore_0" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_F_astore_1) , "typed_F_astore_1" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_F_astore_2) , "typed_F_astore_2" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_F_astore_3) , "typed_F_astore_3" , "b" , NULL , T_VOID , -1, false);
+ def(cast(_typed_F_aaload) , "typed_F_aaload" , "b" , NULL , T_FLOAT , -1, true );
+ def(cast(_typed_F_aastore) , "typed_F_aastore" , "b" , NULL , T_VOID , -3, true );
+ def(cast(_typed_F_areturn) , "typed_F_areturn" , "b" , NULL , T_FLOAT , -1, true);
+ def(cast(_typed_F_anewarray) , "typed_F_anewarray" , "bkk" , NULL , T_OBJECT , 0, true );
+ def(cast(_typed_F_aconst_null), "typed_F_aconst_null", "b" , NULL , T_FLOAT , 1, false);
+ }
+
+ void Bytecodes::define_typed_bytecodes_sets() {
+ define_typed_I_bytecodes();
+ define_typed_F_bytecodes();
+ }
+
// Restore optimization
#ifdef _M_AMD64
#pragma optimize ("", on)
#endif
< prev index next >