mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-17 00:11:25 -07:00
Merge tag 'dev-2024-12'
# Conflicts: # vendor/raylib/windows/raylib.dll # vendor/raylib/windows/raylibdll.lib
This commit is contained in:
+43
-461
@@ -2,12 +2,6 @@
|
||||
Gather and print platform and version info to help with reporting Odin bugs.
|
||||
*/
|
||||
|
||||
#if !defined(GB_COMPILER_MSVC)
|
||||
#if defined(GB_CPU_X86)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GB_SYSTEM_LINUX)
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/sysinfo.h>
|
||||
@@ -154,21 +148,6 @@ gb_internal void report_windows_product_type(DWORD ProductType) {
|
||||
}
|
||||
#endif
|
||||
|
||||
gb_internal void odin_cpuid(int leaf, int result[]) {
|
||||
#if defined(GB_CPU_ARM) || defined(GB_CPU_RISCV)
|
||||
return;
|
||||
|
||||
#elif defined(GB_CPU_X86)
|
||||
|
||||
#if defined(GB_COMPILER_MSVC)
|
||||
__cpuid(result, leaf);
|
||||
#else
|
||||
__get_cpuid(leaf, (unsigned int*)&result[0], (unsigned int*)&result[1], (unsigned int*)&result[2], (unsigned int*)&result[3]);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
gb_internal void report_cpu_info() {
|
||||
gb_printf("\tCPU: ");
|
||||
|
||||
@@ -547,387 +526,46 @@ gb_internal void report_os_info() {
|
||||
gb_printf(", %s %s\n", info->sysname, info->release);
|
||||
|
||||
#elif defined(GB_SYSTEM_OSX)
|
||||
struct Darwin_To_Release {
|
||||
const char* build; // 21G83
|
||||
int darwin[3]; // Darwin kernel triplet
|
||||
const char* os_name; // OS X, MacOS
|
||||
struct {
|
||||
const char* name; // Monterey, Mojave, etc.
|
||||
int version[3]; // 12.4, etc.
|
||||
} release;
|
||||
};
|
||||
|
||||
Darwin_To_Release macos_release_map[] = {
|
||||
{"8A428", { 8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}},
|
||||
{"8A432", { 8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}},
|
||||
{"8B15", { 8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}},
|
||||
{"8B17", { 8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}},
|
||||
{"8C46", { 8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
{"8C47", { 8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
{"8E102", { 8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
{"8E45", { 8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
{"8E90", { 8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
|
||||
{"8F46", { 8, 3, 0}, "macOS", {"Tiger", {10, 4, 3}}},
|
||||
{"8G32", { 8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}},
|
||||
{"8G1165", { 8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}},
|
||||
{"8H14", { 8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}},
|
||||
{"8G1454", { 8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}},
|
||||
{"8I127", { 8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}},
|
||||
{"8I1119", { 8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}},
|
||||
{"8J135", { 8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
{"8J2135a", { 8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
{"8K1079", { 8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
{"8N5107", { 8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
|
||||
{"8L127", { 8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}},
|
||||
{"8L2127", { 8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}},
|
||||
{"8P135", { 8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}},
|
||||
{"8P2137", { 8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}},
|
||||
{"8R218", { 8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
|
||||
{"8R2218", { 8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
|
||||
{"8R2232", { 8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
|
||||
{"8S165", { 8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}},
|
||||
{"8S2167", { 8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}},
|
||||
{"9A581", { 9, 0, 0}, "macOS", {"Leopard", {10, 5, 0}}},
|
||||
{"9B18", { 9, 1, 0}, "macOS", {"Leopard", {10, 5, 1}}},
|
||||
{"9B2117", { 9, 1, 1}, "macOS", {"Leopard", {10, 5, 1}}},
|
||||
{"9C31", { 9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}},
|
||||
{"9C7010", { 9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}},
|
||||
{"9D34", { 9, 3, 0}, "macOS", {"Leopard", {10, 5, 3}}},
|
||||
{"9E17", { 9, 4, 0}, "macOS", {"Leopard", {10, 5, 4}}},
|
||||
{"9F33", { 9, 5, 0}, "macOS", {"Leopard", {10, 5, 5}}},
|
||||
{"9G55", { 9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
|
||||
{"9G66", { 9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
|
||||
{"9G71", { 9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
|
||||
{"9J61", { 9, 7, 0}, "macOS", {"Leopard", {10, 5, 7}}},
|
||||
{"9L30", { 9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}},
|
||||
{"9L34", { 9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}},
|
||||
{"10A432", {10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}},
|
||||
{"10A433", {10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}},
|
||||
{"10B504", {10, 1, 0}, "macOS", {"Snow Leopard", {10, 6, 1}}},
|
||||
{"10C540", {10, 2, 0}, "macOS", {"Snow Leopard", {10, 6, 2}}},
|
||||
{"10D573", {10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
|
||||
{"10D575", {10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
|
||||
{"10D578", {10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
|
||||
{"10F569", {10, 4, 0}, "macOS", {"Snow Leopard", {10, 6, 4}}},
|
||||
{"10H574", {10, 5, 0}, "macOS", {"Snow Leopard", {10, 6, 5}}},
|
||||
{"10J567", {10, 6, 0}, "macOS", {"Snow Leopard", {10, 6, 6}}},
|
||||
{"10J869", {10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
|
||||
{"10J3250", {10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
|
||||
{"10J4138", {10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
|
||||
{"10K540", {10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}},
|
||||
{"10K549", {10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}},
|
||||
{"11A511", {11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
{"11A511s", {11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
{"11A2061", {11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
{"11A2063", {11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}},
|
||||
{"11B26", {11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}},
|
||||
{"11B2118", {11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}},
|
||||
{"11C74", {11, 2, 0}, "macOS", {"Lion", {10, 7, 2}}},
|
||||
{"11D50", {11, 3, 0}, "macOS", {"Lion", {10, 7, 3}}},
|
||||
{"11E53", {11, 4, 0}, "macOS", {"Lion", {10, 7, 4}}},
|
||||
{"11G56", {11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}},
|
||||
{"11G63", {11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}},
|
||||
{"12A269", {12, 0, 0}, "macOS", {"Mountain Lion", {10, 8, 0}}},
|
||||
{"12B19", {12, 1, 0}, "macOS", {"Mountain Lion", {10, 8, 1}}},
|
||||
{"12C54", {12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
{"12C60", {12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
{"12C2034", {12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
{"12C3104", {12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
|
||||
{"12D78", {12, 3, 0}, "macOS", {"Mountain Lion", {10, 8, 3}}},
|
||||
{"12E55", {12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
|
||||
{"12E3067", {12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
|
||||
{"12E4022", {12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
|
||||
{"12F37", {12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
{"12F45", {12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
{"12F2501", {12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
{"12F2518", {12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
{"12F2542", {12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
{"12F2560", {12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
|
||||
{"13A603", {13, 0, 0}, "macOS", {"Mavericks", {10, 9, 0}}},
|
||||
{"13B42", {13, 0, 0}, "macOS", {"Mavericks", {10, 9, 1}}},
|
||||
{"13C64", {13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}},
|
||||
{"13C1021", {13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}},
|
||||
{"13D65", {13, 2, 0}, "macOS", {"Mavericks", {10, 9, 3}}},
|
||||
{"13E28", {13, 3, 0}, "macOS", {"Mavericks", {10, 9, 4}}},
|
||||
{"13F34", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1066", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1077", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1096", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1112", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1134", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1507", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1603", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1712", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1808", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"13F1911", {13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
|
||||
{"14A389", {14, 0, 0}, "macOS", {"Yosemite", {10, 10, 0}}},
|
||||
{"14B25", {14, 0, 0}, "macOS", {"Yosemite", {10, 10, 1}}},
|
||||
{"14C109", {14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
{"14C1510", {14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
{"14C2043", {14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
{"14C1514", {14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
{"14C2513", {14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
|
||||
{"14D131", {14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}},
|
||||
{"14D136", {14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}},
|
||||
{"14E46", {14, 4, 0}, "macOS", {"Yosemite", {10, 10, 4}}},
|
||||
{"14F27", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1021", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1505", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1509", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1605", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1713", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1808", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1909", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F1912", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F2009", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F2109", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F2315", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F2411", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"14F2511", {14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
|
||||
{"15A284", {15, 0, 0}, "macOS", {"El Capitan", {10, 11, 0}}},
|
||||
{"15B42", {15, 0, 0}, "macOS", {"El Capitan", {10, 11, 1}}},
|
||||
{"15C50", {15, 2, 0}, "macOS", {"El Capitan", {10, 11, 2}}},
|
||||
{"15D21", {15, 3, 0}, "macOS", {"El Capitan", {10, 11, 3}}},
|
||||
{"15E65", {15, 4, 0}, "macOS", {"El Capitan", {10, 11, 4}}},
|
||||
{"15F34", {15, 5, 0}, "macOS", {"El Capitan", {10, 11, 5}}},
|
||||
{"15G31", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1004", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1011", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1108", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1212", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1217", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1421", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1510", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G1611", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G17023", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G18013", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G19009", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G20015", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G21013", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"15G22010", {15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
|
||||
{"16A323", {16, 0, 0}, "macOS", {"Sierra", {10, 12, 0}}},
|
||||
{"16B2555", {16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}},
|
||||
{"16B2657", {16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}},
|
||||
{"16C67", {16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}},
|
||||
{"16C68", {16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}},
|
||||
{"16D32", {16, 4, 0}, "macOS", {"Sierra", {10, 12, 3}}},
|
||||
{"16E195", {16, 5, 0}, "macOS", {"Sierra", {10, 12, 4}}},
|
||||
{"16F73", {16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}},
|
||||
{"16F2073", {16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}},
|
||||
{"16G29", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1036", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1114", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1212", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1314", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1408", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1510", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1618", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1710", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1815", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1917", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G1918", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G2016", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G2127", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G2128", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"16G2136", {16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
|
||||
{"17A365", {17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}},
|
||||
{"17A405", {17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}},
|
||||
{"17B48", {17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
|
||||
{"17B1002", {17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
|
||||
{"17B1003", {17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
|
||||
{"17C88", {17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
{"17C89", {17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
{"17C205", {17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
{"17C2205", {17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
|
||||
{"17D47", {17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
{"17D2047", {17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
{"17D102", {17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
{"17D2102", {17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
|
||||
{"17E199", {17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}},
|
||||
{"17E202", {17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}},
|
||||
{"17F77", {17, 6, 0}, "macOS", {"High Sierra", {10, 13, 5}}},
|
||||
{"17G65", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G2208", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G2307", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G3025", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G4015", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G5019", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G6029", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G6030", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G7024", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G8029", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G8030", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G8037", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G9016", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G10021", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G11023", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G12034", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G13033", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G13035", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G14019", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G14033", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"17G14042", {17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
|
||||
{"18A391", {18, 0, 0}, "macOS", {"Mojave", {10, 14, 0}}},
|
||||
{"18B75", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
|
||||
{"18B2107", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
|
||||
{"18B3094", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
|
||||
{"18C54", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 2}}},
|
||||
{"18D42", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
|
||||
{"18D43", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
|
||||
{"18D109", {18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
|
||||
{"18E226", {18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}},
|
||||
{"18E227", {18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}},
|
||||
{"18F132", {18, 6, 0}, "macOS", {"Mojave", {10, 14, 5}}},
|
||||
{"18G84", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G87", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G95", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G103", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G1012", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G2022", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G3020", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G4032", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G5033", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G6020", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G6032", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G6042", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G7016", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G8012", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G8022", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G9028", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G9216", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"18G9323", {18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
|
||||
{"19A583", {19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
|
||||
{"19A602", {19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
|
||||
{"19A603", {19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
|
||||
{"19B88", {19, 0, 0}, "macOS", {"Catalina", {10, 15, 1}}},
|
||||
{"19C57", {19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}},
|
||||
{"19C58", {19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}},
|
||||
{"19D76", {19, 3, 0}, "macOS", {"Catalina", {10, 15, 3}}},
|
||||
{"19E266", {19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}},
|
||||
{"19E287", {19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}},
|
||||
{"19F96", {19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}},
|
||||
{"19F101", {19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}},
|
||||
{"19G73", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}},
|
||||
{"19G2021", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}},
|
||||
{"19H2", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H4", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H15", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H114", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H512", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H524", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1030", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1217", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1323", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1417", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1419", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1519", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1615", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1713", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1715", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1824", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H1922", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"19H2026", {19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
|
||||
{"20A2411", {20, 1, 0}, "macOS", {"Big Sur", {11, 0, 0}}},
|
||||
{"20B29", {20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}},
|
||||
{"20B50", {20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}},
|
||||
{"20C69", {20, 2, 0}, "macOS", {"Big Sur", {11, 1, 0}}},
|
||||
{"20D64", {20, 3, 0}, "macOS", {"Big Sur", {11, 2, 0}}},
|
||||
{"20D74", {20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}},
|
||||
{"20D75", {20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}},
|
||||
{"20D80", {20, 3, 0}, "macOS", {"Big Sur", {11, 2, 2}}},
|
||||
{"20D91", {20, 3, 0}, "macOS", {"Big Sur", {11, 2, 3}}},
|
||||
{"20E232", {20, 4, 0}, "macOS", {"Big Sur", {11, 3, 0}}},
|
||||
{"20E241", {20, 4, 0}, "macOS", {"Big Sur", {11, 3, 1}}},
|
||||
{"20F71", {20, 5, 0}, "macOS", {"Big Sur", {11, 4, 0}}},
|
||||
{"20G71", {20, 6, 0}, "macOS", {"Big Sur", {11, 5, 0}}},
|
||||
{"20G80", {20, 6, 0}, "macOS", {"Big Sur", {11, 5, 1}}},
|
||||
{"20G95", {20, 6, 0}, "macOS", {"Big Sur", {11, 5, 2}}},
|
||||
{"20G165", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 0}}},
|
||||
{"20G224", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 1}}},
|
||||
{"20G314", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 2}}},
|
||||
{"20G415", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 3}}},
|
||||
{"20G417", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 4}}},
|
||||
{"20G527", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 5}}},
|
||||
{"20G624", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}},
|
||||
{"20G630", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}},
|
||||
{"20G730", {20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}},
|
||||
{"20G817", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 0}}},
|
||||
{"20G918", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 1}}},
|
||||
{"20G1020", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 2}}},
|
||||
{"20G1116", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 3}}},
|
||||
{"20G1120", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 4}}},
|
||||
{"20G1225", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 5}}},
|
||||
{"20G1231", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 6}}},
|
||||
{"20G1345", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 7}}},
|
||||
{"20G1351", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 8}}},
|
||||
{"20G1426", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 9}}},
|
||||
{"20G1427", {20, 6, 0}, "macOS", {"Big Sur", {11, 7, 10}}},
|
||||
{"21A344", {21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}},
|
||||
{"21A559", {21, 1, 0}, "macOS", {"Monterey", {12, 0, 1}}},
|
||||
{"21C52", {21, 2, 0}, "macOS", {"Monterey", {12, 1, 0}}},
|
||||
{"21D49", {21, 3, 0}, "macOS", {"Monterey", {12, 2, 0}}},
|
||||
{"21D62", {21, 3, 0}, "macOS", {"Monterey", {12, 2, 1}}},
|
||||
{"21E230", {21, 4, 0}, "macOS", {"Monterey", {12, 3, 0}}},
|
||||
{"21E258", {21, 4, 0}, "macOS", {"Monterey", {12, 3, 1}}},
|
||||
{"21F79", {21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||
{"21F2081", {21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||
{"21F2092", {21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
|
||||
{"21G72", {21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
|
||||
{"21G83", {21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
|
||||
{"21G115", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}},
|
||||
{"21G217", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 1}}},
|
||||
{"21G320", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 2}}},
|
||||
{"21G419", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 3}}},
|
||||
{"21G526", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 4}}},
|
||||
{"21G531", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 5}}},
|
||||
{"21G646", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 6}}},
|
||||
{"21G651", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 7}}},
|
||||
{"21G725", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 8}}},
|
||||
{"21G726", {21, 6, 0}, "macOS", {"Monterey", {12, 6, 9}}},
|
||||
{"21G816", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}},
|
||||
{"21G920", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}},
|
||||
{"21G1974", {21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}},
|
||||
{"22A380", {13, 0, 0}, "macOS", {"Ventura", {22, 1, 0}}},
|
||||
{"22A400", {13, 0, 1}, "macOS", {"Ventura", {22, 1, 0}}},
|
||||
{"22C65", {13, 1, 0}, "macOS", {"Ventura", {22, 2, 0}}},
|
||||
{"22D49", {13, 2, 0}, "macOS", {"Ventura", {22, 3, 0}}},
|
||||
{"22D68", {13, 2, 1}, "macOS", {"Ventura", {22, 3, 0}}},
|
||||
{"22E252", {13, 3, 0}, "macOS", {"Ventura", {22, 4, 0}}},
|
||||
{"22E261", {13, 3, 1}, "macOS", {"Ventura", {22, 4, 0}}},
|
||||
{"22F66", {13, 4, 0}, "macOS", {"Ventura", {22, 5, 0}}},
|
||||
{"22F82", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
|
||||
{"22E772610a", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
|
||||
{"22F770820d", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
|
||||
{"22G74", {13, 5, 0}, "macOS", {"Ventura", {22, 6, 0}}},
|
||||
{"22G90", {13, 5, 1}, "macOS", {"Ventura", {22, 6, 0}}},
|
||||
{"22G91", {13, 5, 2}, "macOS", {"Ventura", {22, 6, 0}}},
|
||||
{"22G120", {13, 6, 0}, "macOS", {"Ventura", {22, 6, 0}}},
|
||||
{"22G313", {13, 6, 1}, "macOS", {"Ventura", {22, 6, 0}}},
|
||||
{"22G320", {13, 6, 2}, "macOS", {"Ventura", {22, 6, 0}}},
|
||||
{"23A344", {23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}},
|
||||
{"23B74", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 0}}},
|
||||
{"23B81", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
|
||||
{"23B2082", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
|
||||
{"23B92", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
|
||||
{"23B2091", {23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
|
||||
{"23C64", {23, 2, 0}, "macOS", {"Sonoma", {14, 2, 0}}},
|
||||
{"23C71", {23, 2, 0}, "macOS", {"Sonoma", {14, 2, 1}}},
|
||||
{"23D56", {23, 3, 0}, "macOS", {"Sonoma", {14, 3, 0}}},
|
||||
{"23D60", {23, 3, 0}, "macOS", {"Sonoma", {14, 3, 1}}},
|
||||
{"23E214", {23, 4, 0}, "macOS", {"Sonoma", {14, 4, 0}}},
|
||||
{"23E224", {23, 4, 0}, "macOS", {"Sonoma", {14, 4, 1}}},
|
||||
{"23F79", {23, 5, 0}, "macOS", {"Sonoma", {14, 5, 0}}},
|
||||
{"23G80", {23, 6, 0}, "macOS", {"Sonoma", {14, 6, 0}}},
|
||||
{"23G93", {23, 6, 0}, "macOS", {"Sonoma", {14, 6, 1}}},
|
||||
{"23H124", {23, 6, 0}, "macOS", {"Sonoma", {14, 7, 0}}},
|
||||
{"24A335", {24, 0, 0}, "macOS", {"Sequoia", {15, 0, 0}}},
|
||||
{"24A348", {24, 0, 0}, "macOS", {"Sequoia", {15, 0, 1}}},
|
||||
gbString sw_vers = gb_string_make(heap_allocator(), "");
|
||||
if (!system_exec_command_line_app_output("sw_vers --productVersion", &sw_vers)) {
|
||||
gb_printf("macOS Unknown\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t major, minor, patch;
|
||||
|
||||
if (sscanf(cast(const char *)sw_vers, "%u.%u.%u", &major, &minor, &patch) != 3) {
|
||||
gb_printf("macOS Unknown\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (major) {
|
||||
case 15: gb_printf("macOS Sequoia"); break;
|
||||
case 14: gb_printf("macOS Sonoma"); break;
|
||||
case 13: gb_printf("macOS Ventura"); break;
|
||||
case 12: gb_printf("macOS Monterey"); break;
|
||||
case 11: gb_printf("macOS Big Sur"); break;
|
||||
case 10:
|
||||
{
|
||||
switch (minor) {
|
||||
case 15: gb_printf("macOS Catalina"); break;
|
||||
case 14: gb_printf("macOS Mojave"); break;
|
||||
case 13: gb_printf("macOS High Sierra"); break;
|
||||
case 12: gb_printf("macOS Sierra"); break;
|
||||
case 11: gb_printf("OS X El Capitan"); break;
|
||||
case 10: gb_printf("OS X Yosemite"); break;
|
||||
default: gb_printf("macOS Unknown");
|
||||
};
|
||||
break;
|
||||
}
|
||||
default:
|
||||
gb_printf("macOS Unknown");
|
||||
};
|
||||
|
||||
gb_printf(" %d.%d.%d (build ", major, minor, patch);
|
||||
|
||||
b32 build_found = 1;
|
||||
b32 darwin_found = 1;
|
||||
uint32_t major, minor, patch;
|
||||
|
||||
#define MACOS_VERSION_BUFFER_SIZE 100
|
||||
char build_buffer[MACOS_VERSION_BUFFER_SIZE];
|
||||
@@ -943,81 +581,25 @@ gb_internal void report_os_info() {
|
||||
|
||||
int darwin_mibs[] = { CTL_KERN, KERN_OSRELEASE };
|
||||
if (sysctl(darwin_mibs, 2, darwin_buffer, &darwin_buffer_size, NULL, 0) == -1) {
|
||||
gb_printf("macOS Unknown\n");
|
||||
return;
|
||||
darwin_found = 0;
|
||||
} else {
|
||||
if (sscanf(darwin_buffer, "%u.%u.%u", &major, &minor, &patch) != 3) {
|
||||
darwin_found = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Scan table for match on BUILD
|
||||
int macos_release_count = sizeof(macos_release_map) / sizeof(macos_release_map[0]);
|
||||
Darwin_To_Release build_match = {};
|
||||
Darwin_To_Release kernel_match = {};
|
||||
|
||||
for (int build = 0; build < macos_release_count; build++) {
|
||||
Darwin_To_Release rel = macos_release_map[build];
|
||||
|
||||
// Do we have an exact match on the BUILD?
|
||||
if (gb_strcmp(rel.build, (const char *)build_buffer) == 0) {
|
||||
build_match = rel;
|
||||
break;
|
||||
}
|
||||
|
||||
// Do we have an exact Darwin match?
|
||||
if (rel.darwin[0] == major && rel.darwin[1] == minor && rel.darwin[2] == patch) {
|
||||
kernel_match = rel;
|
||||
}
|
||||
|
||||
// Major kernel version needs to match exactly,
|
||||
if (rel.darwin[0] == major) {
|
||||
// No major version match yet.
|
||||
if (!kernel_match.os_name) {
|
||||
kernel_match = rel;
|
||||
}
|
||||
if (minor >= rel.darwin[1]) {
|
||||
kernel_match = rel;
|
||||
if (patch >= rel.darwin[2]) {
|
||||
kernel_match = rel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Darwin_To_Release match = {};
|
||||
if(!build_match.build) {
|
||||
match = kernel_match;
|
||||
if (build_found) {
|
||||
gb_printf("%s, kernel ", build_buffer);
|
||||
} else {
|
||||
match = build_match;
|
||||
gb_printf("Unknown, kernel ");
|
||||
}
|
||||
|
||||
if (match.os_name) {
|
||||
gb_printf("%s %s %d", match.os_name, match.release.name, match.release.version[0]);
|
||||
if (match.release.version[1] > 0 || match.release.version[2] > 0) {
|
||||
gb_printf(".%d", match.release.version[1]);
|
||||
}
|
||||
if (match.release.version[2] > 0) {
|
||||
gb_printf(".%d", match.release.version[2]);
|
||||
}
|
||||
if (build_found) {
|
||||
gb_printf(" (build: %s, kernel: %d.%d.%d)\n", build_buffer, match.darwin[0], match.darwin[1], match.darwin[2]);
|
||||
} else {
|
||||
gb_printf(" (build: %s?, kernel: %d.%d.%d)\n", match.build, match.darwin[0], match.darwin[1], match.darwin[2]);
|
||||
}
|
||||
return;
|
||||
if (darwin_found) {
|
||||
gb_printf("%s)\n", darwin_buffer);
|
||||
} else {
|
||||
gb_printf("Unknown)\n");
|
||||
}
|
||||
|
||||
if (build_found && darwin_found) {
|
||||
gb_printf("macOS Unknown (build: %s, kernel: %d.%d.%d)\n", build_buffer, major, minor, patch);
|
||||
return;
|
||||
} else if (build_found) {
|
||||
gb_printf("macOS Unknown (build: %s)\n", build_buffer);
|
||||
return;
|
||||
} else if (darwin_found) {
|
||||
gb_printf("macOS Unknown (kernel: %d.%d.%d)\n", major, minor, patch);
|
||||
return;
|
||||
}
|
||||
#elif defined(GB_SYSTEM_OPENBSD) || defined(GB_SYSTEM_NETBSD)
|
||||
struct utsname un;
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#if !defined(GB_COMPILER_MSVC)
|
||||
#if defined(GB_CPU_X86)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gb_internal void odin_cpuid(int leaf, int result[]) {
|
||||
#if defined(GB_CPU_ARM) || defined(GB_CPU_RISCV)
|
||||
return;
|
||||
|
||||
#elif defined(GB_CPU_X86)
|
||||
|
||||
#if defined(GB_COMPILER_MSVC)
|
||||
__cpuid(result, leaf);
|
||||
#else
|
||||
__get_cpuid(leaf, (unsigned int*)&result[0], (unsigned int*)&result[1], (unsigned int*)&result[2], (unsigned int*)&result[3]);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
gb_internal bool should_use_march_native() {
|
||||
#if !defined(GB_CPU_X86)
|
||||
return false;
|
||||
|
||||
#else
|
||||
|
||||
int cpu[4];
|
||||
odin_cpuid(0x1, &cpu[0]); // Get feature information in ECX + EDX
|
||||
|
||||
bool have_popcnt = cpu[2] & (1 << 23); // bit 23 in ECX = popcnt
|
||||
return !have_popcnt;
|
||||
|
||||
#endif
|
||||
}
|
||||
+21
-2
@@ -2,6 +2,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#include "build_cpuid.cpp"
|
||||
|
||||
// #if defined(GB_SYSTEM_WINDOWS)
|
||||
// #define DEFAULT_TO_THREADED_CHECKER
|
||||
@@ -343,6 +344,22 @@ struct BuildCacheData {
|
||||
bool copy_already_done;
|
||||
};
|
||||
|
||||
|
||||
enum LinkerChoice : i32 {
|
||||
Linker_Invalid = -1,
|
||||
Linker_Default = 0,
|
||||
Linker_lld,
|
||||
Linker_radlink,
|
||||
|
||||
Linker_COUNT,
|
||||
};
|
||||
|
||||
String linker_choices[Linker_COUNT] = {
|
||||
str_lit("default"),
|
||||
str_lit("lld"),
|
||||
str_lit("radlink"),
|
||||
};
|
||||
|
||||
// This stores the information for the specify architecture of this build
|
||||
struct BuildContext {
|
||||
// Constants
|
||||
@@ -418,12 +435,13 @@ struct BuildContext {
|
||||
bool no_rpath;
|
||||
bool no_entry_point;
|
||||
bool no_thread_local;
|
||||
bool use_lld;
|
||||
bool cross_compiling;
|
||||
bool different_os;
|
||||
bool keep_object_files;
|
||||
bool disallow_do;
|
||||
|
||||
LinkerChoice linker_choice;
|
||||
|
||||
StringSet custom_attributes;
|
||||
|
||||
bool strict_style;
|
||||
@@ -449,6 +467,7 @@ struct BuildContext {
|
||||
BuildCacheData build_cache_data;
|
||||
|
||||
bool internal_no_inline;
|
||||
bool internal_by_value;
|
||||
|
||||
bool no_threaded_checker;
|
||||
|
||||
@@ -1870,7 +1889,7 @@ gb_internal bool init_build_paths(String init_filename) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!build_context.use_lld && find_result.vs_exe_path.len == 0) {
|
||||
if (build_context.linker_choice == Linker_Default && find_result.vs_exe_path.len == 0) {
|
||||
gb_printf_err("link.exe not found.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
+47
-1
@@ -2565,6 +2565,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
case BuiltinProc_swizzle: {
|
||||
// swizzle :: proc(v: [N]T, ..int) -> [M]T
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *original_type = operand->type;
|
||||
Type *type = base_type(original_type);
|
||||
i64 max_count = 0;
|
||||
@@ -2922,6 +2926,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
// imag :: proc(x: type) -> float_type
|
||||
|
||||
Operand *x = operand;
|
||||
if (!x->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_type_untyped(x->type)) {
|
||||
if (x->mode == Addressing_Constant) {
|
||||
if (is_type_numeric(x->type)) {
|
||||
@@ -2982,6 +2990,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
// kmag :: proc(x: type) -> float_type
|
||||
|
||||
Operand *x = operand;
|
||||
if (!x->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_type_untyped(x->type)) {
|
||||
if (x->mode == Addressing_Constant) {
|
||||
if (is_type_numeric(x->type)) {
|
||||
@@ -3031,6 +3043,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
case BuiltinProc_conj: {
|
||||
// conj :: proc(x: type) -> type
|
||||
Operand *x = operand;
|
||||
if (!x->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *t = x->type;
|
||||
Type *elem = core_array_type(t);
|
||||
|
||||
@@ -3071,10 +3087,14 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
}
|
||||
|
||||
case BuiltinProc_expand_values: {
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *type = base_type(operand->type);
|
||||
if (!is_type_struct(type) && !is_type_array(type)) {
|
||||
gbString type_str = type_to_string(operand->type);
|
||||
error(call, "Expected a struct or array type, got '%s'", type_str);
|
||||
error(call, "Expected a struct or array type to 'expand_values', got '%s'", type_str);
|
||||
gb_string_free(type_str);
|
||||
return false;
|
||||
}
|
||||
@@ -3110,8 +3130,13 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
check_multi_expr_or_type(c, operand, ce->args[0]);
|
||||
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *original_type = operand->type;
|
||||
Type *type = base_type(operand->type);
|
||||
|
||||
if (operand->mode == Addressing_Type && is_type_enumerated_array(type)) {
|
||||
// Okay
|
||||
} else if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
|
||||
@@ -3184,6 +3209,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ce->args.count <= 1) {
|
||||
error(call, "Too few arguments for 'min', two or more are required");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool all_constant = operand->mode == Addressing_Constant;
|
||||
|
||||
@@ -3278,6 +3307,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
check_multi_expr_or_type(c, operand, ce->args[0]);
|
||||
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *original_type = operand->type;
|
||||
Type *type = base_type(operand->type);
|
||||
|
||||
@@ -3357,6 +3390,11 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
gb_string_free(type_str);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ce->args.count <= 1) {
|
||||
error(call, "Too few arguments for 'max', two or more are required");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool all_constant = operand->mode == Addressing_Constant;
|
||||
|
||||
@@ -3448,6 +3486,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
case BuiltinProc_abs: {
|
||||
// abs :: proc(n: numeric) -> numeric
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(is_type_numeric(operand->type) && !is_type_array(operand->type))) {
|
||||
gbString type_str = type_to_string(operand->type);
|
||||
error(call, "Expected a numeric type to 'abs', got '%s'", type_str);
|
||||
@@ -3503,6 +3545,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
case BuiltinProc_clamp: {
|
||||
// clamp :: proc(a, min, max: ordered) -> ordered
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *type = operand->type;
|
||||
if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
|
||||
gbString type_str = type_to_string(operand->type);
|
||||
|
||||
+20
-68
@@ -897,20 +897,6 @@ gb_internal i64 check_distance_between_types(CheckerContext *c, Operand *operand
|
||||
}
|
||||
}
|
||||
|
||||
if (is_type_relative_pointer(dst)) {
|
||||
i64 score = check_distance_between_types(c, operand, dst->RelativePointer.pointer_type, allow_array_programming);
|
||||
if (score >= 0) {
|
||||
return score+2;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_type_relative_multi_pointer(dst)) {
|
||||
i64 score = check_distance_between_types(c, operand, dst->RelativeMultiPointer.pointer_type, allow_array_programming);
|
||||
if (score >= 0) {
|
||||
return score+2;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_type_proc(dst)) {
|
||||
if (are_types_identical(src, dst)) {
|
||||
return 3;
|
||||
@@ -1052,12 +1038,6 @@ gb_internal AstPackage *get_package_of_type(Type *type) {
|
||||
case Type_DynamicArray:
|
||||
type = type->DynamicArray.elem;
|
||||
continue;
|
||||
case Type_RelativePointer:
|
||||
type = type->RelativePointer.pointer_type;
|
||||
continue;
|
||||
case Type_RelativeMultiPointer:
|
||||
type = type->RelativeMultiPointer.pointer_type;
|
||||
continue;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3561,6 +3541,8 @@ gb_internal bool check_transmute(CheckerContext *c, Ast *node, Operand *o, Type
|
||||
return false;
|
||||
}
|
||||
|
||||
Operand src = *o;
|
||||
|
||||
Type *src_t = o->type;
|
||||
Type *dst_t = t;
|
||||
Type *src_bt = base_type(src_t);
|
||||
@@ -3649,7 +3631,8 @@ gb_internal bool check_transmute(CheckerContext *c, Ast *node, Operand *o, Type
|
||||
// identical casts that cannot be foreseen or otherwise
|
||||
// forbidden, so just skip them.
|
||||
if (forbid_identical && check_vet_flags(c) & VetFlag_Cast &&
|
||||
(c->curr_proc_sig == nullptr || !is_type_polymorphic(c->curr_proc_sig))) {
|
||||
(c->curr_proc_sig == nullptr || !is_type_polymorphic(c->curr_proc_sig)) &&
|
||||
check_is_castable_to(c, &src, dst_t)) {
|
||||
if (are_types_identical(src_t, dst_t)) {
|
||||
gbString oper_str = expr_to_string(o->expr);
|
||||
gbString to_type = type_to_string(dst_t);
|
||||
@@ -4471,8 +4454,8 @@ gb_internal ExactValue convert_exact_value_for_type(ExactValue v, Type *type) {
|
||||
}
|
||||
|
||||
gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *target_type) {
|
||||
GB_ASSERT_NOT_NULL(target_type);
|
||||
if (operand->mode == Addressing_Invalid ||
|
||||
// GB_ASSERT_NOT_NULL(target_type);
|
||||
if (target_type == nullptr || operand->mode == Addressing_Invalid ||
|
||||
operand->mode == Addressing_Type ||
|
||||
is_type_typed(operand->type) ||
|
||||
target_type == t_invalid) {
|
||||
@@ -4997,8 +4980,12 @@ gb_internal ExactValue get_constant_field_single(CheckerContext *c, ExactValue v
|
||||
if (success_) *success_ = true;
|
||||
if (finish_) *finish_ = false;
|
||||
return tav.value;
|
||||
} else if (is_type_proc(tav.type)) {
|
||||
if (success_) *success_ = true;
|
||||
if (finish_) *finish_ = false;
|
||||
return tav.value;
|
||||
} else {
|
||||
GB_ASSERT(is_type_untyped_nil(tav.type));
|
||||
GB_ASSERT_MSG(is_type_untyped_nil(tav.type), "%s", type_to_string(tav.type));
|
||||
if (success_) *success_ = true;
|
||||
if (finish_) *finish_ = false;
|
||||
return tav.value;
|
||||
@@ -8232,17 +8219,6 @@ gb_internal bool check_set_index_data(Operand *o, Type *t, bool indirection, i64
|
||||
}
|
||||
return true;
|
||||
|
||||
case Type_RelativeMultiPointer:
|
||||
{
|
||||
Type *pointer_type = base_type(t->RelativeMultiPointer.pointer_type);
|
||||
GB_ASSERT(pointer_type->kind == Type_MultiPointer);
|
||||
o->type = pointer_type->MultiPointer.elem;
|
||||
if (o->mode != Addressing_Constant) {
|
||||
o->mode = Addressing_Variable;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
case Type_DynamicArray:
|
||||
o->type = t->DynamicArray.elem;
|
||||
if (o->mode != Addressing_Constant) {
|
||||
@@ -8481,6 +8457,15 @@ gb_internal ExprKind check_implicit_selector_expr(CheckerContext *c, Operand *o,
|
||||
error(node, "Undeclared name '%.*s' for type '%s'", LIT(name), typ);
|
||||
|
||||
check_did_you_mean_type(name, bt->Enum.fields);
|
||||
} else if (is_type_bit_set(th) && is_type_enum(th->BitSet.elem)) {
|
||||
ERROR_BLOCK();
|
||||
|
||||
gbString typ = type_to_string(th);
|
||||
gbString str = expr_to_string(node);
|
||||
error(node, "Cannot convert enum value to '%s'", typ);
|
||||
error_line("\tSuggestion: Did you mean '{ %s }'?\n", str);
|
||||
gb_string_free(typ);
|
||||
gb_string_free(str);
|
||||
} else {
|
||||
gbString typ = type_to_string(th);
|
||||
gbString str = expr_to_string(node);
|
||||
@@ -10616,8 +10601,6 @@ gb_internal ExprKind check_index_expr(CheckerContext *c, Operand *o, Ast *node,
|
||||
// Okay
|
||||
} else if (is_type_string(t)) {
|
||||
// Okay
|
||||
} else if (is_type_relative_multi_pointer(t)) {
|
||||
// Okay
|
||||
} else if (is_type_matrix(t)) {
|
||||
// Okay
|
||||
} else {
|
||||
@@ -10772,11 +10755,6 @@ gb_internal ExprKind check_slice_expr(CheckerContext *c, Operand *o, Ast *node,
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_RelativeMultiPointer:
|
||||
valid = true;
|
||||
o->type = type_deref(o->type);
|
||||
break;
|
||||
|
||||
case Type_EnumeratedArray:
|
||||
{
|
||||
gbString str = expr_to_string(o->expr);
|
||||
@@ -10853,16 +10831,6 @@ gb_internal ExprKind check_slice_expr(CheckerContext *c, Operand *o, Ast *node,
|
||||
x[i:n] -> []T
|
||||
*/
|
||||
o->type = alloc_type_slice(t->MultiPointer.elem);
|
||||
} else if (t->kind == Type_RelativeMultiPointer && se->high != nullptr) {
|
||||
/*
|
||||
x[:] -> [^]T
|
||||
x[i:] -> [^]T
|
||||
x[:n] -> []T
|
||||
x[i:n] -> []T
|
||||
*/
|
||||
Type *pointer_type = base_type(t->RelativeMultiPointer.pointer_type);
|
||||
GB_ASSERT(pointer_type->kind == Type_MultiPointer);
|
||||
o->type = alloc_type_slice(pointer_type->MultiPointer.elem);
|
||||
}
|
||||
|
||||
|
||||
@@ -11223,22 +11191,6 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
|
||||
} else if (t->kind == Type_SoaPointer) {
|
||||
o->mode = Addressing_SoaVariable;
|
||||
o->type = type_deref(t);
|
||||
} else if (t->kind == Type_RelativePointer) {
|
||||
if (o->mode != Addressing_Variable) {
|
||||
gbString str = expr_to_string(o->expr);
|
||||
gbString typ = type_to_string(o->type);
|
||||
error(o->expr, "Cannot dereference relative pointer '%s' of type '%s' as it does not have a variable addressing mode", str, typ);
|
||||
gb_string_free(typ);
|
||||
gb_string_free(str);
|
||||
}
|
||||
|
||||
// NOTE(bill): This is required because when dereferencing, the original type has been lost
|
||||
add_type_info_type(c, o->type);
|
||||
|
||||
Type *ptr_type = base_type(t->RelativePointer.pointer_type);
|
||||
GB_ASSERT(ptr_type->kind == Type_Pointer);
|
||||
o->mode = Addressing_Variable;
|
||||
o->type = ptr_type->Pointer.elem;
|
||||
} else {
|
||||
gbString str = expr_to_string(o->expr);
|
||||
gbString typ = type_to_string(o->type);
|
||||
|
||||
@@ -2605,6 +2605,7 @@ gb_internal void check_for_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
|
||||
if (cond && cond->kind == Ast_BinaryExpr &&
|
||||
cond->BinaryExpr.left && cond->BinaryExpr.right &&
|
||||
cond->BinaryExpr.op.kind == Token_GtEq &&
|
||||
type_of_expr(cond->BinaryExpr.left) != nullptr &&
|
||||
is_type_unsigned(type_of_expr(cond->BinaryExpr.left)) &&
|
||||
cond->BinaryExpr.right->tav.value.kind == ExactValue_Integer &&
|
||||
is_exact_value_zero(cond->BinaryExpr.right->tav.value)) {
|
||||
@@ -2612,6 +2613,7 @@ gb_internal void check_for_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
|
||||
} else if (cond && cond->kind == Ast_BinaryExpr &&
|
||||
cond->BinaryExpr.left && cond->BinaryExpr.right &&
|
||||
cond->BinaryExpr.op.kind == Token_LtEq &&
|
||||
type_of_expr(cond->BinaryExpr.right) != nullptr &&
|
||||
is_type_unsigned(type_of_expr(cond->BinaryExpr.right)) &&
|
||||
cond->BinaryExpr.left->tav.value.kind == ExactValue_Integer &&
|
||||
is_exact_value_zero(cond->BinaryExpr.left->tav.value)) {
|
||||
|
||||
+3
-37
@@ -2366,8 +2366,7 @@ gb_internal Type *check_get_results(CheckerContext *ctx, Scope *scope, Ast *_res
|
||||
}
|
||||
|
||||
gb_internal void check_procedure_param_polymorphic_type(CheckerContext *ctx, Type *type, Ast *type_expr) {
|
||||
GB_ASSERT_NOT_NULL(type_expr);
|
||||
if (type == nullptr || ctx->in_polymorphic_specialization) { return; }
|
||||
if (type == nullptr || type_expr == nullptr || ctx->in_polymorphic_specialization) { return; }
|
||||
if (!is_type_polymorphic_record_unspecialized(type)) { return; }
|
||||
|
||||
bool invalid_polymorpic_type_use = false;
|
||||
@@ -3517,41 +3516,8 @@ gb_internal bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, T
|
||||
case_end;
|
||||
|
||||
case_ast_node(rt, RelativeType, e);
|
||||
GB_ASSERT(rt->tag->kind == Ast_CallExpr);
|
||||
ast_node(ce, CallExpr, rt->tag);
|
||||
|
||||
Type *base_integer = nullptr;
|
||||
|
||||
if (ce->args.count != 1) {
|
||||
error(rt->type, "#relative expected 1 type argument, got %td", ce->args.count);
|
||||
} else {
|
||||
base_integer = check_type(ctx, ce->args[0]);
|
||||
if (!is_type_integer(base_integer)) {
|
||||
error(rt->type, "#relative base types must be an integer");
|
||||
base_integer = nullptr;
|
||||
} else if (type_size_of(base_integer) > 64) {
|
||||
error(rt->type, "#relative base integer types be less than or equal to 64-bits");
|
||||
base_integer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Type *relative_type = nullptr;
|
||||
Type *base_type = check_type(ctx, rt->type);
|
||||
if (!is_type_pointer(base_type) && !is_type_multi_pointer(base_type)) {
|
||||
error(rt->type, "#relative types can only be a pointer or multi-pointer");
|
||||
relative_type = base_type;
|
||||
} else if (base_integer == nullptr) {
|
||||
relative_type = base_type;
|
||||
} else {
|
||||
if (is_type_pointer(base_type)) {
|
||||
relative_type = alloc_type_relative_pointer(base_type, base_integer);
|
||||
} else if (is_type_multi_pointer(base_type)) {
|
||||
relative_type = alloc_type_relative_multi_pointer(base_type, base_integer);
|
||||
}
|
||||
}
|
||||
GB_ASSERT(relative_type != nullptr);
|
||||
|
||||
*type = relative_type;
|
||||
error(e, "#relative types have been removed from the compiler. Prefer \"core:relative\".");
|
||||
*type = t_invalid;
|
||||
set_base_type(named_type, *type);
|
||||
return true;
|
||||
case_end;
|
||||
|
||||
@@ -2186,16 +2186,6 @@ gb_internal void add_type_info_type_internal(CheckerContext *c, Type *t) {
|
||||
add_type_info_type_internal(c, bt->SimdVector.elem);
|
||||
break;
|
||||
|
||||
case Type_RelativePointer:
|
||||
add_type_info_type_internal(c, bt->RelativePointer.pointer_type);
|
||||
add_type_info_type_internal(c, bt->RelativePointer.base_integer);
|
||||
break;
|
||||
|
||||
case Type_RelativeMultiPointer:
|
||||
add_type_info_type_internal(c, bt->RelativeMultiPointer.pointer_type);
|
||||
add_type_info_type_internal(c, bt->RelativeMultiPointer.base_integer);
|
||||
break;
|
||||
|
||||
case Type_Matrix:
|
||||
add_type_info_type_internal(c, bt->Matrix.elem);
|
||||
break;
|
||||
@@ -2441,16 +2431,6 @@ gb_internal void add_min_dep_type_info(Checker *c, Type *t) {
|
||||
add_min_dep_type_info(c, bt->SimdVector.elem);
|
||||
break;
|
||||
|
||||
case Type_RelativePointer:
|
||||
add_min_dep_type_info(c, bt->RelativePointer.pointer_type);
|
||||
add_min_dep_type_info(c, bt->RelativePointer.base_integer);
|
||||
break;
|
||||
|
||||
case Type_RelativeMultiPointer:
|
||||
add_min_dep_type_info(c, bt->RelativeMultiPointer.pointer_type);
|
||||
add_min_dep_type_info(c, bt->RelativeMultiPointer.base_integer);
|
||||
break;
|
||||
|
||||
case Type_Matrix:
|
||||
add_min_dep_type_info(c, bt->Matrix.elem);
|
||||
break;
|
||||
@@ -3075,8 +3055,6 @@ gb_internal void init_core_type_info(Checker *c) {
|
||||
t_type_info_map = find_core_type(c, str_lit("Type_Info_Map"));
|
||||
t_type_info_bit_set = find_core_type(c, str_lit("Type_Info_Bit_Set"));
|
||||
t_type_info_simd_vector = find_core_type(c, str_lit("Type_Info_Simd_Vector"));
|
||||
t_type_info_relative_pointer = find_core_type(c, str_lit("Type_Info_Relative_Pointer"));
|
||||
t_type_info_relative_multi_pointer = find_core_type(c, str_lit("Type_Info_Relative_Multi_Pointer"));
|
||||
t_type_info_matrix = find_core_type(c, str_lit("Type_Info_Matrix"));
|
||||
t_type_info_soa_pointer = find_core_type(c, str_lit("Type_Info_Soa_Pointer"));
|
||||
t_type_info_bit_field = find_core_type(c, str_lit("Type_Info_Bit_Field"));
|
||||
@@ -3105,8 +3083,6 @@ gb_internal void init_core_type_info(Checker *c) {
|
||||
t_type_info_map_ptr = alloc_type_pointer(t_type_info_map);
|
||||
t_type_info_bit_set_ptr = alloc_type_pointer(t_type_info_bit_set);
|
||||
t_type_info_simd_vector_ptr = alloc_type_pointer(t_type_info_simd_vector);
|
||||
t_type_info_relative_pointer_ptr = alloc_type_pointer(t_type_info_relative_pointer);
|
||||
t_type_info_relative_multi_pointer_ptr = alloc_type_pointer(t_type_info_relative_multi_pointer);
|
||||
t_type_info_matrix_ptr = alloc_type_pointer(t_type_info_matrix);
|
||||
t_type_info_soa_pointer_ptr = alloc_type_pointer(t_type_info_soa_pointer);
|
||||
t_type_info_bit_field_ptr = alloc_type_pointer(t_type_info_bit_field);
|
||||
|
||||
+1
-2
@@ -79,8 +79,7 @@ enum OdinDocTypeKind : u32 {
|
||||
OdinDocType_SOAStructFixed = 17,
|
||||
OdinDocType_SOAStructSlice = 18,
|
||||
OdinDocType_SOAStructDynamic = 19,
|
||||
OdinDocType_RelativePointer = 20,
|
||||
OdinDocType_RelativeMultiPointer = 21,
|
||||
|
||||
OdinDocType_MultiPointer = 22,
|
||||
OdinDocType_Matrix = 23,
|
||||
OdinDocType_SoaPointer = 24,
|
||||
|
||||
@@ -776,24 +776,6 @@ gb_internal OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
|
||||
doc_type.types = odin_doc_type_as_slice(w, type->SimdVector.elem);
|
||||
// TODO(bill):
|
||||
break;
|
||||
case Type_RelativePointer:
|
||||
doc_type.kind = OdinDocType_RelativePointer;
|
||||
{
|
||||
OdinDocTypeIndex types[2] = {};
|
||||
types[0] = odin_doc_type(w, type->RelativePointer.pointer_type);
|
||||
types[1] = odin_doc_type(w, type->RelativePointer.base_integer);
|
||||
doc_type.types = odin_write_slice(w, types, gb_count_of(types));
|
||||
}
|
||||
break;
|
||||
case Type_RelativeMultiPointer:
|
||||
doc_type.kind = OdinDocType_RelativeMultiPointer;
|
||||
{
|
||||
OdinDocTypeIndex types[2] = {};
|
||||
types[0] = odin_doc_type(w, type->RelativeMultiPointer.pointer_type);
|
||||
types[1] = odin_doc_type(w, type->RelativeMultiPointer.base_integer);
|
||||
doc_type.types = odin_write_slice(w, types, gb_count_of(types));
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Matrix:
|
||||
doc_type.kind = OdinDocType_Matrix;
|
||||
|
||||
+5
-1
@@ -370,7 +370,11 @@ gb_internal ExactValue exact_value_from_basic_literal(TokenKind kind, String con
|
||||
}
|
||||
case Token_Rune: {
|
||||
Rune r = GB_RUNE_INVALID;
|
||||
utf8_decode(string.text, string.len, &r);
|
||||
if (string.len == 1) {
|
||||
r = cast(Rune)string.text[0];
|
||||
} else {
|
||||
utf8_decode(string.text, string.len, &r);
|
||||
}
|
||||
return exact_value_i64(r);
|
||||
}
|
||||
}
|
||||
|
||||
+49
-23
@@ -167,8 +167,10 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
|
||||
if (is_windows) {
|
||||
String section_name = str_lit("msvc-link");
|
||||
if (build_context.use_lld) {
|
||||
section_name = str_lit("lld-link");
|
||||
switch (build_context.linker_choice) {
|
||||
case Linker_Default: break;
|
||||
case Linker_lld: section_name = str_lit("lld-link"); break;
|
||||
case Linker_radlink: section_name = str_lit("rad-link"); break;
|
||||
}
|
||||
timings_start_section(timings, section_name);
|
||||
|
||||
@@ -304,7 +306,48 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
String windows_sdk_bin_path = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_Win_SDK_Bin_Path]);
|
||||
defer (gb_free(heap_allocator(), windows_sdk_bin_path.text));
|
||||
|
||||
if (!build_context.use_lld) { // msvc
|
||||
switch (build_context.linker_choice) {
|
||||
case Linker_lld:
|
||||
result = system_exec_command_line_app("msvc-lld-link",
|
||||
"\"%.*s\\bin\\lld-link\" %s -OUT:\"%.*s\" %s "
|
||||
"/nologo /incremental:no /opt:ref /subsystem:%.*s "
|
||||
"%.*s "
|
||||
"%.*s "
|
||||
"%s "
|
||||
"",
|
||||
LIT(build_context.ODIN_ROOT), object_files, LIT(output_filename),
|
||||
link_settings,
|
||||
LIT(build_context.ODIN_WINDOWS_SUBSYSTEM),
|
||||
LIT(build_context.link_flags),
|
||||
LIT(build_context.extra_linker_flags),
|
||||
lib_str
|
||||
);
|
||||
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case Linker_radlink:
|
||||
result = system_exec_command_line_app("msvc-rad-link",
|
||||
"\"%.*s\\bin\\radlink\" %s -OUT:\"%.*s\" %s "
|
||||
"/nologo /incremental:no /opt:ref /subsystem:%.*s "
|
||||
"%.*s "
|
||||
"%.*s "
|
||||
"%s "
|
||||
"",
|
||||
LIT(build_context.ODIN_ROOT), object_files, LIT(output_filename),
|
||||
link_settings,
|
||||
LIT(build_context.ODIN_WINDOWS_SUBSYSTEM),
|
||||
LIT(build_context.link_flags),
|
||||
LIT(build_context.extra_linker_flags),
|
||||
lib_str
|
||||
);
|
||||
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
default: { // msvc
|
||||
String res_path = quote_path(heap_allocator(), build_context.build_paths[BuildPath_RES]);
|
||||
String rc_path = quote_path(heap_allocator(), build_context.build_paths[BuildPath_RC]);
|
||||
defer (gb_free(heap_allocator(), res_path.text));
|
||||
@@ -365,25 +408,8 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
} else { // lld
|
||||
result = system_exec_command_line_app("msvc-lld-link",
|
||||
"\"%.*s\\bin\\lld-link\" %s -OUT:\"%.*s\" %s "
|
||||
"/nologo /incremental:no /opt:ref /subsystem:%.*s "
|
||||
"%.*s "
|
||||
"%.*s "
|
||||
"%s "
|
||||
"",
|
||||
LIT(build_context.ODIN_ROOT), object_files, LIT(output_filename),
|
||||
link_settings,
|
||||
LIT(build_context.ODIN_WINDOWS_SUBSYSTEM),
|
||||
LIT(build_context.link_flags),
|
||||
LIT(build_context.extra_linker_flags),
|
||||
lib_str
|
||||
);
|
||||
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
timings_start_section(timings, str_lit("ld-link"));
|
||||
@@ -679,7 +705,7 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
link_command_line = gb_string_append_fmt(link_command_line, " %.*s ", LIT(build_context.extra_linker_flags));
|
||||
link_command_line = gb_string_append_fmt(link_command_line, " %s ", link_settings);
|
||||
|
||||
if (build_context.use_lld) {
|
||||
if (build_context.linker_choice == Linker_lld) {
|
||||
link_command_line = gb_string_append_fmt(link_command_line, " -fuse-ld=lld");
|
||||
result = system_exec_command_line_app("lld-link", link_command_line);
|
||||
} else {
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
#define LB_USE_NEW_PASS_SYSTEM 0
|
||||
#endif
|
||||
|
||||
#if LLVM_VERSION_MAJOR >= 19
|
||||
#define LLVMDIBuilderInsertDeclareAtEnd(...) LLVMDIBuilderInsertDeclareRecordAtEnd(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
gb_internal bool lb_use_new_pass_system(void) {
|
||||
return LB_USE_NEW_PASS_SYSTEM;
|
||||
}
|
||||
@@ -75,7 +79,6 @@ enum lbAddrKind {
|
||||
lbAddr_Context,
|
||||
lbAddr_SoaVariable,
|
||||
|
||||
lbAddr_RelativePointer,
|
||||
|
||||
lbAddr_Swizzle,
|
||||
lbAddr_SwizzleLarge,
|
||||
@@ -103,9 +106,6 @@ struct lbAddr {
|
||||
lbValue index;
|
||||
Ast *node;
|
||||
} index_set;
|
||||
struct {
|
||||
bool deref;
|
||||
} relative;
|
||||
struct {
|
||||
Type *type;
|
||||
u8 count; // 2, 3, or 4 components
|
||||
@@ -741,4 +741,4 @@ gb_global char const *llvm_linkage_strings[] = {
|
||||
"linker private weak linkage"
|
||||
};
|
||||
|
||||
#define ODIN_METADATA_IS_PACKED str_lit("odin-is-packed")
|
||||
#define ODIN_METADATA_IS_PACKED str_lit("odin-is-packed")
|
||||
|
||||
@@ -920,17 +920,6 @@ gb_internal LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
|
||||
elem, subscripts, gb_count_of(subscripts));
|
||||
}
|
||||
|
||||
case Type_RelativePointer: {
|
||||
LLVMMetadataRef base_integer = lb_debug_type(m, type->RelativePointer.base_integer);
|
||||
gbString name = type_to_string(type, temporary_allocator());
|
||||
return LLVMDIBuilderCreateTypedef(m->debug_builder, base_integer, name, gb_string_length(name), nullptr, 0, nullptr, cast(u32)(8*type_align_of(type)));
|
||||
}
|
||||
case Type_RelativeMultiPointer: {
|
||||
LLVMMetadataRef base_integer = lb_debug_type(m, type->RelativeMultiPointer.base_integer);
|
||||
gbString name = type_to_string(type, temporary_allocator());
|
||||
return LLVMDIBuilderCreateTypedef(m->debug_builder, base_integer, name, gb_string_length(name), nullptr, 0, nullptr, cast(u32)(8*type_align_of(type)));
|
||||
}
|
||||
|
||||
case Type_Matrix: {
|
||||
LLVMMetadataRef subscripts[1] = {};
|
||||
subscripts[0] = LLVMDIBuilderGetOrCreateSubrange(m->debug_builder,
|
||||
|
||||
+11
-38
@@ -4200,30 +4200,6 @@ gb_internal lbAddr lb_build_addr_index_expr(lbProcedure *p, Ast *expr) {
|
||||
return lb_addr(v);
|
||||
}
|
||||
|
||||
case Type_RelativeMultiPointer: {
|
||||
lbAddr rel_ptr_addr = {};
|
||||
if (deref) {
|
||||
lbValue rel_ptr_ptr = lb_build_expr(p, ie->expr);
|
||||
rel_ptr_addr = lb_addr(rel_ptr_ptr);
|
||||
} else {
|
||||
rel_ptr_addr = lb_build_addr(p, ie->expr);
|
||||
}
|
||||
lbValue rel_ptr = lb_relative_pointer_to_pointer(p, rel_ptr_addr);
|
||||
|
||||
lbValue index = lb_build_expr(p, ie->index);
|
||||
index = lb_emit_conv(p, index, t_int);
|
||||
lbValue v = {};
|
||||
|
||||
Type *pointer_type = base_type(t->RelativeMultiPointer.pointer_type);
|
||||
GB_ASSERT(pointer_type->kind == Type_MultiPointer);
|
||||
Type *elem = pointer_type->MultiPointer.elem;
|
||||
|
||||
LLVMValueRef indices[1] = {index.value};
|
||||
v.value = LLVMBuildGEP2(p->builder, lb_type(p->module, elem), rel_ptr.value, indices, 1, "");
|
||||
v.type = alloc_type_pointer(elem);
|
||||
return lb_addr(v);
|
||||
}
|
||||
|
||||
case Type_DynamicArray: {
|
||||
lbValue dynamic_array = {};
|
||||
dynamic_array = lb_build_expr(p, ie->expr);
|
||||
@@ -4333,13 +4309,6 @@ gb_internal lbAddr lb_build_addr_slice_expr(lbProcedure *p, Ast *expr) {
|
||||
return slice;
|
||||
}
|
||||
|
||||
case Type_RelativePointer:
|
||||
GB_PANIC("TODO(bill): Type_RelativePointer should be handled above already on the lb_addr_load");
|
||||
break;
|
||||
case Type_RelativeMultiPointer:
|
||||
GB_PANIC("TODO(bill): Type_RelativeMultiPointer should be handled above already on the lb_addr_load");
|
||||
break;
|
||||
|
||||
case Type_DynamicArray: {
|
||||
Type *elem_type = type->DynamicArray.elem;
|
||||
Type *slice_type = alloc_type_slice(elem_type);
|
||||
@@ -4605,7 +4574,11 @@ gb_internal lbAddr lb_build_addr_compound_lit(lbProcedure *p, Ast *expr) {
|
||||
auto const &f = fields[i];
|
||||
|
||||
LLVMValueRef mask = LLVMConstInt(lit, 1, false);
|
||||
mask = LLVMConstShl(mask, LLVMConstInt(lit, f.bit_size, false));
|
||||
#if LLVM_VERSION_MAJOR >= 19
|
||||
mask = LLVMBuildShl(p->builder, mask, LLVMConstInt(lit, f.bit_size, false), "");
|
||||
#else
|
||||
mask = LLVMConstShl(mask, LLVMConstInt(lit, f.bit_size, false));
|
||||
#endif
|
||||
mask = LLVMConstSub(mask, LLVMConstInt(lit, 1, false));
|
||||
|
||||
LLVMValueRef elem = values[i].value;
|
||||
@@ -4653,7 +4626,11 @@ gb_internal lbAddr lb_build_addr_compound_lit(lbProcedure *p, Ast *expr) {
|
||||
bits_to_set -= mask_width;
|
||||
|
||||
LLVMValueRef mask = LLVMConstInt(vt, 1, false);
|
||||
mask = LLVMConstShl(mask, LLVMConstInt(vt, mask_width, false));
|
||||
#if LLVM_VERSION_MAJOR >= 19
|
||||
mask = LLVMBuildShl(p->builder, mask, LLVMConstInt(vt, mask_width, false), "");
|
||||
#else
|
||||
mask = LLVMConstShl(mask, LLVMConstInt(vt, mask_width, false));
|
||||
#endif
|
||||
mask = LLVMConstSub(mask, LLVMConstInt(vt, 1, false));
|
||||
|
||||
LLVMValueRef to_set = LLVMBuildAnd(p->builder, val, mask, "");
|
||||
@@ -5343,11 +5320,7 @@ gb_internal lbAddr lb_build_addr_internal(lbProcedure *p, Ast *expr) {
|
||||
|
||||
case_ast_node(de, DerefExpr, expr);
|
||||
Type *t = type_of_expr(de->expr);
|
||||
if (is_type_relative_pointer(t)) {
|
||||
lbAddr addr = lb_build_addr(p, de->expr);
|
||||
addr.relative.deref = true;
|
||||
return addr;
|
||||
} else if (is_type_soa_pointer(t)) {
|
||||
if (is_type_soa_pointer(t)) {
|
||||
lbValue value = lb_build_expr(p, de->expr);
|
||||
lbValue ptr = lb_emit_struct_ev(p, value, 0);
|
||||
lbValue idx = lb_emit_struct_ev(p, value, 1);
|
||||
|
||||
@@ -409,14 +409,6 @@ gb_internal lbModule *lb_module_of_entity(lbGenerator *gen, Entity *e) {
|
||||
|
||||
gb_internal lbAddr lb_addr(lbValue addr) {
|
||||
lbAddr v = {lbAddr_Default, addr};
|
||||
if (addr.type != nullptr && is_type_relative_pointer(type_deref(addr.type))) {
|
||||
GB_ASSERT(is_type_pointer(addr.type));
|
||||
v.kind = lbAddr_RelativePointer;
|
||||
} else if (addr.type != nullptr && is_type_relative_multi_pointer(type_deref(addr.type))) {
|
||||
GB_ASSERT(is_type_pointer(addr.type) ||
|
||||
is_type_multi_pointer(addr.type));
|
||||
v.kind = lbAddr_RelativePointer;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -501,42 +493,6 @@ gb_internal Type *lb_addr_type(lbAddr const &addr) {
|
||||
return type_deref(addr.addr.type);
|
||||
}
|
||||
|
||||
|
||||
gb_internal lbValue lb_relative_pointer_to_pointer(lbProcedure *p, lbAddr const &addr) {
|
||||
GB_ASSERT(addr.kind == lbAddr_RelativePointer);
|
||||
|
||||
Type *t = base_type(lb_addr_type(addr));
|
||||
GB_ASSERT(is_type_relative_pointer(t) || is_type_relative_multi_pointer(t));
|
||||
|
||||
Type *pointer_type = nullptr;
|
||||
Type *base_integer = nullptr;
|
||||
if (t->kind == Type_RelativePointer) {
|
||||
pointer_type = t->RelativePointer.pointer_type;
|
||||
base_integer = t->RelativePointer.base_integer;
|
||||
} else if (t->kind == Type_RelativeMultiPointer) {
|
||||
pointer_type = t->RelativeMultiPointer.pointer_type;
|
||||
base_integer = t->RelativeMultiPointer.base_integer;
|
||||
}
|
||||
|
||||
lbValue ptr = lb_emit_conv(p, addr.addr, t_uintptr);
|
||||
lbValue offset = lb_emit_conv(p, ptr, alloc_type_pointer(base_integer));
|
||||
offset = lb_emit_load(p, offset);
|
||||
|
||||
if (!is_type_unsigned(base_integer)) {
|
||||
offset = lb_emit_conv(p, offset, t_i64);
|
||||
}
|
||||
offset = lb_emit_conv(p, offset, t_uintptr);
|
||||
lbValue absolute_ptr = lb_emit_arith(p, Token_Add, ptr, offset, t_uintptr);
|
||||
absolute_ptr = lb_emit_conv(p, absolute_ptr, pointer_type);
|
||||
|
||||
lbValue cond = lb_emit_comp(p, Token_CmpEq, offset, lb_const_nil(p->module, base_integer));
|
||||
|
||||
// NOTE(bill): nil check
|
||||
lbValue nil_ptr = lb_const_nil(p->module, pointer_type);
|
||||
lbValue final_ptr = lb_emit_select(p, cond, nil_ptr, absolute_ptr);
|
||||
return final_ptr;
|
||||
}
|
||||
|
||||
gb_internal lbValue lb_make_soa_pointer(lbProcedure *p, Type *type, lbValue const &addr, lbValue const &index) {
|
||||
lbAddr v = lb_add_local_generated(p, type, false);
|
||||
lbValue ptr = lb_emit_struct_ep(p, v.addr, 0);
|
||||
@@ -557,9 +513,6 @@ gb_internal lbValue lb_addr_get_ptr(lbProcedure *p, lbAddr const &addr) {
|
||||
case lbAddr_Map:
|
||||
return lb_internal_dynamic_map_get_ptr(p, addr.addr, addr.map.key);
|
||||
|
||||
case lbAddr_RelativePointer:
|
||||
return lb_relative_pointer_to_pointer(p, addr);
|
||||
|
||||
case lbAddr_SoaVariable:
|
||||
{
|
||||
Type *soa_ptr_type = alloc_type_soa_pointer(lb_addr_type(addr));
|
||||
@@ -584,9 +537,6 @@ gb_internal lbValue lb_addr_get_ptr(lbProcedure *p, lbAddr const &addr) {
|
||||
|
||||
gb_internal lbValue lb_build_addr_ptr(lbProcedure *p, Ast *expr) {
|
||||
lbAddr addr = lb_build_addr(p, expr);
|
||||
if (addr.kind == lbAddr_RelativePointer) {
|
||||
return addr.addr;
|
||||
}
|
||||
return lb_addr_get_ptr(p, addr);
|
||||
}
|
||||
|
||||
@@ -819,10 +769,6 @@ gb_internal void lb_addr_store(lbProcedure *p, lbAddr addr, lbValue value) {
|
||||
value.value = LLVMConstNull(lb_type(p->module, t));
|
||||
}
|
||||
|
||||
if (addr.kind == lbAddr_RelativePointer && addr.relative.deref) {
|
||||
addr = lb_addr(lb_address_from_load(p, lb_addr_load(p, addr)));
|
||||
}
|
||||
|
||||
if (addr.kind == lbAddr_BitField) {
|
||||
lbValue dst = addr.addr;
|
||||
if (is_type_endian_big(addr.bitfield.type)) {
|
||||
@@ -860,44 +806,6 @@ gb_internal void lb_addr_store(lbProcedure *p, lbAddr addr, lbValue value) {
|
||||
lb_emit_runtime_call(p, "__write_bits", args);
|
||||
}
|
||||
return;
|
||||
} else if (addr.kind == lbAddr_RelativePointer) {
|
||||
Type *rel_ptr = base_type(lb_addr_type(addr));
|
||||
GB_ASSERT(rel_ptr->kind == Type_RelativePointer ||
|
||||
rel_ptr->kind == Type_RelativeMultiPointer);
|
||||
Type *pointer_type = nullptr;
|
||||
Type *base_integer = nullptr;
|
||||
|
||||
if (rel_ptr->kind == Type_RelativePointer) {
|
||||
pointer_type = rel_ptr->RelativePointer.pointer_type;
|
||||
base_integer = rel_ptr->RelativePointer.base_integer;
|
||||
} else if (rel_ptr->kind == Type_RelativeMultiPointer) {
|
||||
pointer_type = rel_ptr->RelativeMultiPointer.pointer_type;
|
||||
base_integer = rel_ptr->RelativeMultiPointer.base_integer;
|
||||
}
|
||||
|
||||
value = lb_emit_conv(p, value, pointer_type);
|
||||
|
||||
GB_ASSERT(is_type_pointer(addr.addr.type));
|
||||
lbValue ptr = lb_emit_conv(p, addr.addr, t_uintptr);
|
||||
lbValue val_ptr = lb_emit_conv(p, value, t_uintptr);
|
||||
lbValue offset = {};
|
||||
offset.value = LLVMBuildSub(p->builder, val_ptr.value, ptr.value, "");
|
||||
offset.type = t_uintptr;
|
||||
|
||||
if (!is_type_unsigned(base_integer)) {
|
||||
offset = lb_emit_conv(p, offset, t_i64);
|
||||
}
|
||||
offset = lb_emit_conv(p, offset, base_integer);
|
||||
|
||||
lbValue offset_ptr = lb_emit_conv(p, addr.addr, alloc_type_pointer(base_integer));
|
||||
offset = lb_emit_select(p,
|
||||
lb_emit_comp(p, Token_CmpEq, val_ptr, lb_const_nil(p->module, t_uintptr)),
|
||||
lb_const_nil(p->module, base_integer),
|
||||
offset
|
||||
);
|
||||
LLVMBuildStore(p->builder, offset.value, offset_ptr.value);
|
||||
return;
|
||||
|
||||
} else if (addr.kind == lbAddr_Map) {
|
||||
lb_internal_dynamic_map_set(p, addr.addr, addr.map.type, addr.map.key, value, p->curr_stmt);
|
||||
return;
|
||||
@@ -1246,46 +1154,6 @@ gb_internal lbValue lb_addr_load(lbProcedure *p, lbAddr const &addr) {
|
||||
}
|
||||
|
||||
return r;
|
||||
} else if (addr.kind == lbAddr_RelativePointer) {
|
||||
Type *rel_ptr = base_type(lb_addr_type(addr));
|
||||
Type *base_integer = nullptr;
|
||||
Type *pointer_type = nullptr;
|
||||
GB_ASSERT(rel_ptr->kind == Type_RelativePointer ||
|
||||
rel_ptr->kind == Type_RelativeMultiPointer);
|
||||
|
||||
if (rel_ptr->kind == Type_RelativePointer) {
|
||||
base_integer = rel_ptr->RelativePointer.base_integer;
|
||||
pointer_type = rel_ptr->RelativePointer.pointer_type;
|
||||
} else if (rel_ptr->kind == Type_RelativeMultiPointer) {
|
||||
base_integer = rel_ptr->RelativeMultiPointer.base_integer;
|
||||
pointer_type = rel_ptr->RelativeMultiPointer.pointer_type;
|
||||
}
|
||||
|
||||
lbValue ptr = lb_emit_conv(p, addr.addr, t_uintptr);
|
||||
lbValue offset = lb_emit_conv(p, ptr, alloc_type_pointer(base_integer));
|
||||
offset = lb_emit_load(p, offset);
|
||||
|
||||
|
||||
if (!is_type_unsigned(base_integer)) {
|
||||
offset = lb_emit_conv(p, offset, t_i64);
|
||||
}
|
||||
offset = lb_emit_conv(p, offset, t_uintptr);
|
||||
lbValue absolute_ptr = lb_emit_arith(p, Token_Add, ptr, offset, t_uintptr);
|
||||
absolute_ptr = lb_emit_conv(p, absolute_ptr, pointer_type);
|
||||
|
||||
lbValue cond = lb_emit_comp(p, Token_CmpEq, offset, lb_const_nil(p->module, base_integer));
|
||||
|
||||
// NOTE(bill): nil check
|
||||
lbValue nil_ptr = lb_const_nil(p->module, pointer_type);
|
||||
lbValue final_ptr = {};
|
||||
final_ptr.type = absolute_ptr.type;
|
||||
final_ptr.value = LLVMBuildSelect(p->builder, cond.value, nil_ptr.value, absolute_ptr.value, "");
|
||||
|
||||
if (rel_ptr->kind == Type_RelativeMultiPointer) {
|
||||
return final_ptr;
|
||||
}
|
||||
return lb_emit_load(p, final_ptr);
|
||||
|
||||
} else if (addr.kind == lbAddr_Map) {
|
||||
Type *map_type = base_type(type_deref(addr.addr.type));
|
||||
GB_ASSERT(map_type->kind == Type_Map);
|
||||
@@ -2378,13 +2246,6 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
|
||||
|
||||
case Type_SimdVector:
|
||||
return LLVMVectorType(lb_type(m, type->SimdVector.elem), cast(unsigned)type->SimdVector.count);
|
||||
|
||||
case Type_RelativePointer:
|
||||
return lb_type_internal(m, type->RelativePointer.base_integer);
|
||||
case Type_RelativeMultiPointer:
|
||||
return lb_type_internal(m, type->RelativeMultiPointer.base_integer);
|
||||
|
||||
|
||||
|
||||
case Type_Matrix:
|
||||
{
|
||||
@@ -2740,7 +2601,7 @@ general_end:;
|
||||
GB_ASSERT(p->decl_block != p->curr_block);
|
||||
|
||||
i64 max_align = gb_max(lb_alignof(src_type), lb_alignof(dst_type));
|
||||
max_align = gb_max(max_align, 4);
|
||||
max_align = gb_max(max_align, 16);
|
||||
|
||||
LLVMValueRef ptr = llvm_alloca(p, dst_type, max_align);
|
||||
|
||||
|
||||
@@ -579,6 +579,8 @@ gb_internal void lb_begin_procedure_body(lbProcedure *p) {
|
||||
p->raw_input_parameters = array_make<LLVMValueRef>(permanent_allocator(), raw_input_parameters_count);
|
||||
LLVMGetParams(p->value, p->raw_input_parameters.data);
|
||||
|
||||
bool is_odin_cc = is_calling_convention_odin(ft->calling_convention);
|
||||
|
||||
unsigned param_index = 0;
|
||||
for_array(i, params->variables) {
|
||||
Entity *e = params->variables[i];
|
||||
@@ -613,9 +615,26 @@ gb_internal void lb_begin_procedure_body(lbProcedure *p) {
|
||||
}
|
||||
} else if (arg_type->kind == lbArg_Indirect) {
|
||||
if (e->token.string.len != 0 && !is_blank_ident(e->token.string)) {
|
||||
i64 sz = type_size_of(e->type);
|
||||
bool do_callee_copy = false;
|
||||
|
||||
if (is_odin_cc) {
|
||||
do_callee_copy = sz <= 16;
|
||||
if (build_context.internal_by_value) {
|
||||
do_callee_copy = true;
|
||||
}
|
||||
}
|
||||
|
||||
lbValue ptr = {};
|
||||
ptr.value = LLVMGetParam(p->value, param_offset+param_index);
|
||||
ptr.type = alloc_type_pointer(e->type);
|
||||
|
||||
if (do_callee_copy) {
|
||||
lbValue new_ptr = lb_add_local_generated(p, e->type, false).addr;
|
||||
lb_mem_copy_non_overlapping(p, new_ptr, ptr, lb_const_int(p->module, t_uint, sz));
|
||||
ptr = new_ptr;
|
||||
}
|
||||
|
||||
lb_add_entity(p->module, e, ptr);
|
||||
lb_add_debug_param_variable(p, ptr.value, e->type, e->token, param_index+1, p->decl_block);
|
||||
}
|
||||
|
||||
@@ -201,6 +201,8 @@ gb_internal void lb_open_scope(lbProcedure *p, Scope *s) {
|
||||
}
|
||||
}
|
||||
|
||||
GB_ASSERT(s != nullptr);
|
||||
p->curr_scope = s;
|
||||
p->scope_index += 1;
|
||||
array_add(&p->scope_stack, s);
|
||||
|
||||
@@ -221,6 +223,10 @@ gb_internal void lb_close_scope(lbProcedure *p, lbDeferExitKind kind, lbBlock *b
|
||||
|
||||
}
|
||||
|
||||
if (p->curr_scope) {
|
||||
p->curr_scope = p->curr_scope->parent;
|
||||
}
|
||||
|
||||
p->scope_index -= 1;
|
||||
array_pop(&p->scope_stack);
|
||||
}
|
||||
|
||||
@@ -61,8 +61,6 @@ gb_internal u64 lb_typeid_kind(lbModule *m, Type *type, u64 id=0) {
|
||||
case Type_Proc: kind = Typeid_Procedure; break;
|
||||
case Type_BitSet: kind = Typeid_Bit_Set; break;
|
||||
case Type_SimdVector: kind = Typeid_Simd_Vector; break;
|
||||
case Type_RelativePointer: kind = Typeid_Relative_Pointer; break;
|
||||
case Type_RelativeMultiPointer: kind = Typeid_Relative_Multi_Pointer; break;
|
||||
case Type_SoaPointer: kind = Typeid_SoaPointer; break;
|
||||
case Type_BitField: kind = Typeid_Bit_Field; break;
|
||||
}
|
||||
@@ -950,30 +948,6 @@ gb_internal void lb_setup_type_info_data_giant_array(lbModule *m, i64 global_typ
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_RelativePointer:
|
||||
{
|
||||
tag_type = t_type_info_relative_pointer;
|
||||
LLVMValueRef vals[2] = {
|
||||
get_type_info_ptr(m, t->RelativePointer.pointer_type),
|
||||
get_type_info_ptr(m, t->RelativePointer.base_integer),
|
||||
};
|
||||
|
||||
variant_value = llvm_const_named_struct(m, tag_type, vals, gb_count_of(vals));
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_RelativeMultiPointer:
|
||||
{
|
||||
tag_type = t_type_info_relative_multi_pointer;
|
||||
LLVMValueRef vals[2] = {
|
||||
get_type_info_ptr(m, t->RelativeMultiPointer.pointer_type),
|
||||
get_type_info_ptr(m, t->RelativeMultiPointer.base_integer),
|
||||
};
|
||||
|
||||
variant_value = llvm_const_named_struct(m, tag_type, vals, gb_count_of(vals));
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_Matrix:
|
||||
{
|
||||
tag_type = t_type_info_matrix;
|
||||
|
||||
@@ -124,8 +124,16 @@ gb_internal void lb_mem_zero_ptr(lbProcedure *p, LLVMValueRef ptr, Type *type, u
|
||||
switch (kind) {
|
||||
case LLVMStructTypeKind:
|
||||
case LLVMArrayTypeKind:
|
||||
// NOTE(bill): Enforce zeroing through memset to make sure padding is zeroed too
|
||||
lb_mem_zero_ptr_internal(p, ptr, lb_const_int(p->module, t_int, sz).value, alignment, false);
|
||||
if (is_type_tuple(type)) {
|
||||
// NOTE(bill): even though this should be safe, to keep ASAN happy, do not zero the implicit padding at the end
|
||||
GB_ASSERT(type->kind == Type_Tuple);
|
||||
i64 n = type->Tuple.variables.count-1;
|
||||
i64 end_offset = type->Tuple.offsets[n] + type_size_of(type->Tuple.variables[n]->type);
|
||||
lb_mem_zero_ptr_internal(p, ptr, lb_const_int(p->module, t_int, end_offset).value, alignment, false);
|
||||
} else {
|
||||
// NOTE(bill): Enforce zeroing through memset to make sure padding is zeroed too
|
||||
lb_mem_zero_ptr_internal(p, ptr, lb_const_int(p->module, t_int, sz).value, alignment, false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LLVMBuildStore(p->builder, LLVMConstNull(lb_type(p->module, type)), ptr);
|
||||
@@ -1123,10 +1131,6 @@ gb_internal lbValue lb_emit_struct_ep(lbProcedure *p, lbValue s, i32 index) {
|
||||
Type *t = base_type(type_deref(s.type));
|
||||
Type *result_type = nullptr;
|
||||
|
||||
if (is_type_relative_pointer(t)) {
|
||||
s = lb_addr_get_ptr(p, lb_addr(s));
|
||||
}
|
||||
|
||||
if (is_type_struct(t)) {
|
||||
result_type = get_struct_field_type(t, index);
|
||||
} else if (is_type_union(t)) {
|
||||
@@ -1432,8 +1436,6 @@ gb_internal lbValue lb_emit_deep_field_gep(lbProcedure *p, lbValue e, Selection
|
||||
e = lb_emit_array_epi(p, e, index);
|
||||
} else if (type->kind == Type_Map) {
|
||||
e = lb_emit_struct_ep(p, e, index);
|
||||
} else if (type->kind == Type_RelativePointer) {
|
||||
e = lb_emit_struct_ep(p, e, index);
|
||||
} else {
|
||||
GB_PANIC("un-gep-able type %s", type_to_string(type));
|
||||
}
|
||||
|
||||
+492
-377
File diff suppressed because it is too large
Load Diff
@@ -2488,6 +2488,7 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
|
||||
tag = parse_call_expr(f, tag);
|
||||
}
|
||||
Ast *type = parse_type(f);
|
||||
syntax_error(tag, "#relative types have now been removed in favour of \"core:relative\"");
|
||||
return ast_relative_type(f, tag, type);
|
||||
} else if (name.string == "force_inline" ||
|
||||
name.string == "force_no_inline") {
|
||||
|
||||
+35
-5
@@ -412,6 +412,32 @@ gb_internal String concatenate4_strings(gbAllocator a, String const &x, String c
|
||||
return make_string(data, len);
|
||||
}
|
||||
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
gb_internal String escape_char(gbAllocator a, String s, char cte) {
|
||||
isize buf_len = s.len;
|
||||
isize cte_count = 0;
|
||||
for (isize j = 0; j < s.len; j++) {
|
||||
if (s.text[j] == cte) {
|
||||
cte_count++;
|
||||
}
|
||||
}
|
||||
|
||||
u8 *buf = gb_alloc_array(a, u8, buf_len+cte_count);
|
||||
isize i = 0;
|
||||
for (isize j = 0; j < s.len; j++) {
|
||||
u8 c = s.text[j];
|
||||
|
||||
if (c == cte) {
|
||||
buf[i++] = '\\';
|
||||
buf[i++] = c;
|
||||
} else {
|
||||
buf[i++] = c;
|
||||
}
|
||||
}
|
||||
return make_string(buf, i);
|
||||
}
|
||||
#endif
|
||||
|
||||
gb_internal String string_join_and_quote(gbAllocator a, Array<String> strings) {
|
||||
if (!strings.count) {
|
||||
return make_string(nullptr, 0);
|
||||
@@ -427,7 +453,11 @@ gb_internal String string_join_and_quote(gbAllocator a, Array<String> strings) {
|
||||
if (i > 0) {
|
||||
s = gb_string_append_fmt(s, " ");
|
||||
}
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
s = gb_string_append_fmt(s, "\"%.*s\" ", LIT(escape_char(a, strings[i], '\\')));
|
||||
#else
|
||||
s = gb_string_append_fmt(s, "\"%.*s\" ", LIT(strings[i]));
|
||||
#endif
|
||||
}
|
||||
|
||||
return make_string(cast(u8 *) s, gb_string_length(s));
|
||||
@@ -688,12 +718,12 @@ gb_internal bool unquote_char(String s, u8 quote, Rune *rune, bool *multiple_byt
|
||||
Rune r = -1;
|
||||
isize size = utf8_decode(s.text, s.len, &r);
|
||||
*rune = r;
|
||||
*multiple_bytes = true;
|
||||
*tail_string = make_string(s.text+size, s.len-size);
|
||||
if (multiple_bytes) *multiple_bytes = true;
|
||||
if (tail_string) *tail_string = make_string(s.text+size, s.len-size);
|
||||
return true;
|
||||
} else if (s[0] != '\\') {
|
||||
*rune = s[0];
|
||||
*tail_string = make_string(s.text+1, s.len-1);
|
||||
if (tail_string) *tail_string = make_string(s.text+1, s.len-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -779,10 +809,10 @@ gb_internal bool unquote_char(String s, u8 quote, Rune *rune, bool *multiple_byt
|
||||
return false;
|
||||
}
|
||||
*rune = r;
|
||||
*multiple_bytes = true;
|
||||
if (multiple_bytes) *multiple_bytes = true;
|
||||
} break;
|
||||
}
|
||||
*tail_string = s;
|
||||
if (tail_string) *tail_string = s;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+7
-101
@@ -272,14 +272,6 @@ struct TypeProc {
|
||||
Type *elem; \
|
||||
Type *generic_count; \
|
||||
}) \
|
||||
TYPE_KIND(RelativePointer, struct { \
|
||||
Type *pointer_type; \
|
||||
Type *base_integer; \
|
||||
}) \
|
||||
TYPE_KIND(RelativeMultiPointer, struct { \
|
||||
Type *pointer_type; \
|
||||
Type *base_integer; \
|
||||
}) \
|
||||
TYPE_KIND(Matrix, struct { \
|
||||
Type *elem; \
|
||||
i64 row_count; \
|
||||
@@ -367,8 +359,6 @@ enum Typeid_Kind : u8 {
|
||||
Typeid_Map,
|
||||
Typeid_Bit_Set,
|
||||
Typeid_Simd_Vector,
|
||||
Typeid_Relative_Pointer,
|
||||
Typeid_Relative_Multi_Pointer,
|
||||
Typeid_Matrix,
|
||||
Typeid_SoaPointer,
|
||||
Typeid_Bit_Field,
|
||||
@@ -678,8 +668,6 @@ gb_global Type *t_type_info_enum = nullptr;
|
||||
gb_global Type *t_type_info_map = nullptr;
|
||||
gb_global Type *t_type_info_bit_set = nullptr;
|
||||
gb_global Type *t_type_info_simd_vector = nullptr;
|
||||
gb_global Type *t_type_info_relative_pointer = nullptr;
|
||||
gb_global Type *t_type_info_relative_multi_pointer = nullptr;
|
||||
gb_global Type *t_type_info_matrix = nullptr;
|
||||
gb_global Type *t_type_info_soa_pointer = nullptr;
|
||||
gb_global Type *t_type_info_bit_field = nullptr;
|
||||
@@ -708,8 +696,6 @@ gb_global Type *t_type_info_enum_ptr = nullptr;
|
||||
gb_global Type *t_type_info_map_ptr = nullptr;
|
||||
gb_global Type *t_type_info_bit_set_ptr = nullptr;
|
||||
gb_global Type *t_type_info_simd_vector_ptr = nullptr;
|
||||
gb_global Type *t_type_info_relative_pointer_ptr = nullptr;
|
||||
gb_global Type *t_type_info_relative_multi_pointer_ptr = nullptr;
|
||||
gb_global Type *t_type_info_matrix_ptr = nullptr;
|
||||
gb_global Type *t_type_info_soa_pointer_ptr = nullptr;
|
||||
gb_global Type *t_type_info_bit_field_ptr = nullptr;
|
||||
@@ -1118,24 +1104,6 @@ gb_internal Type *alloc_type_bit_field() {
|
||||
return t;
|
||||
}
|
||||
|
||||
gb_internal Type *alloc_type_relative_pointer(Type *pointer_type, Type *base_integer) {
|
||||
GB_ASSERT(is_type_pointer(pointer_type));
|
||||
GB_ASSERT(is_type_integer(base_integer));
|
||||
Type *t = alloc_type(Type_RelativePointer);
|
||||
t->RelativePointer.pointer_type = pointer_type;
|
||||
t->RelativePointer.base_integer = base_integer;
|
||||
return t;
|
||||
}
|
||||
|
||||
gb_internal Type *alloc_type_relative_multi_pointer(Type *pointer_type, Type *base_integer) {
|
||||
GB_ASSERT(is_type_multi_pointer(pointer_type));
|
||||
GB_ASSERT(is_type_integer(base_integer));
|
||||
Type *t = alloc_type(Type_RelativeMultiPointer);
|
||||
t->RelativeMultiPointer.pointer_type = pointer_type;
|
||||
t->RelativeMultiPointer.base_integer = base_integer;
|
||||
return t;
|
||||
}
|
||||
|
||||
gb_internal Type *alloc_type_named(String name, Type *base, Entity *type_name) {
|
||||
Type *t = alloc_type(Type_Named);
|
||||
t->Named.name = name;
|
||||
@@ -1227,8 +1195,6 @@ gb_internal Type *type_deref(Type *t, bool allow_multi_pointer) {
|
||||
switch (bt->kind) {
|
||||
case Type_Pointer:
|
||||
return bt->Pointer.elem;
|
||||
case Type_RelativePointer:
|
||||
return type_deref(bt->RelativePointer.pointer_type);
|
||||
case Type_SoaPointer:
|
||||
{
|
||||
Type *elem = base_type(bt->SoaPointer.elem);
|
||||
@@ -1667,15 +1633,6 @@ gb_internal bool is_type_generic(Type *t) {
|
||||
return t->kind == Type_Generic;
|
||||
}
|
||||
|
||||
gb_internal bool is_type_relative_pointer(Type *t) {
|
||||
t = base_type(t);
|
||||
return t->kind == Type_RelativePointer;
|
||||
}
|
||||
gb_internal bool is_type_relative_multi_pointer(Type *t) {
|
||||
t = base_type(t);
|
||||
return t->kind == Type_RelativeMultiPointer;
|
||||
}
|
||||
|
||||
gb_internal bool is_type_u8_slice(Type *t) {
|
||||
t = base_type(t);
|
||||
if (t->kind == Type_Slice) {
|
||||
@@ -2118,8 +2075,6 @@ gb_internal bool is_type_indexable(Type *t) {
|
||||
return true;
|
||||
case Type_EnumeratedArray:
|
||||
return true;
|
||||
case Type_RelativeMultiPointer:
|
||||
return true;
|
||||
case Type_Matrix:
|
||||
return true;
|
||||
}
|
||||
@@ -2137,8 +2092,6 @@ gb_internal bool is_type_sliceable(Type *t) {
|
||||
return true;
|
||||
case Type_EnumeratedArray:
|
||||
return false;
|
||||
case Type_RelativeMultiPointer:
|
||||
return true;
|
||||
case Type_Matrix:
|
||||
return false;
|
||||
}
|
||||
@@ -2345,27 +2298,7 @@ gb_internal bool is_type_polymorphic(Type *t, bool or_specialized=false) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case Type_RelativeMultiPointer:
|
||||
if (is_type_polymorphic(t->RelativeMultiPointer.pointer_type, or_specialized)) {
|
||||
return true;
|
||||
}
|
||||
if (t->RelativeMultiPointer.base_integer != nullptr &&
|
||||
is_type_polymorphic(t->RelativeMultiPointer.base_integer, or_specialized)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Type_RelativePointer:
|
||||
if (is_type_polymorphic(t->RelativePointer.pointer_type, or_specialized)) {
|
||||
return true;
|
||||
}
|
||||
if (t->RelativePointer.base_integer != nullptr &&
|
||||
is_type_polymorphic(t->RelativePointer.base_integer, or_specialized)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2407,10 +2340,6 @@ gb_internal bool type_has_nil(Type *t) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
case Type_RelativePointer:
|
||||
case Type_RelativeMultiPointer:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2579,10 +2508,6 @@ gb_internal bool is_type_load_safe(Type *type) {
|
||||
}
|
||||
return true;
|
||||
|
||||
case Type_RelativePointer:
|
||||
case Type_RelativeMultiPointer:
|
||||
return true;
|
||||
|
||||
case Type_Pointer:
|
||||
case Type_MultiPointer:
|
||||
case Type_Slice:
|
||||
@@ -3945,11 +3870,6 @@ gb_internal i64 type_align_of_internal(Type *t, TypePath *path) {
|
||||
case Type_Matrix:
|
||||
return matrix_align_of(t, path);
|
||||
|
||||
case Type_RelativePointer:
|
||||
return type_align_of_internal(t->RelativePointer.base_integer, path);
|
||||
case Type_RelativeMultiPointer:
|
||||
return type_align_of_internal(t->RelativeMultiPointer.base_integer, path);
|
||||
|
||||
case Type_SoaPointer:
|
||||
return build_context.int_size;
|
||||
}
|
||||
@@ -3968,6 +3888,10 @@ gb_internal i64 *type_set_offsets_of(Slice<Entity *> const &fields, bool is_pack
|
||||
min_field_align = 1;
|
||||
}
|
||||
|
||||
TypePath path{};
|
||||
type_path_init(&path);
|
||||
defer (type_path_free(&path));
|
||||
|
||||
if (is_raw_union) {
|
||||
for_array(i, fields) {
|
||||
offsets[i] = 0;
|
||||
@@ -3977,7 +3901,7 @@ gb_internal i64 *type_set_offsets_of(Slice<Entity *> const &fields, bool is_pack
|
||||
if (fields[i]->kind != Entity_Variable) {
|
||||
offsets[i] = -1;
|
||||
} else {
|
||||
i64 size = type_size_of(fields[i]->type);
|
||||
i64 size = type_size_of_internal(fields[i]->type, &path);
|
||||
offsets[i] = curr_offset;
|
||||
curr_offset += size;
|
||||
}
|
||||
@@ -3988,11 +3912,11 @@ gb_internal i64 *type_set_offsets_of(Slice<Entity *> const &fields, bool is_pack
|
||||
offsets[i] = -1;
|
||||
} else {
|
||||
Type *t = fields[i]->type;
|
||||
i64 align = gb_max(type_align_of(t), min_field_align);
|
||||
i64 align = gb_max(type_align_of_internal(t, &path), min_field_align);
|
||||
if (max_field_align > min_field_align) {
|
||||
align = gb_min(align, max_field_align);
|
||||
}
|
||||
i64 size = gb_max(type_size_of( t), 0);
|
||||
i64 size = gb_max(type_size_of_internal(t, &path), 0);
|
||||
curr_offset = align_formula(curr_offset, align);
|
||||
offsets[i] = curr_offset;
|
||||
curr_offset += size;
|
||||
@@ -4242,11 +4166,6 @@ gb_internal i64 type_size_of_internal(Type *t, TypePath *path) {
|
||||
|
||||
case Type_BitField:
|
||||
return type_size_of_internal(t->BitField.backing_type, path);
|
||||
|
||||
case Type_RelativePointer:
|
||||
return type_size_of_internal(t->RelativePointer.base_integer, path);
|
||||
case Type_RelativeMultiPointer:
|
||||
return type_size_of_internal(t->RelativeMultiPointer.base_integer, path);
|
||||
}
|
||||
|
||||
// Catch all
|
||||
@@ -4872,19 +4791,6 @@ gb_internal gbString write_type_to_string(gbString str, Type *type, bool shortha
|
||||
str = gb_string_append_fmt(str, "#simd[%d]", cast(int)type->SimdVector.count);
|
||||
str = write_type_to_string(str, type->SimdVector.elem);
|
||||
break;
|
||||
|
||||
case Type_RelativePointer:
|
||||
str = gb_string_append_fmt(str, "#relative(");
|
||||
str = write_type_to_string(str, type->RelativePointer.base_integer);
|
||||
str = gb_string_append_fmt(str, ") ");
|
||||
str = write_type_to_string(str, type->RelativePointer.pointer_type);
|
||||
break;
|
||||
case Type_RelativeMultiPointer:
|
||||
str = gb_string_append_fmt(str, "#relative(");
|
||||
str = write_type_to_string(str, type->RelativePointer.base_integer);
|
||||
str = gb_string_append_fmt(str, ") ");
|
||||
str = write_type_to_string(str, type->RelativePointer.pointer_type);
|
||||
break;
|
||||
|
||||
case Type_Matrix:
|
||||
if (type->Matrix.is_row_major) {
|
||||
|
||||
Reference in New Issue
Block a user