[vector] binary operations with a scalar

Paul Sandoz paul.sandoz at oracle.com
Wed Feb 21 19:40:11 UTC 2018



> On Feb 21, 2018, at 4:06 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> 
> 
>>> If we don't care about optimized default implementation, then even simpler variant should work:
>>> 
>>>     @Override
>>>     @ForceInline
>>>     public Int256Vector add(int i) {
>>>         return add(species().broadcast(i));
>>>     }
>>> 
>>> add(), species(), and broadcast() methdos are trivially inlined since the new method is declared in concrete vector class.
>>> 
>> Ah! so a call to say species() is problematic if we are at the abstract level, say IntVector?
> 
> Yes, there's only a single Int256Vector::species() (Int256Vector is a leaf class), but IntVector::species() has many overloads. Depending on compilation context (and profile data), it can be hard to devirtualize (and then inline) the call.
> 

Ok. thanks, i’ll do this and we can adjust as appropriate if necessary based on performance analysis.

Paul.


More information about the panama-dev mailing list