mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 05:27:35 +02:00
heap-stats will now build with Boehm, but just as a noop
This commit is contained in:
parent
9706f6bcc3
commit
8d13b7ace8
2 changed files with 17 additions and 3 deletions
|
@ -1,11 +1,13 @@
|
||||||
/* heap-stats.c -- count or dump heap objects */
|
/* heap-stats.c -- count or dump heap objects */
|
||||||
/* Copyright (c) 2009-2010 Alex Shinn. All rights reserved. */
|
/* Copyright (c) 2009-2011 Alex Shinn. All rights reserved. */
|
||||||
/* BSD-style license: http://synthcode.com/license.txt */
|
/* BSD-style license: http://synthcode.com/license.txt */
|
||||||
|
|
||||||
#include <chibi/eval.h>
|
#include <chibi/eval.h>
|
||||||
|
|
||||||
#define SEXP_HEAP_VECTOR_DEPTH 1
|
#define SEXP_HEAP_VECTOR_DEPTH 1
|
||||||
|
|
||||||
|
#if ! SEXP_USE_BOEHM
|
||||||
|
|
||||||
extern sexp sexp_gc (sexp ctx, size_t *sum_freed);
|
extern sexp sexp_gc (sexp ctx, size_t *sum_freed);
|
||||||
extern sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x);
|
extern sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x);
|
||||||
|
|
||||||
|
@ -112,9 +114,20 @@ static sexp sexp_heap_dump (sexp ctx sexp_api_params(self, n), sexp depth) {
|
||||||
return sexp_heap_walk(ctx, sexp_unbox_fixnum(depth), 1);
|
return sexp_heap_walk(ctx, sexp_unbox_fixnum(depth), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static sexp sexp_heap_stats (sexp ctx sexp_api_params(self, n)) {
|
||||||
|
return SEXP_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static sexp sexp_heap_dump (sexp ctx sexp_api_params(self, n), sexp depth) {
|
||||||
|
return SEXP_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx sexp_api_params(self, n), sexp env) {
|
sexp sexp_init_library (sexp ctx sexp_api_params(self, n), sexp env) {
|
||||||
sexp_define_foreign(ctx, env, "heap-stats", 0, sexp_heap_stats);
|
sexp_define_foreign(ctx, env, "heap-stats", 0, sexp_heap_stats);
|
||||||
sexp_define_foreign_opt(ctx, env, "heap-dump", 1, sexp_heap_dump, SEXP_ONE);
|
sexp_define_foreign_opt(ctx, env, "heap-dump", 1, sexp_heap_dump, SEXP_ONE);
|
||||||
return SEXP_VOID;
|
return SEXP_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,9 @@ static int sexp_in_heap_p (sexp_heap h, sexp p) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static sexp sexp_last_context (sexp ctx, sexp *cstack) {
|
static sexp sexp_last_context (sexp ctx, sexp *cstack) {
|
||||||
sexp res=SEXP_FALSE, p;
|
sexp res=SEXP_FALSE;
|
||||||
#if ! SEXP_USE_BOEHM
|
#if ! SEXP_USE_BOEHM
|
||||||
|
sexp p;
|
||||||
sexp_sint_t i;
|
sexp_sint_t i;
|
||||||
sexp_heap h = sexp_context_heap(ctx);
|
sexp_heap h = sexp_context_heap(ctx);
|
||||||
for (i=0; i<SEXP_LAST_CONTEXT_CHECK_LIMIT; i++) {
|
for (i=0; i<SEXP_LAST_CONTEXT_CHECK_LIMIT; i++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue