Displaying 1 result from an estimated 1 matches for "allocate_object".
2009 Dec 04
1
[LLVMdev] LLVM's GC support
...here I'm getting confused. Anyways, suppose I have a function that has a pointer to a GC-tracked object as a parameter and a collection can be triggered from this function, e.g.
>
> object*
> f(object *some_obj)
> {
> object __attribute__((gcroot)) *new_obj;
> new_obj = allocate_object();
> // A collection could have been executed at this point,
> // and so some_obj might have become invalid
> new_obj->child = some_obj;
> return new_obj;
> }
To ensure that *some_obj isn't collected prematurely, your code will need to copy the value of some_obj i...