diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
commit | 16d128e5e10d541a78654b86409d5a3539f07708 (patch) | |
tree | 66de0af63c3811bb3040c16e9b52c11985f70811 /Build/source/utils/asymptote/backtrace.cc | |
parent | b20f78c549859ec0e8610bdd3ad904245e86b489 (diff) |
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/backtrace.cc')
-rw-r--r-- | Build/source/utils/asymptote/backtrace.cc | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/backtrace.cc b/Build/source/utils/asymptote/backtrace.cc new file mode 100644 index 00000000000..45bf8c4604a --- /dev/null +++ b/Build/source/utils/asymptote/backtrace.cc @@ -0,0 +1,84 @@ +/***** Autogenerated from backtrace.in; changes will be overwritten *****/ + +#line 1 "runtimebase.in" +/***** + * runtimebase.in + * Andy Hammerlindl 2009/07/28 + * + * Common declarations needed for all code-generating .in files. + * + *****/ + + +#line 1 "backtrace.in" +/***** + * backtrace.in + * Andy Hammerlindl 2009/07/28 + * + * Runtime functions for printing garbage collector backtraces. + * + *****/ + +#line 1 "runtimebase.in" +#include "stack.h" +#include "types.h" +#include "builtin.h" +#include "entry.h" +#include "errormsg.h" + +using vm::stack; +using vm::error; +using types::formal; + +#define PRIMITIVE(name,Name,asyName) using types::prim##Name; +#include <primitives.h> +#undef PRIMITIVE + +void unused(void *); + +#line 11 "backtrace.in" +// No extra code for .cc file. + + +namespace run { +#line 13 "backtrace.in" +// void generate_random_backtrace(); +void gen_backtrace0(stack *) +{ +#line 14 "backtrace.in" +#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE) + GC_generate_random_backtrace(); +#else + error("generate_random_backtrace() requires ./configure --enable-gc-debug"); +#endif +} + +#line 22 "backtrace.in" +// void print_random_addresses(Int n=1); +void gen_backtrace1(stack *Stack) +{ + Int n=vm::pop<Int>(Stack,1); +#line 23 "backtrace.in" +#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE) + GC_gcollect(); + for (Int i=0; i < n; ++i) + GC_debug_print_heap_obj_proc(GC_base(GC_generate_random_valid_address())); +#else + error("print_random_addresses() requires ./configure --enable-gc-debug"); + unused(&n); // Avoid unused variable warning message. +#endif +} + +} // namespace run + +namespace trans { + +void gen_backtrace_venv(venv &ve) +{ +#line 13 "backtrace.in" + addFunc(ve, run::gen_backtrace0, primVoid(), "generate_random_backtrace"); +#line 22 "backtrace.in" + addFunc(ve, run::gen_backtrace1, primVoid(), "print_random_addresses", formal(primInt(), "n", true, false)); +} + +} // namespace trans |