!31 fix run context problem when call the callback function

* remove __pikaMain from StdTask
* support run arg from other context(file name space)
* format
* use def_context in callback
* supporting def_context, not ok
This commit is contained in:
李昂 2022-06-21 03:29:29 +00:00
parent 45207b3738
commit e31135ba90
12 changed files with 414 additions and 393 deletions

View File

@ -1,9 +1,10 @@
#api
from PikaObj import *
import PikaStdData
import PikaStdLib
class Task(TinyObj):
class Task(PikaStdLib.SysObj):
calls = PikaStdData.List()
def __init__(self):

View File

@ -1,10 +1,8 @@
#include "BaseObj.h"
#include "PikaVM.h"
extern PikaObj* __pikaMain;
void PikaStdTask_Task___init__(PikaObj* self) {
obj_setInt(self, "is_period", 0);
obj_setRef(__pikaMain, "__calls", obj_getObj(self, "calls"));
}
void PikaStdTask_Task_call_always(PikaObj* self, Arg* fun_todo) {
@ -90,116 +88,115 @@ void PikaStdTask_Task_call_period_ms(PikaObj* self,
}
void PikaStdTask_Task_run_once(PikaObj* self) {
/* transfer the tick to pikaMain */
obj_setInt(__pikaMain, "__tick", obj_getInt(self, "tick"));
/* clang-format off */
PIKA_PYTHON(
len = __calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = __calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = __calls[i]
todo()
info_index = 0
elif mode == 'when':
when = __calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = __calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = __calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = __calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if __tick > __calls[i]:
todo()
__calls[i] = __tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0d, 0x00, 0x00, 0x83, 0x11, 0x00,
0x00, 0x04, 0x16, 0x00, 0x00, 0x85, 0x1b, 0x00, 0x00, 0x04, 0x1d, 0x00,
0x20, 0x85, 0x1b, 0x00, 0x20, 0x01, 0x0d, 0x00, 0x10, 0x02, 0x28, 0x00,
0x00, 0x02, 0x2e, 0x00, 0x00, 0x04, 0x33, 0x00, 0x00, 0x82, 0x37, 0x00,
0x00, 0x04, 0x44, 0x00, 0x00, 0x0d, 0x44, 0x00, 0x00, 0x07, 0x46, 0x00,
0x11, 0x81, 0x0d, 0x00, 0x11, 0x05, 0x1b, 0x00, 0x01, 0x08, 0x48, 0x00,
0x01, 0x07, 0x4b, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1d, 0x00,
0x11, 0x05, 0x1b, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x4d, 0x00, 0x12, 0x01, 0x44, 0x00, 0x22, 0x01, 0x44, 0x00,
0x22, 0x05, 0x4b, 0x00, 0x12, 0x08, 0x55, 0x00, 0x12, 0x05, 0x4b, 0x00,
0x02, 0x02, 0x57, 0x00, 0x02, 0x04, 0x16, 0x00, 0x02, 0x85, 0x4b, 0x00,
0x02, 0x04, 0x1d, 0x00, 0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00,
0x11, 0x05, 0x4b, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x16, 0x00, 0x12, 0x03, 0x61, 0x00, 0x02, 0x08, 0x48, 0x00,
0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00, 0x13, 0x01, 0x44, 0x00,
0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00, 0x13, 0x08, 0x55, 0x00,
0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00, 0x03, 0x04, 0x68, 0x00,
0x03, 0x82, 0x68, 0x00, 0x03, 0x85, 0x1b, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00, 0x12, 0x03, 0x6d, 0x00,
0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00,
0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00,
0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00,
0x03, 0x04, 0x6d, 0x00, 0x03, 0x85, 0x46, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00, 0x12, 0x03, 0x72, 0x00,
0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00,
0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00,
0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00,
0x03, 0x04, 0x72, 0x00, 0x03, 0x85, 0x46, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00, 0x11, 0x05, 0x46, 0x00,
0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00, 0x12, 0x81, 0x16, 0x00,
0x12, 0x03, 0x6d, 0x00, 0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00,
0x03, 0x82, 0x6d, 0x00, 0x03, 0x07, 0x4b, 0x00, 0x14, 0x81, 0x4d, 0x00,
0x14, 0x01, 0x44, 0x00, 0x24, 0x01, 0x44, 0x00, 0x24, 0x05, 0x4b, 0x00,
0x14, 0x08, 0x55, 0x00, 0x14, 0x05, 0x4b, 0x00, 0x04, 0x02, 0x57, 0x00,
0x04, 0x04, 0x68, 0x00, 0x04, 0x82, 0x68, 0x00, 0x03, 0x85, 0x1b, 0x00,
0x03, 0x04, 0x1d, 0x00, 0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00,
0x12, 0x03, 0x72, 0x00, 0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00,
0x13, 0x81, 0x4d, 0x00, 0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00,
0x23, 0x05, 0x4b, 0x00, 0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00,
0x03, 0x02, 0x57, 0x00, 0x03, 0x04, 0x68, 0x00, 0x03, 0x85, 0x7c, 0x00,
0x03, 0x04, 0x1d, 0x00, 0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00,
0x11, 0x05, 0x7c, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x16, 0x00, 0x12, 0x03, 0x72, 0x00, 0x02, 0x08, 0x48, 0x00,
0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x7e, 0x00, 0x23, 0x01, 0x4d, 0x00,
0x23, 0x01, 0x44, 0x00, 0x33, 0x01, 0x44, 0x00, 0x33, 0x05, 0x4b, 0x00,
0x23, 0x08, 0x55, 0x00, 0x23, 0x05, 0x4b, 0x00, 0x13, 0x02, 0x57, 0x00,
0x03, 0x08, 0x85, 0x00, 0x03, 0x07, 0x4b, 0x00, 0x04, 0x82, 0x68, 0x00,
0x14, 0x81, 0x4d, 0x00, 0x14, 0x01, 0x44, 0x00, 0x24, 0x01, 0x7e, 0x00,
0x24, 0x01, 0x72, 0x00, 0x14, 0x08, 0x55, 0x00, 0x14, 0x03, 0x4d, 0x00,
0x04, 0x02, 0x87, 0x00, 0x03, 0x85, 0x1b, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x00, 0x86, 0x8f, 0x00, 0x00, 0x8c, 0x33, 0x00, /* instruct array */
0x92, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e,
0x00, 0x6c, 0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f,
0x64, 0x65, 0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74,
0x65, 0x72, 0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f,
0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00,
0x3d, 0x3d, 0x00, 0x31, 0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73,
0x00, 0x2b, 0x00, 0x5f, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f,
0x00, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f,
0x00, 0x77, 0x68, 0x65, 0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64,
0x5f, 0x6d, 0x73, 0x00, 0x33, 0x00, 0x5f, 0x5f, 0x74, 0x69, 0x63, 0x6b,
0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d,
0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(__pikaMain, (uint8_t*)bytes);
PIKA_PYTHON(
len = calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = calls[i]
todo()
info_index = 0
elif mode == 'when':
when = calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if tick > calls[i]:
todo()
calls[i] = tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0b, 0x00, 0x00, 0x83, 0x0f, 0x00,
0x00, 0x04, 0x14, 0x00, 0x00, 0x85, 0x19, 0x00, 0x00, 0x04, 0x1b, 0x00,
0x20, 0x85, 0x19, 0x00, 0x20, 0x01, 0x0b, 0x00, 0x10, 0x02, 0x26, 0x00,
0x00, 0x02, 0x2c, 0x00, 0x00, 0x04, 0x31, 0x00, 0x00, 0x82, 0x35, 0x00,
0x00, 0x04, 0x42, 0x00, 0x00, 0x0d, 0x42, 0x00, 0x00, 0x07, 0x44, 0x00,
0x11, 0x81, 0x0b, 0x00, 0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00,
0x01, 0x07, 0x49, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1b, 0x00,
0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x4b, 0x00, 0x12, 0x01, 0x42, 0x00, 0x22, 0x01, 0x42, 0x00,
0x22, 0x05, 0x49, 0x00, 0x12, 0x08, 0x51, 0x00, 0x12, 0x05, 0x49, 0x00,
0x02, 0x02, 0x53, 0x00, 0x02, 0x04, 0x14, 0x00, 0x02, 0x85, 0x49, 0x00,
0x02, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x49, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x5d, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00,
0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00,
0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00,
0x03, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x69, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x69, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x6e, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00, 0x11, 0x05, 0x44, 0x00,
0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00, 0x12, 0x81, 0x14, 0x00,
0x12, 0x03, 0x69, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x03, 0x82, 0x69, 0x00, 0x03, 0x07, 0x49, 0x00, 0x14, 0x81, 0x4b, 0x00,
0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x42, 0x00, 0x24, 0x05, 0x49, 0x00,
0x14, 0x08, 0x51, 0x00, 0x14, 0x05, 0x49, 0x00, 0x04, 0x02, 0x53, 0x00,
0x04, 0x04, 0x64, 0x00, 0x04, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00,
0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00,
0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00,
0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00, 0x03, 0x85, 0x78, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x78, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x7a, 0x00, 0x23, 0x01, 0x4b, 0x00,
0x23, 0x01, 0x42, 0x00, 0x33, 0x01, 0x42, 0x00, 0x33, 0x05, 0x49, 0x00,
0x23, 0x08, 0x51, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x02, 0x53, 0x00,
0x03, 0x08, 0x7f, 0x00, 0x03, 0x07, 0x49, 0x00, 0x04, 0x82, 0x64, 0x00,
0x14, 0x81, 0x4b, 0x00, 0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x7a, 0x00,
0x24, 0x01, 0x6e, 0x00, 0x14, 0x08, 0x51, 0x00, 0x14, 0x03, 0x4b, 0x00,
0x04, 0x02, 0x81, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x00, 0x86, 0x89, 0x00, 0x00, 0x8c, 0x31, 0x00, /* instruct array */
0x8c, 0x00, /* const pool size */
0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x00, 0x6c,
0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74, 0x65, 0x72,
0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e,
0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00, 0x3d, 0x3d,
0x00, 0x31, 0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x00, 0x2b, 0x00, 0x5f,
0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f, 0x00, 0x61, 0x6c, 0x77,
0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f, 0x00, 0x77, 0x68, 0x65,
0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x6d, 0x73, 0x00,
0x33, 0x00, 0x74, 0x69, 0x63, 0x6b, 0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73,
0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d, 0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void __Task_update_tick(PikaObj* self) {

View File

@ -11,7 +11,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
// "--gtest_filter=event.gpio"
// "--gtest_filter=compiler*"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",

View File

@ -1,9 +1,10 @@
#api
from PikaObj import *
import PikaStdData
import PikaStdLib
class Task(TinyObj):
class Task(PikaStdLib.SysObj):
calls = PikaStdData.List()
def __init__(self):

View File

@ -1,10 +1,8 @@
#include "BaseObj.h"
#include "PikaVM.h"
extern PikaObj* __pikaMain;
void PikaStdTask_Task___init__(PikaObj* self) {
obj_setInt(self, "is_period", 0);
obj_setRef(__pikaMain, "__calls", obj_getObj(self, "calls"));
}
void PikaStdTask_Task_call_always(PikaObj* self, Arg* fun_todo) {
@ -90,116 +88,115 @@ void PikaStdTask_Task_call_period_ms(PikaObj* self,
}
void PikaStdTask_Task_run_once(PikaObj* self) {
/* transfer the tick to pikaMain */
obj_setInt(__pikaMain, "__tick", obj_getInt(self, "tick"));
/* clang-format off */
PIKA_PYTHON(
len = __calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = __calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = __calls[i]
todo()
info_index = 0
elif mode == 'when':
when = __calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = __calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = __calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = __calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if __tick > __calls[i]:
todo()
__calls[i] = __tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0d, 0x00, 0x00, 0x83, 0x11, 0x00,
0x00, 0x04, 0x16, 0x00, 0x00, 0x85, 0x1b, 0x00, 0x00, 0x04, 0x1d, 0x00,
0x20, 0x85, 0x1b, 0x00, 0x20, 0x01, 0x0d, 0x00, 0x10, 0x02, 0x28, 0x00,
0x00, 0x02, 0x2e, 0x00, 0x00, 0x04, 0x33, 0x00, 0x00, 0x82, 0x37, 0x00,
0x00, 0x04, 0x44, 0x00, 0x00, 0x0d, 0x44, 0x00, 0x00, 0x07, 0x46, 0x00,
0x11, 0x81, 0x0d, 0x00, 0x11, 0x05, 0x1b, 0x00, 0x01, 0x08, 0x48, 0x00,
0x01, 0x07, 0x4b, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1d, 0x00,
0x11, 0x05, 0x1b, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x4d, 0x00, 0x12, 0x01, 0x44, 0x00, 0x22, 0x01, 0x44, 0x00,
0x22, 0x05, 0x4b, 0x00, 0x12, 0x08, 0x55, 0x00, 0x12, 0x05, 0x4b, 0x00,
0x02, 0x02, 0x57, 0x00, 0x02, 0x04, 0x16, 0x00, 0x02, 0x85, 0x4b, 0x00,
0x02, 0x04, 0x1d, 0x00, 0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00,
0x11, 0x05, 0x4b, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x16, 0x00, 0x12, 0x03, 0x61, 0x00, 0x02, 0x08, 0x48, 0x00,
0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00, 0x13, 0x01, 0x44, 0x00,
0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00, 0x13, 0x08, 0x55, 0x00,
0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00, 0x03, 0x04, 0x68, 0x00,
0x03, 0x82, 0x68, 0x00, 0x03, 0x85, 0x1b, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00, 0x12, 0x03, 0x6d, 0x00,
0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00,
0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00,
0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00,
0x03, 0x04, 0x6d, 0x00, 0x03, 0x85, 0x46, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00, 0x12, 0x03, 0x72, 0x00,
0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00,
0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00,
0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00,
0x03, 0x04, 0x72, 0x00, 0x03, 0x85, 0x46, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00, 0x11, 0x05, 0x46, 0x00,
0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00, 0x12, 0x81, 0x16, 0x00,
0x12, 0x03, 0x6d, 0x00, 0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00,
0x03, 0x82, 0x6d, 0x00, 0x03, 0x07, 0x4b, 0x00, 0x14, 0x81, 0x4d, 0x00,
0x14, 0x01, 0x44, 0x00, 0x24, 0x01, 0x44, 0x00, 0x24, 0x05, 0x4b, 0x00,
0x14, 0x08, 0x55, 0x00, 0x14, 0x05, 0x4b, 0x00, 0x04, 0x02, 0x57, 0x00,
0x04, 0x04, 0x68, 0x00, 0x04, 0x82, 0x68, 0x00, 0x03, 0x85, 0x1b, 0x00,
0x03, 0x04, 0x1d, 0x00, 0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00,
0x12, 0x03, 0x72, 0x00, 0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00,
0x13, 0x81, 0x4d, 0x00, 0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00,
0x23, 0x05, 0x4b, 0x00, 0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00,
0x03, 0x02, 0x57, 0x00, 0x03, 0x04, 0x68, 0x00, 0x03, 0x85, 0x7c, 0x00,
0x03, 0x04, 0x1d, 0x00, 0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00,
0x11, 0x05, 0x7c, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x16, 0x00, 0x12, 0x03, 0x72, 0x00, 0x02, 0x08, 0x48, 0x00,
0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x7e, 0x00, 0x23, 0x01, 0x4d, 0x00,
0x23, 0x01, 0x44, 0x00, 0x33, 0x01, 0x44, 0x00, 0x33, 0x05, 0x4b, 0x00,
0x23, 0x08, 0x55, 0x00, 0x23, 0x05, 0x4b, 0x00, 0x13, 0x02, 0x57, 0x00,
0x03, 0x08, 0x85, 0x00, 0x03, 0x07, 0x4b, 0x00, 0x04, 0x82, 0x68, 0x00,
0x14, 0x81, 0x4d, 0x00, 0x14, 0x01, 0x44, 0x00, 0x24, 0x01, 0x7e, 0x00,
0x24, 0x01, 0x72, 0x00, 0x14, 0x08, 0x55, 0x00, 0x14, 0x03, 0x4d, 0x00,
0x04, 0x02, 0x87, 0x00, 0x03, 0x85, 0x1b, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x00, 0x86, 0x8f, 0x00, 0x00, 0x8c, 0x33, 0x00, /* instruct array */
0x92, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e,
0x00, 0x6c, 0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f,
0x64, 0x65, 0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74,
0x65, 0x72, 0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f,
0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00,
0x3d, 0x3d, 0x00, 0x31, 0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73,
0x00, 0x2b, 0x00, 0x5f, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f,
0x00, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f,
0x00, 0x77, 0x68, 0x65, 0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64,
0x5f, 0x6d, 0x73, 0x00, 0x33, 0x00, 0x5f, 0x5f, 0x74, 0x69, 0x63, 0x6b,
0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d,
0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(__pikaMain, (uint8_t*)bytes);
PIKA_PYTHON(
len = calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = calls[i]
todo()
info_index = 0
elif mode == 'when':
when = calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if tick > calls[i]:
todo()
calls[i] = tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0b, 0x00, 0x00, 0x83, 0x0f, 0x00,
0x00, 0x04, 0x14, 0x00, 0x00, 0x85, 0x19, 0x00, 0x00, 0x04, 0x1b, 0x00,
0x20, 0x85, 0x19, 0x00, 0x20, 0x01, 0x0b, 0x00, 0x10, 0x02, 0x26, 0x00,
0x00, 0x02, 0x2c, 0x00, 0x00, 0x04, 0x31, 0x00, 0x00, 0x82, 0x35, 0x00,
0x00, 0x04, 0x42, 0x00, 0x00, 0x0d, 0x42, 0x00, 0x00, 0x07, 0x44, 0x00,
0x11, 0x81, 0x0b, 0x00, 0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00,
0x01, 0x07, 0x49, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1b, 0x00,
0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x4b, 0x00, 0x12, 0x01, 0x42, 0x00, 0x22, 0x01, 0x42, 0x00,
0x22, 0x05, 0x49, 0x00, 0x12, 0x08, 0x51, 0x00, 0x12, 0x05, 0x49, 0x00,
0x02, 0x02, 0x53, 0x00, 0x02, 0x04, 0x14, 0x00, 0x02, 0x85, 0x49, 0x00,
0x02, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x49, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x5d, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00,
0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00,
0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00,
0x03, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x69, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x69, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x6e, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00, 0x11, 0x05, 0x44, 0x00,
0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00, 0x12, 0x81, 0x14, 0x00,
0x12, 0x03, 0x69, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x03, 0x82, 0x69, 0x00, 0x03, 0x07, 0x49, 0x00, 0x14, 0x81, 0x4b, 0x00,
0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x42, 0x00, 0x24, 0x05, 0x49, 0x00,
0x14, 0x08, 0x51, 0x00, 0x14, 0x05, 0x49, 0x00, 0x04, 0x02, 0x53, 0x00,
0x04, 0x04, 0x64, 0x00, 0x04, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00,
0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00,
0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00,
0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00, 0x03, 0x85, 0x78, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x78, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x7a, 0x00, 0x23, 0x01, 0x4b, 0x00,
0x23, 0x01, 0x42, 0x00, 0x33, 0x01, 0x42, 0x00, 0x33, 0x05, 0x49, 0x00,
0x23, 0x08, 0x51, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x02, 0x53, 0x00,
0x03, 0x08, 0x7f, 0x00, 0x03, 0x07, 0x49, 0x00, 0x04, 0x82, 0x64, 0x00,
0x14, 0x81, 0x4b, 0x00, 0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x7a, 0x00,
0x24, 0x01, 0x6e, 0x00, 0x14, 0x08, 0x51, 0x00, 0x14, 0x03, 0x4b, 0x00,
0x04, 0x02, 0x81, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x00, 0x86, 0x89, 0x00, 0x00, 0x8c, 0x31, 0x00, /* instruct array */
0x8c, 0x00, /* const pool size */
0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x00, 0x6c,
0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74, 0x65, 0x72,
0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e,
0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00, 0x3d, 0x3d,
0x00, 0x31, 0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x00, 0x2b, 0x00, 0x5f,
0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f, 0x00, 0x61, 0x6c, 0x77,
0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f, 0x00, 0x77, 0x68, 0x65,
0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x6d, 0x73, 0x00,
0x33, 0x00, 0x74, 0x69, 0x63, 0x6b, 0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73,
0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d, 0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void __Task_update_tick(PikaObj* self) {

View File

@ -2,82 +2,83 @@
TEST(compiler, file) {
char* lines =
"len = __calls.len()\n"
"len = calls.len()\n"
"mode = 'none'\n"
"info_index = 0\n"
"for i in range(0, len):\n"
" if len == 0:\n"
" break\n"
" if info_index == 0:\n"
" mode = __calls[i]\n"
" mode = calls[i]\n"
" info_index = 1\n"
" elif info_index == 1:\n"
" if mode == 'always':\n"
" todo = __calls[i]\n"
" todo = calls[i]\n"
" todo()\n"
" info_index = 0\n"
" elif mode == 'when':\n"
" when = __calls[i]\n"
" when = calls[i]\n"
" info_index = 2\n"
" elif mode == 'period_ms':\n"
" period_ms = __calls[i]\n"
" period_ms = calls[i]\n"
" info_index = 2\n"
" elif info_index == 2:\n"
" if mode == 'when':\n"
" if when():\n"
" todo = __calls[i]\n"
" todo = calls[i]\n"
" todo()\n"
" info_index = 0\n"
" elif mode == 'period_ms':\n"
" todo = __calls[i]\n"
" todo = calls[i]\n"
" info_index = 3\n"
" elif info_index == 3:\n"
" if mode == 'period_ms':\n"
" if __tick > __calls[i]:\n"
" if tick > calls[i]:\n"
" todo()\n"
" __calls[i] = __tick + period_ms\n"
" calls[i] = tick + period_ms\n"
" info_index = 0\n"
"\n";
pikaCompile("task.bin", lines);
Parser_compilePyToBytecodeArray(lines);
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(compiler, task) {
char* lines =
"len = __calls.len()\n"
"len = calls.len()\n"
"mode = 'none'\n"
"info_index = 0\n"
"for i in range(0, len):\n"
" if len == 0:\n"
" break\n"
" if info_index == 0:\n"
" mode = __calls[i]\n"
" mode = calls[i]\n"
" info_index = 1\n"
" elif info_index == 1:\n"
" if mode == 'always':\n"
" todo = __calls[i]\n"
" todo = calls[i]\n"
" todo()\n"
" info_index = 0\n"
" elif mode == 'when':\n"
" when = __calls[i]\n"
" when = calls[i]\n"
" info_index = 2\n"
" elif mode == 'period_ms':\n"
" period_ms = __calls[i]\n"
" period_ms = calls[i]\n"
" info_index = 2\n"
" elif info_index == 2:\n"
" if mode == 'when':\n"
" if when():\n"
" todo = __calls[i]\n"
" todo = calls[i]\n"
" todo()\n"
" info_index = 0\n"
" elif mode == 'period_ms':\n"
" todo = __calls[i]\n"
" todo = calls[i]\n"
" info_index = 3\n"
" elif info_index == 3:\n"
" if mode == 'period_ms':\n"
" if __tick > __calls[i]:\n"
" if tick > calls[i]:\n"
" todo()\n"
" __calls[i] = __tick + period_ms\n"
" calls[i] = tick + period_ms\n"
" info_index = 0\n"
"\n";
@ -564,7 +565,7 @@ TEST(compiler, event_cb) {
}
TEST(compiler, event_cb_lvgl) {
char* lines = "_event_cb(_event_evt)";
char* lines = "eventCallBack(eventSignal)";
Parser_compilePyToBytecodeArray(lines);
EXPECT_EQ(pikaMemNow(), 0);
}

View File

@ -1,6 +1,5 @@
#include "test_common.h"
extern PikaEventListener* g_pika_device_event_listener;
TEST(event, gpio) {
/* init */
@ -8,15 +7,15 @@ TEST(event, gpio) {
/* run */
pikaVM_runFile(pikaMain, "../../examples/TemplateDevice/gpio_cb.py");
#define EVENT_SIGAL_IO_RISING_EDGE 0x01
#define EVENT_SIGAL_IO_FALLING_EDGE 0x02
#define GPIO_PA8_EVENT_ID 0x08
#define EVENT_SIGAL_IO_RISING_EDGE 0x01
#define EVENT_SIGAL_IO_FALLING_EDGE 0x02
#define GPIO_PA8_EVENT_ID 0x08
/* simulate run in the call back */
pks_eventLisener_sendSignal(g_pika_device_event_listener, GPIO_PA8_EVENT_ID,
EVENT_SIGAL_IO_RISING_EDGE);
EVENT_SIGAL_IO_RISING_EDGE);
pks_eventLisener_sendSignal(g_pika_device_event_listener, GPIO_PA8_EVENT_ID,
EVENT_SIGAL_IO_FALLING_EDGE);
EVENT_SIGAL_IO_FALLING_EDGE);
/* collect */
/* assert */
EXPECT_STREQ(log_buff[1], "get rising edge!\r\n");

View File

@ -521,7 +521,15 @@ ByteCodeFrame* methodArg_getBytecodeFrame(Arg* method_arg) {
char* methodArg_getDec(Arg* method_arg) {
uint32_t size_ptr = sizeof(void*);
void* info = arg_getContent(method_arg);
return (char*)((uintptr_t)info + 2 * size_ptr);
return (char*)((uintptr_t)info + 3 * size_ptr);
}
PikaObj* methodArg_getDefContext(Arg* method_arg) {
uint32_t size_ptr = sizeof(void*);
void* info = arg_getContent(method_arg) + 2 * size_ptr;
PikaObj* context = NULL;
__platform_memcpy(&context, info, size_ptr);
return context;
}
static void obj_saveMethodInfo(PikaObj* self, MethodInfo* method_info) {
@ -532,11 +540,17 @@ static void obj_saveMethodInfo(PikaObj* self, MethodInfo* method_info) {
uint32_t size_pars = strGetSize(pars);
uintptr_t method_info_bytecode_frame =
(uintptr_t)method_info->bytecode_frame;
uintptr_t method_info_def_context = (uintptr_t)method_info->def_context;
/* the first arg_value */
arg =
arg_setPtr(arg, method_info->name, method_info->type, method_info->ptr);
/* the seconed */
arg = arg_append(arg, &(method_info_bytecode_frame),
sizeof(method_info_bytecode_frame));
arg = arg_append(arg, &(method_info_def_context),
sizeof(method_info_def_context));
arg = arg_append(arg, method_info->pars, size_pars + 1);
args_setArg(self->list, arg);
strsDeinit(&buffs);
}
@ -545,6 +559,7 @@ static int32_t __class_defineMethodWithType(PikaObj* self,
char* declearation,
Method method_ptr,
ArgType method_type,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame) {
int32_t size = strGetSize(declearation);
int32_t res = 0;
@ -567,6 +582,7 @@ static int32_t __class_defineMethodWithType(PikaObj* self,
method_info.name = method_name;
method_info.ptr = (void*)method_ptr;
method_info.type = method_type;
method_info.def_context = def_context;
method_info.bytecode_frame = bytecode_frame;
obj_saveMethodInfo(method_host, &method_info);
res = 0;
@ -582,7 +598,7 @@ int32_t class_defineConstructor(PikaObj* self,
Method methodPtr) {
return __class_defineMethodWithType(self, declearation, methodPtr,
ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR,
NULL);
NULL, NULL);
}
/* define a native method as default */
@ -590,35 +606,40 @@ int32_t class_defineMethod(PikaObj* self,
char* declearation,
Method methodPtr) {
return __class_defineMethodWithType(self, declearation, methodPtr,
ARG_TYPE_METHOD_NATIVE, NULL);
ARG_TYPE_METHOD_NATIVE, NULL, NULL);
}
/* define object method, object method is which startwith (self) */
int32_t class_defineRunTimeConstructor(PikaObj* self,
char* declearation,
Method methodPtr,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame) {
return __class_defineMethodWithType(self, declearation, methodPtr,
ARG_TYPE_METHOD_CONSTRUCTOR,
bytecode_frame);
def_context, bytecode_frame);
}
/* define object method, object method is which startwith (self) */
int32_t class_defineObjectMethod(PikaObj* self,
char* declearation,
Method methodPtr,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame) {
return __class_defineMethodWithType(self, declearation, methodPtr,
ARG_TYPE_METHOD_OBJECT, bytecode_frame);
ARG_TYPE_METHOD_OBJECT, def_context,
bytecode_frame);
}
/* define a static method as default */
int32_t class_defineStaticMethod(PikaObj* self,
char* declearation,
Method methodPtr,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame) {
return __class_defineMethodWithType(self, declearation, methodPtr,
ARG_TYPE_METHOD_STATIC, bytecode_frame);
ARG_TYPE_METHOD_STATIC, def_context,
bytecode_frame);
}
VMParameters* obj_runDirect(PikaObj* self, char* cmd) {
@ -992,7 +1013,8 @@ PikaObj* obj_importModuleWithByteCode(PikaObj* self,
PikaObj* obj_importModuleWithByteCodeFrame(PikaObj* self,
char* name,
ByteCodeFrame* byteCode_frame) {
obj_newDirectObj(self, name, New_TinyObj);
PikaObj* New_PikaStdLib_SysObj(Args * args);
obj_newDirectObj(self, name, New_PikaStdLib_SysObj);
pikaVM_runByteCodeFrame(obj_getObj(self, name), byteCode_frame);
return self;
}
@ -1092,8 +1114,6 @@ static PikaObj* pks_eventLisener_getEventHandleObj(PikaEventListener* self,
return eventHandleObj;
}
extern PikaObj* __pikaMain;
void pks_eventLisener_init(PikaEventListener** p_self) {
*p_self = newNormalObj(New_TinyObj);
}
@ -1114,23 +1134,19 @@ void pks_eventLisener_sendSignal(PikaEventListener* self,
"Error: can not find event handler by id: [0x%02x]\r\n", eventId);
return;
}
obj_setArg(__pikaMain, "_eventCallBack",
obj_getArg(eventHandleObj, "eventCallBack"));
obj_setInt(__pikaMain, "_eventSignal", eventSignal);
obj_setInt(eventHandleObj, "eventSignal", eventSignal);
/* clang-format off */
PIKA_PYTHON(
_eventCallBack(_eventSignal)
)
eventCallBack(eventSignal)
)
/* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, /* instruct array size */
0x10, 0x81, 0x01, 0x00, 0x00, 0x02, 0x0e, 0x00, /* instruct array */
0x1d, 0x00, /* const pool size */
0x00, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x67,
0x6e, 0x61, 0x6c, 0x00, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x10, 0x81, 0x01, 0x00, 0x00, 0x02, 0x0d, 0x00, /* instruct array */
0x1b, 0x00, /* const pool size */
0x00, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x67,
0x6e, 0x61, 0x6c, 0x00, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x43, 0x61, 0x6c, 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x00, /* const pool */
};
pikaVM_runByteCode(__pikaMain, (uint8_t*)bytes);
obj_removeArg(__pikaMain, "_eventCallBack");
obj_removeArg(__pikaMain, "_eventSignal");
pikaVM_runByteCode(eventHandleObj, (uint8_t*)bytes);
}

View File

@ -81,6 +81,7 @@ struct MethodInfo {
char* dec;
char* ptr;
char* pars;
PikaObj* def_context;
ArgType type;
ByteCodeFrame* bytecode_frame;
};
@ -128,16 +129,20 @@ PikaObj* obj_getHostObj(PikaObj* self, char* objPath);
int32_t obj_freeObj(PikaObj* self, char* subObjectName);
/* method */
int32_t class_defineMethod(PikaObj* self, char* declearation, Method methodPtr);
int32_t class_defineMethod(PikaObj* self,
char* declearation,
Method methodPtr);
int32_t class_defineObjectMethod(PikaObj* self,
char* declearation,
Method methodPtr,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame);
int32_t class_defineStaticMethod(PikaObj* self,
char* declearation,
Method methodPtr,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame);
int32_t class_defineConstructor(PikaObj* self,
@ -147,6 +152,7 @@ int32_t class_defineConstructor(PikaObj* self,
int32_t class_defineRunTimeConstructor(PikaObj* self,
char* declearation,
Method methodPtr,
PikaObj* def_context,
ByteCodeFrame* bytecode_frame);
int32_t obj_removeArg(PikaObj* self, char* argPath);
@ -255,13 +261,14 @@ enum shell_state obj_runChar(PikaObj* self, char inputChar);
typedef PikaObj PikaEventListener;
void pks_eventLisener_sendSignal(PikaEventListener* self,
uint32_t eventId,
int eventSignal);
uint32_t eventId,
int eventSignal);
void pks_eventLicener_registEvent(PikaEventListener* self,
uint32_t eventId,
PikaObj* eventHandleObj);
uint32_t eventId,
PikaObj* eventHandleObj);
void pks_eventLisener_init(PikaEventListener** p_self);
void pks_eventLisener_deinit(PikaEventListener** p_self);
PikaObj* methodArg_getDefContext(Arg* method_arg);
#endif

View File

@ -207,6 +207,10 @@ static Arg* VMState_runMethodArg(VMState* vs,
}
ByteCodeFrame* method_bytecodeFrame =
methodArg_getBytecodeFrame(method_arg);
PikaObj* method_context = methodArg_getDefContext(method_arg);
if (NULL != method_context) {
method_host_obj = method_context;
}
obj_setErrorCode(method_host_obj, 0);
/* run method */
@ -229,8 +233,8 @@ static Arg* VMState_runMethodArg(VMState* vs,
&(method_bytecodeFrame->instruct_array), 0);
uint16_t pc = (uintptr_t)method_ptr - insturctArray_start;
method_args_obj = __pikaVM_runByteCodeFrameWithState(
method_host_obj, method_args_obj, vs->globals, method_bytecodeFrame,
pc);
method_host_obj, method_args_obj, method_host_obj,
method_bytecodeFrame, pc);
/* get method return */
return_arg =
@ -925,15 +929,15 @@ static Arg* __VM_instruction_handler_DEF(PikaObj* self,
if (instructUnit_getBlockDeepth(ins_unit_now) == thisBlockDeepth + 1) {
if (is_in_class) {
class_defineObjectMethod(hostObj, data, (Method)ins_unit_now,
vs->bytecode_frame);
self, vs->bytecode_frame);
} else {
if (is_class) {
class_defineRunTimeConstructor(hostObj, data,
(Method)ins_unit_now,
(Method)ins_unit_now, self,
vs->bytecode_frame);
} else {
class_defineStaticMethod(hostObj, data,
(Method)ins_unit_now,
(Method)ins_unit_now, self,
vs->bytecode_frame);
}
}

View File

@ -1,9 +1,10 @@
#api
from PikaObj import *
import PikaStdData
import PikaStdLib
class Task(TinyObj):
class Task(PikaStdLib.SysObj):
calls = PikaStdData.List()
def __init__(self):

View File

@ -1,10 +1,8 @@
#include "BaseObj.h"
#include "PikaVM.h"
extern PikaObj* __pikaMain;
void PikaStdTask_Task___init__(PikaObj* self) {
obj_setInt(self, "is_period", 0);
obj_setRef(__pikaMain, "__calls", obj_getObj(self, "calls"));
}
void PikaStdTask_Task_call_always(PikaObj* self, Arg* fun_todo) {
@ -90,116 +88,115 @@ void PikaStdTask_Task_call_period_ms(PikaObj* self,
}
void PikaStdTask_Task_run_once(PikaObj* self) {
/* transfer the tick to pikaMain */
obj_setInt(__pikaMain, "__tick", obj_getInt(self, "tick"));
/* clang-format off */
PIKA_PYTHON(
len = __calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = __calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = __calls[i]
todo()
info_index = 0
elif mode == 'when':
when = __calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = __calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = __calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = __calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if __tick > __calls[i]:
todo()
__calls[i] = __tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0d, 0x00, 0x00, 0x83, 0x11, 0x00,
0x00, 0x04, 0x16, 0x00, 0x00, 0x85, 0x1b, 0x00, 0x00, 0x04, 0x1d, 0x00,
0x20, 0x85, 0x1b, 0x00, 0x20, 0x01, 0x0d, 0x00, 0x10, 0x02, 0x28, 0x00,
0x00, 0x02, 0x2e, 0x00, 0x00, 0x04, 0x33, 0x00, 0x00, 0x82, 0x37, 0x00,
0x00, 0x04, 0x44, 0x00, 0x00, 0x0d, 0x44, 0x00, 0x00, 0x07, 0x46, 0x00,
0x11, 0x81, 0x0d, 0x00, 0x11, 0x05, 0x1b, 0x00, 0x01, 0x08, 0x48, 0x00,
0x01, 0x07, 0x4b, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1d, 0x00,
0x11, 0x05, 0x1b, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x4d, 0x00, 0x12, 0x01, 0x44, 0x00, 0x22, 0x01, 0x44, 0x00,
0x22, 0x05, 0x4b, 0x00, 0x12, 0x08, 0x55, 0x00, 0x12, 0x05, 0x4b, 0x00,
0x02, 0x02, 0x57, 0x00, 0x02, 0x04, 0x16, 0x00, 0x02, 0x85, 0x4b, 0x00,
0x02, 0x04, 0x1d, 0x00, 0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00,
0x11, 0x05, 0x4b, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x16, 0x00, 0x12, 0x03, 0x61, 0x00, 0x02, 0x08, 0x48, 0x00,
0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00, 0x13, 0x01, 0x44, 0x00,
0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00, 0x13, 0x08, 0x55, 0x00,
0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00, 0x03, 0x04, 0x68, 0x00,
0x03, 0x82, 0x68, 0x00, 0x03, 0x85, 0x1b, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00, 0x12, 0x03, 0x6d, 0x00,
0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00,
0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00,
0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00,
0x03, 0x04, 0x6d, 0x00, 0x03, 0x85, 0x46, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00, 0x12, 0x03, 0x72, 0x00,
0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x4d, 0x00,
0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00, 0x23, 0x05, 0x4b, 0x00,
0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00, 0x03, 0x02, 0x57, 0x00,
0x03, 0x04, 0x72, 0x00, 0x03, 0x85, 0x46, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00, 0x11, 0x05, 0x46, 0x00,
0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00, 0x12, 0x81, 0x16, 0x00,
0x12, 0x03, 0x6d, 0x00, 0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00,
0x03, 0x82, 0x6d, 0x00, 0x03, 0x07, 0x4b, 0x00, 0x14, 0x81, 0x4d, 0x00,
0x14, 0x01, 0x44, 0x00, 0x24, 0x01, 0x44, 0x00, 0x24, 0x05, 0x4b, 0x00,
0x14, 0x08, 0x55, 0x00, 0x14, 0x05, 0x4b, 0x00, 0x04, 0x02, 0x57, 0x00,
0x04, 0x04, 0x68, 0x00, 0x04, 0x82, 0x68, 0x00, 0x03, 0x85, 0x1b, 0x00,
0x03, 0x04, 0x1d, 0x00, 0x02, 0x8b, 0x4b, 0x00, 0x12, 0x01, 0x16, 0x00,
0x12, 0x03, 0x72, 0x00, 0x02, 0x08, 0x48, 0x00, 0x02, 0x07, 0x4b, 0x00,
0x13, 0x81, 0x4d, 0x00, 0x13, 0x01, 0x44, 0x00, 0x23, 0x01, 0x44, 0x00,
0x23, 0x05, 0x4b, 0x00, 0x13, 0x08, 0x55, 0x00, 0x13, 0x05, 0x4b, 0x00,
0x03, 0x02, 0x57, 0x00, 0x03, 0x04, 0x68, 0x00, 0x03, 0x85, 0x7c, 0x00,
0x03, 0x04, 0x1d, 0x00, 0x01, 0x8b, 0x4b, 0x00, 0x11, 0x01, 0x1d, 0x00,
0x11, 0x05, 0x7c, 0x00, 0x01, 0x08, 0x48, 0x00, 0x01, 0x07, 0x4b, 0x00,
0x12, 0x81, 0x16, 0x00, 0x12, 0x03, 0x72, 0x00, 0x02, 0x08, 0x48, 0x00,
0x02, 0x07, 0x4b, 0x00, 0x13, 0x81, 0x7e, 0x00, 0x23, 0x01, 0x4d, 0x00,
0x23, 0x01, 0x44, 0x00, 0x33, 0x01, 0x44, 0x00, 0x33, 0x05, 0x4b, 0x00,
0x23, 0x08, 0x55, 0x00, 0x23, 0x05, 0x4b, 0x00, 0x13, 0x02, 0x57, 0x00,
0x03, 0x08, 0x85, 0x00, 0x03, 0x07, 0x4b, 0x00, 0x04, 0x82, 0x68, 0x00,
0x14, 0x81, 0x4d, 0x00, 0x14, 0x01, 0x44, 0x00, 0x24, 0x01, 0x7e, 0x00,
0x24, 0x01, 0x72, 0x00, 0x14, 0x08, 0x55, 0x00, 0x14, 0x03, 0x4d, 0x00,
0x04, 0x02, 0x87, 0x00, 0x03, 0x85, 0x1b, 0x00, 0x03, 0x04, 0x1d, 0x00,
0x00, 0x86, 0x8f, 0x00, 0x00, 0x8c, 0x33, 0x00, /* instruct array */
0x92, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e,
0x00, 0x6c, 0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f,
0x64, 0x65, 0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74,
0x65, 0x72, 0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f,
0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00,
0x3d, 0x3d, 0x00, 0x31, 0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73,
0x00, 0x2b, 0x00, 0x5f, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f,
0x00, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f,
0x00, 0x77, 0x68, 0x65, 0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64,
0x5f, 0x6d, 0x73, 0x00, 0x33, 0x00, 0x5f, 0x5f, 0x74, 0x69, 0x63, 0x6b,
0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d,
0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(__pikaMain, (uint8_t*)bytes);
PIKA_PYTHON(
len = calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = calls[i]
todo()
info_index = 0
elif mode == 'when':
when = calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if tick > calls[i]:
todo()
calls[i] = tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0b, 0x00, 0x00, 0x83, 0x0f, 0x00,
0x00, 0x04, 0x14, 0x00, 0x00, 0x85, 0x19, 0x00, 0x00, 0x04, 0x1b, 0x00,
0x20, 0x85, 0x19, 0x00, 0x20, 0x01, 0x0b, 0x00, 0x10, 0x02, 0x26, 0x00,
0x00, 0x02, 0x2c, 0x00, 0x00, 0x04, 0x31, 0x00, 0x00, 0x82, 0x35, 0x00,
0x00, 0x04, 0x42, 0x00, 0x00, 0x0d, 0x42, 0x00, 0x00, 0x07, 0x44, 0x00,
0x11, 0x81, 0x0b, 0x00, 0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00,
0x01, 0x07, 0x49, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1b, 0x00,
0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x4b, 0x00, 0x12, 0x01, 0x42, 0x00, 0x22, 0x01, 0x42, 0x00,
0x22, 0x05, 0x49, 0x00, 0x12, 0x08, 0x51, 0x00, 0x12, 0x05, 0x49, 0x00,
0x02, 0x02, 0x53, 0x00, 0x02, 0x04, 0x14, 0x00, 0x02, 0x85, 0x49, 0x00,
0x02, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x49, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x5d, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00,
0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00,
0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00,
0x03, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x69, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x69, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x6e, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00, 0x11, 0x05, 0x44, 0x00,
0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00, 0x12, 0x81, 0x14, 0x00,
0x12, 0x03, 0x69, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x03, 0x82, 0x69, 0x00, 0x03, 0x07, 0x49, 0x00, 0x14, 0x81, 0x4b, 0x00,
0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x42, 0x00, 0x24, 0x05, 0x49, 0x00,
0x14, 0x08, 0x51, 0x00, 0x14, 0x05, 0x49, 0x00, 0x04, 0x02, 0x53, 0x00,
0x04, 0x04, 0x64, 0x00, 0x04, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00,
0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00,
0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00,
0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00, 0x03, 0x85, 0x78, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x78, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x7a, 0x00, 0x23, 0x01, 0x4b, 0x00,
0x23, 0x01, 0x42, 0x00, 0x33, 0x01, 0x42, 0x00, 0x33, 0x05, 0x49, 0x00,
0x23, 0x08, 0x51, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x02, 0x53, 0x00,
0x03, 0x08, 0x7f, 0x00, 0x03, 0x07, 0x49, 0x00, 0x04, 0x82, 0x64, 0x00,
0x14, 0x81, 0x4b, 0x00, 0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x7a, 0x00,
0x24, 0x01, 0x6e, 0x00, 0x14, 0x08, 0x51, 0x00, 0x14, 0x03, 0x4b, 0x00,
0x04, 0x02, 0x81, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x00, 0x86, 0x89, 0x00, 0x00, 0x8c, 0x31, 0x00, /* instruct array */
0x8c, 0x00, /* const pool size */
0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x00, 0x6c,
0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74, 0x65, 0x72,
0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e,
0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00, 0x3d, 0x3d,
0x00, 0x31, 0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x00, 0x2b, 0x00, 0x5f,
0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f, 0x00, 0x61, 0x6c, 0x77,
0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f, 0x00, 0x77, 0x68, 0x65,
0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x6d, 0x73, 0x00,
0x33, 0x00, 0x74, 0x69, 0x63, 0x6b, 0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73,
0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d, 0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void __Task_update_tick(PikaObj* self) {