mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 00:37:35 +02:00
Bug fixes
This commit is contained in:
parent
87def0fc67
commit
20e71fff3b
2 changed files with 9 additions and 9 deletions
|
@ -209,6 +209,8 @@ void dispatch_va(int argc, function_type_va func, object clo, object cont, objec
|
||||||
void do_dispatch(int argc, function_type func, object clo, object *buffer);
|
void do_dispatch(int argc, function_type func, object clo, object *buffer);
|
||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
|
extern gc_heap *Cyc_heap;
|
||||||
|
extern gc_thread_data *Cyc_thread;
|
||||||
extern clock_t start; /* Starting time. */
|
extern clock_t start; /* Starting time. */
|
||||||
extern char *stack_begin; /* Initialized by main. */
|
extern char *stack_begin; /* Initialized by main. */
|
||||||
extern char *stack_limit1; /* Initialized by main. */
|
extern char *stack_limit1; /* Initialized by main. */
|
||||||
|
|
16
runtime.c
16
runtime.c
|
@ -9,9 +9,6 @@
|
||||||
#include "cyclone/types.h"
|
#include "cyclone/types.h"
|
||||||
#include "cyclone/runtime.h"
|
#include "cyclone/runtime.h"
|
||||||
|
|
||||||
gc_heap *Cyc_heap;
|
|
||||||
gc_thread_data *Cyc_thread;
|
|
||||||
|
|
||||||
/* Error checking section - type mismatch, num args, etc */
|
/* Error checking section - type mismatch, num args, etc */
|
||||||
/* Type names to use for error messages */
|
/* Type names to use for error messages */
|
||||||
const char *tag_names[21] = { \
|
const char *tag_names[21] = { \
|
||||||
|
@ -2593,7 +2590,7 @@ void GC(cont, args, num_args) closure cont; object *args; int num_args;
|
||||||
int scani = 0, alloci = 0; // TODO: not quite sure how to do this yet, want to user pointers but realloc can move them... need to think about how this will work
|
int scani = 0, alloci = 0; // TODO: not quite sure how to do this yet, want to user pointers but realloc can move them... need to think about how this will work
|
||||||
int heap_grown = 0;
|
int heap_grown = 0;
|
||||||
|
|
||||||
fprintf("DEBUG, started minor GC\n"); // JAE DEBUG
|
fprintf(stderr, "DEBUG, started minor GC\n"); // JAE DEBUG
|
||||||
// Prevent overrunning buffer
|
// Prevent overrunning buffer
|
||||||
if (num_args > NUM_GC_ANS) {
|
if (num_args > NUM_GC_ANS) {
|
||||||
printf("Fatal error - too many arguments (%d) to GC\n", num_args);
|
printf("Fatal error - too many arguments (%d) to GC\n", num_args);
|
||||||
|
@ -2707,14 +2704,15 @@ fprintf("DEBUG, started minor GC\n"); // JAE DEBUG
|
||||||
// Check if we need to do a major GC
|
// Check if we need to do a major GC
|
||||||
if (heap_grown) {
|
if (heap_grown) {
|
||||||
size_t freed = 0;
|
size_t freed = 0;
|
||||||
fprintf("DEBUG, starting major mark/sweep GC\n"); // JAE DEBUG
|
fprintf(stderr, "DEBUG, starting major mark/sweep GC\n"); // JAE DEBUG
|
||||||
TODO: not good enough, need to pass current cont/args
|
gc_mark(Cyc_heap, cont);
|
||||||
what about mutation barrier, do we care at this point???
|
for (i = 0; i < num_args; i++){
|
||||||
I don't think so because those are just updates to globals
|
gc_mark(Cyc_heap, args[i]);
|
||||||
|
}
|
||||||
gc_collect(Cyc_heap, &freed);
|
gc_collect(Cyc_heap, &freed);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf("DEBUG, finished minor GC\n"); // JAE DEBUG
|
fprintf(stderr, "DEBUG, finished minor GC\n"); // JAE DEBUG
|
||||||
longjmp(jmp_main,1); // Return globals gc_cont, gc_ans
|
longjmp(jmp_main,1); // Return globals gc_cont, gc_ans
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue