Re: Multiple Values and GC

[email protected] Thu, 16 Sep 2021 07:44:18 +0200
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
I have conducted a very quick experiment:

-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
cat > bt.c <<EOF
#include <backtrace.h>

struct backtrace_state *bt_state;

static int cb(void *data, uintptr_t pc, const char *filename, int lineno, const char *function) {
   printf("%s:%d %s\n", filename ? filename : "", lineno, function ? function : "");
   return 0;
}

static void cbe(void *data, const char *msg, int errnum) {
   fprintf(stderr, "%s(%)", msg, errnum);
}

long bt_init() {
   bt_state = backtrace_create_state(0L, 0, cbe, 0L);
}

long bt_test() {
   backtrace_full(bt_state, 0, cb, cbe, 0L);
}
   
EOF
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----

Then I grabbed the maze.scm from the bglstone suite and inserted a
call to bt_init at the beginning of the execution and a call to bt_test
in the middle of the benchmark. I have then compiled with:

-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
gcc -c -I ../include/ -c bt.c
bigloo -unsafe -O3 maze.scm bt.o ../lib/libbacktrace.a -cg -glines
./a.out | demangle
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----

I obtained

-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
/tmp/BT/libbacktrace/maze.scm:489 print-hexmaze@maze
/tmp/BT/libbacktrace/maze.scm:435 pmaze@maze
/tmp/BT/libbacktrace/maze.scm:805 &<@anonymous:1833>@maze
objs/obj_u/Ieee/port.c:3744 with-output-to-file@__r4_ports_6_10_1
/tmp/BT/libbacktrace/maze.scm:804 do-bench@maze
/tmp/BT/libbacktrace/maze.scm:821 main@maze
/tmp/BT/libbacktrace/maze.scm:1 bigloo_main
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----

Which is, I must admit, very nice. I will definitively have to look at
libbacktrace for next Bigloo releases...

Thanks again for having drawn our attention to that library that, personally,
I didn't know.


-- 
Manuel
signature.asc (application/pgp-signature, 487 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEELgdDMTtUx/Mxl41xMMxQ5DtOwukFAmFC2yYACgkQMMxQ5DtO
wukvMgf9GvJ9asd5tRrwzm9Kzr7rfNtdaL0f040i64ARw4WGyHjJ7DCobKmN38uu
RcY8zzeukf5f/zKopvXFE7z3tAHHA4Z5VPcV11P636+LQUUZ0//hvDdyJt6ekd5v
jxmPgxiJcNTQyEBlOXwEdNQ06LClIr40AZ5LfQOLKxGSPh0fl2Wirnx4yBhQT0OV
4ZLuU2MgKg4usVMqIvAJ+qEvlIcKgkndeJUo9xOlby5EOdc9rYQgufc7cJ5egDBz
fzOJbDavoesMfwuyrtmLvqUg4/BwwZiZuUk0Yn3jWORN1XFpiRh79arSARsf6kdd
FglawxGBCuSxCjlrr+OUwPYyPbEgbA==
=0BCS
-----END PGP SIGNATURE-----