[LLVMdev] A working garbage collector - finally :)
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Tue Mar 8 19:50:40 PST 2011
Since you are using a copying collector, may I ask how do you handle
registers holding pointers to intermediate values?
The example I am considering is something like
void foo(void);
void f(long long *v, long long n) {
long long int i;
for (i = 0; i < n; ++i) {
v[i] = i;
foo();
}
}
If *v points to gc memory, we can start the function with
%v.addr = alloca i64*, align 8
%foobar = bitcast i64** %v.addr to i8**
call void @llvm.gcroot(i8** %foobar, i8* null)
store i64* %v, i64** %v.addr, align 8
but nothing prevents llvm from putting the call to foo in between the
computation of &v[i] and the store by using a callee saved register. If
GC moves moves v during the call to foo, the next store will be wrong.
> -- Talin
>
Cheers,
Rafael
More information about the llvm-dev
mailing list