+
+#if !defined(ENABLE_REPLACEMENT)
+
+/*** macros for the codegens (disabled version) ************************/
+
+#define REPLACEMENT_POINTS_INIT(cd, jd)
+#define REPLACEMENT_POINTS_RESET(cd, jd)
+#define REPLACEMENT_POINT_BLOCK_START(cd, bptr)
+#define REPLACEMENT_POINT_INLINE_START(cd, iptr)
+#define REPLACEMENT_POINT_INLINE_BODY(cd, iptr)
+#define REPLACEMENT_POINT_RETURN(cd, iptr)
+#define REPLACEMENT_POINT_INVOKE(cd, iptr)
+#define REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr)
+#define REPLACEMENT_POINT_FORGC_BUILTIN(cd, iptr)
+#define REPLACEMENT_POINT_FORGC_BUILTIN_RETURN(cd, iptr)
+
+#else /* defined(ENABLE_REPLACEMENT) */
+
+/* forward typedefs ***********************************************************/
+
+typedef struct rplalloc rplalloc;
+typedef struct rplpoint rplpoint;
+typedef struct sourcestate_t sourcestate_t;
+typedef struct sourceframe_t sourceframe_t;
+typedef union replace_val_t replace_val_t;
+
+#include "arch.h"
+#include "md-abi.h"
+
+#include "vm/jit/reg.h"
+#include "vm/jit/stacktrace.h"
+
+#include "vmcore/method.h"
+
+
+/*** structs *********************************************************/
+
+#define RPLALLOC_STACK -1
+#define RPLALLOC_PARAM -2
+#define RPLALLOC_SYNC -3
+
+/* `rplalloc` is a compact struct for register allocation info */
+
+/* XXX optimize this for space efficiency */
+struct rplalloc {
+ s4 index; /* local index, -1 for stack slot */
+ s4 regoff; /* register index / stack slot offset */
+ unsigned int flags:4; /* OR of (INMEMORY,...) */
+ unsigned int type:4; /* TYPE_... constant */
+};
+
+#if INMEMORY > 0x08
+#error value of INMEMORY is too big to fit in rplalloc.flags
+#endif
+
+
+/* XXX what to do about overlapping rplpoints? */
+/* CAUTION: Do not change the numerical values. These are used as */
+/* indices into replace_normalize_type_map. */
+#define RPLPOINT_TYPE_STD BBTYPE_STD
+#define RPLPOINT_TYPE_EXH BBTYPE_EXH
+#define RPLPOINT_TYPE_SBR BBTYPE_SBR
+#define RPLPOINT_TYPE_CALL 3
+#define RPLPOINT_TYPE_INLINE 4
+#define RPLPOINT_TYPE_RETURN 5
+#define RPLPOINT_TYPE_BODY 6
+
+#define RPLPOINT_FLAG_NOTRAP 0x01 /* rplpoint cannot be trapped */
+#define RPLPOINT_FLAG_COUNTDOWN 0x02 /* count down hits */
+#define RPLPOINT_FLAG_ACTIVE 0x08 /* trap is active */
+
+
+#if !defined(NDEBUG)
+#define RPLPOINT_CHECK(type) , RPLPOINT_TYPE_##type
+#define RPLPOINT_CHECK_BB(bptr) , (bptr)->type
+#else
+#define RPLPOINT_CHECK(type)
+#define RPLPOINT_CHECK_BB(bptr)
+#endif
+