+/* replace_safestack_t *********************************************************
+
+ This struct is used to allocate a safe stack area to be used during the
+ last phase of replacement. It also contains copies of all data needed
+ during this phase. (The data cannot be kept in normal variables, as
+ the C stack may be destroyed during replacement.)
+
+ CAUTION: Do not change the layout of this struct! The assembler code
+ depends on the order of fields. (`stack` must be first,
+ directly followed by `es`.)
+
+*******************************************************************************/
+
+struct replace_safestack_t {
+ u1 stack[REPLACE_SAFESTACK_SIZE];
+ executionstate_t es;
+ sourcestate_t *ss;
+ u1 *mem; /* start of the allocated memory chunk */
+ s4 dumpsize;
+};
+
+
+/*** macros for the codegens *******************************************/
+
+#define REPLACEMENT_POINTS_INIT(cd, jd) \
+ if (!replace_create_replacement_points(jd)) \
+ return false; \
+ (cd)->replacementpoint = (jd)->code->rplpoints;
+
+#define REPLACEMENT_POINTS_RESET(cd, jd) \
+ (cd)->replacementpoint = (jd)->code->rplpoints;
+
+#define REPLACEMENT_POINT_BLOCK_START(cd, bptr) \
+ if ((bptr)->bitflags & BBFLAG_REPLACEMENT) \
+ codegen_set_replacement_point((cd) RPLPOINT_CHECK_BB(bptr));
+
+#define REPLACEMENT_POINT_INLINE_START(cd, iptr) \
+ codegen_set_replacement_point(cd RPLPOINT_CHECK(INLINE));
+
+#define REPLACEMENT_POINT_INLINE_BODY(cd, iptr) \
+ codegen_set_replacement_point_notrap(cd RPLPOINT_CHECK(BODY));
+
+#define REPLACEMENT_POINT_RETURN(cd, iptr) \
+ codegen_set_replacement_point(cd RPLPOINT_CHECK(RETURN));
+
+#define REPLACEMENT_POINT_INVOKE(cd, iptr) \
+ codegen_set_replacement_point(cd RPLPOINT_CHECK(CALL));
+
+#define REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr) \
+ if (iptr->opc != ICMD_BUILTIN) \
+ cd->replacementpoint[-1].callsize = (cd->mcodeptr - cd->mcodebase)\
+ - (ptrint) cd->replacementpoint[-1].pc;
+