mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Makefile changes to force pointers to 32 bits on OSX--this is just a stopgap for testing and shell development
This commit is contained in:
parent
9d3b145d90
commit
7dddedeff0
@ -1017,9 +1017,9 @@ ifdef MOZ_PROFILE_GENERATE
|
||||
endif
|
||||
else # !WINNT || GNU_CC
|
||||
ifeq ($(CPP_PROG_LINK),1)
|
||||
$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE)
|
||||
$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(DARWIN_EXE_LDFLAGS) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE)
|
||||
else # ! CPP_PROG_LINK
|
||||
$(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
|
||||
$(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(DARWIN_EXE_LDFLAGS) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
|
||||
endif # CPP_PROG_LINK
|
||||
endif # WINNT && !GNU_CC
|
||||
endif # WINCE
|
||||
|
@ -539,7 +539,7 @@ JSRuntime::init(uint32 maxbytes)
|
||||
if (!js_InitGC(this, maxbytes) || !js_InitAtomState(this))
|
||||
return false;
|
||||
|
||||
#ifdef _M_X64
|
||||
#ifdef JS_64BIT
|
||||
if (!JSString::initStringTables())
|
||||
return false;
|
||||
#endif
|
||||
|
@ -35,14 +35,14 @@
|
||||
#include "jstypes.h"
|
||||
#include "jsstdint.h"
|
||||
#include "jsgcchunk.h"
|
||||
#ifdef JS_64BIT
|
||||
# include "jsstr.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XP_WIN
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef _M_X64
|
||||
# include "jsstr.h"
|
||||
#endif
|
||||
|
||||
# ifdef _MSC_VER
|
||||
# pragma warning( disable: 4267 4996 4146 )
|
||||
# endif
|
||||
@ -183,27 +183,6 @@ UnmapPages(void *addr, size_t size)
|
||||
NtFreeVirtualMemory(INVALID_HANDLE_VALUE, &addr, &size, MEM_RELEASE);
|
||||
}
|
||||
|
||||
bool
|
||||
JSString::initStringTables()
|
||||
{
|
||||
char *p = (char *) MapPages(NULL, unitStringTableSize + intStringTableSize);
|
||||
if (!p)
|
||||
return false;
|
||||
unitStringTable = (JSString*) memcpy(p, staticUnitStringTable, unitStringTableSize);
|
||||
intStringTable = (JSString*) memcpy(p + unitStringTableSize,
|
||||
staticIntStringTable, intStringTableSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
JSString::freeStringTables()
|
||||
{
|
||||
UnmapPages(unitStringTable, unitStringTableSize + intStringTableSize);
|
||||
unitStringTable = NULL;
|
||||
intStringTable = NULL;
|
||||
}
|
||||
|
||||
# else /* _M_X64 */
|
||||
|
||||
static void *
|
||||
@ -281,6 +260,53 @@ MapAlignedPages(size_t size, size_t alignment)
|
||||
|
||||
# else /* JS_GC_HAS_MAP_ALIGN */
|
||||
|
||||
# if defined(__MACH__) && defined(__APPLE__) && defined(__x86_64__)
|
||||
|
||||
// Make sure the result is in the 32-bit address region.
|
||||
static void *
|
||||
MapPages(void *addr, size_t size)
|
||||
{
|
||||
void * const start = (void *) 0x10000;
|
||||
void * const end = (void *) 0x100000000;
|
||||
|
||||
// If an addr is given, try once there.
|
||||
if (addr) {
|
||||
JS_ASSERT(addr < end);
|
||||
void *p = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
if (p == MAP_FAILED)
|
||||
return NULL;
|
||||
if (p != addr) {
|
||||
JS_ALWAYS_TRUE(munmap(p, size) == 0);
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
// FIXME: this depends on implementation details of OSX mmap, namely
|
||||
// that it searches for free memory starting from the hint,
|
||||
// so that it will find free memory addresses in 32-bit space
|
||||
// if it exists.
|
||||
static void *base = start;
|
||||
while (true) {
|
||||
void *p = mmap(base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
if (p == MAP_FAILED)
|
||||
return NULL;
|
||||
// Got a region in range, so return it.
|
||||
if (start <= p && p < end) {
|
||||
base = (void *) (uintptr_t(p) + size);
|
||||
return p;
|
||||
}
|
||||
// Out of range. If we started past 'start', then we can try
|
||||
// again from there.
|
||||
munmap(p, size);
|
||||
if (base != start)
|
||||
return NULL;
|
||||
base = start;
|
||||
}
|
||||
}
|
||||
|
||||
# else /* DARWIN && __x86_64__ */
|
||||
|
||||
static void *
|
||||
MapPages(void *addr, size_t size)
|
||||
{
|
||||
@ -301,6 +327,8 @@ MapPages(void *addr, size_t size)
|
||||
return p;
|
||||
}
|
||||
|
||||
# endif /* DARWIN && __x86_64__ */
|
||||
|
||||
# endif /* !JS_GC_HAS_MAP_ALIGN */
|
||||
|
||||
static void
|
||||
@ -311,6 +339,29 @@ UnmapPages(void *addr, size_t size)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef JS_64BIT
|
||||
bool
|
||||
JSString::initStringTables()
|
||||
{
|
||||
char *p = (char *) MapPages(NULL, unitStringTableSize + intStringTableSize);
|
||||
if (!p)
|
||||
return false;
|
||||
unitStringTable = (JSString*) memcpy(p, staticUnitStringTable, unitStringTableSize);
|
||||
intStringTable = (JSString*) memcpy(p + unitStringTableSize,
|
||||
staticIntStringTable, intStringTableSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
JSString::freeStringTables()
|
||||
{
|
||||
UnmapPages(unitStringTable, unitStringTableSize + intStringTableSize);
|
||||
unitStringTable = NULL;
|
||||
intStringTable = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace js {
|
||||
|
||||
inline void *
|
||||
|
@ -2640,7 +2640,7 @@ static const jschar UnitStringData[] = {
|
||||
#pragma pack(push, 8)
|
||||
#endif
|
||||
|
||||
#ifndef _M_X64
|
||||
#ifndef JS_64BIT
|
||||
JSString JSString::unitStringTable[]
|
||||
#else
|
||||
JSString JSString::staticUnitStringTable[]
|
||||
@ -2683,7 +2683,7 @@ __attribute__ ((aligned (8)))
|
||||
U(0xf8), U(0xf9), U(0xfa), U(0xfb), U(0xfc), U(0xfd), U(0xfe), U(0xff)
|
||||
};
|
||||
|
||||
#ifdef _M_X64
|
||||
#ifdef JS_64BIT
|
||||
JSString *JSString::unitStringTable = staticUnitStringTable;
|
||||
size_t JSString::unitStringTableSize = sizeof(staticUnitStringTable);
|
||||
#endif
|
||||
@ -2758,7 +2758,7 @@ static const jschar Hundreds[] = {
|
||||
#pragma pack(push, 8)
|
||||
#endif
|
||||
|
||||
#ifndef _M_X64
|
||||
#ifndef JS_64BIT
|
||||
JSString JSString::intStringTable[]
|
||||
#else
|
||||
JSString JSString::staticIntStringTable[]
|
||||
@ -2801,7 +2801,7 @@ __attribute__ ((aligned (8)))
|
||||
L3(0xf8), L3(0xf9), L3(0xfa), L3(0xfb), L3(0xfc), L3(0xfd), L3(0xfe), L3(0xff)
|
||||
};
|
||||
|
||||
#ifdef _M_X64
|
||||
#ifdef JS_64BIT
|
||||
JSString *JSString::intStringTable = staticIntStringTable;
|
||||
size_t JSString::intStringTableSize = sizeof(staticIntStringTable);
|
||||
#endif
|
||||
|
@ -289,7 +289,7 @@ struct JSString {
|
||||
#pragma align 8 (__1cIJSStringPunitStringTable_, __1cIJSStringOintStringTable_)
|
||||
#endif
|
||||
|
||||
#ifndef _M_X64
|
||||
#ifndef JS_64BIT
|
||||
static JSString unitStringTable[];
|
||||
static JSString intStringTable[];
|
||||
#else
|
||||
|
@ -303,6 +303,21 @@
|
||||
# include "jsautocfg.h" /* Use auto-detected configuration */
|
||||
#endif
|
||||
|
||||
// Define JS_64BIT iff we are building in an environment with 64-bit
|
||||
// addresses.
|
||||
#ifdef _MSC_VER
|
||||
# if defined(_M_X64) || defined(_M_AMD64)
|
||||
# define JS_64BIT
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
# ifdef __x86_64__
|
||||
# define JS_64BIT
|
||||
# endif
|
||||
#else
|
||||
# error "Implement me"
|
||||
#endif
|
||||
|
||||
|
||||
#include "jsinttypes.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
@ -62,6 +62,12 @@ WIN32_EXE_LDFLAGS += -ENTRY:mainACRTStartup
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
ifeq ($(TARGET_CPU),x86_64)
|
||||
DARWIN_EXE_LDFLAGS += -pagezero_size 10000 -image_base 100000000
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef MOZ_SHARK
|
||||
|
Loading…
Reference in New Issue
Block a user