Reviewers: Erik Corry,

Message:
You were right. I did that.
Also changed a 'long' type to int; lint complained about it and on ia32 there's
no difference anyway.

Description:
Fix MinGW build
- add missing functions SignalCodeMovingGC() and MemoryBarrier()
- avoid pointer conversion/comparison warnings
- don't attempt to hide symbols with -fvisibility, MinGW doesn't support it

BUG=http://code.google.com/p/v8/issues/detail?id=949

Please review this at http://codereview.chromium.org/5471001/

Affected files:
  M AUTHORS
  M SConstruct
  M src/platform-win32.cc


Index: AUTHORS
diff --git a/AUTHORS b/AUTHORS
index 3749cebcd1763a9de665448b845cecbee18e8902..ea5b93e1e935599a4377a07f1c741a7f62f90fc5 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -11,6 +11,7 @@ Hewlett-Packard Development Company, LP
 Alexander Botero-Lowry <[email protected]>
 Alexandre Vassalotti <[email protected]>
 Andreas Anyuru <[email protected]>
+Bert Belder <[email protected]>
 Burcu Dogan <[email protected]>
 Craig Schlenter <[email protected]>
 Daniel Andersson <[email protected]>
Index: SConstruct
diff --git a/SConstruct b/SConstruct
index 820c1a1c72aef454a6771782bebe1bf87e00c5a6..ca63c299cce947bc1d24e67b67059d12c9d9f0be 100644
--- a/SConstruct
+++ b/SConstruct
@@ -654,9 +654,18 @@ def GuessToolchain(os):
     return None


+def GuessVisibility(os, toolchain):
+  if os == 'win32' and toolchain == 'gcc':
+    # MinGW can't do it.
+    return 'default'
+  else:
+    return 'hidden'
+
+
 OS_GUESS = utils.GuessOS()
 TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
 ARCH_GUESS = utils.GuessArchitecture()
+VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS)


 SIMPLE_OPTIONS = {
@@ -762,8 +771,8 @@ SIMPLE_OPTIONS = {
   },
   'visibility': {
     'values': ['default', 'hidden'],
-    'default': 'hidden',
-    'help': 'shared library symbol visibility'
+    'default': VISIBILITY_GUESS,
+    'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS
   },
   'pgo': {
     'values': ['off', 'instrument', 'optimize'],
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index c50424e57a44a83733c2078b70691a5a50689304..ce74447348f6ed81fc76b395e0509c89403c8f40 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -207,6 +207,12 @@ int strncpy_s(char* strDest, size_t numberOfElements,
   return 0;
 }

+
+inline void MemoryBarrier() {
+  int barrier = 0;
+  __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier));
+}
+
 #endif  // __MINGW32__

 // Generate a pseudo-random number in the range 0-2^31-1. Usually
@@ -858,13 +864,13 @@ void* OS::Allocate(const size_t requested,

   // VirtualAlloc rounds allocated size to page size automatically.
   size_t msize = RoundUp(requested, static_cast<int>(GetPageSize()));
-  intptr_t address = NULL;
+  intptr_t address = 0;

   // Windows XP SP2 allows Data Excution Prevention (DEP).
   int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;

   // For exectutable pages try and randomize the allocation address
-  if (prot == PAGE_EXECUTE_READWRITE && msize >= Page::kPageSize) {
+ if (prot == PAGE_EXECUTE_READWRITE && msize >= static_cast<size_t>(Page::kPageSize)) {
     address = (V8::RandomPrivate() << kPageSizeBits)
       | kAllocationRandomAddressMin;
     address &= kAllocationRandomAddressMax;
@@ -874,7 +880,7 @@ void* OS::Allocate(const size_t requested,
                               msize,
                               MEM_COMMIT | MEM_RESERVE,
                               prot);
-  if (mbase == NULL && address != NULL)
+  if (mbase == NULL && address != 0)
     mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot);

   if (mbase == NULL) {
@@ -1347,6 +1353,7 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {

 #else  // __MINGW32__
 void OS::LogSharedLibraryAddresses() { }
+void OS::SignalCodeMovingGC() { }
 int OS::StackWalk(Vector<OS::StackFrame> frames) { return 0; }
 #endif  // __MINGW32__



--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to