version 1.8, 2009/02/06 10:11:12 |
version 1.13, 2013/06/13 18:40:31 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.7 2009/02/06 08:58:28 ohara Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.12 2013/06/13 07:45:28 ohara Exp $ */ |
|
|
|
#if defined(VISUAL) |
|
#include "private/gcconfig.h" |
|
#endif |
#include "gc.h" |
#include "gc.h" |
#include <time.h> |
#include <time.h> |
|
|
void error(char *); |
void error(char *); |
|
void int_handler(); |
|
|
int *StackBottom; |
int *StackBottom; |
|
int in_gc, caught_intr; |
|
|
void *Risa_GC_malloc(size_t d) |
void *Risa_GC_malloc(size_t d) |
{ |
{ |
void *ret; |
void *ret; |
|
|
|
in_gc = 1; |
ret = (void *)GC_malloc(d); |
ret = (void *)GC_malloc(d); |
|
in_gc = 0; |
|
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
if ( !ret ) |
if ( !ret ) |
error("GC_malloc : failed to allocate memory"); |
error("GC_malloc : failed to allocate memory"); |
return ret; |
return ret; |
Line 21 void *Risa_GC_malloc_atomic(size_t d) |
|
Line 29 void *Risa_GC_malloc_atomic(size_t d) |
|
{ |
{ |
void *ret; |
void *ret; |
|
|
|
in_gc = 1; |
ret = (void *)GC_malloc_atomic(d); |
ret = (void *)GC_malloc_atomic(d); |
|
in_gc = 0; |
|
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
if ( !ret ) |
if ( !ret ) |
error("GC_malloc_atomic : failed to allocate memory"); |
error("GC_malloc_atomic : failed to allocate memory"); |
return ret; |
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 *Risa_GC_realloc(void *p,size_t d) |
{ |
{ |
void *ret; |
void *ret; |
|
|
|
in_gc = 1; |
ret = (void *)GC_realloc(p,d); |
ret = (void *)GC_realloc(p,d); |
|
in_gc = 0; |
|
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
if ( !ret ) |
if ( !ret ) |
error("GC_realloc : failed to reallocate memory"); |
error("GC_realloc : failed to reallocate memory"); |
return ret; |
return ret; |
} |
} |
|
|
int get_heapsize() |
void Risa_GC_free(void *p) |
{ |
{ |
|
in_gc = 1; |
|
GC_free(p); |
|
in_gc = 0; |
|
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
|
} |
|
|
|
size_t get_heapsize() |
|
{ |
return GC_get_heap_size(); |
return GC_get_heap_size(); |
} |
} |
|
|
Line 46 int get_heapsize() |
|
Line 81 int get_heapsize() |
|
#define BYTES_TO_WORDS(x) ((x)>>2) |
#define BYTES_TO_WORDS(x) ((x)>>2) |
#endif |
#endif |
|
|
long get_allocwords() |
size_t get_allocwords() |
{ |
{ |
size_t n = GC_get_total_bytes(); |
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; |
static double asir_start_time; |