From e21a1c0b54bed5bcb30c3e6c6c20c756a0ac89ef Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 2 May 2009 10:17:05 -0500 Subject: [PATCH] More VM fixes --- vmpp/bignum.cpp | 2 +- vmpp/code_gc.hpp | 8 ++++---- vmpp/data_gc.hpp | 4 ++-- vmpp/image.hpp | 8 ++++---- vmpp/math.cpp | 2 +- vmpp/os-windows.cpp | 1 - vmpp/run.hpp | 10 +++++----- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/vmpp/bignum.cpp b/vmpp/bignum.cpp index e8920a5ac6..3a665f22d3 100755 --- a/vmpp/bignum.cpp +++ b/vmpp/bignum.cpp @@ -347,7 +347,7 @@ bignum_remainder(F_BIGNUM * numerator, F_BIGNUM * denominator) if (n == 1) return (BIGNUM_ONE (0)); \ if (n < (type)0 && n == (type)-1) return (BIGNUM_ONE (1)); \ { \ - utype accumulator = ((negative_p = (n < (utype)0)) ? (-n) : n); \ + utype accumulator = ((negative_p = (n < (type)0)) ? (-n) : n); \ do \ { \ (*end_digits++) = (accumulator & BIGNUM_DIGIT_MASK); \ diff --git a/vmpp/code_gc.hpp b/vmpp/code_gc.hpp index 35f8d66d90..f199e469ff 100755 --- a/vmpp/code_gc.hpp +++ b/vmpp/code_gc.hpp @@ -1,15 +1,15 @@ #define FREE_LIST_COUNT 16 #define BLOCK_SIZE_INCREMENT 32 -typedef struct { +struct F_HEAP_FREE_LIST { F_FREE_BLOCK *small_blocks[FREE_LIST_COUNT]; F_FREE_BLOCK *large_blocks; -} F_HEAP_FREE_LIST; +}; -typedef struct { +struct F_HEAP { F_SEGMENT *segment; F_HEAP_FREE_LIST free; -} F_HEAP; +}; typedef void (*HEAP_ITERATOR)(F_BLOCK *compiled); diff --git a/vmpp/data_gc.hpp b/vmpp/data_gc.hpp index 9dc3a77071..2e508c93a5 100755 --- a/vmpp/data_gc.hpp +++ b/vmpp/data_gc.hpp @@ -4,13 +4,13 @@ void gc(void); DLLEXPORT void minor_gc(void); /* statistics */ -typedef struct { +struct F_GC_STATS { CELL collections; u64 gc_time; u64 max_gc_time; CELL object_count; u64 bytes_copied; -} F_GC_STATS; +}; extern F_ZONE *newspace; diff --git a/vmpp/image.hpp b/vmpp/image.hpp index ac2123c602..f3041dc45b 100755 --- a/vmpp/image.hpp +++ b/vmpp/image.hpp @@ -1,7 +1,7 @@ #define IMAGE_MAGIC 0x0f0e0d0c #define IMAGE_VERSION 4 -typedef struct { +struct F_HEADER { CELL magic; CELL version; /* all pointers in the image file are relocated from @@ -23,9 +23,9 @@ typedef struct { CELL bignum_neg_one; /* Initial user environment */ CELL userenv[USER_ENV]; -} F_HEADER; +}; -typedef struct { +struct F_PARAMETERS { const F_CHAR *image_path; const F_CHAR *executable_path; CELL ds_size, rs_size; @@ -36,7 +36,7 @@ typedef struct { bool console; bool stack_traces; CELL max_pic_size; -} F_PARAMETERS; +}; void load_image(F_PARAMETERS *p); bool save_image(const F_CHAR *file); diff --git a/vmpp/math.cpp b/vmpp/math.cpp index eb78bf0f7c..856c9ec8b5 100644 --- a/vmpp/math.cpp +++ b/vmpp/math.cpp @@ -82,7 +82,7 @@ void primitive_fixnum_divmod(void) else { put(ds - CELLS,tag_fixnum(untag_fixnum_fast(x) / untag_fixnum_fast(y))); - put(ds,x % y); + put(ds,(F_FIXNUM)x % (F_FIXNUM)y); } } diff --git a/vmpp/os-windows.cpp b/vmpp/os-windows.cpp index e1f5c16647..6bd7dd9956 100755 --- a/vmpp/os-windows.cpp +++ b/vmpp/os-windows.cpp @@ -90,7 +90,6 @@ const F_CHAR *vm_executable_path(void) void primitive_existsp(void) { - F_CHAR *path = unbox_u16_string(); box_boolean(windows_stat(path)); } diff --git a/vmpp/run.hpp b/vmpp/run.hpp index d3bec859ef..0b54f94980 100755 --- a/vmpp/run.hpp +++ b/vmpp/run.hpp @@ -200,18 +200,18 @@ INLINE CELL type_of(CELL tagged) DEFPUSHPOP(d,ds) DEFPUSHPOP(r,rs) -typedef struct { +struct F_SEGMENT { CELL start; CELL size; CELL end; -} F_SEGMENT; +}; /* Assembly code makes assumptions about the layout of this struct: - callstack_top field is 0 - callstack_bottom field is 1 - datastack field is 2 - retainstack field is 3 */ -typedef struct _F_CONTEXT { +struct F_CONTEXT { /* C stack pointer on entry */ F_STACK_FRAME *callstack_top; F_STACK_FRAME *callstack_bottom; @@ -238,8 +238,8 @@ typedef struct _F_CONTEXT { CELL catchstack_save; CELL current_callback_save; - struct _F_CONTEXT *next; -} F_CONTEXT; + F_CONTEXT *next; +}; extern F_CONTEXT *stack_chain;