=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/gc_risa.c,v retrieving revision 1.7 retrieving revision 1.11 diff -u -p -r1.7 -r1.11 --- OpenXM_contrib2/asir2000/parse/gc_risa.c 2009/02/06 08:58:28 1.7 +++ OpenXM_contrib2/asir2000/parse/gc_risa.c 2012/12/17 07:20:45 1.11 @@ -1,17 +1,24 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.6 2009/02/05 11:25:59 ohara Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.10 2011/05/11 06:03:53 ohara Exp $ */ +#if defined(VISUAL) +#include "private/gcconfig.h" +#endif #include "gc.h" #include void error(char *); int *StackBottom; +int in_gc, caught_intr; void *Risa_GC_malloc(size_t d) { void *ret; + in_gc = 1; ret = (void *)GC_malloc(d); + in_gc = 0; + if ( caught_intr ) { caught_intr = 0; int_handler(); } if ( !ret ) error("GC_malloc : failed to allocate memory"); return ret; @@ -21,22 +28,50 @@ void *Risa_GC_malloc_atomic(size_t d) { void *ret; + in_gc = 1; ret = (void *)GC_malloc_atomic(d); + in_gc = 0; + if ( caught_intr ) { caught_intr = 0; int_handler(); } if ( !ret ) error("GC_malloc_atomic : failed to allocate memory"); return ret; } +void *Risa_GC_malloc_atomic_ignore_off_page(size_t d) +{ + void *ret; + + in_gc = 1; + ret = (void *)GC_malloc_atomic_ignore_off_page(d); + in_gc = 0; + if ( caught_intr ) { caught_intr = 0; int_handler(); } + if ( !ret ) + error("GC_malloc_atomic_ignore_off_page : failed to allocate memory"); + return ret; +} + void *Risa_GC_realloc(void *p,size_t d) { void *ret; + in_gc = 1; ret = (void *)GC_realloc(p,d); + in_gc = 0; + if ( caught_intr ) { caught_intr = 0; int_handler(); } if ( !ret ) error("GC_realloc : failed to reallocate memory"); return ret; } +void Risa_GC_free(void *p) +{ + in_gc = 1; + GC_free(p); + in_gc = 0; + if ( caught_intr ) { caught_intr = 0; int_handler(); } +} + + int get_heapsize() { return GC_get_heap_size(); @@ -46,10 +81,10 @@ int get_heapsize() #define BYTES_TO_WORDS(x) ((x)>>2) #endif -long get_allocwords() +size_t get_allocwords() { size_t n = GC_get_total_bytes(); - return (long)BYTES_TO_WORDS(n); /* bytes to words */ + return BYTES_TO_WORDS(n); /* bytes to words */ } static double asir_start_time; @@ -182,7 +217,7 @@ double get_clock() #endif #endif -#if 1 +#if !defined(NO_ASIR_GC) extern int GC_free_space_numerator; void Risa_GC_get_adj(int *nm, int *dn) {