aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4compileddata_p.h4
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h9
2 files changed, 9 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index e2cdc3d8fc..f5c528f8bb 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -263,7 +263,9 @@ struct Function
static int calculateSize(int nFormals, int nLocals, int nLines, int nInnerfunctions, int nIdObjectDependencies, int nPropertyDependencies, int codeSize) {
int trailingData = (nFormals + nLocals + nInnerfunctions + nIdObjectDependencies +
2 * nPropertyDependencies)*sizeof (quint32) + nLines*sizeof(CodeOffsetToLine);
- return align(align(sizeof(Function)) + size_t(trailingData)) + align(codeSize);
+ auto size = align(align(sizeof(Function)) + size_t(trailingData)) + align(codeSize);
+ Q_ASSERT(size >= 0 && size < INT_MAX);
+ return int(size);
}
static size_t align(size_t a) {
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index 90ed2c804c..8234f1261e 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -304,10 +304,11 @@ QT_BEGIN_NAMESPACE
#define MOTH_INSTR_ENUM(I) I,
#define MOTH_INSTR_SIZE(I) (sizeof(QV4::Moth::Instr::instr_##I))
+#define MOTH_EXPAND_FOR_MSVC(x) x
#define MOTH_DEFINE_ARGS(nargs, ...) \
- MOTH_DEFINE_ARGS##nargs(__VA_ARGS__)
+ MOTH_EXPAND_FOR_MSVC(MOTH_DEFINE_ARGS##nargs(__VA_ARGS__))
-#define MOTH_DEFINE_ARGS0(dummy)
+#define MOTH_DEFINE_ARGS0()
#define MOTH_DEFINE_ARGS1(arg) \
int arg;
#define MOTH_DEFINE_ARGS2(arg1, arg2) \
@@ -352,6 +353,7 @@ QT_BEGIN_NAMESPACE
#define MOTH_DECODE_INSTRUCTION(name, nargs, ...) \
MOTH_DEFINE_ARGS(nargs, __VA_ARGS__) \
+ goto op_int_##name; \
op_int_##name: \
MOTH_ADJUST_CODE(int, nargs); \
MOTH_DECODE_ARGS(name, int, nargs, __VA_ARGS__) \
@@ -365,6 +367,7 @@ QT_BEGIN_NAMESPACE
#define MOTH_DECODE_WITH_BASE_INSTRUCTION(name, nargs, ...) \
MOTH_DEFINE_ARGS(nargs, __VA_ARGS__) \
const char *base_ptr; \
+ goto op_int_##name; \
op_int_##name: \
base_ptr = code; \
MOTH_ADJUST_CODE(int, nargs); \
@@ -378,7 +381,7 @@ QT_BEGIN_NAMESPACE
; \
#define MOTH_DECODE_ARGS(name, type, nargs, ...) \
- MOTH_DECODE_ARGS##nargs(name, type, nargs, __VA_ARGS__)
+ MOTH_EXPAND_FOR_MSVC(MOTH_DECODE_ARGS##nargs(name, type, nargs, __VA_ARGS__))
#define MOTH_DECODE_ARGS0(name, type, nargs, dummy)
#define MOTH_DECODE_ARGS1(name, type, nargs, arg) \