Rename after our recently deceased little dog

This commit is contained in:
David Gonzalez Martin 2024-11-02 14:54:02 -06:00 committed by David
parent c223aed812
commit 6cf81cebec
11 changed files with 57 additions and 55 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
/build/ /build/
/nest/ /bb/
/*.data /*.data
/perf.data* /perf.data*
project project

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(nest) project(bloat-buster)
include(CMakePrintHelpers) include(CMakePrintHelpers)
cmake_print_variables("Build type: ${CMAKE_BUILD_TYPE}") cmake_print_variables("Build type: ${CMAKE_BUILD_TYPE}")
@ -106,7 +106,7 @@ link_directories("${LLVM_LIBDIRS}")
set(LIBRARY_NAME "std") set(LIBRARY_NAME "std")
set(RUNNER_NAME "runner") set(RUNNER_NAME "runner")
set(COMPILER_NAME "nest") set(COMPILER_NAME "bb")
add_library("${LIBRARY_NAME}" add_library("${LIBRARY_NAME}"
"bootstrap/std/base.c" "bootstrap/std/base.c"
@ -121,9 +121,9 @@ add_executable("${RUNNER_NAME}" "bootstrap/runner/runner.c")
target_link_libraries(${RUNNER_NAME} PRIVATE ${LIBRARY_NAME}) target_link_libraries(${RUNNER_NAME} PRIVATE ${LIBRARY_NAME})
add_executable("${COMPILER_NAME}" add_executable("${COMPILER_NAME}"
"bootstrap/nest/main.c" "bootstrap/bloat-buster/main.c"
"bootstrap/nest/pdb_image.c" "bootstrap/bloat-buster/pdb_image.c"
"bootstrap/nest/llvm.cpp" "bootstrap/bloat-buster/llvm.cpp"
) )
target_compile_definitions(${COMPILER_NAME} PRIVATE ${LLVM_DEFINITIONS}) target_compile_definitions(${COMPILER_NAME} PRIVATE ${LLVM_DEFINITIONS})

View File

@ -1,7 +1,7 @@
#define unreachable() __builtin_unreachable() #define unreachable() __builtin_unreachable()
#include <llvm-c/Core.h> #include <llvm-c/Core.h>
#include <std/os.h> #include <std/os.h>
#include <nest/base.h> #include <bloat-buster/base.h>
#include <llvm/IR/IRBuilder.h> #include <llvm/IR/IRBuilder.h>
#include <llvm/IR/LegacyPassManager.h> #include <llvm/IR/LegacyPassManager.h>

View File

@ -5,9 +5,9 @@
#include <std/md5.h> #include <std/md5.h>
#include <std/string.h> #include <std/string.h>
#include <nest/base.h> #include <bloat-buster/base.h>
#include <nest/pdb_image.h> #include <bloat-buster/pdb_image.h>
#include <nest/llvm.h> #include <bloat-buster/llvm.h>
#ifdef __APPLE__ #ifdef __APPLE__
#define clang_path "/opt/homebrew/opt/llvm/bin/clang" #define clang_path "/opt/homebrew/opt/llvm/bin/clang"
@ -36,7 +36,7 @@ STRUCT(GetOrPut(T)) \
u8 existing;\ u8 existing;\
} }
auto compiler_name = strlit("nest"); auto compiler_name = strlit("bb");
fn void print_string(String message) fn void print_string(String message)
{ {
@ -9502,7 +9502,7 @@ may_be_unused fn String write_elf(Thread* thread, ObjectOptions options)
// comp_dir: strx1 // comp_dir: strx1
{ {
auto string = strlit("/home/david/dev/nest/tests"); auto string = strlit("/home/david/dev/bb/tests");
auto string_offset = debug_str.length; auto string_offset = debug_str.length;
vb_copy_string_zero_terminated(&debug_str, string); vb_copy_string_zero_terminated(&debug_str, string);
auto string_offset_index = debug_str_offsets.length; auto string_offset_index = debug_str_offsets.length;
@ -9763,7 +9763,7 @@ may_be_unused fn String write_elf(Thread* thread, ObjectOptions options)
u8 directory_index = 0; u8 directory_index = 0;
auto directory_string_offset = debug_line_str.length; auto directory_string_offset = debug_line_str.length;
{ {
auto string = strlit("/home/david/dev/nest/tests"); auto string = strlit("/home/david/dev/bloat-buster/tests");
vb_copy_string_zero_terminated(&debug_line_str, string); vb_copy_string_zero_terminated(&debug_line_str, string);
} }
u32 paths[] = { directory_string_offset }; u32 paths[] = { directory_string_offset };
@ -9800,7 +9800,7 @@ may_be_unused fn String write_elf(Thread* thread, ObjectOptions options)
MD5Result hash; MD5Result hash;
}; };
// MD5Result md5_hash = { { 0x05, 0xAB, 0x89, 0xF5, 0x48, 0x1B, 0xC9, 0xF2, 0xD0, 0x37, 0xE7, 0x88, 0x66, 0x41, 0xE9, 0x19 } }; // MD5Result md5_hash = { { 0x05, 0xAB, 0x89, 0xF5, 0x48, 0x1B, 0xC9, 0xF2, 0xD0, 0x37, 0xE7, 0x88, 0x66, 0x41, 0xE9, 0x19 } };
String dummy_file = file_read(thread->arena, strlit("/home/david/dev/nest/tests/first.nat")); String dummy_file = file_read(thread->arena, strlit("/home/david/dev/bloat-buster/tests/first.nat"));
auto md5_hash = md5_string(dummy_file); auto md5_hash = md5_string(dummy_file);
auto filename_string_offset = debug_line_str.length; auto filename_string_offset = debug_line_str.length;
@ -23577,7 +23577,7 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
VirtualBuffer(u8) code = {}; VirtualBuffer(u8) code = {};
auto object_path = binary_path_from_options(thread->arena, (BinaryPathOptions) { auto object_path = binary_path_from_options(thread->arena, (BinaryPathOptions) {
.build_directory = strlit("nest"), .build_directory = strlit(cache_dir),
.name = options.test_name, .name = options.test_name,
.target = options.target, .target = options.target,
.backend = options.backend, .backend = options.backend,
@ -23585,7 +23585,7 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
}); });
auto exe_path = binary_path_from_options(thread->arena, (BinaryPathOptions) { auto exe_path = binary_path_from_options(thread->arena, (BinaryPathOptions) {
.build_directory = strlit("nest"), .build_directory = strlit(cache_dir),
.name = options.test_name, .name = options.test_name,
.target = options.target, .target = options.target,
.backend = options.backend, .backend = options.backend,
@ -24329,7 +24329,7 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
// TODO: delete, this is testing // TODO: delete, this is testing
llvm_codegen(options, object_path); llvm_codegen(options, object_path);
} break; } break;
case COMPILER_BACKEND_NEST: case COMPILER_BACKEND_BB:
{ {
auto code_slice = (Slice(u8)) { .pointer = code.pointer, .length = code.length, }; auto code_slice = (Slice(u8)) { .pointer = code.pointer, .length = code.length, };
auto object_options = (ObjectOptions) { auto object_options = (ObjectOptions) {
@ -24794,7 +24794,7 @@ void entry_point(int argc, char* argv[], char* envp[])
Target target = native_target_get(); Target target = native_target_get();
os_directory_make(strlit("nest")); os_directory_make(strlit(cache_dir));
File file = { File file = {
.path = source_file_path, .path = source_file_path,

View File

@ -1,4 +1,4 @@
#include <nest/pdb_image.h> #include <bloat-buster/pdb_image.h>
u8 pdb_image[143360] = { u8 pdb_image[143360] = {
0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x2F, 0x43, 0x2B, 0x2B, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x2F, 0x43, 0x2B, 0x2B, 0x20,

View File

@ -3,6 +3,8 @@
#include <std/base.h> #include <std/base.h>
#include <std/os.h> #include <std/os.h>
#define cache_dir "bb"
typedef enum CpuArchitecture : u8 typedef enum CpuArchitecture : u8
{ {
CPU_ARCH_X86_64, CPU_ARCH_X86_64,
@ -48,7 +50,7 @@ STRUCT(Target)
typedef enum CompilerBackend : u8 typedef enum CompilerBackend : u8
{ {
COMPILER_BACKEND_NEST, COMPILER_BACKEND_BB,
COMPILER_BACKEND_LLVM, COMPILER_BACKEND_LLVM,
COMPILER_BACKEND_COUNT, COMPILER_BACKEND_COUNT,
} CompilerBackend; } CompilerBackend;
@ -57,8 +59,8 @@ fn String compiler_backend_to_one_char_string(CompilerBackend backend)
{ {
switch (backend) switch (backend)
{ {
case COMPILER_BACKEND_NEST: case COMPILER_BACKEND_BB:
return strlit("n"); return strlit("b");
case COMPILER_BACKEND_LLVM: case COMPILER_BACKEND_LLVM:
return strlit("l"); return strlit("l");
case COMPILER_BACKEND_COUNT: case COMPILER_BACKEND_COUNT:
@ -70,8 +72,8 @@ fn String compiler_backend_to_string(CompilerBackend backend)
{ {
switch (backend) switch (backend)
{ {
case COMPILER_BACKEND_NEST: case COMPILER_BACKEND_BB:
return strlit("nest"); return strlit("bb");
case COMPILER_BACKEND_LLVM: case COMPILER_BACKEND_LLVM:
return strlit("llvm"); return strlit("llvm");
case COMPILER_BACKEND_COUNT: case COMPILER_BACKEND_COUNT:

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include <nest/base.h> #include <bloat-buster/base.h>
EXPORT void llvm_codegen(CodegenOptions options, String object_path); EXPORT void llvm_codegen(CodegenOptions options, String object_path);

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#ifdef NDEBUG #ifdef NDEBUG
#define NEST_DEBUG 0 #define BB_DEBUG 0
#else #else
#define NEST_DEBUG 1 #define BB_DEBUG 1
#endif #endif
#ifdef STATIC #ifdef STATIC
@ -167,7 +167,7 @@ const may_be_unused global_variable u8 bracket_close = ']';
#define s_get_slice(T, s, start, end) (Slice(T)){ .pointer = ((s).pointer) + (start), .length = (end) - (start) } #define s_get_slice(T, s, start, end) (Slice(T)){ .pointer = ((s).pointer) + (start), .length = (end) - (start) }
#define s_equal(a, b) ((a).length == (b).length && memcmp((a).pointer, (b).pointer, sizeof(*((a).pointer)) * (a).length) == 0) #define s_equal(a, b) ((a).length == (b).length && memcmp((a).pointer, (b).pointer, sizeof(*((a).pointer)) * (a).length) == 0)
#if NEST_DEBUG #if BB_DEBUG
#define assert(x) if (unlikely(!(x))) { bad_exit("Assert failed: \"" # x "\"", __FILE__, __LINE__); } #define assert(x) if (unlikely(!(x))) { bad_exit("Assert failed: \"" # x "\"", __FILE__, __LINE__); }
#else #else
#define assert(x) unlikely(!(x)) #define assert(x) unlikely(!(x))
@ -178,7 +178,7 @@ const may_be_unused global_variable u8 bracket_close = ']';
#ifdef unreachable #ifdef unreachable
#undef unreachable #undef unreachable
#endif #endif
#if NEST_DEBUG #if BB_DEBUG
#define unreachable() bad_exit("Unreachable triggered", __FILE__, __LINE__) #define unreachable() bad_exit("Unreachable triggered", __FILE__, __LINE__)
#else #else
#define unreachable() __builtin_unreachable() #define unreachable() __builtin_unreachable()

View File

@ -4,9 +4,9 @@
#include <std/virtual_buffer.h> #include <std/virtual_buffer.h>
#include <std/string.h> #include <std/string.h>
#include <nest/base.h> #include <bloat-buster/base.h>
#define nest_dir "nest" #define bb_dir "bb"
declare_slice(CompilerBackend); declare_slice(CompilerBackend);
@ -19,14 +19,14 @@ typedef enum CMakeBuildType
CMAKE_BUILD_TYPE_COUNT, CMAKE_BUILD_TYPE_COUNT,
} CMakeBuildType; } CMakeBuildType;
fn void run(Arena* arena, char** envp, String compiler_path, CompilerBackend compiler_backend, u8 debug, char* nest_source_path) fn void run(Arena* arena, char** envp, String compiler_path, CompilerBackend compiler_backend, u8 debug, char* bb_source_path)
{ {
CStringSlice args = {}; CStringSlice args = {};
auto compiler_backend_string = compiler_backend_to_one_char_string(compiler_backend); auto compiler_backend_string = compiler_backend_to_one_char_string(compiler_backend);
#define common_compile_and_run_args \ #define common_compile_and_run_args \
string_to_c(compiler_path), \ string_to_c(compiler_path), \
nest_source_path, \ bb_source_path, \
string_to_c(compiler_backend_string), \ string_to_c(compiler_backend_string), \
0, 0,
@ -113,7 +113,7 @@ fn void run_tests(Arena* arena, String compiler_path, TestOptions const * const
// if (compiler_backend != COMPILER_BACKEND_INTERPRETER) // if (compiler_backend != COMPILER_BACKEND_INTERPRETER)
{ {
auto executable = binary_path_from_options(arena, (BinaryPathOptions) { auto executable = binary_path_from_options(arena, (BinaryPathOptions) {
.build_directory = strlit(nest_dir), .build_directory = strlit(bb_dir),
.name = test_name, .name = test_name,
.target = target, .target = target,
.backend = compiler_backend, .backend = compiler_backend,
@ -237,7 +237,7 @@ void entry_point(int argc, char* argv[], char* envp[])
{ {
if (preferred_compiler_backend == COMPILER_BACKEND_COUNT) if (preferred_compiler_backend == COMPILER_BACKEND_COUNT)
{ {
preferred_compiler_backend = COMPILER_BACKEND_NEST; preferred_compiler_backend = COMPILER_BACKEND_BB;
} }
} }
@ -246,7 +246,7 @@ void entry_point(int argc, char* argv[], char* envp[])
build_type = CMAKE_BUILD_TYPE_DEBUG; build_type = CMAKE_BUILD_TYPE_DEBUG;
} }
String compiler_path = strlit("build/nest"); String compiler_path = strlit("build/bb");
switch (command) switch (command)
{ {
@ -277,7 +277,7 @@ void entry_point(int argc, char* argv[], char* envp[])
// strlit("tests/comparison.nat"), // strlit("tests/comparison.nat"),
}; };
CompilerBackend all_compiler_backends[] = { CompilerBackend all_compiler_backends[] = {
COMPILER_BACKEND_NEST, COMPILER_BACKEND_BB,
COMPILER_BACKEND_LLVM, COMPILER_BACKEND_LLVM,
}; };
static_assert(array_length(all_compiler_backends) == COMPILER_BACKEND_COUNT); static_assert(array_length(all_compiler_backends) == COMPILER_BACKEND_COUNT);

View File

@ -3,7 +3,7 @@
u8 cast_u32_to_u8(u32 source, const char* name, int line) u8 cast_u32_to_u8(u32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > UINT8_MAX) if (source > UINT8_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -19,7 +19,7 @@ u8 cast_u32_to_u8(u32 source, const char* name, int line)
u16 cast_u32_to_u16(u32 source, const char* name, int line) u16 cast_u32_to_u16(u32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > UINT16_MAX) if (source > UINT16_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -35,7 +35,7 @@ u16 cast_u32_to_u16(u32 source, const char* name, int line)
s16 cast_u32_to_s16(u32 source, const char* name, int line) s16 cast_u32_to_s16(u32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > INT16_MAX) if (source > INT16_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -51,7 +51,7 @@ s16 cast_u32_to_s16(u32 source, const char* name, int line)
s32 cast_u32_to_s32(u32 source, const char* name, int line) s32 cast_u32_to_s32(u32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > INT32_MAX) if (source > INT32_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -67,7 +67,7 @@ s32 cast_u32_to_s32(u32 source, const char* name, int line)
u8 cast_u64_to_u8(u64 source, const char* name, int line) u8 cast_u64_to_u8(u64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > UINT8_MAX) if (source > UINT8_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -83,7 +83,7 @@ u8 cast_u64_to_u8(u64 source, const char* name, int line)
u16 cast_u64_to_u16(u64 source, const char* name, int line) u16 cast_u64_to_u16(u64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > UINT16_MAX) if (source > UINT16_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -99,7 +99,7 @@ u16 cast_u64_to_u16(u64 source, const char* name, int line)
u32 cast_u64_to_u32(u64 source, const char* name, int line) u32 cast_u64_to_u32(u64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > UINT32_MAX) if (source > UINT32_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -115,7 +115,7 @@ u32 cast_u64_to_u32(u64 source, const char* name, int line)
s32 cast_u64_to_s32(u64 source, const char* name, int line) s32 cast_u64_to_s32(u64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > INT32_MAX) if (source > INT32_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -131,7 +131,7 @@ s32 cast_u64_to_s32(u64 source, const char* name, int line)
s64 cast_u64_to_s64(u64 source, const char* name, int line) s64 cast_u64_to_s64(u64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > INT64_MAX) if (source > INT64_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -147,7 +147,7 @@ s64 cast_u64_to_s64(u64 source, const char* name, int line)
u8 cast_s32_to_u8(s32 source, const char* name, int line) u8 cast_s32_to_u8(s32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -168,7 +168,7 @@ u8 cast_s32_to_u8(s32 source, const char* name, int line)
u16 cast_s32_to_u16(s32 source, const char* name, int line) u16 cast_s32_to_u16(s32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -189,7 +189,7 @@ u16 cast_s32_to_u16(s32 source, const char* name, int line)
u32 cast_s32_to_u32(s32 source, const char* name, int line) u32 cast_s32_to_u32(s32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -205,7 +205,7 @@ u32 cast_s32_to_u32(s32 source, const char* name, int line)
u64 cast_s32_to_u64(s32 source, const char* name, int line) u64 cast_s32_to_u64(s32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -221,7 +221,7 @@ u64 cast_s32_to_u64(s32 source, const char* name, int line)
s16 cast_s32_to_s16(s32 source, const char* name, int line) s16 cast_s32_to_s16(s32 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source > INT16_MAX) if (source > INT16_MAX)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -242,7 +242,7 @@ s16 cast_s32_to_s16(s32 source, const char* name, int line)
u16 cast_s64_to_u16(s64 source, const char* name, int line) u16 cast_s64_to_u16(s64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -263,7 +263,7 @@ u16 cast_s64_to_u16(s64 source, const char* name, int line)
u32 cast_s64_to_u32(s64 source, const char* name, int line) u32 cast_s64_to_u32(s64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -279,7 +279,7 @@ u32 cast_s64_to_u32(s64 source, const char* name, int line)
u64 cast_s64_to_u64(s64 source, const char* name, int line) u64 cast_s64_to_u64(s64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < 0) if (source < 0)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);
@ -295,7 +295,7 @@ u64 cast_s64_to_u64(s64 source, const char* name, int line)
s32 cast_s64_to_s32(s64 source, const char* name, int line) s32 cast_s64_to_s32(s64 source, const char* name, int line)
{ {
#if NEST_DEBUG #if BB_DEBUG
if (source < INT32_MIN) if (source < INT32_MIN)
{ {
print("Cast failed at {cstr}:{u32}\n", name, line); print("Cast failed at {cstr}:{u32}\n", name, line);