< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java
Print this page
rev 58165 : Fix the issue that unslice modifies the argument vector
Summary: Change the name of getElements() to vec() and clone argument value to
avoid it being modified
@@ -56,11 +56,11 @@
static final int VLENGTH = VSPECIES.laneCount();
static final Class<Double> ETYPE = double.class;
// The JVM expects to find the state here.
- private final double[] vec; // Don't access directly, use getElements() instead.
+ private final double[] vec; // Don't access directly, use vec() instead.
Double256Vector(double[] v) {
vec = v;
}
@@ -117,11 +117,11 @@
public final int byteSize() { return VSIZE / Byte.SIZE; }
/*package-private*/
@ForceInline
final @Override
- double[] getElements() {
+ double[] vec() {
return VectorIntrinsics.maybeRebox(this).vec;
}
// Virtualized constructors
@@ -470,11 +470,11 @@
}
long bits = (long) VectorIntrinsics.extract(
VCLASS, ETYPE, VLENGTH,
this, i,
(vec, ix) -> {
- double[] vecarr = vec.getElements();
+ double[] vecarr = vec.vec();
return (long)Double.doubleToLongBits(vecarr[ix]);
});
return Double.longBitsToDouble(bits);
}
@@ -485,11 +485,11 @@
}
return VectorIntrinsics.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Double.doubleToLongBits(e),
(v, ix, bits) -> {
- double[] res = v.getElements().clone();
+ double[] res = v.vec().clone();
res[ix] = Double.longBitsToDouble((long)bits);
return v.vectorFactory(res);
});
}
< prev index next >