Mercurial > hg > truffle
comparison src/share/vm/opto/output.cpp @ 10408:836a62f43af9
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 19 Jun 2013 10:45:56 +0200 |
parents | b9a918201d47 70120f47d403 |
children | 3cce976666d9 |
comparison
equal
deleted
inserted
replaced
10086:e0fb8a213650 | 10408:836a62f43af9 |
---|---|
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
26 #include "asm/assembler.inline.hpp" | 26 #include "asm/assembler.inline.hpp" |
27 #include "code/compiledIC.hpp" | |
27 #include "code/debugInfo.hpp" | 28 #include "code/debugInfo.hpp" |
28 #include "code/debugInfoRec.hpp" | 29 #include "code/debugInfoRec.hpp" |
29 #include "compiler/compileBroker.hpp" | 30 #include "compiler/compileBroker.hpp" |
30 #include "compiler/oopMap.hpp" | 31 #include "compiler/oopMap.hpp" |
31 #include "memory/allocation.inline.hpp" | 32 #include "memory/allocation.inline.hpp" |
39 #include "opto/subnode.hpp" | 40 #include "opto/subnode.hpp" |
40 #include "opto/type.hpp" | 41 #include "opto/type.hpp" |
41 #include "runtime/handles.inline.hpp" | 42 #include "runtime/handles.inline.hpp" |
42 #include "utilities/xmlstream.hpp" | 43 #include "utilities/xmlstream.hpp" |
43 | 44 |
44 extern uint size_java_to_interp(); | |
45 extern uint reloc_java_to_interp(); | |
46 extern uint size_exception_handler(); | 45 extern uint size_exception_handler(); |
47 extern uint size_deopt_handler(); | 46 extern uint size_deopt_handler(); |
48 | 47 |
49 #ifndef PRODUCT | 48 #ifndef PRODUCT |
50 #define DEBUG_ARG(x) , x | 49 #define DEBUG_ARG(x) , x |
387 // Handle machine instruction nodes | 386 // Handle machine instruction nodes |
388 if (nj->is_Mach()) { | 387 if (nj->is_Mach()) { |
389 MachNode *mach = nj->as_Mach(); | 388 MachNode *mach = nj->as_Mach(); |
390 blk_size += (mach->alignment_required() - 1) * relocInfo::addr_unit(); // assume worst case padding | 389 blk_size += (mach->alignment_required() - 1) * relocInfo::addr_unit(); // assume worst case padding |
391 reloc_size += mach->reloc(); | 390 reloc_size += mach->reloc(); |
392 if( mach->is_MachCall() ) { | 391 if (mach->is_MachCall()) { |
393 MachCallNode *mcall = mach->as_MachCall(); | 392 MachCallNode *mcall = mach->as_MachCall(); |
394 // This destination address is NOT PC-relative | 393 // This destination address is NOT PC-relative |
395 | 394 |
396 mcall->method_set((intptr_t)mcall->entry_point()); | 395 mcall->method_set((intptr_t)mcall->entry_point()); |
397 | 396 |
398 if( mcall->is_MachCallJava() && mcall->as_MachCallJava()->_method ) { | 397 if (mcall->is_MachCallJava() && mcall->as_MachCallJava()->_method) { |
399 stub_size += size_java_to_interp(); | 398 stub_size += CompiledStaticCall::to_interp_stub_size(); |
400 reloc_size += reloc_java_to_interp(); | 399 reloc_size += CompiledStaticCall::reloc_to_interp_stub(); |
401 } | 400 } |
402 } else if (mach->is_MachSafePoint()) { | 401 } else if (mach->is_MachSafePoint()) { |
403 // If call/safepoint are adjacent, account for possible | 402 // If call/safepoint are adjacent, account for possible |
404 // nop to disambiguate the two safepoints. | 403 // nop to disambiguate the two safepoints. |
405 // ScheduleAndBundle() can rearrange nodes in a block, | 404 // ScheduleAndBundle() can rearrange nodes in a block, |
928 scval = new_loc_value( _regalloc, obj_reg, Location::narrowoop ); | 927 scval = new_loc_value( _regalloc, obj_reg, Location::narrowoop ); |
929 } else { | 928 } else { |
930 scval = new_loc_value( _regalloc, obj_reg, Location::oop ); | 929 scval = new_loc_value( _regalloc, obj_reg, Location::oop ); |
931 } | 930 } |
932 } else { | 931 } else { |
933 const TypePtr *tp = obj_node->bottom_type()->make_ptr(); | 932 const TypePtr *tp = obj_node->get_ptr_type(); |
934 scval = new ConstantOopWriteValue(tp->is_oopptr()->const_oop()->constant_encoding()); | 933 scval = new ConstantOopWriteValue(tp->is_oopptr()->const_oop()->constant_encoding()); |
935 } | 934 } |
936 | 935 |
937 OptoReg::Name box_reg = BoxLockNode::reg(box_node); | 936 OptoReg::Name box_reg = BoxLockNode::reg(box_node); |
938 Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg)); | 937 Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg)); |
1044 } | 1043 } |
1045 | 1044 |
1046 // Mark the end of the scope set. | 1045 // Mark the end of the scope set. |
1047 debug_info->end_non_safepoint(pc_offset); | 1046 debug_info->end_non_safepoint(pc_offset); |
1048 } | 1047 } |
1049 | |
1050 | |
1051 | |
1052 // helper for fill_buffer bailout logic | |
1053 static void turn_off_compiler(Compile* C) { | |
1054 if (CodeCache::largest_free_block() >= CodeCacheMinimumFreeSpace*10) { | |
1055 // Do not turn off compilation if a single giant method has | |
1056 // blown the code cache size. | |
1057 C->record_failure("excessive request to CodeCache"); | |
1058 } else { | |
1059 // Let CompilerBroker disable further compilations. | |
1060 C->record_failure("CodeCache is full"); | |
1061 } | |
1062 } | |
1063 | |
1064 | 1048 |
1065 //------------------------------init_buffer------------------------------------ | 1049 //------------------------------init_buffer------------------------------------ |
1066 CodeBuffer* Compile::init_buffer(uint* blk_starts) { | 1050 CodeBuffer* Compile::init_buffer(uint* blk_starts) { |
1067 | 1051 |
1068 // Set the initially allocated size | 1052 // Set the initially allocated size |
1159 CodeBuffer* cb = code_buffer(); | 1143 CodeBuffer* cb = code_buffer(); |
1160 cb->initialize(total_req, locs_req); | 1144 cb->initialize(total_req, locs_req); |
1161 | 1145 |
1162 // Have we run out of code space? | 1146 // Have we run out of code space? |
1163 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { | 1147 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { |
1164 turn_off_compiler(this); | 1148 C->record_failure("CodeCache is full"); |
1165 return NULL; | 1149 return NULL; |
1166 } | 1150 } |
1167 // Configure the code buffer. | 1151 // Configure the code buffer. |
1168 cb->initialize_consts_size(const_req); | 1152 cb->initialize_consts_size(const_req); |
1169 cb->initialize_stubs_size(stub_req); | 1153 cb->initialize_stubs_size(stub_req); |
1477 } | 1461 } |
1478 | 1462 |
1479 // Verify that there is sufficient space remaining | 1463 // Verify that there is sufficient space remaining |
1480 cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size); | 1464 cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size); |
1481 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { | 1465 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { |
1482 turn_off_compiler(this); | 1466 C->record_failure("CodeCache is full"); |
1483 return; | 1467 return; |
1484 } | 1468 } |
1485 | 1469 |
1486 // Save the offset for the listing | 1470 // Save the offset for the listing |
1487 #ifndef PRODUCT | 1471 #ifndef PRODUCT |
1634 } | 1618 } |
1635 } | 1619 } |
1636 | 1620 |
1637 // One last check for failed CodeBuffer::expand: | 1621 // One last check for failed CodeBuffer::expand: |
1638 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { | 1622 if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) { |
1639 turn_off_compiler(this); | 1623 C->record_failure("CodeCache is full"); |
1640 return; | 1624 return; |
1641 } | 1625 } |
1642 | 1626 |
1643 #ifndef PRODUCT | 1627 #ifndef PRODUCT |
1644 // Dump the assembly code, including basic-block numbers | 1628 // Dump the assembly code, including basic-block numbers |