aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-04-20 12:18:13 +0100
committergingerBill <bill@gingerbill.org>2023-04-20 12:18:13 +0100
commit685f7d0feae7b7bbfee5b24f6e6dc6751366d36e (patch)
tree782c0fd8133e9227d53ad72189d200a62598b05b /src
parentf5d9ca64f95ab47b6c2809275755ebca260c9448 (diff)
Rename `word_size` to `ptr_size` internally to make it clearer
Diffstat (limited to 'src')
-rw-r--r--src/build_settings.cpp18
-rw-r--r--src/llvm_abi.cpp8
-rw-r--r--src/llvm_backend.hpp2
-rw-r--r--src/llvm_backend_debug.cpp30
-rw-r--r--src/llvm_backend_general.cpp12
-rw-r--r--src/llvm_backend_proc.cpp4
-rw-r--r--src/llvm_backend_stmt.cpp2
-rw-r--r--src/llvm_backend_type.cpp4
-rw-r--r--src/llvm_backend_utility.cpp10
-rw-r--r--src/types.cpp44
10 files changed, 67 insertions, 67 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp
index 63997c2d1..af6c5a6d4 100644
--- a/src/build_settings.cpp
+++ b/src/build_settings.cpp
@@ -116,7 +116,7 @@ gb_global String const ODIN_VERSION = str_lit(ODIN_VERSION_RAW);
struct TargetMetrics {
TargetOsKind os;
TargetArchKind arch;
- isize word_size;
+ isize ptr_size;
isize int_size;
isize max_align;
isize max_simd_align;
@@ -238,10 +238,10 @@ struct BuildContext {
TargetEndianKind endian_kind;
// In bytes
- i64 word_size; // Size of a pointer, must be >= 4
+ i64 ptr_size; // Size of a pointer, must be >= 4
i64 int_size; // Size of a int/uint, must be >= 4
- i64 max_align; // max alignment, must be >= 1 (and typically >= word_size)
- i64 max_simd_align; // max alignment, must be >= 1 (and typically >= word_size)
+ i64 max_align; // max alignment, must be >= 1 (and typically >= ptr_size)
+ i64 max_simd_align; // max alignment, must be >= 1 (and typically >= ptr_size)
CommandKind command_kind;
String command;
@@ -1192,14 +1192,14 @@ gb_internal void init_build_context(TargetMetrics *cross_target) {
GB_ASSERT(metrics->os != TargetOs_Invalid);
GB_ASSERT(metrics->arch != TargetArch_Invalid);
- GB_ASSERT(metrics->word_size > 1);
+ GB_ASSERT(metrics->ptr_size > 1);
GB_ASSERT(metrics->int_size > 1);
GB_ASSERT(metrics->max_align > 1);
GB_ASSERT(metrics->max_simd_align > 1);
- GB_ASSERT(metrics->int_size >= metrics->word_size);
- if (metrics->int_size > metrics->word_size) {
- GB_ASSERT(metrics->int_size == 2*metrics->word_size);
+ GB_ASSERT(metrics->int_size >= metrics->ptr_size);
+ if (metrics->int_size > metrics->ptr_size) {
+ GB_ASSERT(metrics->int_size == 2*metrics->ptr_size);
}
@@ -1208,7 +1208,7 @@ gb_internal void init_build_context(TargetMetrics *cross_target) {
bc->ODIN_OS = target_os_names[metrics->os];
bc->ODIN_ARCH = target_arch_names[metrics->arch];
bc->endian_kind = target_endians[metrics->arch];
- bc->word_size = metrics->word_size;
+ bc->ptr_size = metrics->ptr_size;
bc->int_size = metrics->int_size;
bc->max_align = metrics->max_align;
bc->max_simd_align = metrics->max_simd_align;
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp
index 3fc68644d..6308d7bbf 100644
--- a/src/llvm_abi.cpp
+++ b/src/llvm_abi.cpp
@@ -218,7 +218,7 @@ gb_internal i64 lb_sizeof(LLVMTypeRef type) {
case LLVMDoubleTypeKind:
return 8;
case LLVMPointerTypeKind:
- return build_context.word_size;
+ return build_context.ptr_size;
case LLVMStructTypeKind:
{
unsigned field_count = LLVMCountStructElementTypes(type);
@@ -275,7 +275,7 @@ gb_internal i64 lb_alignof(LLVMTypeRef type) {
case LLVMIntegerTypeKind:
{
unsigned w = LLVMGetIntTypeWidth(type);
- return gb_clamp((w + 7)/8, 1, build_context.word_size);
+ return gb_clamp((w + 7)/8, 1, build_context.ptr_size);
}
case LLVMHalfTypeKind:
return 2;
@@ -284,7 +284,7 @@ gb_internal i64 lb_alignof(LLVMTypeRef type) {
case LLVMDoubleTypeKind:
return 8;
case LLVMPointerTypeKind:
- return build_context.word_size;
+ return build_context.ptr_size;
case LLVMStructTypeKind:
{
if (LLVMIsPackedStruct(type)) {
@@ -388,7 +388,7 @@ namespace lbAbi386 {
}
if (build_context.metrics.os == TargetOs_windows &&
- build_context.word_size == 8 &&
+ build_context.ptr_size == 8 &&
lb_is_type_kind(type, LLVMIntegerTypeKind) &&
type == LLVMIntTypeInContext(c, 128)) {
// NOTE(bill): Because Windows AMD64 is weird
diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp
index 964195223..c626bb9a5 100644
--- a/src/llvm_backend.hpp
+++ b/src/llvm_backend.hpp
@@ -539,7 +539,7 @@ gb_internal void lb_mem_copy_non_overlapping(lbProcedure *p, lbValue dst, lbValu
gb_internal LLVMValueRef lb_mem_zero_ptr_internal(lbProcedure *p, LLVMValueRef ptr, LLVMValueRef len, unsigned alignment, bool is_volatile);
gb_internal gb_inline i64 lb_max_zero_init_size(void) {
- return cast(i64)(4*build_context.word_size);
+ return cast(i64)(4*build_context.int_size);
}
gb_internal LLVMTypeRef OdinLLVMGetArrayElementType(LLVMTypeRef type);
diff --git a/src/llvm_backend_debug.cpp b/src/llvm_backend_debug.cpp
index d31179191..616ad3045 100644
--- a/src/llvm_backend_debug.cpp
+++ b/src/llvm_backend_debug.cpp
@@ -52,8 +52,8 @@ gb_internal LLVMMetadataRef lb_debug_type_internal_proc(lbModule *m, Type *type)
GB_ASSERT(type != t_invalid);
- /* unsigned const word_size = cast(unsigned)build_context.word_size;
- unsigned const word_bits = cast(unsigned)(8*build_context.word_size); */
+ /* unsigned const ptr_size = cast(unsigned)build_context.ptr_size;
+ unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size); */
GB_ASSERT(type->kind == Type_Proc);
unsigned parameter_count = 1;
@@ -131,9 +131,9 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
GB_ASSERT(type != t_invalid);
- /* unsigned const word_size = cast(unsigned)build_context.word_size; */
+ /* unsigned const ptr_size = cast(unsigned)build_context.ptr_size; */
unsigned const int_bits = cast(unsigned)(8*build_context.int_size);
- unsigned const word_bits = cast(unsigned)(8*build_context.word_size);
+ unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size);
switch (type->kind) {
case Type_Basic:
@@ -165,10 +165,10 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
case Basic_int: return lb_debug_type_basic_type(m, str_lit("int"), int_bits, LLVMDWARFTypeEncoding_Signed);
case Basic_uint: return lb_debug_type_basic_type(m, str_lit("uint"), int_bits, LLVMDWARFTypeEncoding_Unsigned);
- case Basic_uintptr: return lb_debug_type_basic_type(m, str_lit("uintptr"), word_bits, LLVMDWARFTypeEncoding_Unsigned);
+ case Basic_uintptr: return lb_debug_type_basic_type(m, str_lit("uintptr"), ptr_bits, LLVMDWARFTypeEncoding_Unsigned);
case Basic_typeid:
- return lb_debug_type_basic_type(m, str_lit("typeid"), word_bits, LLVMDWARFTypeEncoding_Unsigned);
+ return lb_debug_type_basic_type(m, str_lit("typeid"), ptr_bits, LLVMDWARFTypeEncoding_Unsigned);
// Endian Specific Types
case Basic_i16le: return lb_debug_type_basic_type(m, str_lit("i16le"), 16, LLVMDWARFTypeEncoding_Signed, LLVMDIFlagLittleEndian);
@@ -252,7 +252,7 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
case Basic_rawptr:
{
LLVMMetadataRef void_type = lb_debug_type_basic_type(m, str_lit("void"), 8, LLVMDWARFTypeEncoding_Unsigned);
- return LLVMDIBuilderCreatePointerType(m->debug_builder, void_type, word_bits, word_bits, LLVMDWARFTypeEncoding_Address, "rawptr", 6);
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, void_type, ptr_bits, ptr_bits, LLVMDWARFTypeEncoding_Address, "rawptr", 6);
}
case Basic_string:
{
@@ -264,14 +264,14 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
case Basic_cstring:
{
LLVMMetadataRef char_type = lb_debug_type_basic_type(m, str_lit("char"), 8, LLVMDWARFTypeEncoding_Unsigned);
- return LLVMDIBuilderCreatePointerType(m->debug_builder, char_type, word_bits, word_bits, 0, "cstring", 7);
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, char_type, ptr_bits, ptr_bits, 0, "cstring", 7);
}
case Basic_any:
{
LLVMMetadataRef elements[2] = {};
elements[0] = lb_debug_struct_field(m, str_lit("data"), t_rawptr, 0);
- elements[1] = lb_debug_struct_field(m, str_lit("id"), t_typeid, word_bits);
- return lb_debug_basic_struct(m, str_lit("any"), 2*word_bits, word_bits, elements, gb_count_of(elements));
+ elements[1] = lb_debug_struct_field(m, str_lit("id"), t_typeid, ptr_bits);
+ return lb_debug_basic_struct(m, str_lit("any"), 2*ptr_bits, ptr_bits, elements, gb_count_of(elements));
}
// Untyped types
@@ -295,9 +295,9 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
case Type_SoaPointer:
return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->SoaPointer.elem), int_bits, int_bits, 0, nullptr, 0);
case Type_Pointer:
- return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->Pointer.elem), word_bits, word_bits, 0, nullptr, 0);
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->Pointer.elem), ptr_bits, ptr_bits, 0, nullptr, 0);
case Type_MultiPointer:
- return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->MultiPointer.elem), word_bits, word_bits, 0, nullptr, 0);
+ return LLVMDIBuilderCreatePointerType(m->debug_builder, lb_debug_type(m, type->MultiPointer.elem), ptr_bits, ptr_bits, 0, nullptr, 0);
case Type_Array: {
LLVMMetadataRef subscripts[1] = {};
@@ -417,7 +417,7 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
case Type_Proc:
{
LLVMMetadataRef proc_underlying_type = lb_debug_type_internal_proc(m, type);
- LLVMMetadataRef pointer_type = LLVMDIBuilderCreatePointerType(m->debug_builder, proc_underlying_type, word_bits, word_bits, 0, nullptr, 0);
+ LLVMMetadataRef pointer_type = LLVMDIBuilderCreatePointerType(m->debug_builder, proc_underlying_type, ptr_bits, ptr_bits, 0, nullptr, 0);
gbString name = type_to_string(type, temporary_allocator());
return LLVMDIBuilderCreateTypedef(m->debug_builder, pointer_type, name, gb_string_length(name), nullptr, 0, nullptr, cast(u32)(8*type_align_of(type)));
}
@@ -618,8 +618,8 @@ gb_internal LLVMMetadataRef lb_debug_type(lbModule *m, Type *type) {
}
gb_internal void lb_debug_complete_types(lbModule *m) {
- /* unsigned const word_size = cast(unsigned)build_context.word_size; */
- unsigned const word_bits = cast(unsigned)(8*build_context.word_size);
+ /* unsigned const ptr_size = cast(unsigned)build_context.ptr_size; */
+ unsigned const ptr_bits = cast(unsigned)(8*build_context.ptr_size);
unsigned const int_bits = cast(unsigned)(8*build_context.int_size);
for_array(debug_incomplete_type_index, m->debug_incomplete_types) {
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp
index 5108e7c39..3d38416e0 100644
--- a/src/llvm_backend_general.cpp
+++ b/src/llvm_backend_general.cpp
@@ -1626,7 +1626,7 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
GB_ASSERT(type != t_invalid);
- bool bigger_int = build_context.word_size != build_context.int_size;
+ bool bigger_int = build_context.ptr_size != build_context.int_size;
switch (type->kind) {
case Type_Basic:
@@ -1765,7 +1765,7 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
case Basic_int: return LLVMIntTypeInContext(ctx, 8*cast(unsigned)build_context.int_size);
case Basic_uint: return LLVMIntTypeInContext(ctx, 8*cast(unsigned)build_context.int_size);
- case Basic_uintptr: return LLVMIntTypeInContext(ctx, 8*cast(unsigned)build_context.word_size);
+ case Basic_uintptr: return LLVMIntTypeInContext(ctx, 8*cast(unsigned)build_context.ptr_size);
case Basic_rawptr: return LLVMPointerType(LLVMInt8TypeInContext(ctx), 0);
case Basic_string:
@@ -1800,7 +1800,7 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
return type;
}
- case Basic_typeid: return LLVMIntTypeInContext(m->ctx, 8*cast(unsigned)build_context.word_size);
+ case Basic_typeid: return LLVMIntTypeInContext(m->ctx, 8*cast(unsigned)build_context.ptr_size);
// Endian Specific Types
case Basic_i16le: return LLVMInt16TypeInContext(ctx);
@@ -1927,7 +1927,7 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
if (bigger_int) {
LLVMTypeRef fields[3] = {
LLVMPointerType(lb_type(m, type->Slice.elem), 0), // data
- lb_type_padding_filler(m, build_context.word_size, build_context.word_size), // padding
+ lb_type_padding_filler(m, build_context.ptr_size, build_context.ptr_size), // padding
lb_type(m, t_int), // len
};
return LLVMStructTypeInContext(ctx, fields, gb_count_of(fields), false);
@@ -1946,7 +1946,7 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
if (bigger_int) {
LLVMTypeRef fields[5] = {
LLVMPointerType(lb_type(m, type->DynamicArray.elem), 0), // data
- lb_type_padding_filler(m, build_context.word_size, build_context.word_size), // padding
+ lb_type_padding_filler(m, build_context.ptr_size, build_context.ptr_size), // padding
lb_type(m, t_int), // len
lb_type(m, t_int), // cap
lb_type(m, t_allocator), // allocator
@@ -2173,7 +2173,7 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
LLVMTypeRef *fields = gb_alloc_array(permanent_allocator(), LLVMTypeRef, field_count);
fields[0] = LLVMPointerType(lb_type(m, type->Pointer.elem), 0);
if (bigger_int) {
- fields[1] = lb_type_padding_filler(m, build_context.word_size, build_context.word_size);
+ fields[1] = lb_type_padding_filler(m, build_context.ptr_size, build_context.ptr_size);
fields[2] = LLVMIntTypeInContext(ctx, 8*cast(unsigned)build_context.int_size);
} else {
fields[1] = LLVMIntTypeInContext(ctx, 8*cast(unsigned)build_context.int_size);
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index ddf058668..651ebf35c 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -14,7 +14,7 @@ gb_internal void lb_mem_copy_overlapping(lbProcedure *p, lbValue dst, lbValue sr
char const *name = "llvm.memmove";
if (LLVMIsConstant(len.value)) {
i64 const_len = cast(i64)LLVMConstIntGetSExtValue(len.value);
- if (const_len <= 4*build_context.word_size) {
+ if (const_len <= 4*build_context.int_size) {
name = "llvm.memmove.inline";
}
}
@@ -43,7 +43,7 @@ gb_internal void lb_mem_copy_non_overlapping(lbProcedure *p, lbValue dst, lbValu
char const *name = "llvm.memcpy";
if (LLVMIsConstant(len.value)) {
i64 const_len = cast(i64)LLVMConstIntGetSExtValue(len.value);
- if (const_len <= 4*build_context.word_size) {
+ if (const_len <= 4*build_context.int_size) {
name = "llvm.memcpy.inline";
}
}
diff --git a/src/llvm_backend_stmt.cpp b/src/llvm_backend_stmt.cpp
index 125913ac5..00e02092d 100644
--- a/src/llvm_backend_stmt.cpp
+++ b/src/llvm_backend_stmt.cpp
@@ -1652,7 +1652,7 @@ gb_internal void lb_build_return_stmt_internal(lbProcedure *p, lbValue res) {
if (res.value != nullptr) {
LLVMValueRef res_val = res.value;
i64 sz = type_size_of(res.type);
- if (LLVMIsALoadInst(res_val) && sz > build_context.word_size) {
+ if (LLVMIsALoadInst(res_val) && sz > build_context.int_size) {
lbValue ptr = lb_address_from_load_or_generate_local(p, res);
lb_mem_copy_non_overlapping(p, p->return_ptr.addr, ptr, lb_const_int(p->module, t_int, sz));
} else {
diff --git a/src/llvm_backend_type.cpp b/src/llvm_backend_type.cpp
index 3af10112f..eba41a55c 100644
--- a/src/llvm_backend_type.cpp
+++ b/src/llvm_backend_type.cpp
@@ -68,7 +68,7 @@ gb_internal lbValue lb_typeid(lbModule *m, Type *type) {
}
u64 data = 0;
- if (build_context.word_size == 4) {
+ if (build_context.ptr_size == 4) {
GB_ASSERT(id <= (1u<<24u));
data |= (id &~ (1u<<24)) << 0u; // index
data |= (kind &~ (1u<<5)) << 24u; // kind
@@ -76,7 +76,7 @@ gb_internal lbValue lb_typeid(lbModule *m, Type *type) {
data |= (special &~ (1u<<1)) << 30u; // kind
data |= (reserved &~ (1u<<1)) << 31u; // kind
} else {
- GB_ASSERT(build_context.word_size == 8);
+ GB_ASSERT(build_context.ptr_size == 8);
GB_ASSERT(id <= (1ull<<56u));
data |= (id &~ (1ull<<56)) << 0ul; // index
data |= (kind &~ (1ull<<5)) << 56ull; // kind
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp
index 758657657..4499803e5 100644
--- a/src/llvm_backend_utility.cpp
+++ b/src/llvm_backend_utility.cpp
@@ -930,17 +930,17 @@ gb_internal i32 lb_convert_struct_index(lbModule *m, Type *t, i32 index) {
if (t->kind == Type_Struct) {
auto field_remapping = lb_get_struct_remapping(m, t);
return field_remapping[index];
- } else if (build_context.word_size != build_context.int_size) {
+ } else if (build_context.ptr_size != build_context.int_size) {
switch (t->kind) {
case Type_Slice:
- GB_ASSERT(build_context.word_size*2 == build_context.int_size);
+ GB_ASSERT(build_context.ptr_size*2 == build_context.int_size);
switch (index) {
case 0: return 0; // data
case 1: return 2; // len
}
break;
case Type_DynamicArray:
- GB_ASSERT(build_context.word_size*2 == build_context.int_size);
+ GB_ASSERT(build_context.ptr_size*2 == build_context.int_size);
switch (index) {
case 0: return 0; // data
case 1: return 2; // len
@@ -949,7 +949,7 @@ gb_internal i32 lb_convert_struct_index(lbModule *m, Type *t, i32 index) {
}
break;
case Type_SoaPointer:
- GB_ASSERT(build_context.word_size*2 == build_context.int_size);
+ GB_ASSERT(build_context.ptr_size*2 == build_context.int_size);
switch (index) {
case 0: return 0; // data
case 1: return 2; // offset
@@ -1589,7 +1589,7 @@ gb_internal lbValue lb_map_data_uintptr(lbProcedure *p, lbValue value) {
GB_ASSERT(is_type_map(value.type) || are_types_identical(value.type, t_raw_map));
lbValue data = lb_emit_struct_ev(p, value, 0);
u64 mask_value = 0;
- if (build_context.word_size == 4) {
+ if (build_context.ptr_size == 4) {
mask_value = 0xfffffffful & ~(MAP_CACHE_LINE_SIZE-1);
} else {
mask_value = 0xffffffffffffffffull & ~(MAP_CACHE_LINE_SIZE-1);
diff --git a/src/types.cpp b/src/types.cpp
index 0ce2f127f..ddfedf1e1 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -3411,15 +3411,15 @@ gb_internal i64 type_size_of(Type *t) {
GB_ASSERT_MSG(is_type_typed(t), "%s", type_to_string(t));
switch (t->Basic.kind) {
case Basic_string: size = 2*build_context.int_size; break;
- case Basic_cstring: size = build_context.word_size; break;
- case Basic_any: size = 2*build_context.word_size; break;
- case Basic_typeid: size = build_context.word_size; break;
+ case Basic_cstring: size = build_context.ptr_size; break;
+ case Basic_any: size = 2*build_context.ptr_size; break;
+ case Basic_typeid: size = build_context.ptr_size; break;
case Basic_int: case Basic_uint:
size = build_context.int_size;
break;
case Basic_uintptr: case Basic_rawptr:
- size = build_context.word_size;
+ size = build_context.ptr_size;
break;
default:
size = t->Basic.size;
@@ -3474,14 +3474,14 @@ gb_internal i64 type_align_of_internal(Type *t, TypePath *path) {
GB_ASSERT(is_type_typed(t));
switch (t->Basic.kind) {
case Basic_string: return build_context.int_size;
- case Basic_cstring: return build_context.word_size;
- case Basic_any: return build_context.word_size;
- case Basic_typeid: return build_context.word_size;
+ case Basic_cstring: return build_context.ptr_size;
+ case Basic_any: return build_context.ptr_size;
+ case Basic_typeid: return build_context.ptr_size;
case Basic_int: case Basic_uint:
return build_context.int_size;
case Basic_uintptr: case Basic_rawptr:
- return build_context.word_size;
+ return build_context.ptr_size;
case Basic_complex32: case Basic_complex64: case Basic_complex128:
return type_size_of_internal(t, path) / 2;
@@ -3532,7 +3532,7 @@ gb_internal i64 type_align_of_internal(Type *t, TypePath *path) {
} break;
case Type_Map:
- return build_context.word_size;
+ return build_context.ptr_size;
case Type_Enum:
return type_align_of_internal(t->Enum.base_type, path);
@@ -3615,7 +3615,7 @@ gb_internal i64 type_align_of_internal(Type *t, TypePath *path) {
return build_context.int_size;
}
- // NOTE(bill): Things that are bigger than build_context.word_size, are actually comprised of smaller types
+ // NOTE(bill): Things that are bigger than build_context.ptr_size, are actually comprised of smaller types
// TODO(bill): Is this correct for 128-bit types (integers)?
return gb_clamp(next_pow2(type_size_of_internal(t, path)), 1, build_context.max_align);
}
@@ -3698,22 +3698,22 @@ gb_internal i64 type_size_of_internal(Type *t, TypePath *path) {
}
switch (kind) {
case Basic_string: return 2*build_context.int_size;
- case Basic_cstring: return build_context.word_size;
- case Basic_any: return 2*build_context.word_size;
- case Basic_typeid: return build_context.word_size;
+ case Basic_cstring: return build_context.ptr_size;
+ case Basic_any: return 2*build_context.ptr_size;
+ case Basic_typeid: return build_context.ptr_size;
case Basic_int: case Basic_uint:
return build_context.int_size;
case Basic_uintptr: case Basic_rawptr:
- return build_context.word_size;
+ return build_context.ptr_size;
}
} break;
case Type_Pointer:
- return build_context.word_size;
+ return build_context.ptr_size;
case Type_MultiPointer:
- return build_context.word_size;
+ return build_context.ptr_size;
case Type_SoaPointer:
return build_context.int_size*2;
@@ -3753,7 +3753,7 @@ gb_internal i64 type_size_of_internal(Type *t, TypePath *path) {
case Type_DynamicArray:
// data + len + cap + allocator(procedure+data)
- return 3*build_context.int_size + 2*build_context.word_size;
+ return 3*build_context.int_size + 2*build_context.ptr_size;
case Type_Map:
/*
@@ -3763,7 +3763,7 @@ gb_internal i64 type_size_of_internal(Type *t, TypePath *path) {
allocator: runtime.Allocator, // 2 words
}
*/
- return (1 + 1 + 2)*build_context.word_size;
+ return (1 + 1 + 2)*build_context.ptr_size;
case Type_Tuple: {
i64 count, align, size;
@@ -3889,7 +3889,7 @@ gb_internal i64 type_size_of_internal(Type *t, TypePath *path) {
}
// Catch all
- return build_context.word_size;
+ return build_context.ptr_size;
}
gb_internal i64 type_offset_of(Type *t, i32 index) {
@@ -3914,8 +3914,8 @@ gb_internal i64 type_offset_of(Type *t, i32 index) {
}
} else if (t->Basic.kind == Basic_any) {
switch (index) {
- case 0: return 0; // type_info
- case 1: return build_context.word_size; // data
+ case 0: return 0; // type_info
+ case 1: return build_context.ptr_size; // data
}
}
} else if (t->kind == Type_Slice) {
@@ -3934,7 +3934,7 @@ gb_internal i64 type_offset_of(Type *t, i32 index) {
} else if (t->kind == Type_Union) {
/* i64 s = */ type_size_of(t);
switch (index) {
- case -1: return align_formula(t->Union.variant_block_size, build_context.word_size); // __type_info
+ case -1: return align_formula(t->Union.variant_block_size, build_context.ptr_size); // __type_info
}
}
return 0;