Browse Source

debug info fixes/refactor

This fixes (on my end) #3340, #3117, #2945, #2922, and #2762

A general refactor of debug info generation in order to fix issues and
increase stability.

What I believe is the root cause of a bunch of issues is that we use the
temporary metadata/forward declarations too much (/ hold onto them for
too long). It seems to cause problems with the reference counting inside
LLVM.

This PR reduces the use of these forward declarations to a minimum, it
creates it, fills in the fields, and resolves it, instead of waiting
until the end of generating code.

Some smaller issues I came across have also been solved.
Laytan Laats 1 year ago
parent
commit
9647cb74ad
4 changed files with 494 additions and 488 deletions
  1. 0 6
      src/llvm_backend.cpp
  2. 0 2
      src/llvm_backend.hpp
  3. 494 479
      src/llvm_backend_debug.cpp
  4. 0 1
      src/llvm_backend_general.cpp

+ 0 - 6
src/llvm_backend.cpp

@@ -1975,12 +1975,6 @@ gb_internal void lb_generate_missing_procedures(lbGenerator *gen, bool do_thread
 }
 
 gb_internal void lb_debug_info_complete_types_and_finalize(lbGenerator *gen) {
-	for (auto const &entry : gen->modules) {
-		lbModule *m = entry.value;
-		if (m->debug_builder != nullptr) {
-			lb_debug_complete_types(m);
-		}
-	}
 	for (auto const &entry : gen->modules) {
 		lbModule *m = entry.value;
 		if (m->debug_builder != nullptr) {

+ 0 - 2
src/llvm_backend.hpp

@@ -199,8 +199,6 @@ struct lbModule {
 	RecursiveMutex debug_values_mutex;
 	PtrMap<void *, LLVMMetadataRef> debug_values; 
 
-	Array<lbIncompleteDebugType> debug_incomplete_types;
-
 	StringMap<lbAddr> objc_classes;
 	StringMap<lbAddr> objc_selectors;
 

File diff suppressed because it is too large
+ 494 - 479
src/llvm_backend_debug.cpp


+ 0 - 1
src/llvm_backend_general.cpp

@@ -81,7 +81,6 @@ gb_internal void lb_init_module(lbModule *m, Checker *c) {
 	array_init(&m->global_procedures_and_types_to_create, a, 0, 1024);
 	array_init(&m->missing_procedures_to_check, a, 0, 16);
 	map_init(&m->debug_values);
-	array_init(&m->debug_incomplete_types, a, 0, 1024);
 
 	string_map_init(&m->objc_classes);
 	string_map_init(&m->objc_selectors);

Some files were not shown because too many files changed in this diff