Mercurial > hg > truffle
comparison src/share/vm/opto/lcm.cpp @ 14521:29ccc4cbabca
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 12 Mar 2014 13:30:08 +0100 |
parents | cd5d10655495 |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14520:f84115370178 | 14521:29ccc4cbabca |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
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); |
470 if (use->is_MachIf() && get_block_for_node(use) == block) { | 518 if (use->is_MachIf() && get_block_for_node(use) == block) { |
471 found_machif = true; | 519 found_machif = true; |
472 break; | 520 break; |
473 } | 521 } |
474 | 522 |
475 // For nodes that produce a FlagsProj, make the node adjacent to the | |
476 // use of the FlagsProj | |
477 if (use->is_FlagsProj() && get_block_for_node(use) == block) { | |
478 found_machif = true; | |
479 break; | |
480 } | |
481 | |
482 // More than this instruction pending for successor to be ready, | 523 // More than this instruction pending for successor to be ready, |
483 // don't choose this if other opportunities are ready | 524 // don't choose this if other opportunities are ready |
484 if (ready_cnt.at(use->_idx) > 1) | 525 if (ready_cnt.at(use->_idx) > 1) |
485 n_choice = 1; | 526 n_choice = 1; |
486 } | 527 } |