Author: Jan Nijtmans <jan.nijtmans@gmail.com>
State: Draft
Type: Project
Vote: Pending
Created: 29-Dec-2017
Post-History:
Keywords: tcl
Tcl-Version: 9.0
Abstract
This TIP describes the non-controversial part of the Tcl 9 changes: Make Tcl 9 ready for the 64-bit era.
Rationale
Many Tcl API functions and struct fields have int parameters, which don't provide sufficient room on 64-bit platforms.
Proposal
Enhance the hash functions, such that the hash value is stored in a size_t in stead of unsigned int. This allows hash tables to grow beyond 4Gb on 64-bit platforms
Enhance all struct fields representing refCounts or epochs, make them of type size_t
All memory-related functions, such as Tcl_Alloc(), will change its size argument from int to size_t, and its "char *" arguments to "void *"
Many functions, which have size parameters of type int (but NOT int *) will change to type size_t
On 32-bit platforms, this is all 100% upwards binary compatible, provided no internal API is used (since some internal structs has incompatible but externally invisible changes)
On 64-bit platforms, those changes cause binary incompatibility, but source compatibility is retained. Therefore the TCL_MAGIC value needs to change, so extensions compiled using Tcl 9 headers will not load in Tcl 8 and reverse.
TODO explain changes in more detail.
Implementation
An implementation of this TIP can be found in the memory-API branch. (still in development)
Copyright
This document has been placed in the public domain.