Changeset 15383
- Timestamp:
- 09/26/20 07:32:03 (3 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/BasicVector_CharBuffer.java
r15359 r15383 77 77 elements = buffer.asCharBuffer(); 78 78 this.directAllocation = directAllocation; 79 capacity = ((java.nio.Buffer)buffer).limit() ;79 capacity = ((java.nio.Buffer)buffer).limit() / 2; 80 80 } 81 81 -
trunk/abcl/src/org/armedbear/lisp/BasicVector_IntBuffer.java
r15359 r15383 80 80 this.directAllocation = directAllocation; 81 81 elements = buffer.asIntBuffer(); 82 capacity = ((java.nio.Buffer)buffer).limit() ;82 capacity = ((java.nio.Buffer)buffer).limit() / 4; 83 83 } 84 84 85 85 public BasicVector_IntBuffer(IntBuffer buffer) { 86 this(buffer, false); 87 } 88 89 public BasicVector_IntBuffer(IntBuffer buffer, boolean directAllocation) { 86 90 this.directAllocation = directAllocation; 87 91 elements = buffer; -
trunk/abcl/src/org/armedbear/lisp/make_array.java
r15352 r15383 193 193 && fillPointer == NIL && adjustable == NIL) { 194 194 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 195 v = new BasicVector_CharBuffer(size, directAllocation); 195 if (!nioBuffer.equals(NIL)) { 196 Object o = ((JavaObject)nioBuffer).getObject(); 197 if (o instanceof java.nio.CharBuffer) { 198 v = new BasicVector_CharBuffer((java.nio.CharBuffer) o, directAllocation); 199 } else if (o instanceof java.nio.ByteBuffer) { 200 v = new BasicVector_CharBuffer((java.nio.ByteBuffer)o, directAllocation); // FIXME warn on coercion? 201 } else { 202 return type_error(nioBuffer, JavaObject.getInstance(java.nio.CharBuffer.class)); 203 } 204 } else { 205 v = new BasicVector_CharBuffer(size, directAllocation); 206 } 196 207 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 197 208 v = new BasicVector_UnsignedByte16(size); … … 200 211 } else if (upgradedType.equal(UNSIGNED_BYTE_32)) { 201 212 if (fillPointer != NIL || adjustable != NIL) { 202 v = new ComplexVector_UnsignedByte32(size);203 } else {204 213 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 205 v = new BasicVector_IntBuffer(size, directAllocation); 214 v = new ComplexVector_IntBuffer(size); 215 } else { 216 v = new ComplexVector_UnsignedByte32(size); 217 } 218 } else { 219 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 220 if (!nioBuffer.equals(NIL)) { 221 Object o = ((JavaObject)nioBuffer).getObject(); 222 if (o instanceof java.nio.IntBuffer) { 223 v = new BasicVector_IntBuffer((java.nio.IntBuffer)o, directAllocation); 224 } else if (o instanceof java.nio.ByteBuffer) { 225 v = new BasicVector_IntBuffer((java.nio.ByteBuffer)o, directAllocation); 226 } else { 227 return type_error(nioBuffer, JavaObject.getInstance(java.nio.IntBuffer.class)); 228 } 229 } else { 230 v = new BasicVector_IntBuffer(size, directAllocation); 231 } 206 232 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 207 233 v = new BasicVector_UnsignedByte32(size); … … 220 246 defaultInitialElement = NIL; 221 247 } 248 222 249 if (nioBuffer != NIL) { 223 // v is fineâŠ250 // v should have been allocated with a nioBuffer reference⊠224 251 ; 225 252 } else if (initialElementProvided != NIL) {
Note: See TracChangeset
for help on using the changeset viewer.