< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.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


  41 
  42 // -- This file was mechanically generated: Do not edit! -- //
  43 
  44 @SuppressWarnings("cast")  // warning: redundant cast
  45 final class Long512Vector extends LongVector {
  46     static final LongSpecies VSPECIES =
  47         (LongSpecies) LongVector.SPECIES_512;
  48 
  49     static final VectorShape VSHAPE =
  50         VSPECIES.vectorShape();
  51 
  52     static final Class<Long512Vector> VCLASS = Long512Vector.class;
  53 
  54     static final int VSIZE = VSPECIES.vectorBitSize();
  55 
  56     static final int VLENGTH = VSPECIES.laneCount();
  57 
  58     static final Class<Long> ETYPE = long.class;
  59 
  60     // The JVM expects to find the state here.
  61     private final long[] vec; // Don't access directly, use getElements() instead.
  62 
  63     Long512Vector(long[] v) {
  64         vec = v;
  65     }
  66 
  67     // For compatibility as Long512Vector::new,
  68     // stored into species.vectorFactory.
  69     Long512Vector(Object v) {
  70         this((long[]) v);
  71     }
  72 
  73     static final Long512Vector ZERO = new Long512Vector(new long[VLENGTH]);
  74     static final Long512Vector IOTA = new Long512Vector(VSPECIES.iotaArray());
  75 
  76     static {
  77         // Warm up a few species caches.
  78         // If we do this too much we will
  79         // get NPEs from bootstrap circularity.
  80         VSPECIES.dummyVector();
  81         VSPECIES.withLanes(LaneType.BYTE);


 102 
 103     @ForceInline
 104     @Override
 105     public final VectorShape shape() { return VSHAPE; }
 106 
 107     @ForceInline
 108     @Override
 109     public final int length() { return VLENGTH; }
 110 
 111     @ForceInline
 112     @Override
 113     public final int bitSize() { return VSIZE; }
 114 
 115     @ForceInline
 116     @Override
 117     public final int byteSize() { return VSIZE / Byte.SIZE; }
 118 
 119     /*package-private*/
 120     @ForceInline
 121     final @Override
 122     long[] getElements() {
 123         return VectorIntrinsics.maybeRebox(this).vec;
 124     }
 125 
 126     // Virtualized constructors
 127 
 128     @Override
 129     @ForceInline
 130     public final Long512Vector broadcast(long e) {
 131         return (Long512Vector) super.broadcastTemplate(e);  // specialize
 132     }
 133 
 134 
 135     @Override
 136     @ForceInline
 137     Long512Mask maskFromArray(boolean[] bits) {
 138         return new Long512Mask(bits);
 139     }
 140 
 141     @Override
 142     @ForceInline


 451 
 452     @Override
 453     @ForceInline
 454     public Long512Vector selectFrom(Vector<Long> v,
 455                                    VectorMask<Long> m) {
 456         return (Long512Vector)
 457             super.selectFromTemplate((Long512Vector) v,
 458                                      (Long512Mask) m);  // specialize
 459     }
 460 
 461 
 462     @Override
 463     public long lane(int i) {
 464         if (i < 0 || i >= VLENGTH) {
 465             throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
 466         }
 467         return (long) VectorIntrinsics.extract(
 468                                 VCLASS, ETYPE, VLENGTH,
 469                                 this, i,
 470                                 (vec, ix) -> {
 471                                     long[] vecarr = vec.getElements();
 472                                     return (long)vecarr[ix];
 473                                 });
 474     }
 475 
 476     @Override
 477     public Long512Vector withLane(int i, long e) {
 478         if (i < 0 || i >= VLENGTH) {
 479             throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
 480         }
 481         return VectorIntrinsics.insert(
 482                                 VCLASS, ETYPE, VLENGTH,
 483                                 this, i, (long)e,
 484                                 (v, ix, bits) -> {
 485                                     long[] res = v.getElements().clone();
 486                                     res[ix] = (long)bits;
 487                                     return v.vectorFactory(res);
 488                                 });
 489     }
 490 
 491     // Mask
 492 
 493     static final class Long512Mask extends AbstractMask<Long> {
 494 
 495         private final boolean[] bits; // Don't access directly, use getBits() instead.
 496 
 497         public Long512Mask(boolean[] bits) {
 498             this(bits, 0);
 499         }
 500 
 501         public Long512Mask(boolean[] bits, int offset) {
 502             boolean[] a = new boolean[vspecies().laneCount()];
 503             for (int i = 0; i < a.length; i++) {
 504                 a[i] = bits[offset + i];
 505             }




  41 
  42 // -- This file was mechanically generated: Do not edit! -- //
  43 
  44 @SuppressWarnings("cast")  // warning: redundant cast
  45 final class Long512Vector extends LongVector {
  46     static final LongSpecies VSPECIES =
  47         (LongSpecies) LongVector.SPECIES_512;
  48 
  49     static final VectorShape VSHAPE =
  50         VSPECIES.vectorShape();
  51 
  52     static final Class<Long512Vector> VCLASS = Long512Vector.class;
  53 
  54     static final int VSIZE = VSPECIES.vectorBitSize();
  55 
  56     static final int VLENGTH = VSPECIES.laneCount();
  57 
  58     static final Class<Long> ETYPE = long.class;
  59 
  60     // The JVM expects to find the state here.
  61     private final long[] vec; // Don't access directly, use vec() instead.
  62 
  63     Long512Vector(long[] v) {
  64         vec = v;
  65     }
  66 
  67     // For compatibility as Long512Vector::new,
  68     // stored into species.vectorFactory.
  69     Long512Vector(Object v) {
  70         this((long[]) v);
  71     }
  72 
  73     static final Long512Vector ZERO = new Long512Vector(new long[VLENGTH]);
  74     static final Long512Vector IOTA = new Long512Vector(VSPECIES.iotaArray());
  75 
  76     static {
  77         // Warm up a few species caches.
  78         // If we do this too much we will
  79         // get NPEs from bootstrap circularity.
  80         VSPECIES.dummyVector();
  81         VSPECIES.withLanes(LaneType.BYTE);


 102 
 103     @ForceInline
 104     @Override
 105     public final VectorShape shape() { return VSHAPE; }
 106 
 107     @ForceInline
 108     @Override
 109     public final int length() { return VLENGTH; }
 110 
 111     @ForceInline
 112     @Override
 113     public final int bitSize() { return VSIZE; }
 114 
 115     @ForceInline
 116     @Override
 117     public final int byteSize() { return VSIZE / Byte.SIZE; }
 118 
 119     /*package-private*/
 120     @ForceInline
 121     final @Override
 122     long[] vec() {
 123         return VectorIntrinsics.maybeRebox(this).vec;
 124     }
 125 
 126     // Virtualized constructors
 127 
 128     @Override
 129     @ForceInline
 130     public final Long512Vector broadcast(long e) {
 131         return (Long512Vector) super.broadcastTemplate(e);  // specialize
 132     }
 133 
 134 
 135     @Override
 136     @ForceInline
 137     Long512Mask maskFromArray(boolean[] bits) {
 138         return new Long512Mask(bits);
 139     }
 140 
 141     @Override
 142     @ForceInline


 451 
 452     @Override
 453     @ForceInline
 454     public Long512Vector selectFrom(Vector<Long> v,
 455                                    VectorMask<Long> m) {
 456         return (Long512Vector)
 457             super.selectFromTemplate((Long512Vector) v,
 458                                      (Long512Mask) m);  // specialize
 459     }
 460 
 461 
 462     @Override
 463     public long lane(int i) {
 464         if (i < 0 || i >= VLENGTH) {
 465             throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
 466         }
 467         return (long) VectorIntrinsics.extract(
 468                                 VCLASS, ETYPE, VLENGTH,
 469                                 this, i,
 470                                 (vec, ix) -> {
 471                                     long[] vecarr = vec.vec();
 472                                     return (long)vecarr[ix];
 473                                 });
 474     }
 475 
 476     @Override
 477     public Long512Vector withLane(int i, long e) {
 478         if (i < 0 || i >= VLENGTH) {
 479             throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
 480         }
 481         return VectorIntrinsics.insert(
 482                                 VCLASS, ETYPE, VLENGTH,
 483                                 this, i, (long)e,
 484                                 (v, ix, bits) -> {
 485                                     long[] res = v.vec().clone();
 486                                     res[ix] = (long)bits;
 487                                     return v.vectorFactory(res);
 488                                 });
 489     }
 490 
 491     // Mask
 492 
 493     static final class Long512Mask extends AbstractMask<Long> {
 494 
 495         private final boolean[] bits; // Don't access directly, use getBits() instead.
 496 
 497         public Long512Mask(boolean[] bits) {
 498             this(bits, 0);
 499         }
 500 
 501         public Long512Mask(boolean[] bits, int offset) {
 502             boolean[] a = new boolean[vspecies().laneCount()];
 503             for (int i = 0; i < a.length; i++) {
 504                 a[i] = bits[offset + i];
 505             }


< prev index next >