< prev index next >
src/share/vm/oops/methodData.cpp
Print this page
@@ -203,17 +203,19 @@
}
int TypeEntriesAtCall::compute_cell_count(BytecodeStream* stream) {
assert(Bytecodes::is_invoke(stream->code()), "should be invoke");
assert(TypeStackSlotEntries::per_arg_count() > ReturnTypeEntry::static_cell_count(), "code to test for arguments/results broken");
- Bytecode_invoke inv(stream->method(), stream->bci());
+ const methodHandle m = stream->method();
+ int bci = stream->bci();
+ Bytecode_invoke inv(m, bci);
int args_cell = 0;
- if (arguments_profiling_enabled()) {
+ if (MethodData::profile_arguments_for_invoke(m, bci)) {
args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit);
}
int ret_cell = 0;
- if (return_profiling_enabled() && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) {
+ if (MethodData::profile_return_for_invoke(m, bci) && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) {
ret_cell = ReturnTypeEntry::static_cell_count();
}
int header_cell = 0;
if (args_cell + ret_cell > 0) {
header_cell = header_cell_count();
@@ -1523,10 +1525,22 @@
Bytecode_invoke inv(m , bci);
return inv.is_invokedynamic() || inv.is_invokehandle();
}
+bool MethodData::profile_unsafe(const methodHandle& m, int bci) {
+ Bytecode_invoke inv(m , bci);
+ if (inv.is_invokevirtual() && inv.klass() == vmSymbols::jdk_internal_misc_Unsafe()) {
+ ResourceMark rm;
+ char* name = inv.name()->as_C_string();
+ if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) {
+ return true;
+ }
+ }
+ return false;
+}
+
int MethodData::profile_arguments_flag() {
return TypeProfileLevel % 10;
}
bool MethodData::profile_arguments() {
@@ -1548,10 +1562,14 @@
if (profile_all_arguments()) {
return true;
}
+ if (profile_unsafe(m, bci)) {
+ return true;
+ }
+
assert(profile_arguments_jsr292_only(), "inconsistent");
return profile_jsr292(m, bci);
}
int MethodData::profile_return_flag() {
< prev index next >