> > This looks all very hackish with no immediate benefit mostly because > of the use of lto_output_string. I think what you should do instead > is split up lto_output_string_with_length into the piece that streams > the string itself to the string-stream and returns an index into it > and the piece streaming the index to the specified stream. Then you > can simply bitpack that index and the two int line / column fields.
Hmm, I plan to optimize string streaming (since we always stream one uleb to set it is non-NULL that can be easilly handled by assigining NULL string index 0). How precisely you however suggest to bitpack line/column and string offset together? The point is to make location info occupy not even whole byte most of time. Adding a simple stats claims that for tramp3d 30% of time location is undefined, 15% of time file changes, 39% of time line changes and 44% of time column changes (on tramp3d). So assuming one byte for each uleb (that is optimistic, of course) one need 4 bits for the changed flags + less than a byte for the data. Situation is similar for combine.c where unknown id 10%, file change is 0.5% and line change is 30%. If we want to get fancy, we could probably mix index/line/column as you suggest (so we will have only undefined bit and location change bit) and record only changes to reduce uleb's range. All location streaming I know of somehow takes advantage of fact that location do not change completely all the time from one place to another. Honza