7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "ci/bcEscapeAnalyzer.hpp"
26 #include "compiler/compileLog.hpp"
27 #include "libadt/vectset.hpp"
28 #include "memory/allocation.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "opto/c2compiler.hpp"
31 #include "opto/arraycopynode.hpp"
32 #include "opto/callnode.hpp"
33 #include "opto/cfgnode.hpp"
34 #include "opto/compile.hpp"
35 #include "opto/escape.hpp"
36 #include "opto/phaseX.hpp"
37 #include "opto/movenode.hpp"
38 #include "opto/rootnode.hpp"
39 #if INCLUDE_ALL_GCS
40 #include "gc/g1/g1ThreadLocalData.hpp"
41 #endif // INCLUDE_ALL_GCS
42
43 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
44 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
45 _in_worklist(C->comp_arena()),
|
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "ci/bcEscapeAnalyzer.hpp"
26 #include "compiler/compileLog.hpp"
27 #include "gc/shared/c2/barrierSetC2.hpp"
28 #include "libadt/vectset.hpp"
29 #include "memory/allocation.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "opto/c2compiler.hpp"
32 #include "opto/arraycopynode.hpp"
33 #include "opto/callnode.hpp"
34 #include "opto/cfgnode.hpp"
35 #include "opto/compile.hpp"
36 #include "opto/escape.hpp"
37 #include "opto/phaseX.hpp"
38 #include "opto/movenode.hpp"
39 #include "opto/rootnode.hpp"
40 #if INCLUDE_ALL_GCS
41 #include "gc/g1/g1ThreadLocalData.hpp"
42 #endif // INCLUDE_ALL_GCS
43
44 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
45 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
46 _in_worklist(C->comp_arena()),
|
960 assert(aat == Type::TOP || aat == TypePtr::NULL_PTR ||
961 aat->isa_ptr() != NULL, "expecting an Ptr");
962 bool arg_has_oops = aat->isa_oopptr() &&
963 (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
964 (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()));
965 if (i == TypeFunc::Parms) {
966 src_has_oops = arg_has_oops;
967 }
968 //
969 // src or dst could be j.l.Object when other is basic type array:
970 //
971 // arraycopy(char[],0,Object*,0,size);
972 // arraycopy(Object*,0,char[],0,size);
973 //
974 // Don't add edges in such cases.
975 //
976 bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
977 arg_has_oops && (i > TypeFunc::Parms);
978 #ifdef ASSERT
979 if (!(is_arraycopy ||
980 (call->as_CallLeaf()->_name != NULL &&
981 (strcmp(call->as_CallLeaf()->_name, "g1_wb_pre") == 0 ||
982 strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||
983 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
984 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
985 strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
986 strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
987 strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
988 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
989 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
990 strcmp(call->as_CallLeaf()->_name, "counterMode_AESCrypt") == 0 ||
991 strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
992 strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
993 strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
994 strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
995 strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
996 strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
997 strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
998 strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
999 strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
1000 strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
1001 strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
1002 strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0 ||
|
961 assert(aat == Type::TOP || aat == TypePtr::NULL_PTR ||
962 aat->isa_ptr() != NULL, "expecting an Ptr");
963 bool arg_has_oops = aat->isa_oopptr() &&
964 (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
965 (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()));
966 if (i == TypeFunc::Parms) {
967 src_has_oops = arg_has_oops;
968 }
969 //
970 // src or dst could be j.l.Object when other is basic type array:
971 //
972 // arraycopy(char[],0,Object*,0,size);
973 // arraycopy(Object*,0,char[],0,size);
974 //
975 // Don't add edges in such cases.
976 //
977 bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
978 arg_has_oops && (i > TypeFunc::Parms);
979 #ifdef ASSERT
980 if (!(is_arraycopy ||
981 BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(call) ||
982 (call->as_CallLeaf()->_name != NULL &&
983 (strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
984 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
985 strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
986 strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
987 strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
988 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
989 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
990 strcmp(call->as_CallLeaf()->_name, "counterMode_AESCrypt") == 0 ||
991 strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
992 strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
993 strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
994 strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
995 strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
996 strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
997 strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
998 strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
999 strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
1000 strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
1001 strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
1002 strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0 ||
|
3265 } else if (use->is_MemBar()) {
3266 if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
3267 memnode_worklist.append_if_missing(use);
3268 }
3269 #ifdef ASSERT
3270 } else if(use->is_Mem()) {
3271 assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
3272 } else if (use->is_MergeMem()) {
3273 assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");
3274 } else if (use->Opcode() == Op_EncodeISOArray) {
3275 if (use->in(MemNode::Memory) == n || use->in(3) == n) {
3276 // EncodeISOArray overwrites destination array
3277 memnode_worklist.append_if_missing(use);
3278 }
3279 } else {
3280 uint op = use->Opcode();
3281 if ((use->in(MemNode::Memory) == n) &&
3282 (op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) {
3283 // They overwrite memory edge corresponding to destination array,
3284 memnode_worklist.append_if_missing(use);
3285 } else if (!(op == Op_StoreCM ||
3286 (op == Op_CallLeaf && use->as_CallLeaf()->_name != NULL &&
3287 strcmp(use->as_CallLeaf()->_name, "g1_wb_pre") == 0) ||
3288 op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives ||
3289 op == Op_StrCompressedCopy || op == Op_StrInflatedCopy ||
3290 op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) {
3291 n->dump();
3292 use->dump();
3293 assert(false, "EA: missing memory path");
3294 }
3295 #endif
3296 }
3297 }
3298 }
3299
3300 // Phase 3: Process MergeMem nodes from mergemem_worklist.
3301 // Walk each memory slice moving the first node encountered of each
3302 // instance type to the the input corresponding to its alias index.
3303 uint length = _mergemem_worklist.length();
3304 for( uint next = 0; next < length; ++next ) {
3305 MergeMemNode* nmm = _mergemem_worklist.at(next);
3306 assert(!visited.test_set(nmm->_idx), "should not be visited before");
|
3265 } else if (use->is_MemBar()) {
3266 if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
3267 memnode_worklist.append_if_missing(use);
3268 }
3269 #ifdef ASSERT
3270 } else if(use->is_Mem()) {
3271 assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
3272 } else if (use->is_MergeMem()) {
3273 assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");
3274 } else if (use->Opcode() == Op_EncodeISOArray) {
3275 if (use->in(MemNode::Memory) == n || use->in(3) == n) {
3276 // EncodeISOArray overwrites destination array
3277 memnode_worklist.append_if_missing(use);
3278 }
3279 } else {
3280 uint op = use->Opcode();
3281 if ((use->in(MemNode::Memory) == n) &&
3282 (op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) {
3283 // They overwrite memory edge corresponding to destination array,
3284 memnode_worklist.append_if_missing(use);
3285 } else if (!(BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(use) ||
3286 op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives ||
3287 op == Op_StrCompressedCopy || op == Op_StrInflatedCopy ||
3288 op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) {
3289 n->dump();
3290 use->dump();
3291 assert(false, "EA: missing memory path");
3292 }
3293 #endif
3294 }
3295 }
3296 }
3297
3298 // Phase 3: Process MergeMem nodes from mergemem_worklist.
3299 // Walk each memory slice moving the first node encountered of each
3300 // instance type to the the input corresponding to its alias index.
3301 uint length = _mergemem_worklist.length();
3302 for( uint next = 0; next < length; ++next ) {
3303 MergeMemNode* nmm = _mergemem_worklist.at(next);
3304 assert(!visited.test_set(nmm->_idx), "should not be visited before");
|