Skip to content

Commit 2b2f2df

Browse files
committed
Add vm_finalize() to clean program pointer for embed systems
JerryScript-DCO-1.0-Signed-off-by: SaeHie Park [email protected]
1 parent afd532d commit 2b2f2df

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

jerry-core/jerry.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,7 @@ jerry_cleanup (void)
11711171
ecma_finalize ();
11721172
serializer_free ();
11731173
mem_finalize (is_show_mem_stats);
1174+
vm_finalize ();
11741175
} /* jerry_cleanup */
11751176

11761177
/**

jerry-core/vm/vm.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,15 @@ vm_init (const opcode_t *program_p, /**< pointer to byte-code program */
350350
__program = program_p;
351351
} /* vm_init */
352352

353+
/**
354+
* Cleanup interpreter
355+
*/
356+
void
357+
vm_finalize (void)
358+
{
359+
__program = NULL;
360+
} /* vm_finalize */
361+
353362
/**
354363
* Run global code
355364
*/

jerry-core/vm/vm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "opcodes.h"
2222

2323
extern void vm_init (const opcode_t* program_p, bool dump_mem_stats);
24+
extern void vm_finalize (void);
2425
extern jerry_completion_code_t vm_run_global (void);
2526
extern ecma_completion_value_t vm_loop (int_data_t *int_data);
2627
extern ecma_completion_value_t vm_run_from_pos (opcode_counter_t start_pos,

0 commit comments

Comments
 (0)