x86-32 and x86-64 can share much emission code, so unify their emit-code_*.c files.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro> --- arch/x86/Makefile_32 | 2 +- arch/x86/Makefile_64 | 2 +- arch/x86/{emit-code_32.c => emit-code.c} | 48 ++++++++++++++++++++++++- arch/x86/emit-code_64.c | 59 ------------------------------ 4 files changed, 49 insertions(+), 62 deletions(-) rename arch/x86/{emit-code_32.c => emit-code.c} (97%) delete mode 100644 arch/x86/emit-code_64.c diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32 index 78be589..16386b0 100644 --- a/arch/x86/Makefile_32 +++ b/arch/x86/Makefile_32 @@ -1,7 +1,7 @@ ARCH_OBJS = \ arch/x86/backtrace.o \ arch/x86/disassemble.o \ - arch/x86/emit-code_32.o \ + arch/x86/emit-code.o \ arch/x86/exception.o \ arch/x86/insn-selector_32.o \ arch/x86/instruction.o \ diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64 index 3449463..807ea5c 100644 --- a/arch/x86/Makefile_64 +++ b/arch/x86/Makefile_64 @@ -4,7 +4,7 @@ ARCH_LIBS = -L/usr/lib64/libffi -lffi ARCH_OBJS = \ arch/x86/backtrace.o \ arch/x86/disassemble.o \ - arch/x86/emit-code_64.o \ + arch/x86/emit-code.o \ arch/x86/insn-selector_64.o \ arch/x86/instruction.o \ arch/x86/lir-printer.o \ diff --git a/arch/x86/emit-code_32.c b/arch/x86/emit-code.c similarity index 97% rename from arch/x86/emit-code_32.c rename to arch/x86/emit-code.c index 58c6ec7..4419b74 100644 --- a/arch/x86/emit-code_32.c +++ b/arch/x86/emit-code.c @@ -1,5 +1,5 @@ /* - * IA-32 code emitter. + * x86-32/x86-64 code emitter. * * Copyright (C) 2006 Pekka Enberg * @@ -33,6 +33,16 @@ #include <../jamvm/lock.h> +/************************ + * Common code emitters * + ************************/ + +#ifdef CONFIG_X86_32 + +/************************ + * x86-32 code emitters * + ************************/ + #define PREFIX_SIZE 1 #define BRANCH_INSN_SIZE 5 #define BRANCH_TARGET_OFFSET 1 @@ -1071,3 +1081,39 @@ void emit_trampoline(struct compilation_unit *cu, __emit_pop_reg(buf, REG_EBP); emit_indirect_jump_reg(buf, REG_EAX); } + +#else /* CONFIG_X86_32 */ + +/************************ + * x86-64 code emitters * + ************************/ + +void emit_prolog(struct buffer *buf, unsigned long nr_locals) +{ + abort(); +} + +void emit_ret(struct buffer *buf) +{ + abort(); +} + +void emit_epilog(struct buffer *buf, unsigned long nr_locals) +{ + abort(); +} + +void emit_branch_rel(struct buffer *buf, unsigned char prefix, + unsigned char opc, long rel32) +{ + abort(); +} + +void emit_trampoline(struct compilation_unit *cu, void *call_target, + struct jit_trampoline *trampoline) +{ + abort(); +} + +#endif /* CONFIG_X86_32 */ + diff --git a/arch/x86/emit-code_64.c b/arch/x86/emit-code_64.c deleted file mode 100644 index 3799634..0000000 --- a/arch/x86/emit-code_64.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2009 Pekka Enberg - * - * This file is released under the GPL version 2 with the following - * clarification and special exception: - * - * Linking this library statically or dynamically with other modules is - * making a combined work based on this library. Thus, the terms and - * conditions of the GNU General Public License cover the whole - * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce an - * executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. An - * independent module is a module which is not derived from or based on - * this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. - * - * Please refer to the file LICENSE for details. - */ - -#include <arch/instruction.h> -#include <jit/basic-block.h> -#include <jit/emit-code.h> -#include <vm/buffer.h> - -#include <stdlib.h> - -void emit_prolog(struct buffer *buf, unsigned long nr_locals) -{ - abort(); -} - -void emit_ret(struct buffer *buf) -{ - abort(); -} - -void emit_epilog(struct buffer *buf, unsigned long nr_locals) -{ - abort(); -} - -void emit_branch_rel(struct buffer *buf, unsigned char prefix, - unsigned char opc, long rel32) -{ - abort(); -} - -void emit_trampoline(struct compilation_unit *cu, void *call_target, - struct jit_trampoline *trampoline) -{ - abort(); -} -- 1.6.0.6 ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel