384 static Code java_code (Code code) { check(code); return _java_code [code]; } 385 static bool can_rewrite (Code code) { check(code); return has_all_flags(code, _bc_can_rewrite, false); } 386 static bool must_rewrite(Bytecodes::Code code) { return can_rewrite(code) && check_must_rewrite(code); } 387 static bool native_byte_order(Code code) { check(code); return has_all_flags(code, _fmt_has_nbo, false); } 388 static bool uses_cp_cache (Code code) { check(code); return has_all_flags(code, _fmt_has_j, false); } 389 // if 'end' is provided, it indicates the end of the code buffer which 390 // should not be read past when parsing. 391 static int special_length_at(Bytecodes::Code code, address bcp, address end = NULL); 392 static int special_length_at(Method* method, address bcp, address end = NULL) { return special_length_at(code_at(method, bcp), bcp, end); } 393 static int raw_special_length_at(address bcp, address end = NULL); 394 static int length_for_code_at(Bytecodes::Code code, address bcp) { int l = length_for(code); return l > 0 ? l : special_length_at(code, bcp); } 395 static int length_at (Method* method, address bcp) { return length_for_code_at(code_at(method, bcp), bcp); } 396 static int java_length_at (Method* method, address bcp) { return length_for_code_at(java_code_at(method, bcp), bcp); } 397 static bool is_java_code (Code code) { return 0 <= code && code < number_of_java_codes; } 398 399 static bool is_aload (Code code) { return (code == _aload || code == _aload_0 || code == _aload_1 400 || code == _aload_2 || code == _aload_3); } 401 static bool is_astore (Code code) { return (code == _astore || code == _astore_0 || code == _astore_1 402 || code == _astore_2 || code == _astore_3); } 403 404 static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0 405 || code == _fconst_0 || code == _dconst_0); } 406 static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); } 407 static bool has_receiver (Code code) { assert(is_invoke(code), ""); return code == _invokevirtual || 408 code == _invokespecial || 409 code == _invokeinterface; } 410 static bool has_optional_appendix(Code code) { return code == _invokedynamic || code == _invokehandle; } 411 412 static int compute_flags (const char* format, int more_flags = 0); // compute the flags 413 static int flags (int code, bool is_wide) { 414 assert(code == (u_char)code, "must be a byte"); 415 return _flags[code + (is_wide ? (1<<BitsPerByte) : 0)]; 416 } 417 static int format_bits (Code code, bool is_wide) { return flags(code, is_wide) & _all_fmt_bits; } 418 static bool has_all_flags (Code code, int test_flags, bool is_wide) { 419 return (flags(code, is_wide) & test_flags) == test_flags; 420 } 421 422 // Initialization 423 static void initialize (); 424 }; 425 | 384 static Code java_code (Code code) { check(code); return _java_code [code]; } 385 static bool can_rewrite (Code code) { check(code); return has_all_flags(code, _bc_can_rewrite, false); } 386 static bool must_rewrite(Bytecodes::Code code) { return can_rewrite(code) && check_must_rewrite(code); } 387 static bool native_byte_order(Code code) { check(code); return has_all_flags(code, _fmt_has_nbo, false); } 388 static bool uses_cp_cache (Code code) { check(code); return has_all_flags(code, _fmt_has_j, false); } 389 // if 'end' is provided, it indicates the end of the code buffer which 390 // should not be read past when parsing. 391 static int special_length_at(Bytecodes::Code code, address bcp, address end = NULL); 392 static int special_length_at(Method* method, address bcp, address end = NULL) { return special_length_at(code_at(method, bcp), bcp, end); } 393 static int raw_special_length_at(address bcp, address end = NULL); 394 static int length_for_code_at(Bytecodes::Code code, address bcp) { int l = length_for(code); return l > 0 ? l : special_length_at(code, bcp); } 395 static int length_at (Method* method, address bcp) { return length_for_code_at(code_at(method, bcp), bcp); } 396 static int java_length_at (Method* method, address bcp) { return length_for_code_at(java_code_at(method, bcp), bcp); } 397 static bool is_java_code (Code code) { return 0 <= code && code < number_of_java_codes; } 398 399 static bool is_aload (Code code) { return (code == _aload || code == _aload_0 || code == _aload_1 400 || code == _aload_2 || code == _aload_3); } 401 static bool is_astore (Code code) { return (code == _astore || code == _astore_0 || code == _astore_1 402 || code == _astore_2 || code == _astore_3); } 403 404 static bool is_const (Code code) { return (_aconst_null <= code && code <= _ldc2_w); } 405 static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0 406 || code == _fconst_0 || code == _dconst_0); } 407 static bool is_return (Code code) { return (_ireturn <= code && code <= _return); } 408 static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); } 409 static bool has_receiver (Code code) { assert(is_invoke(code), ""); return code == _invokevirtual || 410 code == _invokespecial || 411 code == _invokeinterface; } 412 static bool has_optional_appendix(Code code) { return code == _invokedynamic || code == _invokehandle; } 413 414 static int compute_flags (const char* format, int more_flags = 0); // compute the flags 415 static int flags (int code, bool is_wide) { 416 assert(code == (u_char)code, "must be a byte"); 417 return _flags[code + (is_wide ? (1<<BitsPerByte) : 0)]; 418 } 419 static int format_bits (Code code, bool is_wide) { return flags(code, is_wide) & _all_fmt_bits; } 420 static bool has_all_flags (Code code, int test_flags, bool is_wide) { 421 return (flags(code, is_wide) & test_flags) == test_flags; 422 } 423 424 // Initialization 425 static void initialize (); 426 }; 427 |