[LLVMbugs] [Bug 392] NEW: Global Vars Have (Somewhat) Limited Type Range

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jul 1 22:27:36 PDT 2004


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=392

           Summary: Global Vars Have (Somewhat) Limited Type Range
           Product: libraries
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Bytecode Reader
        AssignedTo: rspencer at x10sys.com
        ReportedBy: rspencer at x10sys.com


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? :)



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list