#include "exception_handler.cpp"
#endif
+static
void compiler_status() {
jit_log("compiled code starts at %p, current at %08x", compiled_code, (unsigned int)(current_compile_p - compiled_code));
}
if (tune_alignment) {
align_loops = x86_alignments[c->x86_processor].align_loop;
#ifdef UAE
+ /* FIXME: using hard-coded align_jumps right now */
#else
align_jumps = x86_alignments[c->x86_processor].align_jump;
#endif
extern void compile_block(cpu_history* pc_hist, int blocklen, int totcyles);
extern int check_for_cache_miss(void);
+static inline void flush_icache(int n)
+{
+ flush_icache(0, n);
+}
+
+static inline void flush_icache_hard(int n)
+{
+ flush_icache(0, n);
+}
#define scaled_cycles(x) (currprefs.m68k_speed<0?(((x)/SCALE)?(((x)/SCALE<MAXCYCLES?((x)/SCALE):MAXCYCLES)):1):(x))
#define PEEPHOLE_O 2000000
#define DECLARE(func) extern void func
+/* What we expose to the outside */
+#define DECLARE_MIDFUNC(func) extern void func
+
+#include "compemu_midfunc_x86.h"
+
+#undef DECLARE_MIDFUNC
/* What we expose to the outside */
DECLARE(bt_l_ri(RR4 r, IMM i));
--- /dev/null
+/*
+ * compiler/compemu_midfunc_x86.h - Native MIDFUNCS for IA-32 and AMD64
+ *
+ * Copyright (c) 2014 Jens Heitmann of ARAnyM dev team (see AUTHORS)
+ *
+ * Inspired by Christian Bauer's Basilisk II
+ *
+ * Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer
+ *
+ * Adaptation for Basilisk II and improvements, copyright 2000-2002
+ * Gwenole Beauchesne
+ *
+ * Basilisk II (C) 1997-2002 Christian Bauer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Note:
+ * File is included by compemu.h
+ *
+ */
+
+DECLARE_MIDFUNC(mul_32_32(RW4 d, RR4 s));
+DECLARE_MIDFUNC(or_l_rm(RW4 d, IMM s));
#ifdef UAE
#define UNUSED(x)
+/* FIXME: Looks like HAVE_GET_WORD_UNSWAPPED should be defined for little-endian / ARAnyM */
#define HAVE_GET_WORD_UNSWAPPED
#include "uae.h"
#include "uae/log.h"
}
};
+#if USE_SEPARATE_BIA
+static LazyBlockAllocator<blockinfo> BlockInfoAllocator;
+static LazyBlockAllocator<checksum_info> ChecksumInfoAllocator;
+#else
+static HardBlockAllocator<blockinfo> BlockInfoAllocator;
+static HardBlockAllocator<checksum_info> ChecksumInfoAllocator;
+#endif
+
+static inline checksum_info *alloc_checksum_info(void)
+{
+ checksum_info *csi = ChecksumInfoAllocator.acquire();
+ csi->next = NULL;
+ return csi;
+}
+
+static inline void free_checksum_info(checksum_info *csi)
+{
+ csi->next = NULL;
+ ChecksumInfoAllocator.release(csi);
+}
+
+static inline void free_checksum_info_chain(checksum_info *csi)
+{
+ while (csi != NULL) {
+ checksum_info *csi2 = csi->next;
+ free_checksum_info(csi);
+ csi = csi2;
+ }
+}
+
+static inline blockinfo *alloc_blockinfo(void)
+{
+ blockinfo *bi = BlockInfoAllocator.acquire();
+#if USE_CHECKSUM_INFO
+ bi->csi = NULL;
+#endif
+ return bi;
+}
+
+static inline void free_blockinfo(blockinfo *bi)
+{
+#if USE_CHECKSUM_INFO
+ free_checksum_info_chain(bi->csi);
+ bi->csi = NULL;
+#endif
+ BlockInfoAllocator.release(bi);
+}
static inline void alloc_blockinfos(void)
{
#ifdef UAE
static inline void big_to_small_state(bigstate* b, smallstate* s)
{
+ /* FIXME: replace with ARAnyM version */
int i;
int count=0;
********************************************************************/
#ifdef UAE
+/* FIXME: implement */
#else
void set_zero(int r, int tmp)
{
return b ? "on" : "off";
}
+static
void compiler_init(void)
{
static bool initialized = false;
if (initialized)
return;
+
+#if PROFILE_UNTRANSLATED_INSNS
+ panicbug("<JIT compiler> : gather statistics on untranslated insns count");
+#endif
+
+#if PROFILE_COMPILE_TIME
+ panicbug("<JIT compiler> : gather statistics on translation time");
+ emul_start_time = clock();
+#endif
}
+static
void compiler_exit(void)
{
#if PROFILE_COMPILE_TIME
uae_u8* cw=can_word;
uae_u8* au=always_used;
+#ifdef RECORD_REGISTER_USAGE
+ for (i=0;i<16;i++)
+ reg_count_local[i] = 0;
+#endif
+
for (i=0;i<VREGS;i++) {
live.state[i].realreg=-1;
live.state[i].needflush=NF_SCRATCH;
static inline void match_states(blockinfo* bi)
{
#ifdef UAE
+ /* FIXME: replace with ARAnyM version */
flush(1);
#else
int i;
#endif
#ifdef UAE
- /* Different implementation in newcpu.cpp */
+/* FIXME: check differences against UAE execute_normal (newcpu.cpp) */
#else
void execute_normal(void)
{
typedef void (*compiled_handler)(void);
#ifdef UAE
+/* FIXME: check differences against UAE m68k_do_compile_execute */
#else
void m68k_do_compile_execute(void)
{
#endif
#ifdef UAE
+/* FIXME: check differences against UAE m68k_compile_execute */
#else
void m68k_compile_execute (void)
{