Skip to content

Commit

Permalink
Various improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoNex committed Oct 26, 2023
1 parent 6dc1cf2 commit e434da1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/vm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static struct bookmark *vm_get_bookmark(struct vm * restrict vm) {
struct bookmark *bookmarks = frame->cl.data.cl->fn->bookmarks;

if (blen > 0) {
for (int i = 0; i < blen; i++) {
for (size_t i = 0; i < blen; i++) {
struct bookmark b = bookmarks[i];
if (offset <= b.offset) {
return &bookmarks[i];
Expand Down Expand Up @@ -219,7 +219,7 @@ static inline void vm_push_closure(struct vm * restrict vm, uint32_t const_idx,
}

struct object *free = malloc(sizeof(struct object) * num_free);
for (int i = 0; i < num_free; i++) {
for (uint32_t i = 0; i < num_free; i++) {
free[i] = vm->stack[vm->sp-num_free+i];
}

Expand Down Expand Up @@ -644,7 +644,7 @@ static inline void vm_exec_index(struct vm * restrict vm) {
}

static inline void vm_call_closure(struct vm * restrict vm, struct object *cl, size_t numargs) {
int num_params = cl->data.cl->fn->num_params;
size_t num_params = cl->data.cl->fn->num_params;

if (num_params != numargs) {
vm_errorf(vm, "wrong number of arguments: expected %d, got %lu", num_params, numargs);
Expand Down
2 changes: 1 addition & 1 deletion internal/vm/vm.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vm

// #cgo CFLAGS: -Wall -g -Ofast -mtune=native -fopenmp
// #cgo CFLAGS: -g -Ofast -mtune=native -fopenmp
// #cgo LDFLAGS: -fopenmp
// #include <stdlib.h>
// #include <stdio.h>
Expand Down
1 change: 1 addition & 0 deletions repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func REPL() error {
fmt.Println(err)
return fmt.Errorf("error opening terminal: %w", err)
}
vm.TermState = initState
defer term.Restore(int(os.Stdin.Fd()), initState)

t := term.NewTerminal(os.Stdin, ">>> ")
Expand Down

0 comments on commit e434da1

Please sign in to comment.