[Python-Dev] How can we use 48bit pointer safely?
Serhiy Storchaka
storchaka at gmail.com
Fri Mar 30 06:23:22 EDT 2018
30.03.18 09:28, INADA Naoki пише:
> As far as I know, most amd64 and arm64 systems use only 48bit address spaces.
> (except [1])
>
> [1] https://software.intel.com/sites/default/files/managed/2b/80/5-level_paging_white_paper.pdf
>
> It means there are some chance to compact some data structures.
> I point two examples below.
>
> My question is; can we use 48bit pointer safely?
> It depends on CPU architecture & OS memory map.
> Maybe, configure option which is available on only (amd64, amd64) *
> (Linux, Windows, macOS)?
If the size be the main problem, we could use these 8 bit for encoding
the type and the size of the value for some types, and even encode the
value itself for some types in other 48 bits. For example 48 bit
integers, 0-, 1- and 2-character Unicode strings, ASCII strings up to 6
characters (and even longer if use base 64 encodings for ASCII
identifiers), singletons like None, True, False, Ellipsis,
NotImplementes could be encoded in 64 bit word without using additional
memory.
But this would significantly complicate and slow down the code.
More information about the Python-Dev
mailing list