7160570: Intrinsification support for tracing framework

Tue, 06 Mar 2012 12:36:59 +0100

author
rbackman
date
Tue, 06 Mar 2012 12:36:59 +0100
changeset 3709
0105f367a14c
parent 3708
c263e0e9f14b
child 3715
f3f101a5e59b
child 3721
f3a4ee95783b

7160570: Intrinsification support for tracing framework
Reviewed-by: sla, never

src/os/bsd/vm/osThread_bsd.hpp file | annotate | diff | comparison | revisions
src/os/linux/vm/osThread_linux.hpp file | annotate | diff | comparison | revisions
src/os/solaris/vm/osThread_solaris.hpp file | annotate | diff | comparison | revisions
src/os/windows/vm/osThread_windows.hpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_GraphBuilder.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_LIRGenerator.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_LIRGenerator.hpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_Runtime1.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/vmSymbols.hpp file | annotate | diff | comparison | revisions
src/share/vm/oops/instanceKlass.hpp file | annotate | diff | comparison | revisions
src/share/vm/opto/library_call.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/runtime.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/runtime.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/osThread.hpp file | annotate | diff | comparison | revisions
src/share/vm/trace/traceMacros.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/os/bsd/vm/osThread_bsd.hpp	Sun Apr 15 15:37:20 2012 -0700
     1.2 +++ b/src/os/bsd/vm/osThread_bsd.hpp	Tue Mar 06 12:36:59 2012 +0100
     1.3 @@ -72,15 +72,18 @@
     1.4  
     1.5  #ifdef _ALLBSD_SOURCE
     1.6  #ifdef __APPLE__
     1.7 +  static size_t thread_id_size()         { return sizeof(thread_t); }
     1.8    thread_t thread_id() const {
     1.9      return _thread_id;
    1.10    }
    1.11  #else
    1.12 +  static size_t thread_id_size()         { return sizeof(pthread_t); }
    1.13    pthread_t thread_id() const {
    1.14      return _thread_id;
    1.15    }
    1.16  #endif
    1.17  #else
    1.18 +  static size_t thread_id_size()         { return sizeof(pid_t); }
    1.19    pid_t thread_id() const {
    1.20      return _thread_id;
    1.21    }
     2.1 --- a/src/os/linux/vm/osThread_linux.hpp	Sun Apr 15 15:37:20 2012 -0700
     2.2 +++ b/src/os/linux/vm/osThread_linux.hpp	Tue Mar 06 12:36:59 2012 +0100
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -56,6 +56,8 @@
    2.11    sigset_t  caller_sigmask() const       { return _caller_sigmask; }
    2.12    void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
    2.13  
    2.14 +  static size_t thread_id_size()         { return sizeof(pid_t); }
    2.15 +
    2.16    pid_t thread_id() const {
    2.17      return _thread_id;
    2.18    }
     3.1 --- a/src/os/solaris/vm/osThread_solaris.hpp	Sun Apr 15 15:37:20 2012 -0700
     3.2 +++ b/src/os/solaris/vm/osThread_solaris.hpp	Tue Mar 06 12:36:59 2012 +0100
     3.3 @@ -36,6 +36,7 @@
     3.4    bool     _vm_created_thread; // true if the VM created this thread,
     3.5                                 // false if primary thread or attached thread
     3.6   public:
     3.7 +  static size_t thread_id_size()   { return sizeof(thread_t); }
     3.8    thread_t thread_id() const       { return _thread_id; }
     3.9    uint     lwp_id() const          { return _lwp_id; }
    3.10    int      native_priority() const { return _native_priority; }
     4.1 --- a/src/os/windows/vm/osThread_windows.hpp	Sun Apr 15 15:37:20 2012 -0700
     4.2 +++ b/src/os/windows/vm/osThread_windows.hpp	Tue Mar 06 12:36:59 2012 +0100
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -42,6 +42,8 @@
    4.11    HANDLE interrupt_event() const                   { return _interrupt_event; }
    4.12    void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; }
    4.13  
    4.14 +
    4.15 +  static size_t thread_id_size()                   { return sizeof(unsigned long); }
    4.16    unsigned long thread_id() const                  { return _thread_id; }
    4.17  #ifndef PRODUCT
    4.18    // Used for debugging, return a unique integer for each thread.
     5.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp	Sun Apr 15 15:37:20 2012 -0700
     5.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Mar 06 12:36:59 2012 +0100
     5.3 @@ -3132,10 +3132,23 @@
     5.4    bool cantrap = true;
     5.5    vmIntrinsics::ID id = callee->intrinsic_id();
     5.6    switch (id) {
     5.7 -    case vmIntrinsics::_arraycopy     :
     5.8 +    case vmIntrinsics::_arraycopy:
     5.9        if (!InlineArrayCopy) return false;
    5.10        break;
    5.11  
    5.12 +#ifdef TRACE_HAVE_INTRINSICS
    5.13 +    case vmIntrinsics::_classID:
    5.14 +    case vmIntrinsics::_threadID:
    5.15 +      preserves_state = true;
    5.16 +      cantrap = true;
    5.17 +      break;
    5.18 +
    5.19 +    case vmIntrinsics::_counterTime:
    5.20 +      preserves_state = true;
    5.21 +      cantrap = false;
    5.22 +      break;
    5.23 +#endif
    5.24 +
    5.25      case vmIntrinsics::_currentTimeMillis:
    5.26      case vmIntrinsics::_nanoTime:
    5.27        preserves_state = true;
     6.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Sun Apr 15 15:37:20 2012 -0700
     6.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Mar 06 12:36:59 2012 +0100
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -2879,6 +2879,50 @@
    6.11    __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
    6.12  }
    6.13  
    6.14 +void LIRGenerator::do_RuntimeCall(address routine, int expected_arguments, Intrinsic* x) {
    6.15 +    assert(x->number_of_arguments() == expected_arguments, "wrong type");
    6.16 +    LIR_Opr reg = result_register_for(x->type());
    6.17 +    __ call_runtime_leaf(routine, getThreadTemp(),
    6.18 +                         reg, new LIR_OprList());
    6.19 +    LIR_Opr result = rlock_result(x);
    6.20 +    __ move(reg, result);
    6.21 +}
    6.22 +
    6.23 +#ifdef TRACE_HAVE_INTRINSICS
    6.24 +void LIRGenerator::do_ThreadIDIntrinsic(Intrinsic* x) {
    6.25 +    LIR_Opr thread = getThreadPointer();
    6.26 +    LIR_Opr osthread = new_pointer_register();
    6.27 +    __ move(new LIR_Address(thread, in_bytes(JavaThread::osthread_offset()), osthread->type()), osthread);
    6.28 +    size_t thread_id_size = OSThread::thread_id_size();
    6.29 +    if (thread_id_size == (size_t) BytesPerLong) {
    6.30 +      LIR_Opr id = new_register(T_LONG);
    6.31 +      __ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_LONG), id);
    6.32 +      __ convert(Bytecodes::_l2i, id, rlock_result(x));
    6.33 +    } else if (thread_id_size == (size_t) BytesPerInt) {
    6.34 +      __ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_INT), rlock_result(x));
    6.35 +    } else {
    6.36 +      ShouldNotReachHere();
    6.37 +    }
    6.38 +}
    6.39 +
    6.40 +void LIRGenerator::do_ClassIDIntrinsic(Intrinsic* x) {
    6.41 +    CodeEmitInfo* info = state_for(x);
    6.42 +    CodeEmitInfo* info2 = new CodeEmitInfo(info); // Clone for the second null check
    6.43 +    assert(info != NULL, "must have info");
    6.44 +    LIRItem arg(x->argument_at(1), this);
    6.45 +    arg.load_item();
    6.46 +    LIR_Opr klass = new_register(T_OBJECT);
    6.47 +    __ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), T_OBJECT), klass, info);
    6.48 +    LIR_Opr id = new_register(T_LONG);
    6.49 +    ByteSize offset = TRACE_ID_OFFSET;
    6.50 +    LIR_Address* trace_id_addr = new LIR_Address(klass, in_bytes(offset), T_LONG);
    6.51 +    __ move(trace_id_addr, id);
    6.52 +    __ logical_or(id, LIR_OprFact::longConst(0x01l), id);
    6.53 +    __ store(id, trace_id_addr);
    6.54 +    __ logical_and(id, LIR_OprFact::longConst(~0x3l), id);
    6.55 +    __ move(id, rlock_result(x));
    6.56 +}
    6.57 +#endif
    6.58  
    6.59  void LIRGenerator::do_Intrinsic(Intrinsic* x) {
    6.60    switch (x->id()) {
    6.61 @@ -2890,25 +2934,21 @@
    6.62      break;
    6.63    }
    6.64  
    6.65 -  case vmIntrinsics::_currentTimeMillis: {
    6.66 -    assert(x->number_of_arguments() == 0, "wrong type");
    6.67 -    LIR_Opr reg = result_register_for(x->type());
    6.68 -    __ call_runtime_leaf(CAST_FROM_FN_PTR(address, os::javaTimeMillis), getThreadTemp(),
    6.69 -                         reg, new LIR_OprList());
    6.70 -    LIR_Opr result = rlock_result(x);
    6.71 -    __ move(reg, result);
    6.72 +#ifdef TRACE_HAVE_INTRINSICS
    6.73 +  case vmIntrinsics::_threadID: do_ThreadIDIntrinsic(x); break;
    6.74 +  case vmIntrinsics::_classID: do_ClassIDIntrinsic(x); break;
    6.75 +  case vmIntrinsics::_counterTime:
    6.76 +    do_RuntimeCall(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), 0, x);
    6.77      break;
    6.78 -  }
    6.79 -
    6.80 -  case vmIntrinsics::_nanoTime: {
    6.81 -    assert(x->number_of_arguments() == 0, "wrong type");
    6.82 -    LIR_Opr reg = result_register_for(x->type());
    6.83 -    __ call_runtime_leaf(CAST_FROM_FN_PTR(address, os::javaTimeNanos), getThreadTemp(),
    6.84 -                         reg, new LIR_OprList());
    6.85 -    LIR_Opr result = rlock_result(x);
    6.86 -    __ move(reg, result);
    6.87 +#endif
    6.88 +
    6.89 +  case vmIntrinsics::_currentTimeMillis:
    6.90 +    do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeMillis), 0, x);
    6.91      break;
    6.92 -  }
    6.93 +
    6.94 +  case vmIntrinsics::_nanoTime:
    6.95 +    do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeNanos), 0, x);
    6.96 +    break;
    6.97  
    6.98    case vmIntrinsics::_Object_init:    do_RegisterFinalizer(x); break;
    6.99    case vmIntrinsics::_getClass:       do_getClass(x);      break;
     7.1 --- a/src/share/vm/c1/c1_LIRGenerator.hpp	Sun Apr 15 15:37:20 2012 -0700
     7.2 +++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Tue Mar 06 12:36:59 2012 +0100
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -426,6 +426,12 @@
    7.11    SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);
    7.12    void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
    7.13  
    7.14 +  void do_RuntimeCall(address routine, int expected_arguments, Intrinsic* x);
    7.15 +#ifdef TRACE_HAVE_INTRINSICS
    7.16 +  void do_ThreadIDIntrinsic(Intrinsic* x);
    7.17 +  void do_ClassIDIntrinsic(Intrinsic* x);
    7.18 +#endif
    7.19 +
    7.20   public:
    7.21    Compilation*  compilation() const              { return _compilation; }
    7.22    FrameMap*     frame_map() const                { return _compilation->frame_map(); }
     8.1 --- a/src/share/vm/c1/c1_Runtime1.cpp	Sun Apr 15 15:37:20 2012 -0700
     8.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp	Tue Mar 06 12:36:59 2012 +0100
     8.3 @@ -295,6 +295,9 @@
     8.4    FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
     8.5    FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
     8.6    FUNCTION_CASE(entry, trace_block_entry);
     8.7 +#ifdef TRACE_HAVE_INTRINSICS
     8.8 +  FUNCTION_CASE(entry, TRACE_TIME_METHOD);
     8.9 +#endif
    8.10  
    8.11  #undef FUNCTION_CASE
    8.12  
     9.1 --- a/src/share/vm/classfile/vmSymbols.hpp	Sun Apr 15 15:37:20 2012 -0700
     9.2 +++ b/src/share/vm/classfile/vmSymbols.hpp	Tue Mar 06 12:36:59 2012 +0100
     9.3 @@ -27,6 +27,7 @@
     9.4  
     9.5  #include "oops/symbol.hpp"
     9.6  #include "memory/iterator.hpp"
     9.7 +#include "trace/traceMacros.hpp"
     9.8  
     9.9  // The class vmSymbols is a name space for fast lookup of
    9.10  // symbols commonly used in the VM.
    9.11 @@ -424,6 +425,7 @@
    9.12    template(throwable_throwable_signature,             "(Ljava/lang/Throwable;)Ljava/lang/Throwable;")             \
    9.13    template(class_void_signature,                      "(Ljava/lang/Class;)V")                     \
    9.14    template(class_int_signature,                       "(Ljava/lang/Class;)I")                     \
    9.15 +  template(class_long_signature,                      "(Ljava/lang/Class;)J")                     \
    9.16    template(class_boolean_signature,                   "(Ljava/lang/Class;)Z")                     \
    9.17    template(throwable_string_void_signature,           "(Ljava/lang/Throwable;Ljava/lang/String;)V")               \
    9.18    template(string_array_void_signature,               "([Ljava/lang/String;)V")                                   \
    9.19 @@ -539,10 +541,12 @@
    9.20    template(serializePropertiesToByteArray_signature,   "()[B")                                                    \
    9.21    template(serializeAgentPropertiesToByteArray_name,   "serializeAgentPropertiesToByteArray")                     \
    9.22    template(classRedefinedCount_name,                   "classRedefinedCount")                                     \
    9.23 +                                                                                                                  \
    9.24 +  /* trace signatures */                                                                                          \
    9.25 +  TRACE_TEMPLATES(template)                                                                                       \
    9.26 +                                                                                                                  \
    9.27    /*end*/
    9.28  
    9.29 -
    9.30 -
    9.31  // Here are all the intrinsics known to the runtime and the CI.
    9.32  // Each intrinsic consists of a public enum name (like _hashCode),
    9.33  // followed by a specification of its klass, name, and signature:
    9.34 @@ -648,6 +652,8 @@
    9.35    do_intrinsic(_nanoTime,                 java_lang_System,       nanoTime_name,          void_long_signature,   F_S)   \
    9.36     do_name(     nanoTime_name,                                   "nanoTime")                                            \
    9.37                                                                                                                          \
    9.38 +  TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias)                                             \
    9.39 +                                                                                                                        \
    9.40    do_intrinsic(_arraycopy,                java_lang_System,       arraycopy_name, arraycopy_signature,           F_S)   \
    9.41     do_name(     arraycopy_name,                                  "arraycopy")                                           \
    9.42     do_signature(arraycopy_signature,                             "(Ljava/lang/Object;ILjava/lang/Object;II)V")          \
    10.1 --- a/src/share/vm/oops/instanceKlass.hpp	Sun Apr 15 15:37:20 2012 -0700
    10.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Tue Mar 06 12:36:59 2012 +0100
    10.3 @@ -642,6 +642,7 @@
    10.4  
    10.5    // support for stub routines
    10.6    static ByteSize init_state_offset()  { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_state)); }
    10.7 +  TRACE_DEFINE_OFFSET;
    10.8    static ByteSize init_thread_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_thread)); }
    10.9  
   10.10    // subclass/subinterface checks
    11.1 --- a/src/share/vm/opto/library_call.cpp	Sun Apr 15 15:37:20 2012 -0700
    11.2 +++ b/src/share/vm/opto/library_call.cpp	Tue Mar 06 12:36:59 2012 +0100
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -175,7 +175,11 @@
   11.11    bool inline_unsafe_allocate();
   11.12    bool inline_unsafe_copyMemory();
   11.13    bool inline_native_currentThread();
   11.14 -  bool inline_native_time_funcs(bool isNano);
   11.15 +#ifdef TRACE_HAVE_INTRINSICS
   11.16 +  bool inline_native_classID();
   11.17 +  bool inline_native_threadID();
   11.18 +#endif
   11.19 +  bool inline_native_time_funcs(address method, const char* funcName);
   11.20    bool inline_native_isInterrupted();
   11.21    bool inline_native_Class_query(vmIntrinsics::ID id);
   11.22    bool inline_native_subtype_check();
   11.23 @@ -638,10 +642,18 @@
   11.24    case vmIntrinsics::_isInterrupted:
   11.25      return inline_native_isInterrupted();
   11.26  
   11.27 +#ifdef TRACE_HAVE_INTRINSICS
   11.28 +  case vmIntrinsics::_classID:
   11.29 +    return inline_native_classID();
   11.30 +  case vmIntrinsics::_threadID:
   11.31 +    return inline_native_threadID();
   11.32 +  case vmIntrinsics::_counterTime:
   11.33 +    return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
   11.34 +#endif
   11.35    case vmIntrinsics::_currentTimeMillis:
   11.36 -    return inline_native_time_funcs(false);
   11.37 +    return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
   11.38    case vmIntrinsics::_nanoTime:
   11.39 -    return inline_native_time_funcs(true);
   11.40 +    return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
   11.41    case vmIntrinsics::_allocateInstance:
   11.42      return inline_unsafe_allocate();
   11.43    case vmIntrinsics::_copyMemory:
   11.44 @@ -2840,14 +2852,63 @@
   11.45    return true;
   11.46  }
   11.47  
   11.48 +#ifdef TRACE_HAVE_INTRINSICS
   11.49 +/*
   11.50 + * oop -> myklass
   11.51 + * myklass->trace_id |= USED
   11.52 + * return myklass->trace_id & ~0x3
   11.53 + */
   11.54 +bool LibraryCallKit::inline_native_classID() {
   11.55 +  int nargs = 1 + 1;
   11.56 +  null_check_receiver(callee());  // check then ignore argument(0)
   11.57 +  _sp += nargs;
   11.58 +  Node* cls = do_null_check(argument(1), T_OBJECT);
   11.59 +  _sp -= nargs;
   11.60 +  Node* kls = load_klass_from_mirror(cls, false, nargs, NULL, 0);
   11.61 +  _sp += nargs;
   11.62 +  kls = do_null_check(kls, T_OBJECT);
   11.63 +  _sp -= nargs;
   11.64 +  ByteSize offset = TRACE_ID_OFFSET;
   11.65 +  Node* insp = basic_plus_adr(kls, in_bytes(offset));
   11.66 +  Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG);
   11.67 +  Node* bits = longcon(~0x03l); // ignore bit 0 & 1
   11.68 +  Node* andl = _gvn.transform(new (C, 3) AndLNode(tvalue, bits));
   11.69 +  Node* clsused = longcon(0x01l); // set the class bit
   11.70 +  Node* orl = _gvn.transform(new (C, 3) OrLNode(tvalue, clsused));
   11.71 +
   11.72 +  const TypePtr *adr_type = _gvn.type(insp)->isa_ptr();
   11.73 +  store_to_memory(control(), insp, orl, T_LONG, adr_type);
   11.74 +  push_pair(andl);
   11.75 +  return true;
   11.76 +}
   11.77 +
   11.78 +bool LibraryCallKit::inline_native_threadID() {
   11.79 +  Node* tls_ptr = NULL;
   11.80 +  Node* cur_thr = generate_current_thread(tls_ptr);
   11.81 +  Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset()));
   11.82 +  Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS);
   11.83 +  p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::thread_id_offset()));
   11.84 +
   11.85 +  Node* threadid = NULL;
   11.86 +  size_t thread_id_size = OSThread::thread_id_size();
   11.87 +  if (thread_id_size == (size_t) BytesPerLong) {
   11.88 +    threadid = ConvL2I(make_load(control(), p, TypeLong::LONG, T_LONG));
   11.89 +    push(threadid);
   11.90 +  } else if (thread_id_size == (size_t) BytesPerInt) {
   11.91 +    threadid = make_load(control(), p, TypeInt::INT, T_INT);
   11.92 +    push(threadid);
   11.93 +  } else {
   11.94 +    ShouldNotReachHere();
   11.95 +  }
   11.96 +  return true;
   11.97 +}
   11.98 +#endif
   11.99 +
  11.100  //------------------------inline_native_time_funcs--------------
  11.101  // inline code for System.currentTimeMillis() and System.nanoTime()
  11.102  // these have the same type and signature
  11.103 -bool LibraryCallKit::inline_native_time_funcs(bool isNano) {
  11.104 -  address funcAddr = isNano ? CAST_FROM_FN_PTR(address, os::javaTimeNanos) :
  11.105 -                              CAST_FROM_FN_PTR(address, os::javaTimeMillis);
  11.106 -  const char * funcName = isNano ? "nanoTime" : "currentTimeMillis";
  11.107 -  const TypeFunc *tf = OptoRuntime::current_time_millis_Type();
  11.108 +bool LibraryCallKit::inline_native_time_funcs(address funcAddr, const char* funcName) {
  11.109 +  const TypeFunc *tf = OptoRuntime::void_long_Type();
  11.110    const TypePtr* no_memory_effects = NULL;
  11.111    Node* time = make_runtime_call(RC_LEAF, tf, funcAddr, funcName, no_memory_effects);
  11.112    Node* value = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms+0));
    12.1 --- a/src/share/vm/opto/runtime.cpp	Sun Apr 15 15:37:20 2012 -0700
    12.2 +++ b/src/share/vm/opto/runtime.cpp	Tue Mar 06 12:36:59 2012 +0100
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -709,9 +709,9 @@
   12.11    return TypeFunc::make(domain, range);
   12.12  }
   12.13  
   12.14 -//-------------- currentTimeMillis
   12.15 +//-------------- currentTimeMillis, currentTimeNanos, etc
   12.16  
   12.17 -const TypeFunc* OptoRuntime::current_time_millis_Type() {
   12.18 +const TypeFunc* OptoRuntime::void_long_Type() {
   12.19    // create input type (domain)
   12.20    const Type **fields = TypeTuple::fields(0);
   12.21    const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
    13.1 --- a/src/share/vm/opto/runtime.hpp	Sun Apr 15 15:37:20 2012 -0700
    13.2 +++ b/src/share/vm/opto/runtime.hpp	Tue Mar 06 12:36:59 2012 +0100
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -268,7 +268,7 @@
   13.11    static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
   13.12    static const TypeFunc* modf_Type();
   13.13    static const TypeFunc* l2f_Type();
   13.14 -  static const TypeFunc* current_time_millis_Type();
   13.15 +  static const TypeFunc* void_long_Type();
   13.16  
   13.17    static const TypeFunc* flush_windows_Type();
   13.18  
    14.1 --- a/src/share/vm/runtime/osThread.hpp	Sun Apr 15 15:37:20 2012 -0700
    14.2 +++ b/src/share/vm/runtime/osThread.hpp	Tue Mar 06 12:36:59 2012 +0100
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -98,6 +98,7 @@
   14.11  
   14.12    // For java intrinsics:
   14.13    static ByteSize interrupted_offset()            { return byte_offset_of(OSThread, _interrupted); }
   14.14 +  static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
   14.15  
   14.16    // Platform dependent stuff
   14.17  #ifdef TARGET_OS_FAMILY_linux
    15.1 --- a/src/share/vm/trace/traceMacros.hpp	Sun Apr 15 15:37:20 2012 -0700
    15.2 +++ b/src/share/vm/trace/traceMacros.hpp	Tue Mar 06 12:36:59 2012 +0100
    15.3 @@ -1,5 +1,5 @@
    15.4  /*
    15.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    15.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    15.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.8   *
    15.9   * This code is free software; you can redistribute it and/or modify it
   15.10 @@ -43,5 +43,9 @@
   15.11  #define TRACE_SET_KLASS_TRACE_ID(x1, x2) do { } while (0)
   15.12  #define TRACE_DEFINE_KLASS_METHODS typedef int ___IGNORED_hs_trace_type1
   15.13  #define TRACE_DEFINE_KLASS_TRACE_ID typedef int ___IGNORED_hs_trace_type2
   15.14 +#define TRACE_DEFINE_OFFSET typedef int ___IGNORED_hs_trace_type3
   15.15 +#define TRACE_ID_OFFSET in_ByteSize(0); ShouldNotReachHere()
   15.16 +#define TRACE_TEMPLATES(template)
   15.17 +#define TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias)
   15.18  
   15.19  #endif

mercurial