Skip to content

Commit

Permalink
Fix compilation error due to TypedArray not being PE-constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
woess committed Sep 30, 2024
1 parent 41ddc5d commit 1d75abd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private Object exportBuffer(JSArrayBufferObject arrayBuffer, int offset, int len
bufferType = TypedArray.BUFFER_TYPE_SHARED;
}
TypedArray arrayType = TypedArrayFactory.Uint8Array.createArrayType(bufferType, (offset != 0), true);
JSTypedArrayObject array = JSArrayBufferView.createArrayBufferView(context, realm, buffer, arrayType, offset, length);
JSTypedArrayObject array = JSArrayBufferView.createArrayBufferView(context, realm, buffer, TypedArrayFactory.Uint8Array, arrayType, offset, length);
return new InteropBufferView(buffer, offset, length, array);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,13 @@ private static boolean hasNumericIndex(JSDynamicObject thisObj, Object numericIn
return d < JSArrayBufferView.typedArrayGetLength(thisObj);
}

public static JSTypedArrayObject createArrayBufferView(JSContext context, JSRealm realm, JSArrayBufferObject arrayBuffer, TypedArray arrayType, int offset, int length) {
CompilerAsserts.partialEvaluationConstant(arrayType);
assert JSArrayBuffer.isJSAbstractBuffer(arrayBuffer);
public static JSTypedArrayObject createArrayBufferView(JSContext context, JSRealm realm, JSArrayBufferObject arrayBuffer,
TypedArrayFactory typedArrayFactory, TypedArray arrayType, int offset, int length) {
CompilerAsserts.partialEvaluationConstant(typedArrayFactory);
if (!context.getTypedArrayNotDetachedAssumption().isValid() && JSArrayBuffer.isDetachedBuffer(arrayBuffer)) {
throw Errors.createTypeErrorDetachedBuffer();
}
JSObjectFactory objectFactory = context.getArrayBufferViewFactory(arrayType.getFactory());
JSObjectFactory objectFactory = context.getArrayBufferViewFactory(typedArrayFactory);
return createArrayBufferView(objectFactory, realm, arrayBuffer, arrayType, offset, length);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ private Object typedArrayNew(Object arrayBuffer, int offset, int length, TypedAr
if (detached) {
dynamicObject = JSArrayBuffer.createDirectArrayBuffer(context, realm, 0);
}
JSDynamicObject result = JSArrayBufferView.createArrayBufferView(context, realm, dynamicObject, arrayType, offset, length);
JSDynamicObject result = JSArrayBufferView.createArrayBufferView(context, realm, dynamicObject, factory, arrayType, offset, length);
if (detached) {
JSArrayBuffer.detachArrayBuffer(dynamicObject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ private JSDynamicObject readJSArrayBufferView(JSContext context, JSRealm realm,
TypedArrayFactory factory = tag.getFactory();
TypedArray array = factory.createArrayType(TypedArray.BUFFER_TYPE_DIRECT, offset != 0, true);
int length = byteLength / factory.getBytesPerElement();
view = JSArrayBufferView.createArrayBufferView(context, realm, arrayBuffer, array, offset, length);
view = JSArrayBufferView.createArrayBufferView(context, realm, arrayBuffer, factory, array, offset, length);
}
return assignId(view);
}
Expand Down

0 comments on commit 1d75abd

Please sign in to comment.