8135085: Change Method::_intrinsic_id from u1 to u2

Convert Method::_intrinsic_id from u1 to u2 to expand id range over 255.

Reviewed-by: coleenp, iklam, jiangli
This commit is contained in:
Aleksey Shipilev 2015-09-18 13:41:11 -07:00 committed by Yumin Qi
parent e7ed6bff90
commit bbc043a7f2
10 changed files with 31 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -1608,6 +1608,8 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
test_method_data_pointer(mdp, profile_continue);
if (MethodData::profile_return_jsr292_only()) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
// If we don't profile all invoke bytecodes we must make sure
// it's a bytecode we indeed profile. We can't go back to the
// begining of the ProfileData we intend to update to check its
@ -1620,7 +1622,7 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
cmp(rscratch1, Bytecodes::_invokehandle);
br(Assembler::EQ, do_profile);
get_method(tmp);
ldrb(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes()));
ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes()));
cmp(rscratch1, vmIntrinsics::_compiledLambdaForm);
br(Assembler::NE, profile_continue);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -188,9 +188,11 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
address entry_point = __ pc();
if (VerifyMethodHandles) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
Label L;
BLOCK_COMMENT("verify_intrinsic_id {");
__ ldrb(rscratch1, Address(rmethod, Method::intrinsic_id_offset_in_bytes()));
__ ldrh(rscratch1, Address(rmethod, Method::intrinsic_id_offset_in_bytes()));
__ cmp(rscratch1, (int) iid);
__ br(Assembler::EQ, L);
if (iid == vmIntrinsics::_linkToVirtual ||

View File

@ -1817,13 +1817,15 @@ void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1,
test_method_data_pointer(profile_continue);
if (MethodData::profile_return_jsr292_only()) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
// If we don't profile all invoke bytecodes we must make sure
// it's a bytecode we indeed profile. We can't go back to the
// begining of the ProfileData we intend to update to check its
// type because we're right after it and we don't known its
// length.
lbz(tmp1, 0, R14_bcp);
lbz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
lhz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
cror(CCR0, Assembler::equal, CCR1, Assembler::equal);

View File

@ -224,11 +224,12 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
address entry_point = __ pc();
if (VerifyMethodHandles) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
Label L;
BLOCK_COMMENT("verify_intrinsic_id {");
__ load_sized_value(temp1, Method::intrinsic_id_offset_in_bytes(), R19_method,
sizeof(u1), /*is_signed*/ false);
// assert(sizeof(u1) == sizeof(Method::_intrinsic_id), "");
sizeof(u2), /*is_signed*/ false);
__ cmpwi(CCR1, temp1, (int) iid);
__ beq(CCR1, L);
if (iid == vmIntrinsics::_linkToVirtual ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -2021,6 +2021,8 @@ void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1,
test_method_data_pointer(profile_continue);
if (MethodData::profile_return_jsr292_only()) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
// If we don't profile all invoke bytecodes we must make sure
// it's a bytecode we indeed profile. We can't go back to the
// begining of the ProfileData we intend to update to check its
@ -2031,7 +2033,7 @@ void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1,
cmp_and_br_short(tmp1, Bytecodes::_invokedynamic, equal, pn, do_profile);
cmp(tmp1, Bytecodes::_invokehandle);
br(equal, false, pn, do_profile);
delayed()->ldub(Lmethod, Method::intrinsic_id_offset_in_bytes(), tmp1);
delayed()->lduh(Lmethod, Method::intrinsic_id_offset_in_bytes(), tmp1);
cmp_and_br_short(tmp1, vmIntrinsics::_compiledLambdaForm, notEqual, pt, profile_continue);
bind(do_profile);

View File

@ -229,9 +229,11 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
address entry_point = __ pc();
if (VerifyMethodHandles) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
Label L;
BLOCK_COMMENT("verify_intrinsic_id {");
__ ldub(Address(G5_method, Method::intrinsic_id_offset_in_bytes()), O1_scratch);
__ lduh(Address(G5_method, Method::intrinsic_id_offset_in_bytes()), O1_scratch);
__ cmp_and_br_short(O1_scratch, (int) iid, Assembler::equal, Assembler::pt, L);
if (iid == vmIntrinsics::_linkToVirtual ||
iid == vmIntrinsics::_linkToSpecial) {

View File

@ -169,6 +169,8 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
test_method_data_pointer(mdp, profile_continue);
if (MethodData::profile_return_jsr292_only()) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
// If we don't profile all invoke bytecodes we must make sure
// it's a bytecode we indeed profile. We can't go back to the
// begining of the ProfileData we intend to update to check its
@ -180,7 +182,7 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle);
jcc(Assembler::equal, do_profile);
get_method(tmp);
cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
cmpw(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
jcc(Assembler::notEqual, profile_continue);
bind(do_profile);

View File

@ -222,9 +222,11 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
address entry_point = __ pc();
if (VerifyMethodHandles) {
assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
Label L;
BLOCK_COMMENT("verify_intrinsic_id {");
__ cmpb(Address(rbx_method, Method::intrinsic_id_offset_in_bytes()), (int) iid);
__ cmpw(Address(rbx_method, Method::intrinsic_id_offset_in_bytes()), (int) iid);
__ jcc(Assembler::equal, L);
if (iid == vmIntrinsics::_linkToVirtual ||
iid == vmIntrinsics::_linkToSpecial) {

View File

@ -72,7 +72,7 @@ class Method : public Metadata {
int _result_index; // C++ interpreter needs for converting results to/from stack
#endif
u2 _method_size; // size of this object
u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
u2 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
// Flags
enum Flags {
@ -653,7 +653,7 @@ class Method : public Metadata {
// for code generation
static int method_data_offset_in_bytes() { return offset_of(Method, _method_data); }
static int intrinsic_id_offset_in_bytes() { return offset_of(Method, _intrinsic_id); }
static int intrinsic_id_size_in_bytes() { return sizeof(u1); }
static int intrinsic_id_size_in_bytes() { return sizeof(u2); }
// Static methods that are used to implement member methods where an exposed this pointer
// is needed due to possible GCs
@ -777,7 +777,7 @@ class Method : public Metadata {
// Support for inlining of intrinsic methods
vmIntrinsics::ID intrinsic_id() const { return (vmIntrinsics::ID) _intrinsic_id; }
void set_intrinsic_id(vmIntrinsics::ID id) { _intrinsic_id = (u1) id; }
void set_intrinsic_id(vmIntrinsics::ID id) { _intrinsic_id = (u2) id; }
// Helper routines for intrinsic_id() and vmIntrinsics::method().
void init_intrinsic_id(); // updates from _none if a match

View File

@ -383,7 +383,7 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
nonstatic_field(Method, _access_flags, AccessFlags) \
nonstatic_field(Method, _vtable_index, int) \
nonstatic_field(Method, _method_size, u2) \
nonstatic_field(Method, _intrinsic_id, u1) \
nonstatic_field(Method, _intrinsic_id, u2) \
nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \
volatile_nonstatic_field(Method, _code, nmethod*) \
nonstatic_field(Method, _i2i_entry, address) \