comparison src/share/vm/runtime/sharedRuntime.hpp @ 116:018d5b58dd4f

6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes Summary: Initial checkin of JSDT code Reviewed-by: acorn, sbohne
author kamg
date Thu, 17 Apr 2008 22:18:15 -0400
parents f8236e79048a
children d1605aabd0a1 37f87013dfd8
comparison
equal deleted inserted replaced
115:e7a91a357527 116:018d5b58dd4f
57 // Counters 57 // Counters
58 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable) 58 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable)
59 59
60 #endif // !PRODUCT 60 #endif // !PRODUCT
61 public: 61 public:
62
63 // max bytes for each dtrace string parameter
64 enum { max_dtrace_string_size = 256 };
65
62 // The following arithmetic routines are used on platforms that do 66 // The following arithmetic routines are used on platforms that do
63 // not have machine instructions to implement their functionality. 67 // not have machine instructions to implement their functionality.
64 // Do not remove these. 68 // Do not remove these.
65 69
66 // long arithmetics 70 // long arithmetics
256 static address clean_opt_virtual_call_entry(); 260 static address clean_opt_virtual_call_entry();
257 static address clean_static_call_entry(); 261 static address clean_static_call_entry();
258 262
259 public: 263 public:
260 264
261
262 static void create_native_wrapper (JavaThread* thread, methodOop method);
263
264 // Read the array of BasicTypes from a Java signature, and compute where 265 // Read the array of BasicTypes from a Java signature, and compute where
265 // compiled Java code would like to put the results. Values in reg_lo and 266 // compiled Java code would like to put the results. Values in reg_lo and
266 // reg_hi refer to 4-byte quantities. Values less than SharedInfo::stack0 are 267 // reg_hi refer to 4-byte quantities. Values less than SharedInfo::stack0 are
267 // registers, those above refer to 4-byte stack slots. All stack slots are 268 // registers, those above refer to 4-byte stack slots. All stack slots are
268 // based off of the window top. SharedInfo::stack0 refers to the first usable 269 // based off of the window top. SharedInfo::stack0 refers to the first usable
351 int total_args_passed, 352 int total_args_passed,
352 int max_arg, 353 int max_arg,
353 BasicType *sig_bt, 354 BasicType *sig_bt,
354 VMRegPair *regs, 355 VMRegPair *regs,
355 BasicType ret_type ); 356 BasicType ret_type );
357
358 #ifdef HAVE_DTRACE_H
359 // Generate a dtrace wrapper for a given method. The method takes arguments
360 // in the Java compiled code convention, marshals them to the native
361 // convention (handlizes oops, etc), transitions to native, makes the call,
362 // returns to java state (possibly blocking), unhandlizes any result and
363 // returns.
364 static nmethod *generate_dtrace_nmethod(MacroAssembler* masm,
365 methodHandle method);
366
367 // dtrace support to convert a Java string to utf8
368 static void get_utf(oopDesc* src, address dst);
369 #endif // def HAVE_DTRACE_H
356 370
357 // A compiled caller has just called the interpreter, but compiled code 371 // A compiled caller has just called the interpreter, but compiled code
358 // exists. Patch the caller so he no longer calls into the interpreter. 372 // exists. Patch the caller so he no longer calls into the interpreter.
359 static void fixup_callers_callsite(methodOopDesc* moop, address ret_pc); 373 static void fixup_callers_callsite(methodOopDesc* moop, address ret_pc);
360 374
490 address _i2c_entry; 504 address _i2c_entry;
491 address _c2i_entry; 505 address _c2i_entry;
492 address _c2i_unverified_entry; 506 address _c2i_unverified_entry;
493 507
494 public: 508 public:
509
510 // The name we give all buffer blobs
511 static const char* name;
512
495 AdapterHandlerEntry(address i2c_entry, address c2i_entry, address c2i_unverified_entry): 513 AdapterHandlerEntry(address i2c_entry, address c2i_entry, address c2i_unverified_entry):
496 _i2c_entry(i2c_entry), 514 _i2c_entry(i2c_entry),
497 _c2i_entry(c2i_entry), 515 _c2i_entry(c2i_entry),
498 _c2i_unverified_entry(c2i_unverified_entry) { 516 _c2i_unverified_entry(c2i_unverified_entry) {
499 } 517 }
500 // The name we give all buffer blobs
501 static const char* name;
502 518
503 address get_i2c_entry() { return _i2c_entry; } 519 address get_i2c_entry() { return _i2c_entry; }
504 address get_c2i_entry() { return _c2i_entry; } 520 address get_c2i_entry() { return _c2i_entry; }
505 address get_c2i_unverified_entry() { return _c2i_unverified_entry; } 521 address get_c2i_unverified_entry() { return _c2i_unverified_entry; }
522
506 void relocate(address new_base); 523 void relocate(address new_base);
507 #ifndef PRODUCT 524 #ifndef PRODUCT
508 void print(); 525 void print();
509 #endif /* PRODUCT */ 526 #endif /* PRODUCT */
510 }; 527 };
511 528
512
513 class AdapterHandlerLibrary: public AllStatic { 529 class AdapterHandlerLibrary: public AllStatic {
514 private: 530 private:
531 static u_char _buffer[]; // the temporary code buffer
532 static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection
533 static GrowableArray<AdapterHandlerEntry*> * _handlers; // the corresponding handlers
515 enum { 534 enum {
516 AbstractMethodHandler = 1 // special handler for abstract methods 535 AbstractMethodHandler = 1 // special handler for abstract methods
517 }; 536 };
518 static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection
519 static GrowableArray<AdapterHandlerEntry*> * _handlers; // the corresponding handlers
520 static u_char _buffer[]; // the temporary code buffer
521 static void initialize(); 537 static void initialize();
538 static int get_create_adapter_index(methodHandle method);
539 static address get_i2c_entry( int index ) {
540 return get_entry(index)->get_i2c_entry();
541 }
542 static address get_c2i_entry( int index ) {
543 return get_entry(index)->get_c2i_entry();
544 }
545 static address get_c2i_unverified_entry( int index ) {
546 return get_entry(index)->get_c2i_unverified_entry();
547 }
548
549 public:
522 static AdapterHandlerEntry* get_entry( int index ) { return _handlers->at(index); } 550 static AdapterHandlerEntry* get_entry( int index ) { return _handlers->at(index); }
523 static int get_create_adapter_index(methodHandle method);
524 static address get_i2c_entry( int index ) { return get_entry(index)->get_i2c_entry(); }
525 static address get_c2i_entry( int index ) { return get_entry(index)->get_c2i_entry(); }
526 static address get_c2i_unverified_entry( int index ) { return get_entry(index)->get_c2i_unverified_entry(); }
527
528 public:
529 static nmethod* create_native_wrapper(methodHandle method); 551 static nmethod* create_native_wrapper(methodHandle method);
530 static AdapterHandlerEntry* get_adapter(methodHandle method) { return get_entry(get_create_adapter_index(method)); } 552 static AdapterHandlerEntry* get_adapter(methodHandle method) {
553 return get_entry(get_create_adapter_index(method));
554 }
555 #ifdef HAVE_DTRACE_H
556 static nmethod* create_dtrace_nmethod (methodHandle method);
557 #endif // HAVE_DTRACE_H
531 558
532 #ifndef PRODUCT 559 #ifndef PRODUCT
533 static void print_handler(CodeBlob* b); 560 static void print_handler(CodeBlob* b);
534 static bool contains(CodeBlob* b); 561 static bool contains(CodeBlob* b);
535 #endif /* PRODUCT */ 562 #endif /* PRODUCT */