Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileStream could use write-barrier to detect modification of its buffer #519

Open
blairmcg opened this issue May 9, 2018 · 0 comments
Open

Comments

@blairmcg
Copy link
Contributor

blairmcg commented May 9, 2018

FileStream maintains a dirty flag for its buffer, which has to be maintained by every operation that writes to the buffer (e.g. nextPut, nextPutAll:, etc). This is fairly expensive and means that the full benefit of the stream primitives is lost. It is worth experimenting with the VM write barrier/object immutability, to detect the first modification to a buffer so that subsequent writes can proceed at full speed.

This change should not require any VM modifications. The stream primitives will fail if the buffer is immutable, so all it is necessary to do is to mark the buffer immutable on first moving to a new page, and then alter the primitive failure logic to test for the buffer being immutable, and if so set the dirty flag, make the object mutable, and retry. This can all be done in Smalltalk code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant