48 # include "adfiles/ad_zero.hpp" |
48 # include "adfiles/ad_zero.hpp" |
49 #endif |
49 #endif |
50 #ifdef TARGET_ARCH_MODEL_arm |
50 #ifdef TARGET_ARCH_MODEL_arm |
51 # include "adfiles/ad_arm.hpp" |
51 # include "adfiles/ad_arm.hpp" |
52 #endif |
52 #endif |
53 #ifdef TARGET_ARCH_MODEL_ppc |
53 #ifdef TARGET_ARCH_MODEL_ppc_32 |
54 # include "adfiles/ad_ppc.hpp" |
54 # include "adfiles/ad_ppc_32.hpp" |
55 #endif |
55 #endif |
|
56 #ifdef TARGET_ARCH_MODEL_ppc_64 |
|
57 # include "adfiles/ad_ppc_64.hpp" |
|
58 #endif |
|
59 |
56 |
60 |
57 // Portions of code courtesy of Clifford Click |
61 // Portions of code courtesy of Clifford Click |
58 |
62 |
59 // Optimization - Graph Style |
63 // Optimization - Graph Style |
60 |
64 |
1324 |
1328 |
1325 // Detect implicit-null-check opportunities. Basically, find NULL checks |
1329 // Detect implicit-null-check opportunities. Basically, find NULL checks |
1326 // with suitable memory ops nearby. Use the memory op to do the NULL check. |
1330 // with suitable memory ops nearby. Use the memory op to do the NULL check. |
1327 // I can generate a memory op if there is not one nearby. |
1331 // I can generate a memory op if there is not one nearby. |
1328 if (C->is_method_compilation()) { |
1332 if (C->is_method_compilation()) { |
1329 // Don't do it for natives, adapters, or runtime stubs |
|
1330 int allowed_reasons = 0; |
|
1331 // ...and don't do it when there have been too many traps, globally. |
|
1332 for (int reason = (int)Deoptimization::Reason_none+1; |
|
1333 reason < Compile::trapHistLength; reason++) { |
|
1334 assert(reason < BitsPerInt, "recode bit map"); |
|
1335 if (!C->too_many_traps((Deoptimization::DeoptReason) reason)) |
|
1336 allowed_reasons |= nth_bit(reason); |
|
1337 } |
|
1338 // By reversing the loop direction we get a very minor gain on mpegaudio. |
1333 // By reversing the loop direction we get a very minor gain on mpegaudio. |
1339 // Feel free to revert to a forward loop for clarity. |
1334 // Feel free to revert to a forward loop for clarity. |
1340 // for( int i=0; i < (int)matcher._null_check_tests.size(); i+=2 ) { |
1335 // for( int i=0; i < (int)matcher._null_check_tests.size(); i+=2 ) { |
1341 for (int i = _matcher._null_check_tests.size() - 2; i >= 0; i -= 2) { |
1336 for (int i = _matcher._null_check_tests.size() - 2; i >= 0; i -= 2) { |
1342 Node* proj = _matcher._null_check_tests[i]; |
1337 Node* proj = _matcher._null_check_tests[i]; |
1343 Node* val = _matcher._null_check_tests[i + 1]; |
1338 Node* val = _matcher._null_check_tests[i + 1]; |
1344 Block* block = get_block_for_node(proj); |
1339 Block* block = get_block_for_node(proj); |
1345 implicit_null_check(block, proj, val, allowed_reasons); |
1340 implicit_null_check(block, proj, val, C->allowed_deopt_reasons()); |
1346 // The implicit_null_check will only perform the transformation |
1341 // The implicit_null_check will only perform the transformation |
1347 // if the null branch is truly uncommon, *and* it leads to an |
1342 // if the null branch is truly uncommon, *and* it leads to an |
1348 // uncommon trap. Combined with the too_many_traps guards |
1343 // uncommon trap. Combined with the too_many_traps guards |
1349 // above, this prevents SEGV storms reported in 6366351, |
1344 // above, this prevents SEGV storms reported in 6366351, |
1350 // by recompiling offending methods without this optimization. |
1345 // by recompiling offending methods without this optimization. |