First Last Prev Next    No search results available
Details
: Global Vars Have (Somewhat) Limited Type Range
Bug#: 392
: libraries
: Bitcode Reader
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P5
: minor
: 1.3

:
: missing-feature
:
: 402
  Show dependency tree - Show dependency graph
People
Reporter: Reid Spencer <rspencer@reidspencer.com>
Assigned To: Reid Spencer <rspencer@reidspencer.com>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2004-07-02 00:27
The bytecode file format uses 28 bits for the type of a global var. However, 
generally speaking, type ids are encoded as vbr_uint32 making it possible to 
use 32 bits for a type id. It is conceivable in some monstrously typed module 
that this encoding will fail (if the typeid of the global var is in the range 
2^29 to 2^31). While this probably won't ever happen in the near term, its 
conceivable that linking together some huge enterprise application could fail 
in the bytecode reader/writer if more than 2^29-1 types are used.

A potential fix is to limit type ids to 24 bits (using a new read_vbr_uint24 
method in the BytecodeReader class). This would give us four extra flag bits 
on global variables should we need them in the future(e.g. new linkage types, 
or "thread local storage"), ensures large type numbers are encoded in 3-4 
bytes instead of 4-5, and provides a reasonable limit on the number of types 
that can be instantiated (16 million). 

This bug is really low priority and shouldn't be addressed unless we need 
extra global var bits. Its logged here so we don't forget about it because its 
a *potential* problem even though there's a very low probability of it 
occuring in the foreseeable future (who uses more than 256 million types? :)
------- Comment #1 From Chris Lattner 2004-07-02 00:32:50 -------
"256M types should be enough for anyone" , sorry had to say it. :)
------- Comment #2 From Reid Spencer 2004-07-05 12:03:04 -------
Sorry, I goofed. Five bits are used for the global flags which leaves only 27
bits for the type of the global var. So the maximum number of types global vars
can reach is 128M. Wow, that's 1/2 as many! We REALLY need to fix this NOW! :)
------- Comment #3 From Reid Spencer 2004-07-25 17:06:57 -------
Fixed commensurate with bug 402 changes.

First Last Prev Next    No search results available