diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-20 15:50:38 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-20 15:50:55 +0100 |
commit | 2a13b634d12c53b75f26169fb623ea431b32332a (patch) | |
tree | 611ee4266ac669be759fbd91c4a27e2500128d7d | |
parent | 4db72410f710de1bb70b92e2621a40d78a72152e (diff) |
gc additions
-rw-r--r-- | src/library_gc.js | 13 | ||||
-rw-r--r-- | system/include/gc.h | 8 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/library_gc.js b/src/library_gc.js index bf0a6aff..a06e2f01 100644 --- a/src/library_gc.js +++ b/src/library_gc.js @@ -16,6 +16,11 @@ if (GC_SUPPORT) { init: function() { assert(!GC.initted); GC.initted = true; + + _GC_finalize_on_demand = _malloc(4); setValue(_GC_finalize_on_demand, 0, 'i32') + _GC_java_finalization = _malloc(4); setValue(_GC_java_finalization, 0, 'i32'); + _GC_finalizer_notifier = _malloc(4); setValue(_GC_finalizer_notifier, 0, 'i32'); + if (ENVIRONMENT_IS_WEB) { setInterval(function() { GC.maybeCollect(); @@ -159,7 +164,13 @@ if (GC_SUPPORT) { GC_FORCE_COLLECT__deps: ['$GC'], GC_FORCE_COLLECT: function() { GC.collect(); - } + }, + + GC_finalize_on_demand: 0, + GC_java_finalization: 0, + GC_finalizer_notifier: 0, + + GC_enable_incremental: function(){}, }; mergeInto(LibraryManager.library, LibraryGC); diff --git a/system/include/gc.h b/system/include/gc.h index c27135ec..e0419dcb 100644 --- a/system/include/gc.h +++ b/system/include/gc.h @@ -8,7 +8,7 @@ extern "C" { #endif -void __attribute__((used)) __GC_KEEPALIVE__() { +static void __attribute__((used)) __GC_KEEPALIVE__() { // Force inclusion of necessary dlmalloc functions static int times = 1; void *x = malloc(times); @@ -45,6 +45,12 @@ void GC_MAYBE_COLLECT(); void GC_FORCE_COLLECT(); typedef void (*GC_finalization_proc)(void *func, void *arg); +extern void (*GC_finalizer_notifier)(); + +extern int GC_finalize_on_demand; +extern int GC_java_finalization; + +void GC_enable_incremental(); #ifdef __cplusplus } |