Index: vm/port/src/encoder/ia32_em64t/encoder.h =================================================================== --- vm/port/src/encoder/ia32_em64t/encoder.h (revision 507876) +++ vm/port/src/encoder/ia32_em64t/encoder.h (working copy) @@ -288,8 +288,11 @@ R_Opnd(Reg_No r): RM_Opnd(Reg), _reg_no(r) {} Reg_No reg_no() const { return _reg_no; } +// TODO: couldn't compile with "private:" under windows/em64t +#if !defined(_EM64T_) || !defined(_WIN64) private: // disallow copying +#endif R_Opnd(const R_Opnd &): RM_Opnd(Reg) { assert(false); } }; Index: vm/port/src/lil/em64t/pim/m2n_em64t.cpp =================================================================== --- vm/port/src/lil/em64t/pim/m2n_em64t.cpp (revision 507876) +++ vm/port/src/lil/em64t/pim/m2n_em64t.cpp (working copy) @@ -237,7 +237,12 @@ size_64); } #else //!PLATFORM_POSIX + +// TODO: couldn't compile under windows/em64t with the line below +#if !defined(_EM64T_) || !defined(_WIN64) buf = prefix(buf, fs_prefix); +#endif + buf = mov(buf, *reg, M_Opnd(0x14), size_64); #endif //!PLATFORM_POSIX return buf; Index: vm/port/src/atomic/win/port_atomic.c =================================================================== --- vm/port/src/atomic/win/port_atomic.c (revision 507876) +++ vm/port/src/atomic/win/port_atomic.c (working copy) @@ -21,3 +21,27 @@ /* All code from this file was inlinied in port_atomic.h */ +#include +#include + +#if defined(_EM64T_) and defined(_WIN64) +// TODO: these functions need to be implemented +APR_DECLARE(uint8) port_atomic_cas8(volatile uint8 * data, + uint8 value, uint8 comp) { + assert(0); + return 0; +} + +APR_DECLARE(uint16) port_atomic_cas16(volatile uint16 * data, + uint16 value, uint16 comp) { + assert(0); + return 0; +} + +APR_DECLARE(uint64) port_atomic_cas64(volatile uint64 * data, + uint64 value, uint64 comp) { + assert(0); + return 0; +} + +#endif Index: vm/vmcore/include/atomics.h =================================================================== --- vm/vmcore/include/atomics.h (revision 507876) +++ vm/vmcore/include/atomics.h (working copy) @@ -25,6 +25,9 @@ #include "jni.h" #include "Class.h" +#if defined(_EM64T_) && defined(_WIN64) +#include +#endif JNIEXPORT jlong getFieldOffset (JNIEnv * env, jobject field); @@ -81,10 +84,19 @@ } #else inline void MemoryReadWriteBarrier() { + #if defined(_EM64T_) && defined(_WIN64) + _ReadWriteBarrier(); + #else __asm mfence; + #endif } inline void MemoryWriteBarrier() { - __asm sfence; + #if defined(_EM64T_) && defined(_WIN64) + // TODO: add proper intrinsic + assert(0); + #else + __asm mfence; + #endif } #endif #endif Index: vm/vmcore/src/util/em64t/base/compile_em64t.cpp =================================================================== --- vm/vmcore/src/util/em64t/base/compile_em64t.cpp (revision 507876) +++ vm/vmcore/src/util/em64t/base/compile_em64t.cpp (working copy) @@ -291,7 +291,12 @@ /* BEGIN SUPPORT FOR STUB OVERRIDE CODE SEQUENCES */ +#if defined(_EM64T_) && defined(_WIN64) +// TODO: couldn't compile "as is" under windows/em64t +static Stub_Override_Entry _stub_override_entries_base[1]; +#else static Stub_Override_Entry _stub_override_entries_base[] = {}; +#endif Stub_Override_Entry * stub_override_entries = &(_stub_override_entries_base[0]); Index: vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp =================================================================== --- vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp (revision 507876) +++ vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp (working copy) @@ -19,16 +19,17 @@ * @version $Revision: 1.1.2.1.4.5 $ */ +#undef LOG_DOMAIN +#define LOG_DOMAIN "nt_exception_filter" #include "platform_lowlevel.h" #include "Class.h" #include "Environment.h" -#include "gc_for_vm.h" #include "exceptions.h" +#include "exceptions_jit.h" #include "method_lookup.h" #include "vm_strings.h" #include "vm_threads.h" -#include "vm_utils.h" #include "compile.h" #include "ini.h" #include "cxxlog.h" @@ -44,28 +45,28 @@ void nt_to_vm_context(PCONTEXT pcontext, Registers* regs) { - regs->rax = pcontext->Eax; - regs->rcx = pcontext->Ecx; - regs->rdx = pcontext->Edx; - regs->rdi = pcontext->Edi; - regs->rsi = pcontext->Esi; - regs->rbx = pcontext->Ebx; - regs->rbp = pcontext->Ebp; - regs->rip = pcontext->Eip; - regs->rsp = pcontext->Esp; + regs->rax = pcontext->Rax; + regs->rcx = pcontext->Rcx; + regs->rdx = pcontext->Rdx; + regs->rdi = pcontext->Rdi; + regs->rsi = pcontext->Rsi; + regs->rbx = pcontext->Rbx; + regs->rbp = pcontext->Rbp; + regs->rip = pcontext->Rip; + regs->rsp = pcontext->Rsp; } void vm_to_nt_context(Registers* regs, PCONTEXT pcontext) { - pcontext->Esp = regs->rsp; - pcontext->Eip = regs->rip; - pcontext->Ebp = regs->rbp; - pcontext->Ebx = regs->rbx; - pcontext->Esi = regs->rsi; - pcontext->Edi = regs->rdi; - pcontext->Eax = regs->rax; - pcontext->Ecx = regs->rcx; - pcontext->Edx = regs->rdx; + pcontext->Rsp = regs->rsp; + pcontext->Rip = regs->rip; + pcontext->Rbp = regs->rbp; + pcontext->Rbx = regs->rbx; + pcontext->Rsi = regs->rsi; + pcontext->Rdi = regs->rdi; + pcontext->Rax = regs->rax; + pcontext->Rcx = regs->rcx; + pcontext->Rdx = regs->rdx; } int NT_exception_filter(LPEXCEPTION_POINTERS p_NT_exception) @@ -79,7 +80,7 @@ Global_Env *env = VM_Global_State::loader_env; VM_Code_Type vmct = - vm_identify_eip((void *)p_NT_exception->ContextRecord->Eip); + vm_identify_eip((void *)p_NT_exception->ContextRecord->Rip); if(vmct != VM_TYPE_JAVA) { if (!get_boolean_property("vm.assert_dialog", TRUE, VM_PROPERTIES)) { LWARN(43, "Fatal exception, terminating"); @@ -125,7 +126,7 @@ nt_to_vm_context(p_NT_exception->ContextRecord, ®s); - bool java_code = (vm_identify_eip((void *)regs.eip) == VM_TYPE_JAVA); + bool java_code = (vm_identify_eip((void *)regs.rip) == VM_TYPE_JAVA); exn_athrow_regs(®s, exc_clss, java_code); vm_to_nt_context(®s, p_NT_exception->ContextRecord); @@ -138,8 +139,10 @@ int NT_exception_filter(LPEXCEPTION_POINTERS p_NT_exception); // NT null pointer exception support - __try { - call_the_run_method(p_xx); + __try { + // TODO: couldn't find where call_the_run_method() body is + //call_the_run_method(p_xx); + assert(0); return 0; } __except ( p_NT_exception = GetExceptionInformation(), @@ -151,3 +154,28 @@ } // NT null pointer exception support } + +// TODO: the functions below need an implementation +static void asm_exception_catch_callback() { +assert(0); +} + +void asm_jvmti_exception_catch_callback() { +assert(0); +} + +LONG NTAPI vectored_exception_handler(LPEXCEPTION_POINTERS nt_exception) +{ +assert(0); +return 0; +} + +void init_stack_info() { +assert(0); +} + +size_t get_available_stack_size() { +assert(0); +return 0; +} + Index: vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp =================================================================== --- vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (revision 507876) +++ vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (working copy) @@ -325,13 +325,17 @@ #ifdef GCMAP_TRACK_IDS assert(cond); #else -#ifdef WIN32 +#if defined(WIN32) && !defined(_EM64T_) if (!cond) { __asm { int 3; } } #endif +#if defined (_EM64T_) && defined(_WIN64) + // TODO: add proper code + assert(0); +#endif #endif } Index: vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.cpp =================================================================== --- vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.cpp (revision 507876) +++ vm/jitrino/src/codegenerator/ia32/Ia32InternalTrace.cpp (working copy) @@ -42,12 +42,17 @@ assert(cond); #else #ifdef WIN32 +#ifndef _EM64T_ if (!cond) { __asm { int 3; } } +#else + // TODO: add proper code + assert(0); #endif +#endif #endif } Index: vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp =================================================================== --- vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp (revision 507876) +++ vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp (working copy) @@ -281,7 +281,8 @@ bbpFlagAddrBlock->appendInst(irManager.newCallInst(target, &CallingConvention_STDCALL, 0, NULL, tlsBase)); #else // PLATFORM_POSIX #ifdef _EM64T_ -#error "BBP not implemented on windows/em64t" + // TODO: #error "BBP not implemented on windows/em64t" + assert(0); #endif // TLS base can be obtained from [fs:0x14] Opnd* tlsBase = irManager.newMemOpnd(tlsBaseType, MemOpndKind_Any, NULL, 0x14, RegName_FS); Index: vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp =================================================================== --- vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (revision 507876) +++ vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (working copy) @@ -510,6 +510,7 @@ int64 offset=targetCodeStartAddr-instCodeEndAddr; #ifdef _EM64T_ +#ifndef WIN32 if (llabs(offset) > 0xFFFFFFFF) { const RegName TMP_BASE = RegName_R14; EncoderBase::Operands args; @@ -521,7 +522,11 @@ args.add(TMP_BASE); EncoderBase::encode(ip, Mnemonic_CALL, args); } else { +#else + // TODO: + assert(0); #endif +#endif inst->getOpnd(targetOpndIndex)->assignImmValue((int64)offset); // re-emit the instruction: inst->emit(instCodeStartAddr); @@ -530,8 +535,10 @@ registerDirectCall(inst); } #ifdef _EM64T_ +#ifndef WIN32 } #endif +#endif } // todo64 if (isBcRequired) { Index: vm/jitrino/src/jet/enc.cpp =================================================================== --- vm/jitrino/src/jet/enc.cpp (revision 507876) +++ vm/jitrino/src/jet/enc.cpp (working copy) @@ -53,10 +53,13 @@ { #ifdef PLATFORM_POSIX raise(SIGTRAP); -#else +#elif !defined (_EM64T_) __asm { int 3 } +#else + // TODO: + assert(0); #endif }