@@ -1900,7 +1900,7 @@ THREAD_POOL_TASK_FUNC(gsi_serialize_pub32)
19001900 PDB_GsiSortRecord * sr = & sort_record_arr [sort_idx ];
19011901 sr -> isect_off = isect_off (pub32 -> sec , pub32 -> off );
19021902 sr -> name = name ;
1903- sr -> offset = buffer_cursor ;
1903+ sr -> offset = task -> symbol_data_base + buffer_base + buffer_cursor ;
19041904
19051905 // serialize symbol
19061906 U64 serial_size = cv_write_symbol (buffer , buffer_cursor , buffer_size , symbol_arr [i ], task -> symbol_align );
@@ -1946,7 +1946,7 @@ THREAD_POOL_TASK_FUNC(gsi_serialize_symbols_task)
19461946 // init sort record
19471947 PDB_GsiSortRecord * sr = & sort_record_arr [sort_idx ];
19481948 sr -> name = cv_name_from_symbol (symbol_arr [i ]-> kind , symbol_arr [i ]-> data );
1949- sr -> offset = buffer_cursor ;
1949+ sr -> offset = task -> symbol_data_base + buffer_base + buffer_cursor ;
19501950 sort_idx += 1 ;
19511951
19521952 // serialize symbol
@@ -1969,10 +1969,11 @@ gsi_build_ex(TP_Context *tp, Arena *arena, PDB_GsiContext *gsi, U64 symbol_data_
19691969
19701970 ProfBegin ("Serialize & Sort Symbols" );
19711971
1972- PDB_GsiSerializeSymbolsTask serial_task ;
1973- serial_task .symbol_align = gsi -> symbol_align ;
1974- serial_task .bucket_arr = gsi -> bucket_arr ;
1975- serial_task .bucket_size_arr = push_array (scratch .arena , U64 , gsi -> bucket_count );
1972+ PDB_GsiSerializeSymbolsTask serial_task = {0 };
1973+ serial_task .symbol_data_base = symbol_data_base ;
1974+ serial_task .symbol_align = gsi -> symbol_align ;
1975+ serial_task .bucket_arr = gsi -> bucket_arr ;
1976+ serial_task .bucket_size_arr = push_array (scratch .arena , U64 , gsi -> bucket_count );
19761977
19771978 // estimate each bucket size
19781979 tp_for_parallel (tp , 0 , gsi -> bucket_count , gsi_size_buckets_task , & serial_task );
@@ -2004,12 +2005,8 @@ gsi_build_ex(TP_Context *tp, Arena *arena, PDB_GsiContext *gsi, U64 symbol_data_
20042005 U32 * compressed_offset_arr = push_array_no_zero (arena , U32 , gsi -> bucket_count );
20052006 PDB_GsiHashRecord * hash_record_arr = push_array_no_zero (arena , PDB_GsiHashRecord , hash_record_count );
20062007
2007- // offsets for symbol stream are shifted by one to tell apart from null and zero (see GSI1::fixSymRecs)
2008- U64 offset_cursor = (1 + symbol_data_base );
2009- U64 hash_idx = 0 ;
2010-
20112008 ProfBegin ("Write Bitmap & Record Offsets" );
2012- for (U64 bucket_idx = 0 ; bucket_idx < gsi -> bucket_count ; bucket_idx += 1 ) {
2009+ for (U64 bucket_idx = 0 , hash_idx = 0 ; bucket_idx < gsi -> bucket_count ; bucket_idx += 1 ) {
20132010 // set bit for each occupied bucket
20142011 CV_SymbolList bucket_list = gsi -> bucket_arr [bucket_idx ];
20152012 if (bucket_list .count ) {
@@ -2024,12 +2021,9 @@ gsi_build_ex(TP_Context *tp, Arena *arena, PDB_GsiContext *gsi, U64 symbol_data_
20242021 PDB_GsiSortRecord * sort_record_arr = serial_task .sort_record_arr_arr [bucket_idx ];
20252022 for (U64 sr_idx = 0 ; sr_idx < gsi -> bucket_arr [bucket_idx ].count ; sr_idx += 1 , hash_idx += 1 ) {
20262023 PDB_GsiHashRecord * hr = & hash_record_arr [hash_idx ];
2027- hr -> symbol_off = offset_cursor + sort_record_arr [sr_idx ].offset ;
2024+ hr -> symbol_off = sort_record_arr [sr_idx ].offset + 1 ; // off-by-one because 0 is reserved for null
20282025 hr -> cref = 1 ;
20292026 }
2030-
2031- // advance offset cursor
2032- offset_cursor += serial_task .bucket_size_arr [bucket_idx ];
20332027 }
20342028 ProfEnd ();
20352029
0 commit comments