hello,

i am building a c++ application using jolt as a shared library. i want to add a JIT compiler to an existing smalltalk(-like) virtual machine. we use jolt to compile code while the virtual machine is running. after compilation we execute the code instead of interpreting it again and again.

i would like to profile my application with valgrind, gprof or a similiar tool. unfortunately, valgrind seems to have problems with the runtime code generation that is done in our application with jolt:

$ valgrind --smc-check=all  --tool=callgrind <myApp and Parameters>
==8868== Callgrind, a call-graph generating cache profiler.
==8868== Copyright (C) 2002-2008, and GNU GPL'd, by Josef Weidendorfer et al.
==8868== Using LibVEX rev 1884, a library for dynamic binary translation.
==8868== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==8868== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation framework.
==8868== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==8868== For more details, rerun with: -v
==8868==
==8868== For interactive control, run 'callgrind_control -h'.

==8868==
==8868== Process terminating with default action of signal 11 (SIGSEGV)
==8868==  Access not within mapped region at address 0xBEF4B000
==8868==    at 0x421F3C2: GC_push_all_eager (in jolty.so)
==8868==    by 0x421F407: GC_push_all_stack (in jolty.so)
==8868==    by 0x4217B78: GC_push_all_stacks (in jolty.so)
==8868==    by 0x4215512: GC_default_push_other_roots (in jolty.so)
==8868==    by 0x422075B: GC_push_roots (in jolty.so)
==8868==    by 0x421DF9F: GC_mark_some (in jolty.so)
==8868==    by 0x421996D: GC_stopped_mark (in jolty.so)
==8868==    by 0x421968D: GC_try_to_collect_inner (in jolty.so)
==8868==    by 0x4213D9F: GC_init_inner (in jolty.so)
==8868==    by 0x421394B: GC_init (in jolty.so)
==8868==    by 0x4226122: _libid_init (libid.c:1048)
==8868==    by 0x40EBCD6: GetJoltInitially (jolty.c:7)
==8868== If you believe this happened as a result of a stack overflow in your ==8868== program's main thread (unlikely but possible), you can try to increase ==8868== the size of the main thread stack using the --main-stacksize= flag.
==8868==  The main thread stack size used in this run was 8388608.
==8868==
==8868== Events    : Ir
==8868== Collected : 4645259
==8868==
==8868== I   refs:      4,645,259
Segmentation fault

the programs works fine when executed normally (without valgrind as a profiler). jolty.so is the jolt shared library that we use. we use the latest jolt revision available in the repository (r647).

i have tried using valgrinds "--smc-check=all" flag for self-modifying code because the manual says:

"[...] Useful if you are debugging a JIT compiler or some other dynamic code generation system. After this call, attempts to execute code in the invalidated address range will cause Valgrind to make new translations of that code, which is probably the semantics you want. [...] Alternatively, for transparent self-modifying-code support, use--smc-check=all, or run on ppc32/Linux or ppc64/Linux."

however, this seems to have no effect. the program is still terminated with a segfault when running in valgrind.

is there another way to profile my vm application that uses jolt?

regards,
ingo


_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to