Mercurial > hg > truffle
comparison src/share/vm/opto/output.cpp @ 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 | bbfbe9b06038 |
children | 17b2fbdb6637 |
comparison
equal
deleted
inserted
replaced
17808:d623bc507723 | 17809:a433eb716ce1 |
---|---|
40 #include "opto/subnode.hpp" | 40 #include "opto/subnode.hpp" |
41 #include "opto/type.hpp" | 41 #include "opto/type.hpp" |
42 #include "runtime/handles.inline.hpp" | 42 #include "runtime/handles.inline.hpp" |
43 #include "utilities/xmlstream.hpp" | 43 #include "utilities/xmlstream.hpp" |
44 | 44 |
45 extern uint size_exception_handler(); | |
46 extern uint size_deopt_handler(); | |
47 | |
48 #ifndef PRODUCT | 45 #ifndef PRODUCT |
49 #define DEBUG_ARG(x) , x | 46 #define DEBUG_ARG(x) , x |
50 #else | 47 #else |
51 #define DEBUG_ARG(x) | 48 #define DEBUG_ARG(x) |
52 #endif | 49 #endif |
53 | |
54 extern int emit_exception_handler(CodeBuffer &cbuf); | |
55 extern int emit_deopt_handler(CodeBuffer &cbuf); | |
56 | 50 |
57 // Convert Nodes to instruction bits and pass off to the VM | 51 // Convert Nodes to instruction bits and pass off to the VM |
58 void Compile::Output() { | 52 void Compile::Output() { |
59 // RootNode goes | 53 // RootNode goes |
60 assert( _cfg->get_root_block()->number_of_nodes() == 0, "" ); | 54 assert( _cfg->get_root_block()->number_of_nodes() == 0, "" ); |
392 if (nj->is_Mach()) { | 386 if (nj->is_Mach()) { |
393 MachNode *mach = nj->as_Mach(); | 387 MachNode *mach = nj->as_Mach(); |
394 blk_size += (mach->alignment_required() - 1) * relocInfo::addr_unit(); // assume worst case padding | 388 blk_size += (mach->alignment_required() - 1) * relocInfo::addr_unit(); // assume worst case padding |
395 reloc_size += mach->reloc(); | 389 reloc_size += mach->reloc(); |
396 if (mach->is_MachCall()) { | 390 if (mach->is_MachCall()) { |
391 // add size information for trampoline stub | |
392 // class CallStubImpl is platform-specific and defined in the *.ad files. | |
393 stub_size += CallStubImpl::size_call_trampoline(); | |
394 reloc_size += CallStubImpl::reloc_call_trampoline(); | |
395 | |
397 MachCallNode *mcall = mach->as_MachCall(); | 396 MachCallNode *mcall = mach->as_MachCall(); |
398 // This destination address is NOT PC-relative | 397 // This destination address is NOT PC-relative |
399 | 398 |
400 mcall->method_set((intptr_t)mcall->entry_point()); | 399 mcall->method_set((intptr_t)mcall->entry_point()); |
401 | 400 |
1131 // Pre-compute the length of blocks and replace | 1130 // Pre-compute the length of blocks and replace |
1132 // long branches with short if machine supports it. | 1131 // long branches with short if machine supports it. |
1133 shorten_branches(blk_starts, code_req, locs_req, stub_req); | 1132 shorten_branches(blk_starts, code_req, locs_req, stub_req); |
1134 | 1133 |
1135 // nmethod and CodeBuffer count stubs & constants as part of method's code. | 1134 // nmethod and CodeBuffer count stubs & constants as part of method's code. |
1136 int exception_handler_req = size_exception_handler(); | 1135 // class HandlerImpl is platform-specific and defined in the *.ad files. |
1137 int deopt_handler_req = size_deopt_handler(); | 1136 int exception_handler_req = HandlerImpl::size_exception_handler() + MAX_stubs_size; // add marginal slop for handler |
1138 exception_handler_req += MAX_stubs_size; // add marginal slop for handler | 1137 int deopt_handler_req = HandlerImpl::size_deopt_handler() + MAX_stubs_size; // add marginal slop for handler |
1139 deopt_handler_req += MAX_stubs_size; // add marginal slop for handler | |
1140 stub_req += MAX_stubs_size; // ensure per-stub margin | 1138 stub_req += MAX_stubs_size; // ensure per-stub margin |
1141 code_req += MAX_inst_size; // ensure per-instruction margin | 1139 code_req += MAX_inst_size; // ensure per-instruction margin |
1142 | 1140 |
1143 if (StressCodeBuffers) | 1141 if (StressCodeBuffers) |
1144 code_req = const_req = stub_req = exception_handler_req = deopt_handler_req = 0x10; // force expansion | 1142 code_req = const_req = stub_req = exception_handler_req = deopt_handler_req = 0x10; // force expansion |
1620 // ------------------ | 1618 // ------------------ |
1621 // Fill in exception table entries. | 1619 // Fill in exception table entries. |
1622 FillExceptionTables(inct_cnt, call_returns, inct_starts, blk_labels); | 1620 FillExceptionTables(inct_cnt, call_returns, inct_starts, blk_labels); |
1623 | 1621 |
1624 // Only java methods have exception handlers and deopt handlers | 1622 // Only java methods have exception handlers and deopt handlers |
1623 // class HandlerImpl is platform-specific and defined in the *.ad files. | |
1625 if (_method) { | 1624 if (_method) { |
1626 // Emit the exception handler code. | 1625 // Emit the exception handler code. |
1627 _code_offsets.set_value(CodeOffsets::Exceptions, emit_exception_handler(*cb)); | 1626 _code_offsets.set_value(CodeOffsets::Exceptions, HandlerImpl::emit_exception_handler(*cb)); |
1628 // Emit the deopt handler code. | 1627 // Emit the deopt handler code. |
1629 _code_offsets.set_value(CodeOffsets::Deopt, emit_deopt_handler(*cb)); | 1628 _code_offsets.set_value(CodeOffsets::Deopt, HandlerImpl::emit_deopt_handler(*cb)); |
1630 | 1629 |
1631 // Emit the MethodHandle deopt handler code (if required). | 1630 // Emit the MethodHandle deopt handler code (if required). |
1632 if (has_method_handle_invokes()) { | 1631 if (has_method_handle_invokes()) { |
1633 // We can use the same code as for the normal deopt handler, we | 1632 // We can use the same code as for the normal deopt handler, we |
1634 // just need a different entry point address. | 1633 // just need a different entry point address. |
1635 _code_offsets.set_value(CodeOffsets::DeoptMH, emit_deopt_handler(*cb)); | 1634 _code_offsets.set_value(CodeOffsets::DeoptMH, HandlerImpl::emit_deopt_handler(*cb)); |
1636 } | 1635 } |
1637 } | 1636 } |
1638 | 1637 |
1639 // One last check for failed CodeBuffer::expand: | 1638 // One last check for failed CodeBuffer::expand: |
1640 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { | 1639 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { |