version 1.11, 2012/12/17 07:20:45 |
version 1.17, 2017/08/30 09:40:30 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.10 2011/05/11 06:03:53 ohara Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.16 2015/08/14 13:51:56 fujimoto Exp $ */ |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
#include "private/gcconfig.h" |
#include "private/gcconfig.h" |
#endif |
#endif |
#include "gc.h" |
#include "gc.h" |
#include <time.h> |
#include <time.h> |
|
#include <signal.h> |
|
|
void error(char *); |
void error(char *); |
|
void int_handler(); |
|
|
int *StackBottom; |
int *StackBottom; |
int in_gc, caught_intr; |
int in_gc, caught_intr; |
|
|
|
void check_caught_intr() |
|
{ |
|
if ( caught_intr ) { |
|
caught_intr = 0; |
|
int_handler(SIGINT); |
|
} |
|
} |
|
|
void *Risa_GC_malloc(size_t d) |
void *Risa_GC_malloc(size_t d) |
{ |
{ |
void *ret; |
void *ret; |
Line 18 void *Risa_GC_malloc(size_t d) |
|
Line 28 void *Risa_GC_malloc(size_t d) |
|
in_gc = 1; |
in_gc = 1; |
ret = (void *)GC_malloc(d); |
ret = (void *)GC_malloc(d); |
in_gc = 0; |
in_gc = 0; |
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
check_caught_intr(); |
if ( !ret ) |
if ( !ret ) |
error("GC_malloc : failed to allocate memory"); |
error("GC_malloc : failed to allocate memory"); |
return ret; |
return ret; |
Line 31 void *Risa_GC_malloc_atomic(size_t d) |
|
Line 41 void *Risa_GC_malloc_atomic(size_t d) |
|
in_gc = 1; |
in_gc = 1; |
ret = (void *)GC_malloc_atomic(d); |
ret = (void *)GC_malloc_atomic(d); |
in_gc = 0; |
in_gc = 0; |
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
check_caught_intr(); |
if ( !ret ) |
if ( !ret ) |
error("GC_malloc_atomic : failed to allocate memory"); |
error("GC_malloc_atomic : failed to allocate memory"); |
return ret; |
return ret; |
Line 44 void *Risa_GC_malloc_atomic_ignore_off_page(size_t d) |
|
Line 54 void *Risa_GC_malloc_atomic_ignore_off_page(size_t d) |
|
in_gc = 1; |
in_gc = 1; |
ret = (void *)GC_malloc_atomic_ignore_off_page(d); |
ret = (void *)GC_malloc_atomic_ignore_off_page(d); |
in_gc = 0; |
in_gc = 0; |
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
check_caught_intr(); |
if ( !ret ) |
if ( !ret ) |
error("GC_malloc_atomic_ignore_off_page : failed to allocate memory"); |
error("GC_malloc_atomic_ignore_off_page : failed to allocate memory"); |
return ret; |
return ret; |
Line 57 void *Risa_GC_realloc(void *p,size_t d) |
|
Line 67 void *Risa_GC_realloc(void *p,size_t d) |
|
in_gc = 1; |
in_gc = 1; |
ret = (void *)GC_realloc(p,d); |
ret = (void *)GC_realloc(p,d); |
in_gc = 0; |
in_gc = 0; |
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
check_caught_intr(); |
if ( !ret ) |
if ( !ret ) |
error("GC_realloc : failed to reallocate memory"); |
error("GC_realloc : failed to reallocate memory"); |
return ret; |
return ret; |
Line 68 void Risa_GC_free(void *p) |
|
Line 78 void Risa_GC_free(void *p) |
|
in_gc = 1; |
in_gc = 1; |
GC_free(p); |
GC_free(p); |
in_gc = 0; |
in_gc = 0; |
if ( caught_intr ) { caught_intr = 0; int_handler(); } |
check_caught_intr(); |
} |
} |
|
|
|
size_t get_heapsize() |
int get_heapsize() |
|
{ |
{ |
return GC_get_heap_size(); |
return GC_get_heap_size(); |
} |
} |
Line 108 double get_rtime() |
|
Line 117 double get_rtime() |
|
return get_current_time() - asir_start_time; |
return get_current_time() - asir_start_time; |
} |
} |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
#include <windows.h> |
#include <windows.h> |
|
|
extern int recv_intr,doing_batch; |
extern int recv_intr,doing_batch; |
Line 116 void send_intr(); |
|
Line 125 void send_intr(); |
|
|
|
BOOL set_ctrlc_flag(DWORD type) |
BOOL set_ctrlc_flag(DWORD type) |
{ |
{ |
if ( doing_batch ) |
enter_signal_cs(); |
|
if ( doing_batch ) { |
send_intr(); |
send_intr(); |
else |
}else { |
recv_intr = 1; |
recv_intr = 1; |
|
} |
|
leave_signal_cs(); |
return TRUE; |
return TRUE; |
} |
} |
|
|
Line 244 double GC_get_gctime() { |
|
Line 256 double GC_get_gctime() { |
|
} |
} |
#endif |
#endif |
|
|
#if defined(MSWIN32) && !defined(VISUAL) |
#if defined(MSWIN32) && !defined(VISUAL) && !defined(__MINGW32__) |
#include <signal.h> |
#include <signal.h> |
void process_events() { |
void process_events() { |
if ( check_break() ) |
if ( check_break() ) |
Line 277 void process_events() { |
|
Line 289 void process_events() { |
|
} |
} |
#endif |
#endif |
|
|
#if defined(VISUAL) && !defined(MSWIN32) |
#if (defined(VISUAL) || defined(__MINGW32__)) && !defined(MSWIN32) |
int sigsetmask(mask) int mask; { return 0; } |
int sigsetmask(mask) int mask; { return 0; } |
|
|
void process_events() { |
void process_events() { |
|
|
#else |
#else |
if ( c == ('c' & 037 ) ) |
if ( c == ('c' & 037 ) ) |
#endif |
#endif |
int_handler(); |
int_handler(SIGINT); |
} |
} |
#endif |
#endif |