|
277 | 277 | header string // produced output for out.h (-parallel-cc) |
278 | 278 | res_builder strings.Builder // produced output (complete) |
279 | 279 | out_str string // produced output from g.out |
280 | | - out0_str string // helpers output (auto fns, dump fns) for out_0.c (-parallel-cc) |
| 280 | + out0_str string // helpers output (auto fns, dump fns) for out_0.c (-parallel-cc) |
281 | 281 | extern_str string // extern chunk for (-parallel-cc) |
282 | 282 | out_fn_start_pos []int // fn decl positions |
283 | 283 | } |
@@ -355,15 +355,6 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) GenO |
355 | 355 |
|
356 | 356 | global_g.type_resolver = type_resolver.TypeResolver.new(table, global_g) |
357 | 357 | global_g.comptime = &global_g.type_resolver.info |
358 | | - /* |
359 | | - global_g.out_parallel = []strings.Builder{len: nr_cpus} |
360 | | - for i in 0 .. nr_cpus { |
361 | | - global_g.out_parallel[i] = strings.new_builder(100000) |
362 | | - global_g.out_parallel[i].writeln('#include "out.h"\n') |
363 | | - } |
364 | | - println('LEN=') |
365 | | - println(global_g.out_parallel.len) |
366 | | - */ |
367 | 358 | // anon fn may include assert and thus this needs |
368 | 359 | // to be included before any test contents are written |
369 | 360 | if pref_.is_test { |
@@ -516,18 +507,27 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) GenO |
516 | 507 |
|
517 | 508 | // to make sure type idx's are the same in cached mods |
518 | 509 | if g.pref.build_mode == .build_module { |
| 510 | + is_toml := g.pref.path.contains('/toml') |
519 | 511 | for idx, sym in g.table.type_symbols { |
520 | 512 | if idx in [0, 31] { |
521 | 513 | continue |
522 | 514 | } |
523 | | - g.definitions.writeln('int _v_type_idx_${sym.cname}();') |
| 515 | + if is_toml && sym.cname.contains('map[string]') { |
| 516 | + // Temporary hack to make toml work with -usecache TODO remove |
| 517 | + continue |
| 518 | + } |
| 519 | + g.definitions.writeln('int _v_type_idx_${sym.cname}(); // 1build module ${g.pref.path}') |
524 | 520 | } |
525 | 521 | } else if g.pref.use_cache { |
| 522 | + is_toml := g.pref.path.contains('/toml') |
526 | 523 | for idx, sym in g.table.type_symbols { |
527 | 524 | if idx in [0, 31] { |
528 | 525 | continue |
529 | 526 | } |
530 | | - g.definitions.writeln('int _v_type_idx_${sym.cname}() { return ${idx}; };') |
| 527 | + if is_toml && sym.cname.contains('map[string]') { |
| 528 | + continue |
| 529 | + } |
| 530 | + g.definitions.writeln('int _v_type_idx_${sym.cname}() { return ${idx}; }; //lol ${g.pref.path}') |
531 | 531 | } |
532 | 532 | } |
533 | 533 |
|
@@ -1059,29 +1059,6 @@ pub fn (mut g Gen) init() { |
1059 | 1059 | if g.pref.is_livemain || g.pref.is_liveshared { |
1060 | 1060 | g.generate_hotcode_reloading_declarations() |
1061 | 1061 | } |
1062 | | - // Obfuscate only functions in the main module for now. |
1063 | | - // Generate the obf_ast. |
1064 | | - if g.pref.obfuscate { |
1065 | | - mut i := 0 |
1066 | | - // fns |
1067 | | - for key, f in g.table.fns { |
1068 | | - if f.mod != 'main' && key != 'main' { |
1069 | | - continue |
1070 | | - } |
1071 | | - g.obf_table[key] = '_f${i}' |
1072 | | - i++ |
1073 | | - } |
1074 | | - // methods |
1075 | | - for type_sym in g.table.type_symbols { |
1076 | | - if type_sym.mod != 'main' { |
1077 | | - continue |
1078 | | - } |
1079 | | - for method in type_sym.methods { |
1080 | | - g.obf_table[type_sym.name + '.' + method.name] = '_f${i}' |
1081 | | - i++ |
1082 | | - } |
1083 | | - } |
1084 | | - } |
1085 | 1062 | // we know that this is being called before the multi-threading starts |
1086 | 1063 | // and this is being called in the main thread, so we can mutate the table |
1087 | 1064 | mut muttable := unsafe { &ast.Table(g.table) } |
@@ -5357,14 +5334,6 @@ fn (mut g Gen) ident(node ast.Ident) { |
5357 | 5334 | name = g.generic_fn_name(node.concrete_types, name) |
5358 | 5335 | } |
5359 | 5336 | } |
5360 | | - |
5361 | | - if g.pref.obfuscate && g.cur_mod.name == 'main' && name.starts_with('main__') { |
5362 | | - key := node.name |
5363 | | - g.write('/* obf identfn: ${key} */') |
5364 | | - name = g.obf_table[key] or { |
5365 | | - panic('cgen: obf name "${key}" not found, this should never happen') |
5366 | | - } |
5367 | | - } |
5368 | 5337 | } |
5369 | 5338 | g.write(g.get_ternary_name(name)) |
5370 | 5339 | if is_auto_heap { |
|
0 commit comments