< prev index next >

src/share/vm/opto/castnode.cpp

Print this page
rev 12618 : undo checkcastpp
rev 12682 : nio exps
rev 12700 : 8176506: C2: loop unswitching and unsafe accesses cause crash
Reviewed-by:

@@ -119,10 +119,13 @@
   // in that case only the narrower CastII would be kept by the code
   // below which would be incorrect.
   if (is_CastII() && as_CastII()->has_range_check()) {
     return NULL;
   }
+  if (type()->isa_rawptr() && (phase->type_or_null(val) == NULL || phase->type(val)->isa_oopptr())) {
+    return NULL;
+  }
   for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
     Node* u = val->fast_out(i);
     if (u != this &&
         u->outcnt() > 0 &&
         u->Opcode() == opc &&

@@ -303,15 +306,19 @@
   if( in_type != NULL && my_type != NULL ) {
     TypePtr::PTR   in_ptr    = in_type->ptr();
     if (in_ptr == TypePtr::Null) {
       result = in_type;
     } else if (in_ptr == TypePtr::Constant) {
+      if (my_type->isa_rawptr()) {
+        result = my_type;
+      } else {
       const TypeOopPtr *jptr = my_type->isa_oopptr();
       assert(jptr, "");
       result = !in_type->higher_equal(_type)
       ? my_type->cast_to_ptr_type(TypePtr::NotNull)
       : in_type;
+      }
     } else {
       result =  my_type->cast_to_ptr_type( my_type->join_ptr(in_ptr) );
     }
   }
 
< prev index next >