Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 1 | /*===-- GCInterface.h - Public interface exposed by garbage collectors ----===*\ |
| 2 | |* |
| 3 | |* The LLVM Compiler Infrastructure |
| 4 | |* |
| 5 | |* This file was developed by the LLVM research group and is distributed under |
| 6 | |* the University of Illinois Open Source License. See LICENSE.TXT for details. |
Misha Brukman | fd93908 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 7 | |* |
Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 8 | |*===----------------------------------------------------------------------===*| |
Misha Brukman | fd93908 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 9 | |* |
Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 10 | |* This file defines the common public interface that must be exposed by all |
| 11 | |* LLVM garbage collectors. |
| 12 | |* |
| 13 | \*===----------------------------------------------------------------------===*/ |
| 14 | |
| 15 | #ifndef GCINTERFACE_H |
| 16 | #define GCINTERFACE_H |
| 17 | |
Chris Lattner | a2f45b2 | 2004-05-27 05:51:13 +0000 | [diff] [blame] | 18 | /* llvm_cg_walk_gcroots - This function is exposed by the LLVM code generator, |
| 19 | * and allows us to traverse the roots on the stack. |
| 20 | */ |
| 21 | void llvm_cg_walk_gcroots(void (*FP)(void **Root, void *Meta)); |
| 22 | |
| 23 | |
Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 24 | /* llvm_gc_initialize - This function is called to initalize the garbage |
| 25 | * collector. |
| 26 | */ |
Chris Lattner | a2f45b2 | 2004-05-27 05:51:13 +0000 | [diff] [blame] | 27 | void llvm_gc_initialize(unsigned InitialHeapSize); |
Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 28 | |
| 29 | /* llvm_gc_allocate - This function allocates Size bytes from the heap and |
| 30 | * returns a pointer to it. |
| 31 | */ |
| 32 | void *llvm_gc_allocate(unsigned Size); |
| 33 | |
| 34 | /* llvm_gc_collect - This function forces a garbage collection cycle. |
| 35 | */ |
| 36 | void llvm_gc_collect(); |
| 37 | |
| 38 | /* llvm_gc_read - This function should be implemented to include any read |
| 39 | * barrier code that is needed by the garbage collector. |
| 40 | */ |
Chris Lattner | 93c9587 | 2004-07-22 05:51:13 +0000 | [diff] [blame] | 41 | void *llvm_gc_read(void *ObjPtr, void **FieldPtr); |
Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 42 | |
| 43 | /* llvm_gc_write - This function should be implemented to include any write |
| 44 | * barrier code that is needed by the garbage collector. |
| 45 | */ |
Chris Lattner | 93c9587 | 2004-07-22 05:51:13 +0000 | [diff] [blame] | 46 | void llvm_gc_write(void *V, void *ObjPtr, void **FieldPtr); |
Chris Lattner | e6fd776 | 2004-05-23 21:25:59 +0000 | [diff] [blame] | 47 | |
| 48 | #endif |