Generational mark and sweep GC.

This commit is contained in:
Ruben Ayrapetyan
2014-08-07 14:54:32 +04:00
parent ba6713e295
commit e3cd8ee942
15 changed files with 475 additions and 180 deletions
+15 -5
View File
@@ -23,16 +23,26 @@
#ifndef ECMA_GC_H
#define ECMA_GC_H
/**
* Garbage collector interface
*/
#include "ecma-globals.h"
/**
* GC generation identifier
*/
typedef enum
{
ECMA_GC_GEN_0, /**< generation 0 */
ECMA_GC_GEN_1, /**< generation 1 */
ECMA_GC_GEN_2, /**< generation 2 */
ECMA_GC_GEN_COUNT /**< generations' number */
} ecma_gc_gen_t;
extern void ecma_gc_init( void);
extern void ecma_init_gc_info(ecma_object_t *object_p);
extern void ecma_ref_object(ecma_object_t *object_p);
extern void ecma_deref_object(ecma_object_t *object_p);
extern void ecma_gc_run( void);
extern void ecma_gc_update_may_ref_younger_object_flag_by_value( ecma_object_t *obj_p, ecma_value_t value);
extern void ecma_gc_update_may_ref_younger_object_flag_by_object( ecma_object_t *obj_p, ecma_object_t *ref_obj_p);
extern void ecma_gc_run( ecma_gc_gen_t max_gen_to_collect);
#endif /* !ECMA_GC_H */