aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4instr_moth_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-24 16:04:19 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-28 13:19:04 +0000
commit2951f6105ad3851b38fa66348a4edd3fe7cfa47e (patch)
tree5c42f21917bb90cea98eaa2ee7f47e3cf944558a /src/qml/compiler/qv4instr_moth_p.h
parentcd67176bb24c82b239414c162644ebf9e0d3327e (diff)
Introduce the wide/xwide instruction prefixes
And add proper decoding for the prefixed instructions to the VME and bytecode dumper. We still only generate XWide instructions, that will get fixed in the next change. Change-Id: I6d2dc6a0a4f706044038274ca79e019a6c9bb7d9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4instr_moth_p.h')
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index bffc7b2bf4..c10d48ff8e 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -341,6 +341,27 @@ QT_BEGIN_NAMESPACE
#define MOTH_EMIT_INSTR_MEMBER_INSTRUCTION(name, nargs, ...) \
instr_##name name;
+/* collect jump labels */
+#define COLLECT_LABELS(instr) \
+ INSTR_##instr(GET_LABEL)
+#define GET_LABEL_INSTRUCTION(name, ...) \
+ &&op_char_##name,
+
+#define COLLECT_LABELS_WIDE(instr) \
+ INSTR_##instr(GET_LABEL_WIDE)
+#define GET_LABEL_WIDE_INSTRUCTION(name, ...) \
+ &&op_short_##name,
+
+#define COLLECT_LABELS_XWIDE(instr) \
+ INSTR_##instr(GET_LABEL_XWIDE)
+#define GET_LABEL_XWIDE_INSTRUCTION(name, ...) \
+ &&op_int_##name,
+
+#define MOTH_JUMP_TABLE \
+ static const void *jumpTable[] = { FOR_EACH_MOTH_INSTR(COLLECT_LABELS) }; \
+ static const void *jumpTableWide[] = { FOR_EACH_MOTH_INSTR(COLLECT_LABELS_WIDE) }; \
+ static const void *jumpTableXWide[] = { FOR_EACH_MOTH_INSTR(COLLECT_LABELS_XWIDE) }
+
#define MOTH_DECODE_ARG(arg, type, offset) \
arg = reinterpret_cast<const type *>(code)[offset]
@@ -352,6 +373,16 @@ QT_BEGIN_NAMESPACE
op_int_##name: \
MOTH_DECODE_ARGS(name, int, nargs, __VA_ARGS__) \
MOTH_ADJUST_CODE(int, nargs); \
+ goto op_main_##name; \
+ op_short_##name: \
+ MOTH_DECODE_ARGS(name, short, nargs, __VA_ARGS__) \
+ MOTH_ADJUST_CODE(short, nargs); \
+ goto op_main_##name; \
+ op_char_##name: \
+ MOTH_DECODE_ARGS(name, char, nargs, __VA_ARGS__) \
+ MOTH_ADJUST_CODE(char, nargs); \
+ op_main_##name: \
+ ; \
#define MOTH_DECODE_ARGS(name, type, nargs, ...) \
MOTH_DECODE_ARGS##nargs(name, type, __VA_ARGS__)
@@ -374,6 +405,16 @@ QT_BEGIN_NAMESPACE
++code; \
goto *jumpTable[instr];
+#define MOTH_DISPATCH_WIDE() \
+ int winstr = *code; \
+ ++code; \
+ goto *jumpTableWide[winstr];
+
+#define MOTH_DISPATCH_XWIDE() \
+ int xwinstr = *code; \
+ ++code; \
+ goto *jumpTableXWide[xwinstr];
+
namespace QV4 {
namespace Moth {