Commit e9c12ff
committed
cgraph: Move next/previous from symtab to toplevel_node [PR122955]
Currently the GC marker functions don't support chain_next on non-toplevel
tag structures (and does not error out either). So since r16-4747-g529c25ed6e0a06
if there are a lot of chained symtab_nodes (happens most likely with LTO), the GC
marker function could cause a stack overflow because of the recusive nature of the marker.
This fixes the problem by moving next/previous to toplevel_node. I had originally
thought about doing chain_next/chain_prev and using is_a<symtab_node *> to get if
it was symtab_node and then used the next/previous from there. But it was noticed that
asm_node had a next too (though not using chain_next) so adding a previous is not going
to much more space anyways; there will not be many toplevel inline-asm anyways.
Bootstraped and tested on x86_64-linux-gnu.
PR ipa/122955
gcc/ChangeLog:
* cgraph.h (toplevel_node): Add next and previous fields.
Add chain_next and chain_prev to GTY.
(symtab_node): Remove next and previous field. Remove chain_next and chain_prev
from the GTY.
(asm_node): Remove next field.
(symtab_node::next_defined_symbol): Use save_as_a<symtab_node*> around next.
(symbol_table::unregister): Likewise
(FOR_EACH_SYMBOL): Likewise
(symbol_table::first_defined_symbol): Likewise
(symbol_table::first_variable): Likewise
(symbol_table::next_variable): Likewise
(symbol_table::first_static_initializer): Likewise
(symbol_table::next_static_initializer): Likewise
(symbol_table::first_defined_variable): Likewise
(symbol_table::next_defined_variable): Likewise
(symbol_table::first_defined_function): Likewise
(symbol_table::next_defined_function): Likewise
(symbol_table::first_function): Likewise
(symbol_table::next_function): Likewise
(symbol_table::first_function_with_gimple_body): Likewise
(symbol_table::next_function_with_gimple_body): Likewise
* cgraphunit.cc (analyze_functions): Likewise
(output_in_order): Likewise
* lto-streamer-out.cc (lto_output): Use save_as_a<asm_node*> around next.
* symtab.cc (symtab_node::verify_symtab_nodes): Likewise.
gcc/lto/ChangeLog:
* lto-partition.cc (lto_1_to_1_map): Use save_as_a<asm_node*> around next.
(create_asm_partition): Likewise.
Signed-off-by: Andrew Pinski <[email protected]>1 parent bcbb536 commit e9c12ff
File tree
5 files changed
+48
-42
lines changed- gcc
- lto
5 files changed
+48
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
119 | 125 | | |
120 | 126 | | |
121 | 127 | | |
| |||
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
128 | | - | |
129 | | - | |
| 134 | + | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
| |||
633 | 638 | | |
634 | 639 | | |
635 | 640 | | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | 641 | | |
641 | 642 | | |
642 | 643 | | |
| |||
2243 | 2244 | | |
2244 | 2245 | | |
2245 | 2246 | | |
2246 | | - | |
| 2247 | + | |
2247 | 2248 | | |
2248 | | - | |
2249 | | - | |
2250 | 2249 | | |
2251 | 2250 | | |
2252 | 2251 | | |
| |||
2867 | 2866 | | |
2868 | 2867 | | |
2869 | 2868 | | |
2870 | | - | |
| 2869 | + | |
2871 | 2870 | | |
2872 | | - | |
| 2871 | + | |
2873 | 2872 | | |
2874 | 2873 | | |
2875 | 2874 | | |
| |||
2997 | 2996 | | |
2998 | 2997 | | |
2999 | 2998 | | |
3000 | | - | |
| 2999 | + | |
3001 | 3000 | | |
3002 | 3001 | | |
3003 | 3002 | | |
| |||
3026 | 3025 | | |
3027 | 3026 | | |
3028 | 3027 | | |
3029 | | - | |
| 3028 | + | |
| 3029 | + | |
3030 | 3030 | | |
3031 | 3031 | | |
3032 | 3032 | | |
3033 | 3033 | | |
3034 | 3034 | | |
3035 | 3035 | | |
3036 | 3036 | | |
3037 | | - | |
| 3037 | + | |
| 3038 | + | |
3038 | 3039 | | |
3039 | 3040 | | |
3040 | 3041 | | |
| |||
3051 | 3052 | | |
3052 | 3053 | | |
3053 | 3054 | | |
3054 | | - | |
| 3055 | + | |
3055 | 3056 | | |
3056 | 3057 | | |
3057 | 3058 | | |
| |||
3061 | 3062 | | |
3062 | 3063 | | |
3063 | 3064 | | |
3064 | | - | |
3065 | | - | |
| 3065 | + | |
| 3066 | + | |
3066 | 3067 | | |
3067 | 3068 | | |
3068 | 3069 | | |
| |||
3078 | 3079 | | |
3079 | 3080 | | |
3080 | 3081 | | |
3081 | | - | |
| 3082 | + | |
3082 | 3083 | | |
3083 | 3084 | | |
3084 | 3085 | | |
| |||
3091 | 3092 | | |
3092 | 3093 | | |
3093 | 3094 | | |
3094 | | - | |
3095 | | - | |
| 3095 | + | |
| 3096 | + | |
3096 | 3097 | | |
3097 | 3098 | | |
3098 | 3099 | | |
| |||
3111 | 3112 | | |
3112 | 3113 | | |
3113 | 3114 | | |
3114 | | - | |
| 3115 | + | |
3115 | 3116 | | |
3116 | 3117 | | |
3117 | 3118 | | |
| |||
3124 | 3125 | | |
3125 | 3126 | | |
3126 | 3127 | | |
3127 | | - | |
3128 | | - | |
| 3128 | + | |
| 3129 | + | |
3129 | 3130 | | |
3130 | 3131 | | |
3131 | 3132 | | |
| |||
3143 | 3144 | | |
3144 | 3145 | | |
3145 | 3146 | | |
3146 | | - | |
| 3147 | + | |
3147 | 3148 | | |
3148 | 3149 | | |
3149 | 3150 | | |
| |||
3156 | 3157 | | |
3157 | 3158 | | |
3158 | 3159 | | |
3159 | | - | |
3160 | | - | |
| 3160 | + | |
| 3161 | + | |
3161 | 3162 | | |
3162 | 3163 | | |
3163 | 3164 | | |
| |||
3176 | 3177 | | |
3177 | 3178 | | |
3178 | 3179 | | |
3179 | | - | |
| 3180 | + | |
3180 | 3181 | | |
3181 | 3182 | | |
3182 | 3183 | | |
| |||
3186 | 3187 | | |
3187 | 3188 | | |
3188 | 3189 | | |
3189 | | - | |
3190 | | - | |
| 3190 | + | |
| 3191 | + | |
3191 | 3192 | | |
3192 | 3193 | | |
3193 | 3194 | | |
| |||
3198 | 3199 | | |
3199 | 3200 | | |
3200 | 3201 | | |
3201 | | - | |
| 3202 | + | |
3202 | 3203 | | |
3203 | 3204 | | |
3204 | 3205 | | |
| |||
3211 | 3212 | | |
3212 | 3213 | | |
3213 | 3214 | | |
3214 | | - | |
3215 | | - | |
| 3215 | + | |
| 3216 | + | |
3216 | 3217 | | |
3217 | 3218 | | |
3218 | 3219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1210 | 1210 | | |
1211 | 1211 | | |
1212 | 1212 | | |
1213 | | - | |
1214 | | - | |
| 1213 | + | |
| 1214 | + | |
1215 | 1215 | | |
1216 | 1216 | | |
1217 | 1217 | | |
| |||
1373 | 1373 | | |
1374 | 1374 | | |
1375 | 1375 | | |
1376 | | - | |
| 1376 | + | |
1377 | 1377 | | |
1378 | 1378 | | |
1379 | 1379 | | |
| |||
1428 | 1428 | | |
1429 | 1429 | | |
1430 | 1430 | | |
1431 | | - | |
| 1431 | + | |
1432 | 1432 | | |
1433 | 1433 | | |
1434 | 1434 | | |
| |||
2203 | 2203 | | |
2204 | 2204 | | |
2205 | 2205 | | |
2206 | | - | |
| 2206 | + | |
| 2207 | + | |
2207 | 2208 | | |
2208 | 2209 | | |
2209 | 2210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2828 | 2828 | | |
2829 | 2829 | | |
2830 | 2830 | | |
2831 | | - | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
2832 | 2834 | | |
2833 | 2835 | | |
2834 | 2836 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
| 409 | + | |
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1485 | 1485 | | |
1486 | 1486 | | |
1487 | 1487 | | |
1488 | | - | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
1489 | 1491 | | |
1490 | 1492 | | |
1491 | 1493 | | |
| |||
0 commit comments