Skip to content

Commit a0cb4ed

Browse files
dpgeorgepfalcon
authored andcommitted
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.
1 parent cef0738 commit a0cb4ed

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

esp8266/mpconfigport.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@
6969
#define MICROPY_VFS_FAT (1)
7070

7171
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
72+
#define MICROPY_VM_HOOK_COUNT (10)
73+
#define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT;
74+
#define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \
75+
vm_hook_divisor = MICROPY_VM_HOOK_COUNT; \
76+
extern void ets_loop_iter(void); \
77+
ets_loop_iter(); \
78+
}
79+
#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
80+
#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
7281

7382
// type definitions for the specific machine
7483

0 commit comments

Comments
 (0)