< prev index next >

src/share/vm/c1/c1_Canonicalizer.cpp

Print this page

        

@@ -485,10 +485,21 @@
         set_constant(0);
       }
     }
     break;
   }
+  case vmIntrinsics::_isPrimitive        : {
+    assert(x->number_of_arguments() == 1, "wrong type");
+
+    // Class.isPrimitive is known on constant classes:
+    InstanceConstant* c = x->argument_at(0)->type()->as_InstanceConstant();
+    if (c != NULL && !c->value()->is_null_object()) {
+      ciType* t = c->value()->as_instance()->java_mirror_type();
+      set_constant(t->is_klass() ? 0 : 1);
+    }
+    break;
+  }
   }
 }
 
 void Canonicalizer::do_Convert        (Convert*         x) {
   if (x->value()->type()->is_constant()) {
< prev index next >