RFR (S) 8150669: C1 intrinsic for Class.isPrimitive
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Tue Mar 1 10:07:08 UTC 2016
> http://cr.openjdk.java.net/~shade/8150669/webrev.02/
Overall, looks good.
+ ciType* t = c->value()->as_instance()->java_mirror_type();
as_instance() is redundant: InstanceConstant::value() already produces
ciInstance:
class InstanceConstant: public InstanceType {
ciInstance* value() const { return _value; }
+ set_constant(t->is_klass() ? 0 : 1);
I'd prefer to see ciType::is_primitive_type() instead which is more
readable.
class ciType : public ciMetadata {
...
// Returns true if this is not a klass or array (i.e., not a
reference type).
bool is_primitive_type() const { return basic_type() !=
T_OBJECT && basic_type() != T_ARRAY; }
I have a general question: why did you decide to intrinsify the method
into a native call? Class::is_primitive looks pretty trivial to
translate it right into machine code:
bool java_lang_Class::is_primitive(oop java_class) {
bool is_primitive = (java_class->metadata_field(_klass_offset) ==
NULL);
...
return is_primitive;
}
Best regards,
Vladimir Ivanov
More information about the hotspot-compiler-dev
mailing list