RFR: 8138659: Speed up InstanceKlass subclass discrimination (original) (raw)
Kim Barrett kim.barrett at oracle.com
Thu Oct 8 00:43:31 UTC 2015
- Previous message: RFR: 8138659: Speed up InstanceKlass subclass discrimination
- Next message: RFR: 8138659: Speed up InstanceKlass subclass discrimination
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 7, 2015, at 7:35 PM, Coleen Phillimore <coleen.phillimore at oracle.com> wrote:
Kim,
This looks very nice. Thank you for doing this: + return staticcast<InstanceMirrorKlass*>(k);
For bonus points can you change this to a staticcast<> ??? // Casting from Klass* static InstanceKlass* cast(Klass* k) { assert(k == NULL || k->isklass(), "must be"); assert(k == NULL || k->oopisinstance(), "cast to InstanceKlass"); return (InstanceKlass*) k; }
Yikes! I somehow forgot that InstanceKlass::cast accepted NULL. But I wonder if that case really arises? Certainly a large percentage of uses of it will (nearly) instantly crash if k is NULL, because we immediately call some member function on the result of the cast.
[And the is_klass is questionable too, since for it to even potentially return false someone must have performed a bad cast, so we’re already in the realm of undefined behavior and that call could do anything.]
- Previous message: RFR: 8138659: Speed up InstanceKlass subclass discrimination
- Next message: RFR: 8138659: Speed up InstanceKlass subclass discrimination
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]