I replaced the MMTk code with a C-version MMTk code (I have been working on such AOT compiler for a while). The compiler should deal with most of the MMTk code base correctly - at least I get marksweep running with a tiny client). So I am trying to put the C version MMTk back with VmKit. I tried not to change much existing code except where necessary, such as name mangling and MMTkObject layout.
I am having the following error during building VmKit:
[vmkit ./tools/trainer]: Pre-compiling bootstrap code
Thread 0x110000000 received a SIGSEGV: either the VM code or an external
native method is bogus. Aborting…
make: *** [/home/yilin/vmkit/vmkit/tools/trainer/Release+Asserts/Precompiled.bc] Error 134
[vmkit .]: abort with error in ./tools/trainer
make: *** [all] Error 1
The stacktrace from gdb is:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x1100ff700 (LWP 21670)]
0x000000000107b180 in llvm::BumpPtrAllocator::Allocate(unsigned long, unsigned long) ()
#0 0x000000000107b180 in llvm::BumpPtrAllocator::Allocate(unsigned long, unsigned long) ()
#1 0x00000000005ae35d in j3::JavaMethod::marshalArguments(vmkit::ThreadAllocator&, __va_list_tag*) ()
#2 0x00000000005b04e4 in j3::JavaObject* j3::JavaMethod::invokeStaticAP<j3::JavaObject*, j3::JavaObject* ()(j3::JavaConstantPool, void*, void*)>(j3::Jnjvm*, j3::Class*, __va_list_tag*) ()
#3 0x00000000005af054 in j3::JavaMethod::invokeJavaObjectStatic(j3::Jnjvm*, j3::Class*, …) ()
#4 0x00000000005cb662 in j3::Jnjvm::asciizToStr(char const*) ()
#5 0x00000000005cbde4 in j3::Jnjvm::CreateArithmeticException() ()
#6 0x00007ffff7f6316d in ?? ()
#7 0x0000000000000000 in ?? ()
The main thread was waiting in “vmkit::VirtualMachine::waitForExit() ()”, so the application (HelloWorld) should have been started.
To me, the stack trace seems not showing where the original error happened. It seems an arithmetic error happened somewhere, VM was trying to throw an exception, but met another error. Is this correct? And how can I track where that actual error happened?
What does the precompiler do? I dont quite understand why it is needed here.
Any information would be very helpful. Thanks very much.