comparison src/cpu/sparc/vm/sparc.ad @ 17809:a433eb716ce1

8037821: Account for trampoline stubs when estimating code buffer sizes Summary: Take into account space needed for "trampoline code" used by calls on PPC64. Reviewed-by: kvn Contributed-by: lutz.schmidt@sap.com
author goetz
date Tue, 25 Mar 2014 12:54:21 -0700
parents 752ba2e5f6d0
children 62c54fcc0a35
comparison
equal deleted inserted replaced
17808:d623bc507723 17809:a433eb716ce1
455 455
456 //----------SOURCE BLOCK------------------------------------------------------- 456 //----------SOURCE BLOCK-------------------------------------------------------
457 // This is a block of C++ code which provides values, functions, and 457 // This is a block of C++ code which provides values, functions, and
458 // definitions necessary in the rest of the architecture description 458 // definitions necessary in the rest of the architecture description
459 source_hpp %{ 459 source_hpp %{
460 // Header information of the source block.
461 // Method declarations/definitions which are used outside
462 // the ad-scope can conveniently be defined here.
463 //
464 // To keep related declarations/definitions/uses close together,
465 // we switch between source %{ }% and source_hpp %{ }% freely as needed.
466
460 // Must be visible to the DFA in dfa_sparc.cpp 467 // Must be visible to the DFA in dfa_sparc.cpp
461 extern bool can_branch_register( Node *bol, Node *cmp ); 468 extern bool can_branch_register( Node *bol, Node *cmp );
462 469
463 extern bool use_block_zeroing(Node* count); 470 extern bool use_block_zeroing(Node* count);
464 471
465 // Macros to extract hi & lo halves from a long pair. 472 // Macros to extract hi & lo halves from a long pair.
466 // G0 is not part of any long pair, so assert on that. 473 // G0 is not part of any long pair, so assert on that.
467 // Prevents accidentally using G1 instead of G0. 474 // Prevents accidentally using G1 instead of G0.
468 #define LONG_HI_REG(x) (x) 475 #define LONG_HI_REG(x) (x)
469 #define LONG_LO_REG(x) (x) 476 #define LONG_LO_REG(x) (x)
477
478 class CallStubImpl {
479
480 //--------------------------------------------------------------
481 //---< Used for optimization in Compile::Shorten_branches >---
482 //--------------------------------------------------------------
483
484 public:
485 // Size of call trampoline stub.
486 static uint size_call_trampoline() {
487 return 0; // no call trampolines on this platform
488 }
489
490 // number of relocations needed by a call trampoline stub
491 static uint reloc_call_trampoline() {
492 return 0; // no call trampolines on this platform
493 }
494 };
495
496 class HandlerImpl {
497
498 public:
499
500 static int emit_exception_handler(CodeBuffer &cbuf);
501 static int emit_deopt_handler(CodeBuffer& cbuf);
502
503 static uint size_exception_handler() {
504 if (TraceJumps) {
505 return (400); // just a guess
506 }
507 return ( NativeJump::instruction_size ); // sethi;jmp;nop
508 }
509
510 static uint size_deopt_handler() {
511 if (TraceJumps) {
512 return (400); // just a guess
513 }
514 return ( 4+ NativeJump::instruction_size ); // save;sethi;jmp;restore
515 }
516 };
470 517
471 %} 518 %}
472 519
473 source %{ 520 source %{
474 #define __ _masm. 521 #define __ _masm.
1708 } 1755 }
1709 1756
1710 1757
1711 //============================================================================= 1758 //=============================================================================
1712 1759
1713 uint size_exception_handler() {
1714 if (TraceJumps) {
1715 return (400); // just a guess
1716 }
1717 return ( NativeJump::instruction_size ); // sethi;jmp;nop
1718 }
1719
1720 uint size_deopt_handler() {
1721 if (TraceJumps) {
1722 return (400); // just a guess
1723 }
1724 return ( 4+ NativeJump::instruction_size ); // save;sethi;jmp;restore
1725 }
1726 1760
1727 // Emit exception handler code. 1761 // Emit exception handler code.
1728 int emit_exception_handler(CodeBuffer& cbuf) { 1762 int HandlerImpl::emit_exception_handler(CodeBuffer& cbuf) {
1729 Register temp_reg = G3; 1763 Register temp_reg = G3;
1730 AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point()); 1764 AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point());
1731 MacroAssembler _masm(&cbuf); 1765 MacroAssembler _masm(&cbuf);
1732 1766
1733 address base = 1767 address base =
1744 __ end_a_stub(); 1778 __ end_a_stub();
1745 1779
1746 return offset; 1780 return offset;
1747 } 1781 }
1748 1782
1749 int emit_deopt_handler(CodeBuffer& cbuf) { 1783 int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
1750 // Can't use any of the current frame's registers as we may have deopted 1784 // Can't use any of the current frame's registers as we may have deopted
1751 // at a poll and everything (including G3) can be live. 1785 // at a poll and everything (including G3) can be live.
1752 Register temp_reg = L0; 1786 Register temp_reg = L0;
1753 AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack()); 1787 AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack());
1754 MacroAssembler _masm(&cbuf); 1788 MacroAssembler _masm(&cbuf);