Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/escape.cpp @ 20804:7848fc12602b
Merge with jdk8u40-b25
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 14:58:49 +0200 |
parents | 52b4284cb496 f913964f3fde |
children | dd9cc155639c |
comparison
equal
deleted
inserted
replaced
20184:84105dcdb05b | 20804:7848fc12602b |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2014, 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. |
35 #include "opto/phaseX.hpp" | 35 #include "opto/phaseX.hpp" |
36 #include "opto/rootnode.hpp" | 36 #include "opto/rootnode.hpp" |
37 | 37 |
38 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : | 38 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : |
39 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL), | 39 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL), |
40 _in_worklist(C->comp_arena()), | |
41 _next_pidx(0), | |
40 _collecting(true), | 42 _collecting(true), |
41 _verify(false), | 43 _verify(false), |
42 _compile(C), | 44 _compile(C), |
43 _igvn(igvn), | 45 _igvn(igvn), |
44 _node_map(C->comp_arena()) { | 46 _node_map(C->comp_arena()) { |
122 ideal_nodes.map(C->live_nodes(), NULL); // preallocate space | 124 ideal_nodes.map(C->live_nodes(), NULL); // preallocate space |
123 // Initialize worklist | 125 // Initialize worklist |
124 if (C->root() != NULL) { | 126 if (C->root() != NULL) { |
125 ideal_nodes.push(C->root()); | 127 ideal_nodes.push(C->root()); |
126 } | 128 } |
129 // Processed ideal nodes are unique on ideal_nodes list | |
130 // but several ideal nodes are mapped to the phantom_obj. | |
131 // To avoid duplicated entries on the following worklists | |
132 // add the phantom_obj only once to them. | |
133 ptnodes_worklist.append(phantom_obj); | |
134 java_objects_worklist.append(phantom_obj); | |
127 for( uint next = 0; next < ideal_nodes.size(); ++next ) { | 135 for( uint next = 0; next < ideal_nodes.size(); ++next ) { |
128 Node* n = ideal_nodes.at(next); | 136 Node* n = ideal_nodes.at(next); |
129 // Create PointsTo nodes and add them to Connection Graph. Called | 137 // Create PointsTo nodes and add them to Connection Graph. Called |
130 // only once per ideal node since ideal_nodes is Unique_Node list. | 138 // only once per ideal node since ideal_nodes is Unique_Node list. |
131 add_node_to_connection_graph(n, &delayed_worklist); | 139 add_node_to_connection_graph(n, &delayed_worklist); |
132 PointsToNode* ptn = ptnode_adr(n->_idx); | 140 PointsToNode* ptn = ptnode_adr(n->_idx); |
133 if (ptn != NULL) { | 141 if (ptn != NULL && ptn != phantom_obj) { |
134 ptnodes_worklist.append(ptn); | 142 ptnodes_worklist.append(ptn); |
135 if (ptn->is_JavaObject()) { | 143 if (ptn->is_JavaObject()) { |
136 java_objects_worklist.append(ptn->as_JavaObject()); | 144 java_objects_worklist.append(ptn->as_JavaObject()); |
137 if ((n->is_Allocate() || n->is_CallStaticJava()) && | 145 if ((n->is_Allocate() || n->is_CallStaticJava()) && |
138 (ptn->escape_state() < PointsToNode::GlobalEscape)) { | 146 (ptn->escape_state() < PointsToNode::GlobalEscape)) { |
412 add_java_object(n, es); | 420 add_java_object(n, es); |
413 break; | 421 break; |
414 } | 422 } |
415 case Op_CreateEx: { | 423 case Op_CreateEx: { |
416 // assume that all exception objects globally escape | 424 // assume that all exception objects globally escape |
417 add_java_object(n, PointsToNode::GlobalEscape); | 425 map_ideal_node(n, phantom_obj); |
418 break; | 426 break; |
419 } | 427 } |
420 case Op_LoadKlass: | 428 case Op_LoadKlass: |
421 case Op_LoadNKlass: { | 429 case Op_LoadNKlass: { |
422 // Unknown class is loaded | 430 // Unknown class is loaded |
936 strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 || | 944 strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 || |
937 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 || | 945 strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 || |
938 strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 || | 946 strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 || |
939 strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 || | 947 strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 || |
940 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 || | 948 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 || |
941 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0) | 949 strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 || |
950 strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 || | |
951 strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 || | |
952 strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 || | |
953 strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 || | |
954 strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 || | |
955 strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 || | |
956 strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0) | |
942 ))) { | 957 ))) { |
943 call->dump(); | 958 call->dump(); |
944 fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name)); | 959 fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name)); |
945 } | 960 } |
946 #endif | 961 #endif |
1056 GrowableArray<FieldNode*>& oop_fields_worklist) { | 1071 GrowableArray<FieldNode*>& oop_fields_worklist) { |
1057 // Normally only 1-3 passes needed to build Connection Graph depending | 1072 // Normally only 1-3 passes needed to build Connection Graph depending |
1058 // on graph complexity. Observed 8 passes in jvm2008 compiler.compiler. | 1073 // on graph complexity. Observed 8 passes in jvm2008 compiler.compiler. |
1059 // Set limit to 20 to catch situation when something did go wrong and | 1074 // Set limit to 20 to catch situation when something did go wrong and |
1060 // bailout Escape Analysis. | 1075 // bailout Escape Analysis. |
1061 // Also limit build time to 30 sec (60 in debug VM). | 1076 // Also limit build time to 20 sec (60 in debug VM), EscapeAnalysisTimeout flag. |
1062 #define CG_BUILD_ITER_LIMIT 20 | 1077 #define CG_BUILD_ITER_LIMIT 20 |
1063 #ifdef ASSERT | |
1064 #define CG_BUILD_TIME_LIMIT 60.0 | |
1065 #else | |
1066 #define CG_BUILD_TIME_LIMIT 30.0 | |
1067 #endif | |
1068 | 1078 |
1069 // Propagate GlobalEscape and ArgEscape escape states and check that | 1079 // Propagate GlobalEscape and ArgEscape escape states and check that |
1070 // we still have non-escaping objects. The method pushs on _worklist | 1080 // we still have non-escaping objects. The method pushs on _worklist |
1071 // Field nodes which reference phantom_object. | 1081 // Field nodes which reference phantom_object. |
1072 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { | 1082 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { |
1073 return false; // Nothing to do. | 1083 return false; // Nothing to do. |
1074 } | 1084 } |
1075 // Now propagate references to all JavaObject nodes. | 1085 // Now propagate references to all JavaObject nodes. |
1076 int java_objects_length = java_objects_worklist.length(); | 1086 int java_objects_length = java_objects_worklist.length(); |
1077 elapsedTimer time; | 1087 elapsedTimer time; |
1088 bool timeout = false; | |
1078 int new_edges = 1; | 1089 int new_edges = 1; |
1079 int iterations = 0; | 1090 int iterations = 0; |
1080 do { | 1091 do { |
1081 while ((new_edges > 0) && | 1092 while ((new_edges > 0) && |
1082 (iterations++ < CG_BUILD_ITER_LIMIT) && | 1093 (iterations++ < CG_BUILD_ITER_LIMIT)) { |
1083 (time.seconds() < CG_BUILD_TIME_LIMIT)) { | 1094 double start_time = time.seconds(); |
1084 time.start(); | 1095 time.start(); |
1085 new_edges = 0; | 1096 new_edges = 0; |
1086 // Propagate references to phantom_object for nodes pushed on _worklist | 1097 // Propagate references to phantom_object for nodes pushed on _worklist |
1087 // by find_non_escaped_objects() and find_field_value(). | 1098 // by find_non_escaped_objects() and find_field_value(). |
1088 new_edges += add_java_object_edges(phantom_obj, false); | 1099 new_edges += add_java_object_edges(phantom_obj, false); |
1089 for (int next = 0; next < java_objects_length; ++next) { | 1100 for (int next = 0; next < java_objects_length; ++next) { |
1090 JavaObjectNode* ptn = java_objects_worklist.at(next); | 1101 JavaObjectNode* ptn = java_objects_worklist.at(next); |
1091 new_edges += add_java_object_edges(ptn, true); | 1102 new_edges += add_java_object_edges(ptn, true); |
1092 } | 1103 |
1104 #define SAMPLE_SIZE 4 | |
1105 if ((next % SAMPLE_SIZE) == 0) { | |
1106 // Each 4 iterations calculate how much time it will take | |
1107 // to complete graph construction. | |
1108 time.stop(); | |
1109 // Poll for requests from shutdown mechanism to quiesce compiler | |
1110 // because Connection graph construction may take long time. | |
1111 CompileBroker::maybe_block(); | |
1112 double stop_time = time.seconds(); | |
1113 double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE; | |
1114 double time_until_end = time_per_iter * (double)(java_objects_length - next); | |
1115 if ((start_time + time_until_end) >= EscapeAnalysisTimeout) { | |
1116 timeout = true; | |
1117 break; // Timeout | |
1118 } | |
1119 start_time = stop_time; | |
1120 time.start(); | |
1121 } | |
1122 #undef SAMPLE_SIZE | |
1123 | |
1124 } | |
1125 if (timeout) break; | |
1093 if (new_edges > 0) { | 1126 if (new_edges > 0) { |
1094 // Update escape states on each iteration if graph was updated. | 1127 // Update escape states on each iteration if graph was updated. |
1095 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { | 1128 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { |
1096 return false; // Nothing to do. | 1129 return false; // Nothing to do. |
1097 } | 1130 } |
1098 } | 1131 } |
1099 time.stop(); | 1132 time.stop(); |
1100 } | 1133 if (time.seconds() >= EscapeAnalysisTimeout) { |
1101 if ((iterations < CG_BUILD_ITER_LIMIT) && | 1134 timeout = true; |
1102 (time.seconds() < CG_BUILD_TIME_LIMIT)) { | 1135 break; |
1136 } | |
1137 } | |
1138 if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) { | |
1103 time.start(); | 1139 time.start(); |
1104 // Find fields which have unknown value. | 1140 // Find fields which have unknown value. |
1105 int fields_length = oop_fields_worklist.length(); | 1141 int fields_length = oop_fields_worklist.length(); |
1106 for (int next = 0; next < fields_length; next++) { | 1142 for (int next = 0; next < fields_length; next++) { |
1107 FieldNode* field = oop_fields_worklist.at(next); | 1143 FieldNode* field = oop_fields_worklist.at(next); |
1110 // This code may added new edges to phantom_object. | 1146 // This code may added new edges to phantom_object. |
1111 // Need an other cycle to propagate references to phantom_object. | 1147 // Need an other cycle to propagate references to phantom_object. |
1112 } | 1148 } |
1113 } | 1149 } |
1114 time.stop(); | 1150 time.stop(); |
1151 if (time.seconds() >= EscapeAnalysisTimeout) { | |
1152 timeout = true; | |
1153 break; | |
1154 } | |
1115 } else { | 1155 } else { |
1116 new_edges = 0; // Bailout | 1156 new_edges = 0; // Bailout |
1117 } | 1157 } |
1118 } while (new_edges > 0); | 1158 } while (new_edges > 0); |
1119 | 1159 |
1120 // Bailout if passed limits. | 1160 // Bailout if passed limits. |
1121 if ((iterations >= CG_BUILD_ITER_LIMIT) || | 1161 if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) { |
1122 (time.seconds() >= CG_BUILD_TIME_LIMIT)) { | |
1123 Compile* C = _compile; | 1162 Compile* C = _compile; |
1124 if (C->log() != NULL) { | 1163 if (C->log() != NULL) { |
1125 C->log()->begin_elem("connectionGraph_bailout reason='reached "); | 1164 C->log()->begin_elem("connectionGraph_bailout reason='reached "); |
1126 C->log()->text("%s", (iterations >= CG_BUILD_ITER_LIMIT) ? "iterations" : "time"); | 1165 C->log()->text("%s", timeout ? "time" : "iterations"); |
1127 C->log()->end_elem(" limit'"); | 1166 C->log()->end_elem(" limit'"); |
1128 } | 1167 } |
1129 assert(ExitEscapeAnalysisOnTimeout, err_msg_res("infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", | 1168 assert(ExitEscapeAnalysisOnTimeout, err_msg_res("infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", |
1130 time.seconds(), iterations, nodes_size(), ptnodes_worklist.length())); | 1169 time.seconds(), iterations, nodes_size(), ptnodes_worklist.length())); |
1131 // Possible infinite build_connection_graph loop, | 1170 // Possible infinite build_connection_graph loop, |
1138 iterations, nodes_size(), ptnodes_worklist.length()); | 1177 iterations, nodes_size(), ptnodes_worklist.length()); |
1139 } | 1178 } |
1140 #endif | 1179 #endif |
1141 | 1180 |
1142 #undef CG_BUILD_ITER_LIMIT | 1181 #undef CG_BUILD_ITER_LIMIT |
1143 #undef CG_BUILD_TIME_LIMIT | |
1144 | 1182 |
1145 // Find fields initialized by NULL for non-escaping Allocations. | 1183 // Find fields initialized by NULL for non-escaping Allocations. |
1146 int non_escaped_length = non_escaped_worklist.length(); | 1184 int non_escaped_length = non_escaped_worklist.length(); |
1147 for (int next = 0; next < non_escaped_length; next++) { | 1185 for (int next = 0; next < non_escaped_length; next++) { |
1148 JavaObjectNode* ptn = non_escaped_worklist.at(next); | 1186 JavaObjectNode* ptn = non_escaped_worklist.at(next); |
1262 // related field nodes (same base and offset). | 1300 // related field nodes (same base and offset). |
1263 add_field_uses_to_worklist(use->as_Field()); | 1301 add_field_uses_to_worklist(use->as_Field()); |
1264 } | 1302 } |
1265 } | 1303 } |
1266 } | 1304 } |
1267 while(_worklist.length() > 0) { | 1305 for (int l = 0; l < _worklist.length(); l++) { |
1268 PointsToNode* use = _worklist.pop(); | 1306 PointsToNode* use = _worklist.at(l); |
1269 if (PointsToNode::is_base_use(use)) { | 1307 if (PointsToNode::is_base_use(use)) { |
1270 // Add reference from jobj to field and from field to jobj (field's base). | 1308 // Add reference from jobj to field and from field to jobj (field's base). |
1271 use = PointsToNode::get_use_node(use)->as_Field(); | 1309 use = PointsToNode::get_use_node(use)->as_Field(); |
1272 if (add_base(use->as_Field(), jobj)) { | 1310 if (add_base(use->as_Field(), jobj)) { |
1273 new_edges++; | 1311 new_edges++; |
1310 // Put on worklist all field's uses (loads) and | 1348 // Put on worklist all field's uses (loads) and |
1311 // related field nodes (same base and offset). | 1349 // related field nodes (same base and offset). |
1312 add_field_uses_to_worklist(use->as_Field()); | 1350 add_field_uses_to_worklist(use->as_Field()); |
1313 } | 1351 } |
1314 } | 1352 } |
1353 _worklist.clear(); | |
1354 _in_worklist.Reset(); | |
1315 return new_edges; | 1355 return new_edges; |
1316 } | 1356 } |
1317 | 1357 |
1318 // Put on worklist all related field nodes. | 1358 // Put on worklist all related field nodes. |
1319 void ConnectionGraph::add_field_uses_to_worklist(FieldNode* field) { | 1359 void ConnectionGraph::add_field_uses_to_worklist(FieldNode* field) { |
1889 if (ptadr != NULL) { | 1929 if (ptadr != NULL) { |
1890 assert(ptadr->is_LocalVar() && ptadr->ideal_node() == n, "sanity"); | 1930 assert(ptadr->is_LocalVar() && ptadr->ideal_node() == n, "sanity"); |
1891 return; | 1931 return; |
1892 } | 1932 } |
1893 Compile* C = _compile; | 1933 Compile* C = _compile; |
1894 ptadr = new (C->comp_arena()) LocalVarNode(C, n, es); | 1934 ptadr = new (C->comp_arena()) LocalVarNode(this, n, es); |
1895 _nodes.at_put(n->_idx, ptadr); | 1935 _nodes.at_put(n->_idx, ptadr); |
1896 } | 1936 } |
1897 | 1937 |
1898 void ConnectionGraph::add_java_object(Node *n, PointsToNode::EscapeState es) { | 1938 void ConnectionGraph::add_java_object(Node *n, PointsToNode::EscapeState es) { |
1899 PointsToNode* ptadr = _nodes.at(n->_idx); | 1939 PointsToNode* ptadr = _nodes.at(n->_idx); |
1900 if (ptadr != NULL) { | 1940 if (ptadr != NULL) { |
1901 assert(ptadr->is_JavaObject() && ptadr->ideal_node() == n, "sanity"); | 1941 assert(ptadr->is_JavaObject() && ptadr->ideal_node() == n, "sanity"); |
1902 return; | 1942 return; |
1903 } | 1943 } |
1904 Compile* C = _compile; | 1944 Compile* C = _compile; |
1905 ptadr = new (C->comp_arena()) JavaObjectNode(C, n, es); | 1945 ptadr = new (C->comp_arena()) JavaObjectNode(this, n, es); |
1906 _nodes.at_put(n->_idx, ptadr); | 1946 _nodes.at_put(n->_idx, ptadr); |
1907 } | 1947 } |
1908 | 1948 |
1909 void ConnectionGraph::add_field(Node *n, PointsToNode::EscapeState es, int offset) { | 1949 void ConnectionGraph::add_field(Node *n, PointsToNode::EscapeState es, int offset) { |
1910 PointsToNode* ptadr = _nodes.at(n->_idx); | 1950 PointsToNode* ptadr = _nodes.at(n->_idx); |
1916 bool is_oop = is_oop_field(n, offset, &unsafe); | 1956 bool is_oop = is_oop_field(n, offset, &unsafe); |
1917 if (unsafe) { | 1957 if (unsafe) { |
1918 es = PointsToNode::GlobalEscape; | 1958 es = PointsToNode::GlobalEscape; |
1919 } | 1959 } |
1920 Compile* C = _compile; | 1960 Compile* C = _compile; |
1921 FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop); | 1961 FieldNode* field = new (C->comp_arena()) FieldNode(this, n, es, offset, is_oop); |
1922 _nodes.at_put(n->_idx, field); | 1962 _nodes.at_put(n->_idx, field); |
1923 } | 1963 } |
1924 | 1964 |
1925 void ConnectionGraph::add_arraycopy(Node *n, PointsToNode::EscapeState es, | 1965 void ConnectionGraph::add_arraycopy(Node *n, PointsToNode::EscapeState es, |
1926 PointsToNode* src, PointsToNode* dst) { | 1966 PointsToNode* src, PointsToNode* dst) { |
1930 if (ptadr != NULL) { | 1970 if (ptadr != NULL) { |
1931 assert(ptadr->is_Arraycopy() && ptadr->ideal_node() == n, "sanity"); | 1971 assert(ptadr->is_Arraycopy() && ptadr->ideal_node() == n, "sanity"); |
1932 return; | 1972 return; |
1933 } | 1973 } |
1934 Compile* C = _compile; | 1974 Compile* C = _compile; |
1935 ptadr = new (C->comp_arena()) ArraycopyNode(C, n, es); | 1975 ptadr = new (C->comp_arena()) ArraycopyNode(this, n, es); |
1936 _nodes.at_put(n->_idx, ptadr); | 1976 _nodes.at_put(n->_idx, ptadr); |
1937 // Add edge from arraycopy node to source object. | 1977 // Add edge from arraycopy node to source object. |
1938 (void)add_edge(ptadr, src); | 1978 (void)add_edge(ptadr, src); |
1939 src->set_arraycopy_src(); | 1979 src->set_arraycopy_src(); |
1940 // Add edge from destination object to arraycopy node. | 1980 // Add edge from destination object to arraycopy node. |
2370 assert(phi->_idx >= nodes_size(), "only new Phi per instance memory slice"); | 2410 assert(phi->_idx >= nodes_size(), "only new Phi per instance memory slice"); |
2371 return phi->as_Phi(); | 2411 return phi->as_Phi(); |
2372 } | 2412 } |
2373 } | 2413 } |
2374 } | 2414 } |
2375 if ((int) (C->live_nodes() + 2*NodeLimitFudgeFactor) > MaxNodeLimit) { | 2415 if (C->live_nodes() + 2*NodeLimitFudgeFactor > C->max_node_limit()) { |
2376 if (C->do_escape_analysis() == true && !C->failing()) { | 2416 if (C->do_escape_analysis() == true && !C->failing()) { |
2377 // Retry compilation without escape analysis. | 2417 // Retry compilation without escape analysis. |
2378 // If this is the first failure, the sentinel string will "stick" | 2418 // If this is the first failure, the sentinel string will "stick" |
2379 // to the Compile object, and the C2Compiler will see it and retry. | 2419 // to the Compile object, and the C2Compiler will see it and retry. |
2380 C->record_failure(C2Compiler::retry_no_escape_analysis()); | 2420 C->record_failure(C2Compiler::retry_no_escape_analysis()); |
2830 // (reflection allocation), the object can't be restored during | 2870 // (reflection allocation), the object can't be restored during |
2831 // deoptimization without precise type. | 2871 // deoptimization without precise type. |
2832 continue; | 2872 continue; |
2833 } | 2873 } |
2834 } | 2874 } |
2875 | |
2876 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); | |
2877 if (t == NULL) | |
2878 continue; // not a TypeOopPtr | |
2879 if (!t->klass_is_exact()) | |
2880 continue; // not an unique type | |
2881 | |
2835 if (alloc->is_Allocate()) { | 2882 if (alloc->is_Allocate()) { |
2836 // Set the scalar_replaceable flag for allocation | 2883 // Set the scalar_replaceable flag for allocation |
2837 // so it could be eliminated. | 2884 // so it could be eliminated. |
2838 alloc->as_Allocate()->_is_scalar_replaceable = true; | 2885 alloc->as_Allocate()->_is_scalar_replaceable = true; |
2839 } | 2886 } |
2848 // - non-escaping | 2895 // - non-escaping |
2849 // - eligible to be a unique type | 2896 // - eligible to be a unique type |
2850 // - not determined to be ineligible by escape analysis | 2897 // - not determined to be ineligible by escape analysis |
2851 set_map(alloc, n); | 2898 set_map(alloc, n); |
2852 set_map(n, alloc); | 2899 set_map(n, alloc); |
2853 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); | 2900 const TypeOopPtr* tinst = t->cast_to_instance_id(ni); |
2854 if (t == NULL) | |
2855 continue; // not a TypeOopPtr | |
2856 const TypeOopPtr* tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni); | |
2857 igvn->hash_delete(n); | 2901 igvn->hash_delete(n); |
2858 igvn->set_type(n, tinst); | 2902 igvn->set_type(n, tinst); |
2859 n->raise_bottom_type(tinst); | 2903 n->raise_bottom_type(tinst); |
2860 igvn->hash_insert(n); | 2904 igvn->hash_insert(n); |
2861 record_for_optimizer(n); | 2905 record_for_optimizer(n); |