Allow API usage in native_free_callbacks (#3515)

This patch allows the use of API functions in native_free_callbacks for native pointers once again.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla
2020-01-18 10:05:32 +01:00
committed by Dániel Bátyai
parent 71d4e12105
commit f46d061d19
7 changed files with 96 additions and 15 deletions
+16 -2
View File
@@ -29,6 +29,11 @@
* @{
*/
/**
* Maximum number of GC loops on cleanup.
*/
#define JERRY_GC_LOOP_LIMIT 100
/**
* Initialize ECMA components
*/
@@ -73,8 +78,17 @@ ecma_finalize (void)
#endif /* ENABLED (JERRY_ES2015) */
ecma_finalize_global_lex_env ();
ecma_finalize_builtins ();
ecma_gc_run ();
uint8_t runs = 0;
do
{
ecma_finalize_builtins ();
ecma_gc_run ();
if (++runs >= JERRY_GC_LOOP_LIMIT)
{
jerry_fatal (ERR_UNTERMINATED_GC_LOOPS);
}
}
while (JERRY_CONTEXT (ecma_gc_new_objects) != 0);
ecma_finalize_lit_storage ();
} /* ecma_finalize */