fix misalignment bugs
This commit is contained in:
@@ -10,13 +10,15 @@ static enum fh_error w_colon(struct fh_thread_s *fh, const struct fh_word_s *w)
|
|||||||
size_t namelen = 0;
|
size_t namelen = 0;
|
||||||
fh_input_consume_spaces(fh);
|
fh_input_consume_spaces(fh);
|
||||||
TRY(fh_input_read_word(fh, &wordname, &namelen));
|
TRY(fh_input_read_word(fh, &wordname, &namelen));
|
||||||
LOG("Name: %.*s", (int) namelen, wordname);
|
|
||||||
|
|
||||||
fh_setstate(fh, FH_STATE_COMPILE, 0);
|
fh_setstate(fh, FH_STATE_COMPILE, 0);
|
||||||
|
|
||||||
uint32_t ptr;
|
uint32_t ptr;
|
||||||
|
fh_align(fh);
|
||||||
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
||||||
|
|
||||||
|
LOG("New word \"%.*s\", head at 0x%08x, exec at 0x%08x", (int) namelen, wordname, ptr, fh->here);
|
||||||
|
|
||||||
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
||||||
if (!new_word) { return FH_ERR_INTERNAL; }
|
if (!new_word) { return FH_ERR_INTERNAL; }
|
||||||
new_word->previous = fh->dict_last;
|
new_word->previous = fh->dict_last;
|
||||||
@@ -89,6 +91,7 @@ static enum fh_error w_colon_noname(struct fh_thread_s *fh, const struct fh_word
|
|||||||
fh_setstate(fh, FH_STATE_COMPILE, 0);
|
fh_setstate(fh, FH_STATE_COMPILE, 0);
|
||||||
|
|
||||||
uint32_t ptr;
|
uint32_t ptr;
|
||||||
|
fh_align(fh);
|
||||||
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
||||||
|
|
||||||
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
||||||
@@ -218,6 +221,7 @@ static enum fh_error wp_variable(struct fh_thread_s *fh, const struct fh_word_s
|
|||||||
TRY(ds_pop(fh, &value));
|
TRY(ds_pop(fh, &value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fh_align(fh);
|
||||||
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
||||||
|
|
||||||
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
||||||
@@ -536,6 +540,7 @@ static enum fh_error w_defer(struct fh_thread_s *fh, const struct fh_word_s *w)
|
|||||||
|
|
||||||
uint32_t ptr;
|
uint32_t ptr;
|
||||||
|
|
||||||
|
fh_align(fh);
|
||||||
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr));
|
||||||
|
|
||||||
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
struct fh_word_s *new_word = fh_word_at(fh, ptr);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ void fh_abort(struct fh_thread_s *fh) {
|
|||||||
|
|
||||||
void fh_drop_to_interactive(struct fh_thread_s *fh) {
|
void fh_drop_to_interactive(struct fh_thread_s *fh) {
|
||||||
fh_input_teardown(fh);
|
fh_input_teardown(fh);
|
||||||
|
|
||||||
fh_push_input(fh, fh_create_input_from_filestruct(stdin, NULL));
|
fh_push_input(fh, fh_create_input_from_filestruct(stdin, NULL));
|
||||||
fh->return_stack_top = 0;
|
fh->return_stack_top = 0;
|
||||||
fh->execptr = MAGICADDR_EXEC_INTERACTIVE;
|
fh->execptr = MAGICADDR_EXEC_INTERACTIVE;
|
||||||
|
|||||||
@@ -1,4 +1 @@
|
|||||||
|
: RF1 S" REFILL" EVALUATE ; RF1
|
||||||
: RF1 S" REFILL" EVALUATE ;
|
|
||||||
|
|
||||||
RF1
|
|
||||||
|
|||||||
Reference in New Issue
Block a user