Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit d12346c

Browse files
authored
Update index of instructions. (#261)
* Update index of instructions. Fixes Issue #258 - Python script tweak, TRY has now two validation and two execution rules.
1 parent 8f732b8 commit d12346c

File tree

2 files changed

+528
-518
lines changed

2 files changed

+528
-518
lines changed

document/core/appendix/gen-index-instructions.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,28 @@ def RefWrap(s, kind):
5252
return f':ref:`{kind} <{s}>`'
5353

5454

55-
def Instruction(name, opcode, type=None, validation=None, execution=None, operator=None):
55+
def Instruction(name, opcode, type=None, validation=None, execution=None, operator=None, validation2=None, execution2=None):
5656
if operator:
5757
execution_str = ', '.join([RefWrap(execution, 'execution'),
5858
RefWrap(operator, 'operator')])
59+
elif execution2:
60+
execution_str = ', '.join([RefWrap(execution, 'execution'),
61+
RefWrap(execution, 'execution')])
62+
5963
else:
6064
execution_str = RefWrap(execution, 'execution')
6165

66+
if validation2:
67+
validation_str = ', '.join([RefWrap(validation, 'validation'),
68+
RefWrap(validation2, 'validation')])
69+
else:
70+
validation_str = RefWrap(validation, 'validation')
71+
6272
return (
6373
MathWrap(name, '(reserved)'),
6474
MathWrap(opcode),
6575
MathWrap(type),
66-
RefWrap(validation, 'validation'),
76+
validation_str,
6777
execution_str
6878
)
6979

@@ -75,10 +85,10 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
7585
Instruction(r'\LOOP~\X{bt}', r'\hex{03}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-loop', r'exec-loop'),
7686
Instruction(r'\IF~\X{bt}', r'\hex{04}', r'[t_1^\ast~\I32] \to [t_2^\ast]', r'valid-if', r'exec-if'),
7787
Instruction(r'\ELSE', r'\hex{05}'),
78-
Instruction(None, r'\hex{06}'),
79-
Instruction(None, r'\hex{07}'),
80-
Instruction(None, r'\hex{08}'),
81-
Instruction(None, r'\hex{09}'),
88+
Instruction(r'\TRY~\X{bt}', r'\hex{06}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-try-catch', r'exec-try-catch', None, r'valid-try-delegate', r'exec-try-delegate'),
89+
Instruction(r'\CATCH~x', r'\hex{07}'),
90+
Instruction(r'\THROW~x', r'\hex{08}', r'[t_1^\ast~t_x^\ast] \to [t_2^\ast]', r'valid-throw', r'exec-throw'),
91+
Instruction(r'\RETHROW~n', r'\hex{09}', r'[t_1^\ast] \to [t_2^\ast]', r'valid-rethrow', r'exec-rethrow'),
8292
Instruction(None, r'\hex{0A}'),
8393
Instruction(r'\END', r'\hex{0B}'),
8494
Instruction(r'\BR~l', r'\hex{0C}', r'[t_1^\ast~t^\ast] \to [t_2^\ast]', r'valid-br', r'exec-br'),
@@ -93,8 +103,8 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
93103
Instruction(None, r'\hex{15}'),
94104
Instruction(None, r'\hex{16}'),
95105
Instruction(None, r'\hex{17}'),
96-
Instruction(None, r'\hex{18}'),
97-
Instruction(None, r'\hex{19}'),
106+
Instruction(r'\DELEGATE~l', r'\hex{18}'),
107+
Instruction(r'\CATCHALL', r'\hex{19}', None, r'valid-try-catch', r'exec-try-catch'),
98108
Instruction(r'\DROP', r'\hex{1A}', r'[t] \to []', r'valid-drop', r'exec-drop'),
99109
Instruction(r'\SELECT', r'\hex{1B}', r'[t~t~\I32] \to [t]', r'valid-select', r'exec-select'),
100110
Instruction(r'\SELECT~t', r'\hex{1C}', r'[t~t~\I32] \to [t]', r'valid-select', r'exec-select'),

0 commit comments

Comments
 (0)