diff --git a/mozilla/ef/Runtime/System/FieldOrMethod.cpp b/mozilla/ef/Runtime/System/FieldOrMethod.cpp index 22450eb24ac..86037dad775 100644 --- a/mozilla/ef/Runtime/System/FieldOrMethod.cpp +++ b/mozilla/ef/Runtime/System/FieldOrMethod.cpp @@ -1083,10 +1083,7 @@ void Method::getDoubleWordArg(const Type &, JavaObject &arg, Uint32 &hi, Uint32 JavaObject *Method::invoke(JavaObject * PC_ONLY(obj), JavaObject * PC_ONLY(args)[], Int32 PC_ONLY(nArgs)) { -#if defined (XP_PC) || defined(LINUX) || defined(FREEBSD) -#if 0 - void *code = addressFunction(getCode()); -#endif +#ifdef GENERATE_FOR_X86 Int32 i; Int32 start = 0; diff --git a/mozilla/ef/Runtime/System/StackWalker.cpp b/mozilla/ef/Runtime/System/StackWalker.cpp index 8492638bbbe..902519fd6e2 100644 --- a/mozilla/ef/Runtime/System/StackWalker.cpp +++ b/mozilla/ef/Runtime/System/StackWalker.cpp @@ -124,7 +124,7 @@ getMethod() // Return the address of the function that called the getCallerPC extern Uint8* getCallerPC() { -#if defined(WIN32) || defined(LINUX) || defined(FREEBSD) +#ifdef GENERATE_FOR_X86 Uint8** myEBP; INLINE_GET_EBP(myEBP); @@ -132,7 +132,7 @@ extern Uint8* getCallerPC() Uint8** calleeEBP = (Uint8**) *myEBP; // get the callee's EBP Uint8* retAddress = (Uint8*) *(calleeEBP + 1); return retAddress; -#else // WIN32 || LINUX || FREEBSD +#else // !GENERATE_FOR_X86 return 0; #endif } diff --git a/mozilla/ef/Runtime/System/SysCallsRuntime.cpp b/mozilla/ef/Runtime/System/SysCallsRuntime.cpp index 0da0fe013ff..7a7bbe7b3e5 100644 --- a/mozilla/ef/Runtime/System/SysCallsRuntime.cpp +++ b/mozilla/ef/Runtime/System/SysCallsRuntime.cpp @@ -65,7 +65,7 @@ SYSCALL_FUNC(void*) sysNewIntArray(Int32 length) // // Throw an Exception // -#if !defined(_WIN32) && !defined(LINUX) && !defined(FREEBSD) +#ifndef GENERATE_FOR_X86 SYSCALL_FUNC(void) sysThrow(const JavaObject& /* inObject */) { @@ -283,7 +283,7 @@ NS_EXTERN SYSCALL_FUNC(void) sysThrowNamedException(const char *exceptionName) * you're on a platform that does *not* need stubs * to call native code */ -#if !defined(_WIN32) && !defined(LINUX) && !defined(FREEBSD) +#ifndef GENERATE_FOR_X86 SYSCALL_FUNC(void) sysThrowNullPointerException() { sysThrow(const_cast(&Standard::get(cNullPointerException))->newInstance()); diff --git a/mozilla/ef/Runtime/System/Thread.cpp b/mozilla/ef/Runtime/System/Thread.cpp index 995bf2b9440..85b11a737d6 100644 --- a/mozilla/ef/Runtime/System/Thread.cpp +++ b/mozilla/ef/Runtime/System/Thread.cpp @@ -407,7 +407,7 @@ void Thread::_stop(JavaObject* exc) ce = ca.lookupByRange(ip); } if (ce != NULL) { // REPLACE -#if defined(XP_PC) || defined(LINUX) || defined(FREEBSD) +#ifdef GENERATE_FOR_X86 ip = new(*pool) Uint8[10]; ip[0] = 0xf; // 0x0f0b is an illegal instruction ip[1] = 0xb; diff --git a/mozilla/ef/Runtime/System/md/FieldOrMethod_md.h b/mozilla/ef/Runtime/System/md/FieldOrMethod_md.h index 7824db4c16f..7cce0c5b79c 100644 --- a/mozilla/ef/Runtime/System/md/FieldOrMethod_md.h +++ b/mozilla/ef/Runtime/System/md/FieldOrMethod_md.h @@ -18,30 +18,32 @@ #ifndef _FIELD_OR_METHOD_MD_H_ #define _FIELD_OR_METHOD_MD_H_ -#if defined(XP_PC) || defined(LINUX) || defined(FREEBSD) +#ifdef GENERATE_FOR_X86 #define PC_ONLY(x) x #else #define PC_ONLY(x) #endif -#if defined(XP_PC) -# define prepareArg(i, arg) _asm { push arg } // Prepare the ith argument -# define callFunc(func) _asm { call func } // Call function func -# define getReturnValue(ret) _asm {mov ret, eax} // Put return value into ret -#elif defined(LINUX) || defined(FREEBSD) -# define prepareArg(i, arg) __asm__ ("pushl %0" : /* no outputs */ : "g" (arg)) // Prepare the ith argument -# define callFunc(func) __asm__ ("call *%0" : /* no outputs */ : "r" (func)) // Call function func -# define getReturnValue(ret) __asm__ ("movl %%eax,%0" : "=g" (ret) : /* no inputs */) // Put return value into ret +#ifdef GENERATE_FOR_X86 + #ifdef __GNUC__ + #define prepareArg(i, arg) __asm__ ("pushl %0" : /* no outputs */ : "g" (arg)) // Prepare the ith argument + #define callFunc(func) __asm__ ("call *%0" : /* no outputs */ : "r" (func)) // Call function func + #define getReturnValue(ret) __asm__ ("movl %%eax,%0" : "=g" (ret) : /* no inputs */) // Put return value into ret + #else // !__GNUC__ + #define prepareArg(i, arg) _asm { push arg } // Prepare the ith argument + #define callFunc(func) _asm { call func } // Call function func + #define getReturnValue(ret) _asm {mov ret, eax} // Put return value into ret + #endif #elif defined(GENERATE_FOR_PPC) -# ifdef XP_MAC -# define prepareArg(i, arg) -# define callFunc(func) -# define getReturnValue(ret) ret = 0 -# else -# define prepareArg(i, arg) -# define callFunc(func) -# define getReturnValue(ret) ret = 0 -# endif + #ifdef XP_MAC + #define prepareArg(i, arg) + #define callFunc(func) + #define getReturnValue(ret) ret = 0 + #else + #define prepareArg(i, arg) + #define callFunc(func) + #define getReturnValue(ret) ret = 0 + #endif #endif diff --git a/mozilla/ef/Runtime/System/md/x86/x86ExceptionHandler.cpp b/mozilla/ef/Runtime/System/md/x86/x86ExceptionHandler.cpp index 7bbd23c05f8..6329226f35d 100644 --- a/mozilla/ef/Runtime/System/md/x86/x86ExceptionHandler.cpp +++ b/mozilla/ef/Runtime/System/md/x86/x86ExceptionHandler.cpp @@ -15,13 +15,11 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ -// x86Win32_Exception.cpp + // // simon // bjorn -#if defined(_WIN32) || defined(LINUX) || defined (FREEBSD) - #include "SysCalls.h" #include "prprf.h" #include "x86Win32ExceptionHandler.h" @@ -90,8 +88,8 @@ extern "C" SYSCALL_FUNC(JavaObject&) x86NewExceptionInstance(StandardClass class //-------------------------------------------------------------------------------- -// LINUX/FREEBSD specific -- FIX make another file for this -#if defined( LINUX ) || defined( FREEBSD ) +// Non MSVC code -- FIX make another file for this +#ifdef __GNUC__ extern "C" { @@ -438,5 +436,3 @@ Uint8* findExceptionHandler(Context* context) return pHandler; } -//-------------------------------------------------------------------------------- -#endif // _WIN32 || LINUX diff --git a/mozilla/ef/Runtime/System/md/x86/x86Win32ExceptionHandler.h b/mozilla/ef/Runtime/System/md/x86/x86Win32ExceptionHandler.h index f378b2e5148..f9a0024204f 100644 --- a/mozilla/ef/Runtime/System/md/x86/x86Win32ExceptionHandler.h +++ b/mozilla/ef/Runtime/System/md/x86/x86Win32ExceptionHandler.h @@ -19,8 +19,6 @@ // // simon -#if defined(_WIN32) || defined(LINUX) || defined(FREEBSD) - #ifndef _X86WIN32_EXCEPTION_H_ #define _X86WIN32_EXCEPTION_H_ @@ -79,4 +77,3 @@ void printContext(LogModuleObject &f, Context* context); //-------------------------------------------------------------------------------- #endif // _X86WIN32_EXCEPTION_H_ -#endif // _WIN32