这是indexloc提供的服务,不要输入任何密码
Skip to content

[GR-62666] Implement Immutable ArrayBuffers #895

@woess

Description

@woess

TL;DR

We plan to implement Immutable ArrayBuffers in GraalJS.

Details

This proposal enables buffers to be immutable and adds to ArrayBuffer.prototype one read-only accessor

  • immutable: boolean -- is this buffer immutable, or can its contents be changed?

and two methods

  • transferToImmutable(newByteLength?: number): ArrayBuffer -- move the contents of the original buffer into a new immutable buffer, detach the original buffer, and return the new buffer.
  • sliceToImmutable(start?: number, end?: number): ArrayBuffer -- create a new immutable buffer from a range of the original buffer's contents in a way that allows implementations to easily minimize and sometimes even eliminate copying them.

An immutable buffer cannot be detached, resized, or further transferred. Its maxByteLength is the same as its byteLength. A DataView or TypedArray using an immutable buffer as its backing store can be frozen and immutable.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions