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

Data packing #3

merged 14 commits into from Nov 26, 2017


None yet
1 participant

eatonphil commented Nov 15, 2017

Some basic tests are finally passing so it seems like a good time to open a PR.

The premise is to get rid of the god-struct that held a pointer to each kind of Scheme value (string pointer, function pointer, even int pointer). This replace that giant struct with a 128-bit struct with 64-bit fields: a 64-bit header and a 64-bit data field. The lowest 8 bits refer to the type of the data value. Primitive values (for now: integers, bools, the empty list, [characters don't yet exist]) are stored in the 64-bit data field verbatim. Non-primitive values are stored as a pointer to the heap.

This is directly influence by the Chicken Scheme data representation. It differs in that there is only one kind of value struct and integers are only ever at least stored as 64-bit integers. But integer values will be at least twice as big as their Chicken Scheme counterparts.

Others: Python

To do:

  • Make sure a string that is longer than the max allowed is correctly truncated
  • Refactor value functions/types into a values.d file
  • Performance and allocation benchmarks vs what's on master

@eatonphil eatonphil changed the title from [WIP] Data packing to Data packing Nov 26, 2017

@eatonphil eatonphil merged commit 48a8eaf into master Nov 26, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@eatonphil eatonphil deleted the data-packing branch Nov 26, 2017

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