203 } |
203 } |
204 |
204 |
205 int TypeEntriesAtCall::compute_cell_count(BytecodeStream* stream) { |
205 int TypeEntriesAtCall::compute_cell_count(BytecodeStream* stream) { |
206 assert(Bytecodes::is_invoke(stream->code()), "should be invoke"); |
206 assert(Bytecodes::is_invoke(stream->code()), "should be invoke"); |
207 assert(TypeStackSlotEntries::per_arg_count() > ReturnTypeEntry::static_cell_count(), "code to test for arguments/results broken"); |
207 assert(TypeStackSlotEntries::per_arg_count() > ReturnTypeEntry::static_cell_count(), "code to test for arguments/results broken"); |
208 Bytecode_invoke inv(stream->method(), stream->bci()); |
208 const methodHandle m = stream->method(); |
|
209 int bci = stream->bci(); |
|
210 Bytecode_invoke inv(m, bci); |
209 int args_cell = 0; |
211 int args_cell = 0; |
210 if (arguments_profiling_enabled()) { |
212 if (MethodData::profile_arguments_for_invoke(m, bci)) { |
211 args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit); |
213 args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit); |
212 } |
214 } |
213 int ret_cell = 0; |
215 int ret_cell = 0; |
214 if (return_profiling_enabled() && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) { |
216 if (MethodData::profile_return_for_invoke(m, bci) && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) { |
215 ret_cell = ReturnTypeEntry::static_cell_count(); |
217 ret_cell = ReturnTypeEntry::static_cell_count(); |
216 } |
218 } |
217 int header_cell = 0; |
219 int header_cell = 0; |
218 if (args_cell + ret_cell > 0) { |
220 if (args_cell + ret_cell > 0) { |
219 header_cell = header_cell_count(); |
221 header_cell = header_cell_count(); |
1523 |
1525 |
1524 Bytecode_invoke inv(m , bci); |
1526 Bytecode_invoke inv(m , bci); |
1525 return inv.is_invokedynamic() || inv.is_invokehandle(); |
1527 return inv.is_invokedynamic() || inv.is_invokehandle(); |
1526 } |
1528 } |
1527 |
1529 |
|
1530 bool MethodData::profile_unsafe(const methodHandle& m, int bci) { |
|
1531 Bytecode_invoke inv(m , bci); |
|
1532 if (inv.is_invokevirtual() && inv.klass() == vmSymbols::jdk_internal_misc_Unsafe()) { |
|
1533 ResourceMark rm; |
|
1534 char* name = inv.name()->as_C_string(); |
|
1535 if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) { |
|
1536 return true; |
|
1537 } |
|
1538 } |
|
1539 return false; |
|
1540 } |
|
1541 |
1528 int MethodData::profile_arguments_flag() { |
1542 int MethodData::profile_arguments_flag() { |
1529 return TypeProfileLevel % 10; |
1543 return TypeProfileLevel % 10; |
1530 } |
1544 } |
1531 |
1545 |
1532 bool MethodData::profile_arguments() { |
1546 bool MethodData::profile_arguments() { |
1545 if (!profile_arguments()) { |
1559 if (!profile_arguments()) { |
1546 return false; |
1560 return false; |
1547 } |
1561 } |
1548 |
1562 |
1549 if (profile_all_arguments()) { |
1563 if (profile_all_arguments()) { |
|
1564 return true; |
|
1565 } |
|
1566 |
|
1567 if (profile_unsafe(m, bci)) { |
1550 return true; |
1568 return true; |
1551 } |
1569 } |
1552 |
1570 |
1553 assert(profile_arguments_jsr292_only(), "inconsistent"); |
1571 assert(profile_arguments_jsr292_only(), "inconsistent"); |
1554 return profile_jsr292(m, bci); |
1572 return profile_jsr292(m, bci); |