summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbxgen.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/bxgen.c b/bxgen.c
index d672b2f..f0f569b 100755
--- a/bxgen.c
+++ b/bxgen.c
@@ -200,6 +200,9 @@ typedef struct {
// Pool, a collection of all entities.
//
+// NOTE
+// We use one single large memory block for *everything*.
+//
typedef struct {
i64 entity_count;
@@ -255,7 +258,7 @@ void u_elf_x86_64(i64 unit, c8 const *output_file_name);
// ================================================================
//
-// Implementation
+// Main features implementation
//
// ================================================================
@@ -514,8 +517,11 @@ void unit_write(entity_pool_t *pool, i64 unit, u16 target, FILE *out) {
fwrite(code, 1, code_size, out);
}
-// Helpers implementation
+// ================================================================
+//
+// Helpers implementation
//
+// ================================================================
#ifndef DISABLE_HELPERS
@@ -523,6 +529,11 @@ void unit_write(entity_pool_t *pool, i64 unit, u16 target, FILE *out) {
//
static entity_pool_t g_pool = {
+ // Statically allocate a large memory block.
+ //
+ // TODO
+ // Reallocate the memory block when necessary.
+ //
.entities_capacity = MAX_ENTITY_COUNT,
.entities = (entity_t[MAX_ENTITY_COUNT]) { 0 },
};
@@ -572,8 +583,11 @@ void u_elf_x86_64(i64 unit, c8 const *output_file_name) {
#endif
-// Example
+// ================================================================
//
+// Example
+//
+// ================================================================
#ifndef DISABLE_EXAMPLE