From a0cb4eda9a6faef109f64da39e441f2b11afc872 Mon Sep 17 00:00:00 2001 From: Damien George <damien.p.george@gmail.com> Date: Sat, 2 Apr 2016 01:32:55 +0300 Subject: [PATCH] esp8266: Use VM_HOOK to call ets_loop_iter within the VM. Starting with a divisor of 10, pystone_lowmem gives a score of 256. --- esp8266/mpconfigport.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h index 943b16c8f..05f2cb913 100644 --- a/esp8266/mpconfigport.h +++ b/esp8266/mpconfigport.h @@ -69,6 +69,15 @@ #define MICROPY_VFS_FAT (1) #define MICROPY_EVENT_POLL_HOOK {ets_event_poll();} +#define MICROPY_VM_HOOK_COUNT (10) +#define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT; +#define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \ + vm_hook_divisor = MICROPY_VM_HOOK_COUNT; \ + extern void ets_loop_iter(void); \ + ets_loop_iter(); \ + } +#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL +#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL // type definitions for the specific machine -- GitLab