Use of long in Nashorn
Hannes Wallnoefer
hannes.wallnoefer at oracle.com
Sun Dec 6 10:27:53 UTC 2015
Am 2015-12-06 um 11:12 schrieb Hannes Wallnoefer:
>>
>> * array length: could we still have Nashorn APIs that return long?
>> Optimistic filters will deal with these appropriately, won’t they? I
>> guess they should since they also need to be able to handle return
>> values from POJO methods that return long (e.g.
>> System.currentTimeMillis()). Hence, you could have NativeArray.length
>> return “long” and let the optimistic machinery decide whether to cast
>> it as int or double. That would allow you to not have to box the
>> return value of NativeArray.length.
>
> Yes, we could have things returning long, but it will deoptimize to
> Object. OptimisticReturnFilters (which do the runtime checks) are not
> used for ScriptObject properties.
Actually it would still be nice not to box, which probably means we have
to make it optimistic. Looking at this, I found that we have an
@Optimistic annotation but it looks like it isn't actually used nor
implemented.
Hannes
More information about the nashorn-dev
mailing list