Added stack alignment check, fixed Makefile to build target in x86-64 mode

This commit is contained in:
Egor Sheremetov 2024-02-04 11:58:57 +01:00 committed by Roman Venediktov
parent 2dadccc71f
commit f6516bae63
2 changed files with 9 additions and 8 deletions

View file

@ -5,13 +5,13 @@ TEST_FLAGS=$(COMMON_FLAGS) -DDEBUG_VERSION
UNIT_TESTS_FLAGS=$(TEST_FLAGS)
INVARIANTS_CHECK_FLAGS=$(TEST_FLAGS) -DFULL_INVARIANT_CHECKS
# this target is the most important one, its' artefacts should be used as a runtime of Lama
all: gc.o runtime.o
ar rc runtime.a runtime.o gc.o
all64: gc64.o runtime64.o
all: gc64.o runtime64.o
ar rc runtime.a runtime64.o gc64.o
# this target is the most important one, its' artefacts should be used as a runtime of Lama
all32: gc.o runtime.o
ar rc runtime.a runtime.o gc.o
NEGATIVE_TESTS=$(sort $(basename $(notdir $(wildcard negative_scenarios/*_neg.c))))
$(NEGATIVE_TESTS): %: negative_scenarios/%.c

View file

@ -14,6 +14,7 @@ extern size_t __gc_stack_top, __gc_stack_bottom;
flag = __gc_stack_top == 0; \
if (flag) { __gc_stack_top = (size_t)__builtin_frame_address(0); } \
assert(__gc_stack_top != 0); \
assert(__gc_stack_top & 0xF == 0); \
assert(__builtin_frame_address(0) <= (void *)__gc_stack_top);
#define POST_GC() \
@ -238,15 +239,15 @@ extern aint LtagHash (char *s) {
p++;
}
if (strncmp(s, de_hash(h), 5) != 0) { failure("%s <-> %s\n", s, de_hash(h)); }
if (strncmp(s, de_hash(h), MAX_SEXP_TAG_LEN) != 0) { failure("%s <-> %s\n", s, de_hash(h)); }
return BOX(h);
}
char *de_hash (aint n) {
static char buf[6] = {0, 0, 0, 0, 0, 0};
static char buf[MAX_SEXP_TAG_LEN + 1] = {0, 0, 0, 0, 0, 0};
char *p = (char *)BOX(NULL);
p = &buf[5];
p = &buf[MAX_SEXP_TAG_LEN];
*p-- = 0;