1.1 --- a/src/share/vm/runtime/sharedRuntime.hpp Wed Apr 16 17:36:29 2008 -0400 1.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp Thu Apr 17 22:18:15 2008 -0400 1.3 @@ -59,6 +59,10 @@ 1.4 1.5 #endif // !PRODUCT 1.6 public: 1.7 + 1.8 + // max bytes for each dtrace string parameter 1.9 + enum { max_dtrace_string_size = 256 }; 1.10 + 1.11 // The following arithmetic routines are used on platforms that do 1.12 // not have machine instructions to implement their functionality. 1.13 // Do not remove these. 1.14 @@ -258,9 +262,6 @@ 1.15 1.16 public: 1.17 1.18 - 1.19 - static void create_native_wrapper (JavaThread* thread, methodOop method); 1.20 - 1.21 // Read the array of BasicTypes from a Java signature, and compute where 1.22 // compiled Java code would like to put the results. Values in reg_lo and 1.23 // reg_hi refer to 4-byte quantities. Values less than SharedInfo::stack0 are 1.24 @@ -354,6 +355,19 @@ 1.25 VMRegPair *regs, 1.26 BasicType ret_type ); 1.27 1.28 +#ifdef HAVE_DTRACE_H 1.29 + // Generate a dtrace wrapper for a given method. The method takes arguments 1.30 + // in the Java compiled code convention, marshals them to the native 1.31 + // convention (handlizes oops, etc), transitions to native, makes the call, 1.32 + // returns to java state (possibly blocking), unhandlizes any result and 1.33 + // returns. 1.34 + static nmethod *generate_dtrace_nmethod(MacroAssembler* masm, 1.35 + methodHandle method); 1.36 + 1.37 + // dtrace support to convert a Java string to utf8 1.38 + static void get_utf(oopDesc* src, address dst); 1.39 +#endif // def HAVE_DTRACE_H 1.40 + 1.41 // A compiled caller has just called the interpreter, but compiled code 1.42 // exists. Patch the caller so he no longer calls into the interpreter. 1.43 static void fixup_callers_callsite(methodOopDesc* moop, address ret_pc); 1.44 @@ -492,42 +506,55 @@ 1.45 address _c2i_unverified_entry; 1.46 1.47 public: 1.48 + 1.49 + // The name we give all buffer blobs 1.50 + static const char* name; 1.51 + 1.52 AdapterHandlerEntry(address i2c_entry, address c2i_entry, address c2i_unverified_entry): 1.53 _i2c_entry(i2c_entry), 1.54 _c2i_entry(c2i_entry), 1.55 _c2i_unverified_entry(c2i_unverified_entry) { 1.56 } 1.57 - // The name we give all buffer blobs 1.58 - static const char* name; 1.59 1.60 address get_i2c_entry() { return _i2c_entry; } 1.61 address get_c2i_entry() { return _c2i_entry; } 1.62 address get_c2i_unverified_entry() { return _c2i_unverified_entry; } 1.63 + 1.64 void relocate(address new_base); 1.65 #ifndef PRODUCT 1.66 void print(); 1.67 #endif /* PRODUCT */ 1.68 }; 1.69 1.70 - 1.71 class AdapterHandlerLibrary: public AllStatic { 1.72 private: 1.73 + static u_char _buffer[]; // the temporary code buffer 1.74 + static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection 1.75 + static GrowableArray<AdapterHandlerEntry*> * _handlers; // the corresponding handlers 1.76 enum { 1.77 AbstractMethodHandler = 1 // special handler for abstract methods 1.78 }; 1.79 - static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection 1.80 - static GrowableArray<AdapterHandlerEntry*> * _handlers; // the corresponding handlers 1.81 - static u_char _buffer[]; // the temporary code buffer 1.82 static void initialize(); 1.83 - static AdapterHandlerEntry* get_entry( int index ) { return _handlers->at(index); } 1.84 static int get_create_adapter_index(methodHandle method); 1.85 - static address get_i2c_entry( int index ) { return get_entry(index)->get_i2c_entry(); } 1.86 - static address get_c2i_entry( int index ) { return get_entry(index)->get_c2i_entry(); } 1.87 - static address get_c2i_unverified_entry( int index ) { return get_entry(index)->get_c2i_unverified_entry(); } 1.88 + static address get_i2c_entry( int index ) { 1.89 + return get_entry(index)->get_i2c_entry(); 1.90 + } 1.91 + static address get_c2i_entry( int index ) { 1.92 + return get_entry(index)->get_c2i_entry(); 1.93 + } 1.94 + static address get_c2i_unverified_entry( int index ) { 1.95 + return get_entry(index)->get_c2i_unverified_entry(); 1.96 + } 1.97 1.98 public: 1.99 + static AdapterHandlerEntry* get_entry( int index ) { return _handlers->at(index); } 1.100 static nmethod* create_native_wrapper(methodHandle method); 1.101 - static AdapterHandlerEntry* get_adapter(methodHandle method) { return get_entry(get_create_adapter_index(method)); } 1.102 + static AdapterHandlerEntry* get_adapter(methodHandle method) { 1.103 + return get_entry(get_create_adapter_index(method)); 1.104 + } 1.105 +#ifdef HAVE_DTRACE_H 1.106 + static nmethod* create_dtrace_nmethod (methodHandle method); 1.107 +#endif // HAVE_DTRACE_H 1.108 1.109 #ifndef PRODUCT 1.110 static void print_handler(CodeBlob* b);