Changeset 15348


Ignore:
Timestamp:
07/23/20 05:12:03 (3 years ago)
Author:
Mark Evenson
Message:

Revert further (INCOMPLETE) work on byte vectors

Back out incorrect version of byte vectors overhaul checkpoint.

Undoes <https://github.com/armedbear/abcl/pull/250>.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
3 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Lisp.java

    r15347 r15348  
    16531653  }
    16541654
    1655   // TODO rename to coerceToJavaChar
    16561655  public static final char coerceLispObjectToJavaChar(LispObject obj) {
    16571656    return (char)Fixnum.getValue(obj);
    16581657  }
    16591658
    1660   // TODO rename to coerceToJavaByte
    16611659  public static final byte coerceLispObjectToJavaByte(LispObject obj)
     1660
    16621661  {
    16631662          return (byte)Fixnum.getValue(obj);
    16641663  }
    16651664
    1666   public static final int coerceToJavaUnsignedInt(LispObject obj) {
    1667     return (int) (obj.longValue() & 0xffffffffL);
    1668   }
    1669   // TODO rename to coerceFromJavaByte
    16701665  public static final LispObject coerceJavaByteToLispObject(byte b)
    16711666  {
  • trunk/abcl/src/org/armedbear/lisp/SimpleArray_CharBuffer.java

    r15347 r15348  
    5656    this.directAllocation = directAllocation;
    5757    if (directAllocation) {
    58       ByteBuffer b = ByteBuffer.allocateDirect(totalSize * 2);
     58      ByteBuffer b = ByteBuffer.allocate(totalSize * 2);
    5959      data = b.asCharBuffer();
    6060    } else {
  • trunk/abcl/src/org/armedbear/lisp/SimpleArray_UnsignedByte32.java

    r15347 r15348  
    3535
    3636import static org.armedbear.lisp.Lisp.*;
    37 
    38 /*
    39  N.b. this implementation has problems somewhere with converting bytes
    40 
    41       Not fixing currently, as this type is unused with NIO
    42 
    43 (let* ((unspecialized
    44          #(2025373960 3099658457 3238582529 148439321
    45            3099658456 3238582528 3000000000 1000000000
    46            2000000000 2900000000 2400000000 2800000000
    47            0 1))
    48        (array
    49          (make-array (length unspecialized)
    50                      :element-type '(unsigned-byte 32)
    51                      :initial-contents unspecialized)))
    52   (prove:plan (length array))
    53   (loop :for i :below (length array)
    54         :doing
    55            (let ((x0
    56                    (elt unspecialized i))
    57                  (x1
    58                    (elt array i)))
    59            (prove:ok
    60             (equal x0 x1)
    61             (format nil "~a: ~a equals ~a" i x0 x1)))))
    62 */
    6337
    6438public final class SimpleArray_UnsignedByte32 extends AbstractArray
  • trunk/abcl/src/org/armedbear/lisp/make_array.java

    r15347 r15348  
    112112                // an abstract array doesn't have a directAllocation  ???
    113113                v = new ComplexVector_ByteBuffer(dimv[0], array, displacement, directAllocation);
    114               } else { // if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY))
     114              } else if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) {
    115115                v = new ComplexVector_UnsignedByte8(dimv[0], array, displacement);
    116116              }
    117117            } else if (arrayElementType.equal(UNSIGNED_BYTE_32)) {
    118               if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
    119                 // an abstract array doesn't have a directAllocation  ???
    120                 v = new ComplexVector_IntBuffer(dimv[0], array, displacement, directAllocation);
    121               } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY))
    122                 v = new ComplexVector_UnsignedByte32(dimv[0], array, displacement);
    123               }
     118              v = new ComplexVector_UnsignedByte32(dimv[0], array, displacement);
    124119            } else {
    125120              v = new ComplexVector(dimv[0], array, displacement);
     
    213208            defaultInitialElement = Fixnum.ZERO;
    214209          }
    215         else if (upgradedType.equal(UNSIGNED_BYTE_32)) {
    216           if (fillPointer != NIL || adjustable != NIL) {
    217             v = new ComplexVector_UnsignedByte32(size);
    218           } else {
    219             if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
    220               v = new BasicVector_IntBuffer(size, directAllocation);
    221             } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) {
    222               v = new BasicVector_UnsignedByte32(size);
    223             }
    224           }
    225           defaultInitialElement = Fixnum.ZERO;
    226         }
     210        else if (upgradedType.equal(UNSIGNED_BYTE_32))
     211          {
     212            if (fillPointer != NIL || adjustable != NIL)
     213              v = new ComplexVector_UnsignedByte32(size);
     214            else {
     215              if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
     216                v = new BasicVector_IntBuffer(size, directAllocation);
     217              } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) {
     218                v = new BasicVector_UnsignedByte32(size);
     219              }
     220            }
     221            defaultInitialElement = Fixnum.ZERO;
     222          }
    227223        else if (upgradedType == NIL)
    228224          {
     
    319315          }
    320316        }
    321         else if (upgradedType.equal(UNSIGNED_BYTE_32)) {
    322           if (initialContents != NIL) {
    323             if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
    324               array = new SimpleArray_IntBuffer(dimv, initialContents, directAllocation);
    325             } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) {
    326               array = new SimpleArray_UnsignedByte32(dimv, initialContents);
    327             }
    328           } else {
    329             if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
    330               array = new SimpleArray_IntBuffer(dimv, directAllocation);
    331             } else {
    332               array = new SimpleArray_UnsignedByte32(dimv);
    333             }
    334             if (initialElementProvided != NIL) {
    335               array.fill(initialElement);
    336             } else {
    337               array.fill(Fixnum.ZERO);
    338             }
    339           }
    340         } else
     317        // N.b. There is no implementation of SimpleArray with
     318        // contents (unsigned-byte 32) using either a
     319        // primitive array or an nio.Buffer
     320        else if (upgradedType.equal(UNSIGNED_BYTE_32))
     321          {
     322            if (initialContents != NIL)
     323              {
     324                array = new SimpleArray_UnsignedByte32(dimv, initialContents);
     325              }
     326            else
     327              {
     328                array = new SimpleArray_UnsignedByte32(dimv);
     329                if (initialElementProvided != NIL)
     330                  array.fill(initialElement);
     331                else
     332                  array.fill(Fixnum.ZERO);
     333              }
     334          }
     335        else
    341336          {
    342337            if (initialContents != NIL)
     
    377372              }
    378373          }
    379         else if (upgradedType.equal(UNSIGNED_BYTE_32)) {
    380           if (initialContents != NIL) {
    381             if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
    382               array = new ComplexArray_IntBuffer(dimv, initialContents, directAllocation);
    383             } else {  //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) {
    384               array = new ComplexArray_UnsignedByte32(dimv, initialContents);
    385             }
    386           } else {
    387             if (Java.Buffers.active.equals(AllocationPolicy.NIO)) {
    388               array = new ComplexArray_IntBuffer(dimv, directAllocation);
    389             } else {  //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) {
    390               array = new ComplexArray_UnsignedByte32(dimv);
    391             }
    392             if (initialElementProvided != NIL) {
    393               array.fill(initialElement);
    394             } else {
    395               array.fill(Fixnum.ZERO);
    396             }
    397           }
    398         }
     374        else if (upgradedType.equal(UNSIGNED_BYTE_32))
     375          {
     376            if (initialContents != NIL)
     377              {
     378                array = new ComplexArray_UnsignedByte32(dimv, initialContents);
     379              }
     380            else
     381              {
     382                array = new ComplexArray_UnsignedByte32(dimv);
     383                if (initialElementProvided != NIL)
     384                  array.fill(initialElement);
     385                else
     386                  array.fill(Fixnum.ZERO);
     387              }
     388          }
    399389        else
    400390          {
Note: See TracChangeset for help on using the changeset viewer.