Browse Source

revert wrong approach in fixing the load alignment

Laytan Laats 1 year ago
parent
commit
58c0abb98d
3 changed files with 1 additions and 8 deletions
  1. 0 2
      src/check_type.cpp
  2. 1 1
      src/checker.cpp
  3. 0 5
      src/types.cpp

+ 0 - 2
src/check_type.cpp

@@ -135,8 +135,6 @@ gb_internal void check_struct_fields(CheckerContext *ctx, Ast *node, Slice<Entit
 			if (is_type_polymorphic(type)) {
 			if (is_type_polymorphic(type)) {
 				struct_type->Struct.is_polymorphic = true;
 				struct_type->Struct.is_polymorphic = true;
 				type = nullptr;
 				type = nullptr;
-			} else if(struct_type->Struct.is_packed) {
-				type->flags |= TypeFlag_Packed;
 			}
 			}
 		}
 		}
 		if (type == nullptr) {
 		if (type == nullptr) {

+ 1 - 1
src/checker.cpp

@@ -4315,7 +4315,7 @@ gb_internal bool correct_single_type_alias(CheckerContext *c, Entity *e) {
 
 
 gb_internal bool correct_type_alias_in_scope_backwards(CheckerContext *c, Scope *s) {
 gb_internal bool correct_type_alias_in_scope_backwards(CheckerContext *c, Scope *s) {
 	bool correction = false;
 	bool correction = false;
-	for (u32 n = s->elements.count, i = n-1; i < n; i--) {
+	for (u32 n = s->elements.capacity, i = n-1; i < n; i--) {
 		auto const &entry = s->elements.entries[i];
 		auto const &entry = s->elements.entries[i];
 		Entity *e = entry.value;
 		Entity *e = entry.value;
 		if (entry.hash && e != nullptr) {
 		if (entry.hash && e != nullptr) {

+ 0 - 5
src/types.cpp

@@ -321,7 +321,6 @@ enum TypeFlag : u32 {
 	TypeFlag_Polymorphic     = 1<<1,
 	TypeFlag_Polymorphic     = 1<<1,
 	TypeFlag_PolySpecialized = 1<<2,
 	TypeFlag_PolySpecialized = 1<<2,
 	TypeFlag_InProcessOfCheckingPolymorphic = 1<<3,
 	TypeFlag_InProcessOfCheckingPolymorphic = 1<<3,
-	TypeFlag_Packed = 1<<4, 
 };
 };
 
 
 struct Type {
 struct Type {
@@ -949,7 +948,6 @@ gb_internal void set_base_type(Type *t, Type *base) {
 	}
 	}
 }
 }
 
 
-
 gb_internal Type *alloc_type(TypeKind kind) {
 gb_internal Type *alloc_type(TypeKind kind) {
 	// gbAllocator a = heap_allocator();
 	// gbAllocator a = heap_allocator();
 	gbAllocator a = permanent_allocator();
 	gbAllocator a = permanent_allocator();
@@ -3672,9 +3670,6 @@ gb_internal i64 type_align_of(Type *t) {
 	if (t == nullptr) {
 	if (t == nullptr) {
 		return 1;
 		return 1;
 	}
 	}
-	if (t->flags & TypeFlag_Packed) {
-		return 1;
-	}
 	if (t->kind != Type_Named && t->cached_align > 0) {
 	if (t->kind != Type_Named && t->cached_align > 0) {
 		return t->cached_align.load();
 		return t->cached_align.load();
 	}
 	}