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

Eliminate END! datatype, convert to low-bit check #177

Merged
merged 1 commit into from
Dec 1, 2015
Merged

Eliminate END! datatype, convert to low-bit check #177

merged 1 commit into from
Dec 1, 2015

Conversation

hostilefork
Copy link
Member

This removes END! and REB_END as a datatype consideration. It
replaces the idea with a signal of whether a value header indicates an
end or not being a property of the low bit being set (on either big endian
or little endian systems).

Testing whether a value header is an end is just (header % 2 == 0).
This accelerates tests for ends, reclaims a type, and it also means that
an end can be overlaid on top of other non-value-header types...such
as the low bit of a pointer (typically 0 on most architectures because
pointers are never odd). Signifying a terminal can thus be done with
only 1/4 the total size of a REBVAL, and easily so.

The test for an END--which is performed rather frequently--becomes
very slightly faster. This is negated some by the fact that often what used
to be a single get-type-and-switch turns into a two step process of testing
for an end and then testing for the type. Overall it comes out only a little
bit ahead of even, but the real avantage comes from the features that this
will enable in future commits...

This removes END! and REB_END as a datatype consideration.  It
replaces the idea with a signal of whether a value header indicates an
end or not being a property of the low bit being set (on either big endian
or little endian systems).

Testing whether a value header is an end is just (header % 2 == 0).
This accelerates tests for ends, reclaims a type, and it also means that
an end can be overlaid on top of other non-value-header types...such
as the low bit of a pointer (typically 0 on most architectures because
pointers are never odd).  Signifying a terminal can thus be done with
only 1/4 the total size of a REBVAL, and easily so.

The test for an END--which is performed rather frequently--becomes
very slightly faster.  This is negated some by the fact that often what used
to be a single get-type-and-switch turns into a two step process of testing
for an end and then testing for the type.  Overall it comes out only a little
bit ahead of even, but the real avantage comes from the features that this
will enable in future commits...
@hostilefork hostilefork merged commit 424cde2 into metaeducation:master Dec 1, 2015
@hostilefork hostilefork deleted the eliminate-reb-end branch December 2, 2015 00:41
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant