Mercurial > hg > truffle
comparison src/share/vm/opto/lcm.cpp @ 14456:abec000618bf
Merge
author | kvn |
---|---|
date | Tue, 28 Jan 2014 12:25:34 -0800 |
parents | de6a9e811145 b0133e4187d3 |
children | cd5d10655495 62c54fcc0a35 |
comparison
equal
deleted
inserted
replaced
14269:2a8891e0a082 | 14456:abec000618bf |
---|---|
43 # include "adfiles/ad_zero.hpp" | 43 # include "adfiles/ad_zero.hpp" |
44 #endif | 44 #endif |
45 #ifdef TARGET_ARCH_MODEL_arm | 45 #ifdef TARGET_ARCH_MODEL_arm |
46 # include "adfiles/ad_arm.hpp" | 46 # include "adfiles/ad_arm.hpp" |
47 #endif | 47 #endif |
48 #ifdef TARGET_ARCH_MODEL_ppc | 48 #ifdef TARGET_ARCH_MODEL_ppc_32 |
49 # include "adfiles/ad_ppc.hpp" | 49 # include "adfiles/ad_ppc_32.hpp" |
50 #endif | |
51 #ifdef TARGET_ARCH_MODEL_ppc_64 | |
52 # include "adfiles/ad_ppc_64.hpp" | |
50 #endif | 53 #endif |
51 | 54 |
52 // 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 } | |
53 | 93 |
54 //------------------------------implicit_null_check---------------------------- | 94 //------------------------------implicit_null_check---------------------------- |
55 // Detect implicit-null-check opportunities. Basically, find NULL checks | 95 // Detect implicit-null-check opportunities. Basically, find NULL checks |
56 // 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. |
57 // 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. |
204 continue; // Skip it | 244 continue; // Skip it |
205 } | 245 } |
206 } | 246 } |
207 break; | 247 break; |
208 } | 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 | |
209 // check if the offset is not too high for implicit exception | 257 // check if the offset is not too high for implicit exception |
210 { | 258 { |
211 intptr_t offset = 0; | 259 intptr_t offset = 0; |
212 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 |
213 const Node* base = mach->get_base_and_disp(offset, adr_type); | 261 const Node* base = mach->get_base_and_disp(offset, adr_type); |