src/share/vm/opto/graphKit.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6746907 Sdiff src/share/vm/opto

src/share/vm/opto/graphKit.cpp

Print this page




1195   }
1196 
1197   if (null_control != NULL) {
1198     IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN);
1199     Node* null_true = _gvn.transform( new (C, 1) IfFalseNode(iff));
1200     set_control(      _gvn.transform( new (C, 1) IfTrueNode(iff)));
1201     if (null_true == top())
1202       explicit_null_checks_elided++;
1203     (*null_control) = null_true;
1204   } else {
1205     BuildCutout unless(this, tst, ok_prob);
1206     // Check for optimizer eliding test at parse time
1207     if (stopped()) {
1208       // Failure not possible; do not bother making uncommon trap.
1209       explicit_null_checks_elided++;
1210     } else if (assert_null) {
1211       uncommon_trap(reason,
1212                     Deoptimization::Action_make_not_entrant,
1213                     NULL, "assert_null");
1214     } else {

1215       builtin_throw(reason);
1216     }
1217   }
1218 
1219   // Must throw exception, fall-thru not possible?
1220   if (stopped()) {
1221     return top();               // No result
1222   }
1223 
1224   if (assert_null) {
1225     // Cast obj to null on this path.
1226     replace_in_map(value, zerocon(type));
1227     return zerocon(type);
1228   }
1229 
1230   // Cast obj to not-null on this path, if there is no null_control.
1231   // (If there is a null_control, a non-null value may come back to haunt us.)
1232   if (type == T_OBJECT) {
1233     Node* cast = cast_not_null(value, false);
1234     if (null_control == NULL || (*null_control) == top())


1943 // Code is structured as a series of driver functions all called 'do_XXX' that
1944 // call a set of helper functions.  Helper functions first, then drivers.
1945 
1946 //------------------------------null_check_oop---------------------------------
1947 // Null check oop.  Set null-path control into Region in slot 3.
1948 // Make a cast-not-nullness use the other not-null control.  Return cast.
1949 Node* GraphKit::null_check_oop(Node* value, Node* *null_control,
1950                                bool never_see_null) {
1951   // Initial NULL check taken path
1952   (*null_control) = top();
1953   Node* cast = null_check_common(value, T_OBJECT, false, null_control);
1954 
1955   // Generate uncommon_trap:
1956   if (never_see_null && (*null_control) != top()) {
1957     // If we see an unexpected null at a check-cast we record it and force a
1958     // recompile; the offending check-cast will be compiled to handle NULLs.
1959     // If we see more than one offending BCI, then all checkcasts in the
1960     // method will be compiled to handle NULLs.
1961     PreserveJVMState pjvms(this);
1962     set_control(*null_control);

1963     uncommon_trap(Deoptimization::Reason_null_check,
1964                   Deoptimization::Action_make_not_entrant);
1965     (*null_control) = top();    // NULL path is dead
1966   }
1967 
1968   // Cast away null-ness on the result
1969   return cast;
1970 }
1971 
1972 //------------------------------opt_iff----------------------------------------
1973 // Optimize the fast-check IfNode.  Set the fast-path region slot 2.
1974 // Return slow-path control.
1975 Node* GraphKit::opt_iff(Node* region, Node* iff) {
1976   IfNode *opt_iff = _gvn.transform(iff)->as_If();
1977 
1978   // Fast path taken; set region slot 2
1979   Node *fast_taken = _gvn.transform( new (C, 1) IfFalseNode(opt_iff) );
1980   region->init_req(2,fast_taken); // Capture fast-control
1981 
1982   // Fast path not-taken, i.e. slow path




1195   }
1196 
1197   if (null_control != NULL) {
1198     IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN);
1199     Node* null_true = _gvn.transform( new (C, 1) IfFalseNode(iff));
1200     set_control(      _gvn.transform( new (C, 1) IfTrueNode(iff)));
1201     if (null_true == top())
1202       explicit_null_checks_elided++;
1203     (*null_control) = null_true;
1204   } else {
1205     BuildCutout unless(this, tst, ok_prob);
1206     // Check for optimizer eliding test at parse time
1207     if (stopped()) {
1208       // Failure not possible; do not bother making uncommon trap.
1209       explicit_null_checks_elided++;
1210     } else if (assert_null) {
1211       uncommon_trap(reason,
1212                     Deoptimization::Action_make_not_entrant,
1213                     NULL, "assert_null");
1214     } else {
1215       replace_in_map(value, zerocon(type));
1216       builtin_throw(reason);
1217     }
1218   }
1219 
1220   // Must throw exception, fall-thru not possible?
1221   if (stopped()) {
1222     return top();               // No result
1223   }
1224 
1225   if (assert_null) {
1226     // Cast obj to null on this path.
1227     replace_in_map(value, zerocon(type));
1228     return zerocon(type);
1229   }
1230 
1231   // Cast obj to not-null on this path, if there is no null_control.
1232   // (If there is a null_control, a non-null value may come back to haunt us.)
1233   if (type == T_OBJECT) {
1234     Node* cast = cast_not_null(value, false);
1235     if (null_control == NULL || (*null_control) == top())


1944 // Code is structured as a series of driver functions all called 'do_XXX' that
1945 // call a set of helper functions.  Helper functions first, then drivers.
1946 
1947 //------------------------------null_check_oop---------------------------------
1948 // Null check oop.  Set null-path control into Region in slot 3.
1949 // Make a cast-not-nullness use the other not-null control.  Return cast.
1950 Node* GraphKit::null_check_oop(Node* value, Node* *null_control,
1951                                bool never_see_null) {
1952   // Initial NULL check taken path
1953   (*null_control) = top();
1954   Node* cast = null_check_common(value, T_OBJECT, false, null_control);
1955 
1956   // Generate uncommon_trap:
1957   if (never_see_null && (*null_control) != top()) {
1958     // If we see an unexpected null at a check-cast we record it and force a
1959     // recompile; the offending check-cast will be compiled to handle NULLs.
1960     // If we see more than one offending BCI, then all checkcasts in the
1961     // method will be compiled to handle NULLs.
1962     PreserveJVMState pjvms(this);
1963     set_control(*null_control);
1964     replace_in_map(value, null());
1965     uncommon_trap(Deoptimization::Reason_null_check,
1966                   Deoptimization::Action_make_not_entrant);
1967     (*null_control) = top();    // NULL path is dead
1968   }
1969 
1970   // Cast away null-ness on the result
1971   return cast;
1972 }
1973 
1974 //------------------------------opt_iff----------------------------------------
1975 // Optimize the fast-check IfNode.  Set the fast-path region slot 2.
1976 // Return slow-path control.
1977 Node* GraphKit::opt_iff(Node* region, Node* iff) {
1978   IfNode *opt_iff = _gvn.transform(iff)->as_If();
1979 
1980   // Fast path taken; set region slot 2
1981   Node *fast_taken = _gvn.transform( new (C, 1) IfFalseNode(opt_iff) );
1982   region->init_req(2,fast_taken); // Capture fast-control
1983 
1984   // Fast path not-taken, i.e. slow path


src/share/vm/opto/graphKit.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File