mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8163589: Add back class id intrinsic method for event based tracing
Reviewed-by: kvn, mgronlun
This commit is contained in:
parent
ddfcdd9299
commit
d67d71f44c
6 changed files with 84 additions and 0 deletions
|
@ -221,6 +221,9 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
|
||||||
case vmIntrinsics::_putCharStringU:
|
case vmIntrinsics::_putCharStringU:
|
||||||
#ifdef TRACE_HAVE_INTRINSICS
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
case vmIntrinsics::_counterTime:
|
case vmIntrinsics::_counterTime:
|
||||||
|
#if defined(_LP64) || !defined(TRACE_ID_CLASS_SHIFT)
|
||||||
|
case vmIntrinsics::_getClassId:
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -3083,6 +3083,37 @@ void LIRGenerator::do_IfOp(IfOp* x) {
|
||||||
__ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
|
__ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
void LIRGenerator::do_ClassIDIntrinsic(Intrinsic* x) {
|
||||||
|
CodeEmitInfo* info = state_for(x);
|
||||||
|
CodeEmitInfo* info2 = new CodeEmitInfo(info); // Clone for the second null check
|
||||||
|
|
||||||
|
assert(info != NULL, "must have info");
|
||||||
|
LIRItem arg(x->argument_at(0), this);
|
||||||
|
|
||||||
|
arg.load_item();
|
||||||
|
LIR_Opr klass = new_register(T_METADATA);
|
||||||
|
__ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), T_ADDRESS), klass, info);
|
||||||
|
LIR_Opr id = new_register(T_LONG);
|
||||||
|
ByteSize offset = TRACE_KLASS_TRACE_ID_OFFSET;
|
||||||
|
LIR_Address* trace_id_addr = new LIR_Address(klass, in_bytes(offset), T_LONG);
|
||||||
|
|
||||||
|
__ move(trace_id_addr, id);
|
||||||
|
__ logical_or(id, LIR_OprFact::longConst(0x01l), id);
|
||||||
|
__ store(id, trace_id_addr);
|
||||||
|
|
||||||
|
#ifdef TRACE_ID_META_BITS
|
||||||
|
__ logical_and(id, LIR_OprFact::longConst(~TRACE_ID_META_BITS), id);
|
||||||
|
#endif
|
||||||
|
#ifdef TRACE_ID_CLASS_SHIFT
|
||||||
|
__ unsigned_shift_right(id, TRACE_ID_CLASS_SHIFT, id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__ move(id, rlock_result(x));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void LIRGenerator::do_RuntimeCall(address routine, Intrinsic* x) {
|
void LIRGenerator::do_RuntimeCall(address routine, Intrinsic* x) {
|
||||||
assert(x->number_of_arguments() == 0, "wrong type");
|
assert(x->number_of_arguments() == 0, "wrong type");
|
||||||
// Enforce computation of _reserved_argument_area_size which is required on some platforms.
|
// Enforce computation of _reserved_argument_area_size which is required on some platforms.
|
||||||
|
@ -3108,6 +3139,9 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRACE_HAVE_INTRINSICS
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
case vmIntrinsics::_getClassId:
|
||||||
|
do_ClassIDIntrinsic(x);
|
||||||
|
break;
|
||||||
case vmIntrinsics::_counterTime:
|
case vmIntrinsics::_counterTime:
|
||||||
do_RuntimeCall(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), x);
|
do_RuntimeCall(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), x);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -438,6 +438,10 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
|
||||||
SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);
|
SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);
|
||||||
void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
|
void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
void do_ClassIDIntrinsic(Intrinsic* x);
|
||||||
|
#endif
|
||||||
|
|
||||||
void do_RuntimeCall(address routine, Intrinsic* x);
|
void do_RuntimeCall(address routine, Intrinsic* x);
|
||||||
|
|
||||||
ciKlass* profile_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k,
|
ciKlass* profile_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k,
|
||||||
|
|
|
@ -366,6 +366,7 @@ bool vmIntrinsics::can_trap(vmIntrinsics::ID id) {
|
||||||
switch(id) {
|
switch(id) {
|
||||||
#ifdef TRACE_HAVE_INTRINSICS
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
case vmIntrinsics::_counterTime:
|
case vmIntrinsics::_counterTime:
|
||||||
|
case vmIntrinsics::_getClassId:
|
||||||
#endif
|
#endif
|
||||||
case vmIntrinsics::_currentTimeMillis:
|
case vmIntrinsics::_currentTimeMillis:
|
||||||
case vmIntrinsics::_nanoTime:
|
case vmIntrinsics::_nanoTime:
|
||||||
|
|
|
@ -530,6 +530,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
||||||
case vmIntrinsics::_isInterrupted:
|
case vmIntrinsics::_isInterrupted:
|
||||||
#ifdef TRACE_HAVE_INTRINSICS
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
case vmIntrinsics::_counterTime:
|
case vmIntrinsics::_counterTime:
|
||||||
|
case vmIntrinsics::_getClassId:
|
||||||
#endif
|
#endif
|
||||||
case vmIntrinsics::_currentTimeMillis:
|
case vmIntrinsics::_currentTimeMillis:
|
||||||
case vmIntrinsics::_nanoTime:
|
case vmIntrinsics::_nanoTime:
|
||||||
|
|
|
@ -254,6 +254,9 @@ class LibraryCallKit : public GraphKit {
|
||||||
bool inline_native_currentThread();
|
bool inline_native_currentThread();
|
||||||
|
|
||||||
bool inline_native_time_funcs(address method, const char* funcName);
|
bool inline_native_time_funcs(address method, const char* funcName);
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
bool inline_native_classID();
|
||||||
|
#endif
|
||||||
bool inline_native_isInterrupted();
|
bool inline_native_isInterrupted();
|
||||||
bool inline_native_Class_query(vmIntrinsics::ID id);
|
bool inline_native_Class_query(vmIntrinsics::ID id);
|
||||||
bool inline_native_subtype_check();
|
bool inline_native_subtype_check();
|
||||||
|
@ -708,6 +711,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
||||||
|
|
||||||
#ifdef TRACE_HAVE_INTRINSICS
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
case vmIntrinsics::_counterTime: return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
|
case vmIntrinsics::_counterTime: return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
|
||||||
|
case vmIntrinsics::_getClassId: return inline_native_classID();
|
||||||
#endif
|
#endif
|
||||||
case vmIntrinsics::_currentTimeMillis: return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
|
case vmIntrinsics::_currentTimeMillis: return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
|
||||||
case vmIntrinsics::_nanoTime: return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
|
case vmIntrinsics::_nanoTime: return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
|
||||||
|
@ -3132,6 +3136,43 @@ bool LibraryCallKit::inline_native_time_funcs(address funcAddr, const char* func
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
|
||||||
|
/*
|
||||||
|
* oop -> myklass
|
||||||
|
* myklass->trace_id |= USED
|
||||||
|
* return myklass->trace_id & ~0x3
|
||||||
|
*/
|
||||||
|
bool LibraryCallKit::inline_native_classID() {
|
||||||
|
Node* cls = null_check(argument(0), T_OBJECT);
|
||||||
|
Node* kls = load_klass_from_mirror(cls, false, NULL, 0);
|
||||||
|
kls = null_check(kls, T_OBJECT);
|
||||||
|
|
||||||
|
ByteSize offset = TRACE_KLASS_TRACE_ID_OFFSET;
|
||||||
|
Node* insp = basic_plus_adr(kls, in_bytes(offset));
|
||||||
|
Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG, MemNode::unordered);
|
||||||
|
|
||||||
|
Node* clsused = longcon(0x01l); // set the class bit
|
||||||
|
Node* orl = _gvn.transform(new OrLNode(tvalue, clsused));
|
||||||
|
const TypePtr *adr_type = _gvn.type(insp)->isa_ptr();
|
||||||
|
store_to_memory(control(), insp, orl, T_LONG, adr_type, MemNode::unordered);
|
||||||
|
|
||||||
|
#ifdef TRACE_ID_META_BITS
|
||||||
|
Node* mbits = longcon(~TRACE_ID_META_BITS);
|
||||||
|
tvalue = _gvn.transform(new AndLNode(tvalue, mbits));
|
||||||
|
#endif
|
||||||
|
#ifdef TRACE_ID_CLASS_SHIFT
|
||||||
|
Node* cbits = intcon(TRACE_ID_CLASS_SHIFT);
|
||||||
|
tvalue = _gvn.transform(new URShiftLNode(tvalue, cbits));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
set_result(tvalue);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------inline_native_currentThread------------------
|
//------------------------inline_native_currentThread------------------
|
||||||
bool LibraryCallKit::inline_native_currentThread() {
|
bool LibraryCallKit::inline_native_currentThread() {
|
||||||
Node* junk = NULL;
|
Node* junk = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue