comparison src/share/vm/opto/lcm.cpp @ 14436:b0133e4187d3

8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization. Summary: Fixed Implicit NULL check optimization for AIX, where the page at address '0' is only write-protected. Reviewed-by: kvn
author goetz
date Thu, 21 Nov 2013 18:29:34 -0800
parents 2b8e28fdf503
children abec000618bf
comparison
equal deleted inserted replaced
14435:da862781b584 14436:b0133e4187d3
51 #ifdef TARGET_ARCH_MODEL_ppc_64 51 #ifdef TARGET_ARCH_MODEL_ppc_64
52 # include "adfiles/ad_ppc_64.hpp" 52 # include "adfiles/ad_ppc_64.hpp"
53 #endif 53 #endif
54 54
55 // Optimization - Graph Style 55 // Optimization - Graph Style
56
57 // Check whether val is not-null-decoded compressed oop,
58 // i.e. will grab into the base of the heap if it represents NULL.
59 static bool accesses_heap_base_zone(Node *val) {
60 if (Universe::narrow_oop_base() > 0) { // Implies UseCompressedOops.
61 if (val && val->is_Mach()) {
62 if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) {
63 // This assumes all Decodes with TypePtr::NotNull are matched to nodes that
64 // decode NULL to point to the heap base (Decode_NN).
65 if (val->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull) {
66 return true;
67 }
68 }
69 // Must recognize load operation with Decode matched in memory operand.
70 // We should not reach here exept for PPC/AIX, as os::zero_page_read_protected()
71 // returns true everywhere else. On PPC, no such memory operands
72 // exist, therefore we did not yet implement a check for such operands.
73 NOT_AIX(Unimplemented());
74 }
75 }
76 return false;
77 }
78
79 static bool needs_explicit_null_check_for_read(Node *val) {
80 // On some OSes (AIX) the page at address 0 is only write protected.
81 // If so, only Store operations will trap.
82 if (os::zero_page_read_protected()) {
83 return false; // Implicit null check will work.
84 }
85 // Also a read accessing the base of a heap-based compressed heap will trap.
86 if (accesses_heap_base_zone(val) && // Hits the base zone page.
87 Universe::narrow_oop_use_implicit_null_checks()) { // Base zone page is protected.
88 return false;
89 }
90
91 return true;
92 }
56 93
57 //------------------------------implicit_null_check---------------------------- 94 //------------------------------implicit_null_check----------------------------
58 // Detect implicit-null-check opportunities. Basically, find NULL checks 95 // Detect implicit-null-check opportunities. Basically, find NULL checks
59 // with suitable memory ops nearby. Use the memory op to do the NULL check. 96 // with suitable memory ops nearby. Use the memory op to do the NULL check.
60 // I can generate a memory op if there is not one nearby. 97 // I can generate a memory op if there is not one nearby.
207 continue; // Skip it 244 continue; // Skip it
208 } 245 }
209 } 246 }
210 break; 247 break;
211 } 248 }
249
250 // On some OSes (AIX) the page at address 0 is only write protected.
251 // If so, only Store operations will trap.
252 // But a read accessing the base of a heap-based compressed heap will trap.
253 if (!was_store && needs_explicit_null_check_for_read(val)) {
254 continue;
255 }
256
212 // check if the offset is not too high for implicit exception 257 // check if the offset is not too high for implicit exception
213 { 258 {
214 intptr_t offset = 0; 259 intptr_t offset = 0;
215 const TypePtr *adr_type = NULL; // Do not need this return value here 260 const TypePtr *adr_type = NULL; // Do not need this return value here
216 const Node* base = mach->get_base_and_disp(offset, adr_type); 261 const Node* base = mach->get_base_and_disp(offset, adr_type);