7160570: Intrinsification support for tracing framework
Reviewed-by: sla, never
This commit is contained in:
parent
70685b85af
commit
cf406f37e3
@ -72,15 +72,18 @@
|
|||||||
|
|
||||||
#ifdef _ALLBSD_SOURCE
|
#ifdef _ALLBSD_SOURCE
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
static size_t thread_id_size() { return sizeof(thread_t); }
|
||||||
thread_t thread_id() const {
|
thread_t thread_id() const {
|
||||||
return _thread_id;
|
return _thread_id;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
static size_t thread_id_size() { return sizeof(pthread_t); }
|
||||||
pthread_t thread_id() const {
|
pthread_t thread_id() const {
|
||||||
return _thread_id;
|
return _thread_id;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
static size_t thread_id_size() { return sizeof(pid_t); }
|
||||||
pid_t thread_id() const {
|
pid_t thread_id() const {
|
||||||
return _thread_id;
|
return _thread_id;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -56,6 +56,8 @@
|
|||||||
sigset_t caller_sigmask() const { return _caller_sigmask; }
|
sigset_t caller_sigmask() const { return _caller_sigmask; }
|
||||||
void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }
|
void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }
|
||||||
|
|
||||||
|
static size_t thread_id_size() { return sizeof(pid_t); }
|
||||||
|
|
||||||
pid_t thread_id() const {
|
pid_t thread_id() const {
|
||||||
return _thread_id;
|
return _thread_id;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
bool _vm_created_thread; // true if the VM created this thread,
|
bool _vm_created_thread; // true if the VM created this thread,
|
||||||
// false if primary thread or attached thread
|
// false if primary thread or attached thread
|
||||||
public:
|
public:
|
||||||
|
static size_t thread_id_size() { return sizeof(thread_t); }
|
||||||
thread_t thread_id() const { return _thread_id; }
|
thread_t thread_id() const { return _thread_id; }
|
||||||
uint lwp_id() const { return _lwp_id; }
|
uint lwp_id() const { return _lwp_id; }
|
||||||
int native_priority() const { return _native_priority; }
|
int native_priority() const { return _native_priority; }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -42,6 +42,8 @@ typedef void* HANDLE;
|
|||||||
HANDLE interrupt_event() const { return _interrupt_event; }
|
HANDLE interrupt_event() const { return _interrupt_event; }
|
||||||
void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; }
|
void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; }
|
||||||
|
|
||||||
|
|
||||||
|
static size_t thread_id_size() { return sizeof(unsigned long); }
|
||||||
unsigned long thread_id() const { return _thread_id; }
|
unsigned long thread_id() const { return _thread_id; }
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
// Used for debugging, return a unique integer for each thread.
|
// Used for debugging, return a unique integer for each thread.
|
||||||
|
@ -3132,10 +3132,23 @@ bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) {
|
|||||||
bool cantrap = true;
|
bool cantrap = true;
|
||||||
vmIntrinsics::ID id = callee->intrinsic_id();
|
vmIntrinsics::ID id = callee->intrinsic_id();
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case vmIntrinsics::_arraycopy :
|
case vmIntrinsics::_arraycopy:
|
||||||
if (!InlineArrayCopy) return false;
|
if (!InlineArrayCopy) return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
case vmIntrinsics::_classID:
|
||||||
|
case vmIntrinsics::_threadID:
|
||||||
|
preserves_state = true;
|
||||||
|
cantrap = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case vmIntrinsics::_counterTime:
|
||||||
|
preserves_state = true;
|
||||||
|
cantrap = false;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case vmIntrinsics::_currentTimeMillis:
|
case vmIntrinsics::_currentTimeMillis:
|
||||||
case vmIntrinsics::_nanoTime:
|
case vmIntrinsics::_nanoTime:
|
||||||
preserves_state = true;
|
preserves_state = true;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2879,6 +2879,50 @@ 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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LIRGenerator::do_RuntimeCall(address routine, int expected_arguments, Intrinsic* x) {
|
||||||
|
assert(x->number_of_arguments() == expected_arguments, "wrong type");
|
||||||
|
LIR_Opr reg = result_register_for(x->type());
|
||||||
|
__ call_runtime_leaf(routine, getThreadTemp(),
|
||||||
|
reg, new LIR_OprList());
|
||||||
|
LIR_Opr result = rlock_result(x);
|
||||||
|
__ move(reg, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
void LIRGenerator::do_ThreadIDIntrinsic(Intrinsic* x) {
|
||||||
|
LIR_Opr thread = getThreadPointer();
|
||||||
|
LIR_Opr osthread = new_pointer_register();
|
||||||
|
__ move(new LIR_Address(thread, in_bytes(JavaThread::osthread_offset()), osthread->type()), osthread);
|
||||||
|
size_t thread_id_size = OSThread::thread_id_size();
|
||||||
|
if (thread_id_size == (size_t) BytesPerLong) {
|
||||||
|
LIR_Opr id = new_register(T_LONG);
|
||||||
|
__ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_LONG), id);
|
||||||
|
__ convert(Bytecodes::_l2i, id, rlock_result(x));
|
||||||
|
} else if (thread_id_size == (size_t) BytesPerInt) {
|
||||||
|
__ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_INT), rlock_result(x));
|
||||||
|
} else {
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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(1), this);
|
||||||
|
arg.load_item();
|
||||||
|
LIR_Opr klass = new_register(T_OBJECT);
|
||||||
|
__ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), T_OBJECT), klass, info);
|
||||||
|
LIR_Opr id = new_register(T_LONG);
|
||||||
|
ByteSize offset = 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);
|
||||||
|
__ logical_and(id, LIR_OprFact::longConst(~0x3l), id);
|
||||||
|
__ move(id, rlock_result(x));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void LIRGenerator::do_Intrinsic(Intrinsic* x) {
|
void LIRGenerator::do_Intrinsic(Intrinsic* x) {
|
||||||
switch (x->id()) {
|
switch (x->id()) {
|
||||||
@ -2890,25 +2934,21 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case vmIntrinsics::_currentTimeMillis: {
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
assert(x->number_of_arguments() == 0, "wrong type");
|
case vmIntrinsics::_threadID: do_ThreadIDIntrinsic(x); break;
|
||||||
LIR_Opr reg = result_register_for(x->type());
|
case vmIntrinsics::_classID: do_ClassIDIntrinsic(x); break;
|
||||||
__ call_runtime_leaf(CAST_FROM_FN_PTR(address, os::javaTimeMillis), getThreadTemp(),
|
case vmIntrinsics::_counterTime:
|
||||||
reg, new LIR_OprList());
|
do_RuntimeCall(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), 0, x);
|
||||||
LIR_Opr result = rlock_result(x);
|
|
||||||
__ move(reg, result);
|
|
||||||
break;
|
break;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
case vmIntrinsics::_nanoTime: {
|
case vmIntrinsics::_currentTimeMillis:
|
||||||
assert(x->number_of_arguments() == 0, "wrong type");
|
do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeMillis), 0, x);
|
||||||
LIR_Opr reg = result_register_for(x->type());
|
break;
|
||||||
__ call_runtime_leaf(CAST_FROM_FN_PTR(address, os::javaTimeNanos), getThreadTemp(),
|
|
||||||
reg, new LIR_OprList());
|
case vmIntrinsics::_nanoTime:
|
||||||
LIR_Opr result = rlock_result(x);
|
do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeNanos), 0, x);
|
||||||
__ move(reg, result);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case vmIntrinsics::_Object_init: do_RegisterFinalizer(x); break;
|
case vmIntrinsics::_Object_init: do_RegisterFinalizer(x); break;
|
||||||
case vmIntrinsics::_getClass: do_getClass(x); break;
|
case vmIntrinsics::_getClass: do_getClass(x); break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -426,6 +426,12 @@ 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);
|
||||||
|
|
||||||
|
void do_RuntimeCall(address routine, int expected_arguments, Intrinsic* x);
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
void do_ThreadIDIntrinsic(Intrinsic* x);
|
||||||
|
void do_ClassIDIntrinsic(Intrinsic* x);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Compilation* compilation() const { return _compilation; }
|
Compilation* compilation() const { return _compilation; }
|
||||||
FrameMap* frame_map() const { return _compilation->frame_map(); }
|
FrameMap* frame_map() const { return _compilation->frame_map(); }
|
||||||
|
@ -295,6 +295,9 @@ const char* Runtime1::name_for_address(address entry) {
|
|||||||
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
|
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
|
||||||
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
|
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
|
||||||
FUNCTION_CASE(entry, trace_block_entry);
|
FUNCTION_CASE(entry, trace_block_entry);
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
FUNCTION_CASE(entry, TRACE_TIME_METHOD);
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef FUNCTION_CASE
|
#undef FUNCTION_CASE
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "oops/symbol.hpp"
|
#include "oops/symbol.hpp"
|
||||||
#include "memory/iterator.hpp"
|
#include "memory/iterator.hpp"
|
||||||
|
#include "trace/traceMacros.hpp"
|
||||||
|
|
||||||
// The class vmSymbols is a name space for fast lookup of
|
// The class vmSymbols is a name space for fast lookup of
|
||||||
// symbols commonly used in the VM.
|
// symbols commonly used in the VM.
|
||||||
@ -424,6 +425,7 @@
|
|||||||
template(throwable_throwable_signature, "(Ljava/lang/Throwable;)Ljava/lang/Throwable;") \
|
template(throwable_throwable_signature, "(Ljava/lang/Throwable;)Ljava/lang/Throwable;") \
|
||||||
template(class_void_signature, "(Ljava/lang/Class;)V") \
|
template(class_void_signature, "(Ljava/lang/Class;)V") \
|
||||||
template(class_int_signature, "(Ljava/lang/Class;)I") \
|
template(class_int_signature, "(Ljava/lang/Class;)I") \
|
||||||
|
template(class_long_signature, "(Ljava/lang/Class;)J") \
|
||||||
template(class_boolean_signature, "(Ljava/lang/Class;)Z") \
|
template(class_boolean_signature, "(Ljava/lang/Class;)Z") \
|
||||||
template(throwable_string_void_signature, "(Ljava/lang/Throwable;Ljava/lang/String;)V") \
|
template(throwable_string_void_signature, "(Ljava/lang/Throwable;Ljava/lang/String;)V") \
|
||||||
template(string_array_void_signature, "([Ljava/lang/String;)V") \
|
template(string_array_void_signature, "([Ljava/lang/String;)V") \
|
||||||
@ -539,10 +541,12 @@
|
|||||||
template(serializePropertiesToByteArray_signature, "()[B") \
|
template(serializePropertiesToByteArray_signature, "()[B") \
|
||||||
template(serializeAgentPropertiesToByteArray_name, "serializeAgentPropertiesToByteArray") \
|
template(serializeAgentPropertiesToByteArray_name, "serializeAgentPropertiesToByteArray") \
|
||||||
template(classRedefinedCount_name, "classRedefinedCount") \
|
template(classRedefinedCount_name, "classRedefinedCount") \
|
||||||
|
\
|
||||||
|
/* trace signatures */ \
|
||||||
|
TRACE_TEMPLATES(template) \
|
||||||
|
\
|
||||||
/*end*/
|
/*end*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Here are all the intrinsics known to the runtime and the CI.
|
// Here are all the intrinsics known to the runtime and the CI.
|
||||||
// Each intrinsic consists of a public enum name (like _hashCode),
|
// Each intrinsic consists of a public enum name (like _hashCode),
|
||||||
// followed by a specification of its klass, name, and signature:
|
// followed by a specification of its klass, name, and signature:
|
||||||
@ -648,6 +652,8 @@
|
|||||||
do_intrinsic(_nanoTime, java_lang_System, nanoTime_name, void_long_signature, F_S) \
|
do_intrinsic(_nanoTime, java_lang_System, nanoTime_name, void_long_signature, F_S) \
|
||||||
do_name( nanoTime_name, "nanoTime") \
|
do_name( nanoTime_name, "nanoTime") \
|
||||||
\
|
\
|
||||||
|
TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias) \
|
||||||
|
\
|
||||||
do_intrinsic(_arraycopy, java_lang_System, arraycopy_name, arraycopy_signature, F_S) \
|
do_intrinsic(_arraycopy, java_lang_System, arraycopy_name, arraycopy_signature, F_S) \
|
||||||
do_name( arraycopy_name, "arraycopy") \
|
do_name( arraycopy_name, "arraycopy") \
|
||||||
do_signature(arraycopy_signature, "(Ljava/lang/Object;ILjava/lang/Object;II)V") \
|
do_signature(arraycopy_signature, "(Ljava/lang/Object;ILjava/lang/Object;II)V") \
|
||||||
|
@ -642,6 +642,7 @@ class instanceKlass: public Klass {
|
|||||||
|
|
||||||
// support for stub routines
|
// support for stub routines
|
||||||
static ByteSize init_state_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_state)); }
|
static ByteSize init_state_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_state)); }
|
||||||
|
TRACE_DEFINE_OFFSET;
|
||||||
static ByteSize init_thread_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_thread)); }
|
static ByteSize init_thread_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_thread)); }
|
||||||
|
|
||||||
// subclass/subinterface checks
|
// subclass/subinterface checks
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -175,7 +175,11 @@ class LibraryCallKit : public GraphKit {
|
|||||||
bool inline_unsafe_allocate();
|
bool inline_unsafe_allocate();
|
||||||
bool inline_unsafe_copyMemory();
|
bool inline_unsafe_copyMemory();
|
||||||
bool inline_native_currentThread();
|
bool inline_native_currentThread();
|
||||||
bool inline_native_time_funcs(bool isNano);
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
bool inline_native_classID();
|
||||||
|
bool inline_native_threadID();
|
||||||
|
#endif
|
||||||
|
bool inline_native_time_funcs(address method, const char* funcName);
|
||||||
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();
|
||||||
@ -638,10 +642,18 @@ bool LibraryCallKit::try_to_inline() {
|
|||||||
case vmIntrinsics::_isInterrupted:
|
case vmIntrinsics::_isInterrupted:
|
||||||
return inline_native_isInterrupted();
|
return inline_native_isInterrupted();
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
case vmIntrinsics::_classID:
|
||||||
|
return inline_native_classID();
|
||||||
|
case vmIntrinsics::_threadID:
|
||||||
|
return inline_native_threadID();
|
||||||
|
case vmIntrinsics::_counterTime:
|
||||||
|
return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
|
||||||
|
#endif
|
||||||
case vmIntrinsics::_currentTimeMillis:
|
case vmIntrinsics::_currentTimeMillis:
|
||||||
return inline_native_time_funcs(false);
|
return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
|
||||||
case vmIntrinsics::_nanoTime:
|
case vmIntrinsics::_nanoTime:
|
||||||
return inline_native_time_funcs(true);
|
return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
|
||||||
case vmIntrinsics::_allocateInstance:
|
case vmIntrinsics::_allocateInstance:
|
||||||
return inline_unsafe_allocate();
|
return inline_unsafe_allocate();
|
||||||
case vmIntrinsics::_copyMemory:
|
case vmIntrinsics::_copyMemory:
|
||||||
@ -2840,14 +2852,63 @@ bool LibraryCallKit::inline_unsafe_allocate() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TRACE_HAVE_INTRINSICS
|
||||||
|
/*
|
||||||
|
* oop -> myklass
|
||||||
|
* myklass->trace_id |= USED
|
||||||
|
* return myklass->trace_id & ~0x3
|
||||||
|
*/
|
||||||
|
bool LibraryCallKit::inline_native_classID() {
|
||||||
|
int nargs = 1 + 1;
|
||||||
|
null_check_receiver(callee()); // check then ignore argument(0)
|
||||||
|
_sp += nargs;
|
||||||
|
Node* cls = do_null_check(argument(1), T_OBJECT);
|
||||||
|
_sp -= nargs;
|
||||||
|
Node* kls = load_klass_from_mirror(cls, false, nargs, NULL, 0);
|
||||||
|
_sp += nargs;
|
||||||
|
kls = do_null_check(kls, T_OBJECT);
|
||||||
|
_sp -= nargs;
|
||||||
|
ByteSize offset = TRACE_ID_OFFSET;
|
||||||
|
Node* insp = basic_plus_adr(kls, in_bytes(offset));
|
||||||
|
Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG);
|
||||||
|
Node* bits = longcon(~0x03l); // ignore bit 0 & 1
|
||||||
|
Node* andl = _gvn.transform(new (C, 3) AndLNode(tvalue, bits));
|
||||||
|
Node* clsused = longcon(0x01l); // set the class bit
|
||||||
|
Node* orl = _gvn.transform(new (C, 3) OrLNode(tvalue, clsused));
|
||||||
|
|
||||||
|
const TypePtr *adr_type = _gvn.type(insp)->isa_ptr();
|
||||||
|
store_to_memory(control(), insp, orl, T_LONG, adr_type);
|
||||||
|
push_pair(andl);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LibraryCallKit::inline_native_threadID() {
|
||||||
|
Node* tls_ptr = NULL;
|
||||||
|
Node* cur_thr = generate_current_thread(tls_ptr);
|
||||||
|
Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset()));
|
||||||
|
Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS);
|
||||||
|
p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::thread_id_offset()));
|
||||||
|
|
||||||
|
Node* threadid = NULL;
|
||||||
|
size_t thread_id_size = OSThread::thread_id_size();
|
||||||
|
if (thread_id_size == (size_t) BytesPerLong) {
|
||||||
|
threadid = ConvL2I(make_load(control(), p, TypeLong::LONG, T_LONG));
|
||||||
|
push(threadid);
|
||||||
|
} else if (thread_id_size == (size_t) BytesPerInt) {
|
||||||
|
threadid = make_load(control(), p, TypeInt::INT, T_INT);
|
||||||
|
push(threadid);
|
||||||
|
} else {
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------inline_native_time_funcs--------------
|
//------------------------inline_native_time_funcs--------------
|
||||||
// inline code for System.currentTimeMillis() and System.nanoTime()
|
// inline code for System.currentTimeMillis() and System.nanoTime()
|
||||||
// these have the same type and signature
|
// these have the same type and signature
|
||||||
bool LibraryCallKit::inline_native_time_funcs(bool isNano) {
|
bool LibraryCallKit::inline_native_time_funcs(address funcAddr, const char* funcName) {
|
||||||
address funcAddr = isNano ? CAST_FROM_FN_PTR(address, os::javaTimeNanos) :
|
const TypeFunc *tf = OptoRuntime::void_long_Type();
|
||||||
CAST_FROM_FN_PTR(address, os::javaTimeMillis);
|
|
||||||
const char * funcName = isNano ? "nanoTime" : "currentTimeMillis";
|
|
||||||
const TypeFunc *tf = OptoRuntime::current_time_millis_Type();
|
|
||||||
const TypePtr* no_memory_effects = NULL;
|
const TypePtr* no_memory_effects = NULL;
|
||||||
Node* time = make_runtime_call(RC_LEAF, tf, funcAddr, funcName, no_memory_effects);
|
Node* time = make_runtime_call(RC_LEAF, tf, funcAddr, funcName, no_memory_effects);
|
||||||
Node* value = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms+0));
|
Node* value = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms+0));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -709,9 +709,9 @@ const TypeFunc* OptoRuntime::Math_DD_D_Type() {
|
|||||||
return TypeFunc::make(domain, range);
|
return TypeFunc::make(domain, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------- currentTimeMillis
|
//-------------- currentTimeMillis, currentTimeNanos, etc
|
||||||
|
|
||||||
const TypeFunc* OptoRuntime::current_time_millis_Type() {
|
const TypeFunc* OptoRuntime::void_long_Type() {
|
||||||
// create input type (domain)
|
// create input type (domain)
|
||||||
const Type **fields = TypeTuple::fields(0);
|
const Type **fields = TypeTuple::fields(0);
|
||||||
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
|
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -268,7 +268,7 @@ private:
|
|||||||
static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
|
static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
|
||||||
static const TypeFunc* modf_Type();
|
static const TypeFunc* modf_Type();
|
||||||
static const TypeFunc* l2f_Type();
|
static const TypeFunc* l2f_Type();
|
||||||
static const TypeFunc* current_time_millis_Type();
|
static const TypeFunc* void_long_Type();
|
||||||
|
|
||||||
static const TypeFunc* flush_windows_Type();
|
static const TypeFunc* flush_windows_Type();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -98,6 +98,7 @@ class OSThread: public CHeapObj {
|
|||||||
|
|
||||||
// For java intrinsics:
|
// For java intrinsics:
|
||||||
static ByteSize interrupted_offset() { return byte_offset_of(OSThread, _interrupted); }
|
static ByteSize interrupted_offset() { return byte_offset_of(OSThread, _interrupted); }
|
||||||
|
static ByteSize thread_id_offset() { return byte_offset_of(OSThread, _thread_id); }
|
||||||
|
|
||||||
// Platform dependent stuff
|
// Platform dependent stuff
|
||||||
#ifdef TARGET_OS_FAMILY_linux
|
#ifdef TARGET_OS_FAMILY_linux
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -43,5 +43,9 @@
|
|||||||
#define TRACE_SET_KLASS_TRACE_ID(x1, x2) do { } while (0)
|
#define TRACE_SET_KLASS_TRACE_ID(x1, x2) do { } while (0)
|
||||||
#define TRACE_DEFINE_KLASS_METHODS typedef int ___IGNORED_hs_trace_type1
|
#define TRACE_DEFINE_KLASS_METHODS typedef int ___IGNORED_hs_trace_type1
|
||||||
#define TRACE_DEFINE_KLASS_TRACE_ID typedef int ___IGNORED_hs_trace_type2
|
#define TRACE_DEFINE_KLASS_TRACE_ID typedef int ___IGNORED_hs_trace_type2
|
||||||
|
#define TRACE_DEFINE_OFFSET typedef int ___IGNORED_hs_trace_type3
|
||||||
|
#define TRACE_ID_OFFSET in_ByteSize(0); ShouldNotReachHere()
|
||||||
|
#define TRACE_TEMPLATES(template)
|
||||||
|
#define TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user