< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.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<Float> ETYPE = float.class;
// The JVM expects to find the state here.
- private final float[] vec; // Don't access directly, use getElements() instead.
+ private final float[] vec; // Don't access directly, use vec() instead.
Float128Vector(float[] v) {
vec = v;
}
@@ -117,11 +117,11 @@
public final int byteSize() { return VSIZE / Byte.SIZE; }
/*package-private*/
@ForceInline
final @Override
- float[] getElements() {
+ float[] vec() {
return VectorIntrinsics.maybeRebox(this).vec;
}
// Virtualized constructors
@@ -470,11 +470,11 @@
}
int bits = (int) VectorIntrinsics.extract(
VCLASS, ETYPE, VLENGTH,
this, i,
(vec, ix) -> {
- float[] vecarr = vec.getElements();
+ float[] vecarr = vec.vec();
return (long)Float.floatToIntBits(vecarr[ix]);
});
return Float.intBitsToFloat(bits);
}
@@ -485,11 +485,11 @@
}
return VectorIntrinsics.insert(
VCLASS, ETYPE, VLENGTH,
this, i, (long)Float.floatToIntBits(e),
(v, ix, bits) -> {
- float[] res = v.getElements().clone();
+ float[] res = v.vec().clone();
res[ix] = Float.intBitsToFloat((int)bits);
return v.vectorFactory(res);
});
}
< prev index next >