Browse Source

Remove header cache code

gingerBill 3 years ago
parent
commit
831620bfc4
4 changed files with 0 additions and 34 deletions
  1. 0 3
      core/runtime/dynamic_map_internal.odin
  2. 0 25
      src/llvm_backend.cpp
  3. 0 2
      src/llvm_backend.hpp
  4. 0 4
      src/llvm_backend_proc.cpp

+ 0 - 3
core/runtime/dynamic_map_internal.odin

@@ -82,7 +82,6 @@ __dynamic_map_set :: proc "odin" (m: rawptr, table: Map_Header_Table, key_hash:
 		}
 		return prev
 	}
-	assert(condition = m != nil)
 
 	h := Map_Header{(^Raw_Map)(m), table}
 
@@ -126,8 +125,6 @@ __dynamic_map_set :: proc "odin" (m: rawptr, table: Map_Header_Table, key_hash:
 
 // USED INTERNALLY BY THE COMPILER
 __dynamic_map_reserve :: proc "odin" (m: rawptr, table: Map_Header_Table, cap: uint, loc := #caller_location) {
-	assert(condition = m != nil)
-
 	h := Map_Header{(^Raw_Map)(m), table}
 
 	c := context

+ 0 - 25
src/llvm_backend.cpp

@@ -578,31 +578,6 @@ lbAddr lb_gen_map_header_internal(lbProcedure *p, lbValue map_val_ptr, Type *map
 	return h;
 }
 
-
-lbValue lb_gen_map_header(lbProcedure *p, lbValue map_val_ptr, Type *map_type) {
-	GB_ASSERT_MSG(is_type_pointer(map_val_ptr.type), "%s", type_to_string(map_val_ptr.type));
-	GB_ASSERT(is_type_map(map_type));
-
-
-	// TODO(bill): this is a temporary fix since this caching is not working other platforms
-	bool allow_caching = build_context.metrics.os == TargetOs_windows || is_arch_wasm();
-
-	lbAddr h = {};
-	if (!allow_caching) {
-		h = lb_gen_map_header_internal(p, map_val_ptr, map_type);
-	} else {
-		lbAddr *found = map_get(&p->map_header_cache, map_val_ptr.value);
-		if (found != nullptr) {
-			h = *found;
-		} else {
-			h = lb_gen_map_header_internal(p, map_val_ptr, map_type);
-			map_set(&p->map_header_cache, map_val_ptr.value, h);
-		}
-	}
-
-	return lb_addr_load(p, h);
-}
-
 lbValue lb_const_hash(lbModule *m, lbValue key, Type *key_type) {
 	if (true) {
 		return {};

+ 0 - 2
src/llvm_backend.hpp

@@ -310,7 +310,6 @@ struct lbProcedure {
 
 	PtrMap<Ast *, lbValue> selector_values;
 	PtrMap<Ast *, lbAddr>  selector_addr;
-	PtrMap<LLVMValueRef, lbAddr> map_header_cache;
 };
 
 
@@ -446,7 +445,6 @@ String lb_get_const_string(lbModule *m, lbValue value);
 
 lbValue lb_generate_local_array(lbProcedure *p, Type *elem_type, i64 count, bool zero_init=true);
 lbValue lb_generate_global_array(lbModule *m, Type *elem_type, i64 count, String prefix, i64 id);
-lbValue lb_gen_map_header(lbProcedure *p, lbValue map_val_ptr, Type *map_type);
 lbValue lb_gen_map_key_hash(lbProcedure *p, lbValue key, Type *key_type, lbValue *key_ptr_);
 
 lbValue lb_internal_dynamic_map_get_ptr(lbProcedure *p, lbValue const &map_ptr, lbValue const &key);

+ 0 - 4
src/llvm_backend_proc.cpp

@@ -123,7 +123,6 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool ignore_body)
 	p->scope_stack.allocator   = a;
 	map_init(&p->selector_values,  a, 0);
 	map_init(&p->selector_addr,    a, 0);
-	map_init(&p->map_header_cache, a, 0);
 
 	if (p->is_foreign) {
 		lb_add_foreign_library_path(p->module, entity->Procedure.foreign_library);
@@ -380,9 +379,6 @@ lbProcedure *lb_create_dummy_procedure(lbModule *m, String link_name, Type *type
 		lb_add_proc_attribute_at_index(p, offset+parameter_index, "nonnull");
 		lb_add_proc_attribute_at_index(p, offset+parameter_index, "nocapture");
 	}
-
-	map_init(&p->map_header_cache, heap_allocator(), 0);
-
 	return p;
 }