src/share/vm/runtime/sharedRuntime.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.hpp

Print this page
rev 5732 : [mq]: comments2


 365   static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, int total_args_passed);
 366 
 367   // Generate I2C and C2I adapters. These adapters are simple argument marshalling
 368   // blobs. Unlike adapters in the tiger and earlier releases the code in these
 369   // blobs does not create a new frame and are therefore virtually invisible
 370   // to the stack walking code. In general these blobs extend the callers stack
 371   // as needed for the conversion of argument locations.
 372 
 373   // When calling a c2i blob the code will always call the interpreter even if
 374   // by the time we reach the blob there is compiled code available. This allows
 375   // the blob to pass the incoming stack pointer (the sender sp) in a known
 376   // location for the interpreter to record. This is used by the frame code
 377   // to correct the sender code to match up with the stack pointer when the
 378   // thread left the compiled code. In addition it allows the interpreter
 379   // to remove the space the c2i adapter allocated to do it argument conversion.
 380 
 381   // Although a c2i blob will always run interpreted even if compiled code is
 382   // present if we see that compiled code is present the compiled call site
 383   // will be patched/re-resolved so that later calls will run compiled.
 384 
 385   // Aditionally a c2i blob need to have a unverified entry because it can be reached
 386   // in situations where the call site is an inlined cache site and may go megamorphic.
 387 
 388   // A i2c adapter is simpler than the c2i adapter. This is because it is assumed
 389   // that the interpreter before it does any call dispatch will record the current
 390   // stack pointer in the interpreter frame. On return it will restore the stack
 391   // pointer as needed. This means the i2c adapter code doesn't need any special
 392   // handshaking path with compiled code to keep the stack walking correct.
 393 
 394   static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm,
 395                                                       int total_args_passed,
 396                                                       int max_arg,
 397                                                       const BasicType *sig_bt,
 398                                                       const VMRegPair *regs,
 399                                                       AdapterFingerPrint* fingerprint);
 400 
 401   // OSR support
 402 
 403   // OSR_migration_begin will extract the jvm state from an interpreter
 404   // frame (locals, monitors) and store the data in a piece of C heap
 405   // storage. This then allows the interpreter frame to be removed from the


 559   static address nof_inlined_interface_calls_addr()     { return (address)&_nof_inlined_interface_calls; }
 560   static address nof_megamorphic_interface_calls_addr() { return (address)&_nof_megamorphic_interface_calls; }
 561   static void print_call_statistics(int comp_total);
 562   static void print_statistics();
 563   static void print_ic_miss_histogram();
 564 
 565 #endif // PRODUCT
 566 };
 567 
 568 
 569 // ---------------------------------------------------------------------------
 570 // Implementation of AdapterHandlerLibrary
 571 //
 572 // This library manages argument marshaling adapters and native wrappers.
 573 // There are 2 flavors of adapters: I2C and C2I.
 574 //
 575 // The I2C flavor takes a stock interpreted call setup, marshals the
 576 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
 577 // code_begin().  It is broken to call it without an nmethod assigned.
 578 // The usual behavior is to lift any register arguments up out of the
 579 // stack and possibly re-pack the extra arguments to be contigious.
 580 // I2C adapters will save what the interpreter's stack pointer will be
 581 // after arguments are popped, then adjust the interpreter's frame
 582 // size to force alignment and possibly to repack the arguments.
 583 // After re-packing, it jumps to the compiled code start.  There are
 584 // no safepoints in this adapter code and a GC cannot happen while
 585 // marshaling is in progress.
 586 //
 587 // The C2I flavor takes a stock compiled call setup plus the target method in
 588 // Rmethod, marshals the arguments for an interpreted call and jumps to
 589 // Rmethod->_i2i_entry.  On entry, the interpreted frame has not yet been
 590 // setup.  Compiled frames are fixed-size and the args are likely not in the
 591 // right place.  Hence all the args will likely be copied into the
 592 // interpreter's frame, forcing that frame to grow.  The compiled frame's
 593 // outgoing stack args will be dead after the copy.
 594 //
 595 // Native wrappers, like adapters, marshal arguments.  Unlike adapters they
 596 // also perform an offical frame push & pop.  They have a call to the native
 597 // routine in their middles and end in a return (instead of ending in a jump).
 598 // The native wrappers are stored in real nmethods instead of the BufferBlobs
 599 // used by the adapters.  The code generation happens here because it's very
 600 // similar to what the adapters have to do.
 601 
 602 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
 603   friend class AdapterHandlerTable;
 604 
 605  private:
 606   AdapterFingerPrint* _fingerprint;
 607   address _i2c_entry;
 608   address _c2i_entry;
 609   address _c2i_unverified_entry;
 610 
 611 #ifdef ASSERT
 612   // Captures code and signature used to generate this adapter when
 613   // verifing adapter equivalence.
 614   unsigned char* _saved_code;
 615   int            _code_length;
 616   BasicType*     _saved_sig;
 617   int            _total_args_passed;
 618 #endif
 619 
 620   void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
 621     _fingerprint = fingerprint;
 622     _i2c_entry = i2c_entry;
 623     _c2i_entry = c2i_entry;
 624     _c2i_unverified_entry = c2i_unverified_entry;
 625 #ifdef ASSERT
 626     _saved_code = NULL;
 627     _code_length = 0;
 628     _saved_sig = NULL;
 629     _total_args_passed = 0;
 630 #endif
 631   }
 632 
 633   void deallocate();




 365   static int c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, int total_args_passed);
 366 
 367   // Generate I2C and C2I adapters. These adapters are simple argument marshalling
 368   // blobs. Unlike adapters in the tiger and earlier releases the code in these
 369   // blobs does not create a new frame and are therefore virtually invisible
 370   // to the stack walking code. In general these blobs extend the callers stack
 371   // as needed for the conversion of argument locations.
 372 
 373   // When calling a c2i blob the code will always call the interpreter even if
 374   // by the time we reach the blob there is compiled code available. This allows
 375   // the blob to pass the incoming stack pointer (the sender sp) in a known
 376   // location for the interpreter to record. This is used by the frame code
 377   // to correct the sender code to match up with the stack pointer when the
 378   // thread left the compiled code. In addition it allows the interpreter
 379   // to remove the space the c2i adapter allocated to do it argument conversion.
 380 
 381   // Although a c2i blob will always run interpreted even if compiled code is
 382   // present if we see that compiled code is present the compiled call site
 383   // will be patched/re-resolved so that later calls will run compiled.
 384 
 385   // Additionally a c2i blob need to have a unverified entry because it can be reached
 386   // in situations where the call site is an inlined cache site and may go megamorphic.
 387 
 388   // A i2c adapter is simpler than the c2i adapter. This is because it is assumed
 389   // that the interpreter before it does any call dispatch will record the current
 390   // stack pointer in the interpreter frame. On return it will restore the stack
 391   // pointer as needed. This means the i2c adapter code doesn't need any special
 392   // handshaking path with compiled code to keep the stack walking correct.
 393 
 394   static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm,
 395                                                       int total_args_passed,
 396                                                       int max_arg,
 397                                                       const BasicType *sig_bt,
 398                                                       const VMRegPair *regs,
 399                                                       AdapterFingerPrint* fingerprint);
 400 
 401   // OSR support
 402 
 403   // OSR_migration_begin will extract the jvm state from an interpreter
 404   // frame (locals, monitors) and store the data in a piece of C heap
 405   // storage. This then allows the interpreter frame to be removed from the


 559   static address nof_inlined_interface_calls_addr()     { return (address)&_nof_inlined_interface_calls; }
 560   static address nof_megamorphic_interface_calls_addr() { return (address)&_nof_megamorphic_interface_calls; }
 561   static void print_call_statistics(int comp_total);
 562   static void print_statistics();
 563   static void print_ic_miss_histogram();
 564 
 565 #endif // PRODUCT
 566 };
 567 
 568 
 569 // ---------------------------------------------------------------------------
 570 // Implementation of AdapterHandlerLibrary
 571 //
 572 // This library manages argument marshaling adapters and native wrappers.
 573 // There are 2 flavors of adapters: I2C and C2I.
 574 //
 575 // The I2C flavor takes a stock interpreted call setup, marshals the
 576 // arguments for a Java-compiled call, and jumps to Rmethod-> code()->
 577 // code_begin().  It is broken to call it without an nmethod assigned.
 578 // The usual behavior is to lift any register arguments up out of the
 579 // stack and possibly re-pack the extra arguments to be contiguous.
 580 // I2C adapters will save what the interpreter's stack pointer will be
 581 // after arguments are popped, then adjust the interpreter's frame
 582 // size to force alignment and possibly to repack the arguments.
 583 // After re-packing, it jumps to the compiled code start.  There are
 584 // no safepoints in this adapter code and a GC cannot happen while
 585 // marshaling is in progress.
 586 //
 587 // The C2I flavor takes a stock compiled call setup plus the target method in
 588 // Rmethod, marshals the arguments for an interpreted call and jumps to
 589 // Rmethod->_i2i_entry.  On entry, the interpreted frame has not yet been
 590 // setup.  Compiled frames are fixed-size and the args are likely not in the
 591 // right place.  Hence all the args will likely be copied into the
 592 // interpreter's frame, forcing that frame to grow.  The compiled frame's
 593 // outgoing stack args will be dead after the copy.
 594 //
 595 // Native wrappers, like adapters, marshal arguments.  Unlike adapters they
 596 // also perform an official frame push & pop.  They have a call to the native
 597 // routine in their middles and end in a return (instead of ending in a jump).
 598 // The native wrappers are stored in real nmethods instead of the BufferBlobs
 599 // used by the adapters.  The code generation happens here because it's very
 600 // similar to what the adapters have to do.
 601 
 602 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
 603   friend class AdapterHandlerTable;
 604 
 605  private:
 606   AdapterFingerPrint* _fingerprint;
 607   address _i2c_entry;
 608   address _c2i_entry;
 609   address _c2i_unverified_entry;
 610 
 611 #ifdef ASSERT
 612   // Captures code and signature used to generate this adapter when
 613   // verifying adapter equivalence.
 614   unsigned char* _saved_code;
 615   int            _code_length;
 616   BasicType*     _saved_sig;
 617   int            _total_args_passed;
 618 #endif
 619 
 620   void init(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
 621     _fingerprint = fingerprint;
 622     _i2c_entry = i2c_entry;
 623     _c2i_entry = c2i_entry;
 624     _c2i_unverified_entry = c2i_unverified_entry;
 625 #ifdef ASSERT
 626     _saved_code = NULL;
 627     _code_length = 0;
 628     _saved_sig = NULL;
 629     _total_args_passed = 0;
 630 #endif
 631   }
 632 
 633   void deallocate();


src/share/vm/runtime/sharedRuntime.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File