process_root.

Hi,

This is regarding the backend for garbage collection. My problem might be
related to some strange memory fault created by my frontend, but I'll try
here to get some feedback.

For some strange reason I get segmentation fault in process_pointer in
semispace.c (I've implemented a small collector, hopefully :). The fault
occurs when I do:

printf("process_root[0x%p] = 0x%p\n", (void*) Root, (void*) *Root);

I.e, when I reference Root.

My frontend creates llvm assembly with llvm-gcroot in the following
manner:

...
%r22 = alloca uint ;; typetagged integers/pointers
%r23 = cast uint* %r22 to sbyte**
call void %llvm.gcroot(sbyte** %r23, sbyte* null)
...

So Root should be a valid pointer to the program stack. It traces two
roots before the segmentation fault.

Any ideas?

Btw, can I run llvm-db with llvm assembly as source language? Haven't
found any suitable flags.

regards, Tobias

ps. I run my test like this:

llvm-as test.ll|opt -f -lowergc -o=test2.bc;llvm-link test2.bc
~/llvm/llvm/runtime/GC/SemiSpace/BytecodeObj/semispace.bc -f
-o=test3.bc;lli test3.bc

.ds

Hi,

This is regarding the backend for garbage collection. My problem might be
related to some strange memory fault created by my frontend, but I'll try
here to get some feedback.

Okay. I'm not an expert on GC but I'll take a look ...

For some strange reason I get segmentation fault in process_pointer in
semispace.c (I've implemented a small collector, hopefully :). The fault
occurs when I do:

printf("process_root[0x%p] = 0x%p\n", (void*) Root, (void*) *Root);

I.e, when I reference Root.

I don't know what "Root" is but possibly the %p substitution with
"*Root" isn't valid.

My frontend creates llvm assembly with llvm-gcroot in the following
manner:

...
%r22 = alloca uint ;; typetagged integers/pointers
%r23 = cast uint* %r22 to sbyte**
call void %llvm.gcroot(sbyte** %r23, sbyte* null)
...

So Root should be a valid pointer to the program stack. It traces two
roots before the segmentation fault.

Well, Root may be valid, but combining "%p" with *Root probably isn't.

Any ideas?

Btw, can I run llvm-db with llvm assembly as source language?

Yes, but you'd have to manually insert the debugging support information
which would be tedious. You'd be better off doing something like writing
a debug info insertion pass and applying it to the Module. This way you
can use llvmAsmParser to get a module, apply the pass and then the
bcwriter to create the bytecode with the debug info in it.

Reid

Okay. I'm not an expert on GC but I'll take a look ...

Thanks :slight_smile:

> For some strange reason I get segmentation fault in process_pointer in
> semispace.c (I've implemented a small collector, hopefully :). The fault
> occurs when I do:
>
> printf("process_root[0x%p] = 0x%p\n", (void*) Root, (void*) *Root);
>
> I.e, when I reference Root.

I don't know what "Root" is but possibly the %p substitution with
"*Root" isn't valid.

Hmm, ok, that was in the file when I checked it out from the cvs. The
point is that is crashes when using *Root, no matter how, even when not
using it in the printf.

, Tobias

Seems like Root in process_root sometimes is a null pointer. Wonder if it
is my fault? :slight_smile: *debugging*
, Tobias

Okay. I don't know much about the GC stuff, but if you tell me where
this process_root thing is, I might be able to help. I couldn't find it
in a search.

Reid