- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
typedef enum {
INIT1=0, INIT2, INIT3, INIT4, INIT5, INIT6, INITN,
BIND1, BIND2, BIND3, BIND4, BIND5, BIND6, BINDN,
YIELD1, YIELD2, YIELD3, YIELD4, YIELD5, YIELD6, YIELDN,
COMPARE, CHECK, FILTER, CFILTER, PFILTER, CHOOSE, NOOP, CONTINUE,
GET_ENODE,
GET_CGR1, GET_CGR2, GET_CGR3, GET_CGR4, GET_CGR5, GET_CGR6, GET_CGRN,
IS_CGR
} opcode;
...
...
...
switch (m_pc->m_opcode) {
case INIT1:
m_app = m_registers[0];
if (m_app->get_num_args() != 1)
goto backtrack;
m_registers[1] = m_app->get_arg(0);
m_pc = m_pc->m_next;
goto main_loop;
case INIT2:
m_app = m_registers[0];
if (m_app->get_num_args() != 2)
goto backtrack;
m_registers[1] = m_app->get_arg(0);
m_registers[2] = m_app->get_arg(1);
m_pc = m_pc->m_next;
goto main_loop;
case INIT3:
m_app = m_registers[0];
if (m_app->get_num_args() != 3)
goto backtrack;
m_registers[1] = m_app->get_arg(0);
m_registers[2] = m_app->get_arg(1);
m_registers[3] = m_app->get_arg(2);
m_pc = m_pc->m_next;
goto main_loop;
case INIT4:
m_app = m_registers[0];
if (m_app->get_num_args() != 4)
goto backtrack;
m_registers[1] = m_app->get_arg(0);
m_registers[2] = m_app->get_arg(1);
m_registers[3] = m_app->get_arg(2);
m_registers[4] = m_app->get_arg(3);
m_pc = m_pc->m_next;
goto main_loop;
case INIT5:
m_app = m_registers[0];
if (m_app->get_num_args() != 5)
goto backtrack;
m_registers[1] = m_app->get_arg(0);
m_registers[2] = m_app->get_arg(1);
m_registers[3] = m_app->get_arg(2);
m_registers[4] = m_app->get_arg(3);
m_registers[5] = m_app->get_arg(4);
m_pc = m_pc->m_next;
goto main_loop;
case INIT6:
m_app = m_registers[0];
if (m_app->get_num_args() != 6)
goto backtrack;
m_registers[1] = m_app->get_arg(0);
m_registers[2] = m_app->get_arg(1);
m_registers[3] = m_app->get_arg(2);
m_registers[4] = m_app->get_arg(3);
m_registers[5] = m_app->get_arg(4);
m_registers[6] = m_app->get_arg(5);
m_pc = m_pc->m_next;
goto main_loop;
case INITN:
m_app = m_registers[0];
m_num_args = m_app->get_num_args();
if (m_num_args != static_cast<const initn *>(m_pc)->m_num_args)
goto backtrack;
for (unsigned i = 0; i < m_num_args; i++)
m_registers[i+1] = m_app->get_arg(i);
m_pc = m_pc->m_next;
goto main_loop;