RFR: 8138659: Speed up InstanceKlass subclass discrimination (original) (raw)
Coleen Phillimore coleen.phillimore at oracle.com
Thu Oct 8 11:21:35 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 10/7/15 8:43 PM, Kim Barrett wrote:
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.
Oh, yeah, this looks bad! File another bug and someone will look for why we allow null here.
Coleen
[And the isklass 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 ]