From ed96e5e915c5380f0a073ed49d6786b07db68439 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 9 Nov 2021 17:42:59 +0100 Subject: Add display functionality for lambda objects --- src/compiler.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/compiler.h') diff --git a/src/compiler.h b/src/compiler.h index 897b7bb..0223269 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -509,8 +509,15 @@ emit_bss_section(void) { void emit_data_section(void) { printf("section .data\n"); - printf("true_str: db \"true\", 10, 0, 0, 0\n"); - printf("false_str: db \"false\", 10, 0, 0\n"); + printf("true_str:\n db \"true\", 10\n"); + printf(" alignb 8\n"); + printf("false_str:\n db \"false\", 10\n"); + printf(" alignb 8\n"); + printf("lambda_str:\n"); + char lambda_str[] = "#{lambda}"; + printf(" dq %ld\n", sizeof(lambda_str)); + printf(" db \"%s\", 10\n", lambda_str); + printf(" alignb 8\n"); for (size_t i = 0; i < array_size(constants); i++) { // NOTE: Only supporting string constants for now. Constant c = constants[i]; @@ -520,11 +527,7 @@ emit_data_section(void) { printf("%s:\n", c.label); printf(" dq %d\n", n + 1); printf(" db \"%.*s\", 10\n", n, c.obj->text.start); - // Ensure alignment to 8 bytes. - int remainder = (n + 1) % 8; - if (remainder != 0) { - printf(" times %d db 0\n", 8 - (n + 1) % 8); - } + printf(" alignb 8\n"); } printf("\n"); } -- cgit v1.2.1