Build bmalloc on Mac
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Apr 2014 05:31:41 +0000 (05:31 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Apr 2014 05:31:41 +0000 (05:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131333

Reviewed by Mark Rowe.

.:

* Source/Makefile:
* WebKitBuild: Added.
* WebKitBuild/Debug: Added.

Source/bmalloc:

* Makefile: Added. For make clients.

These files are required for building any project in WebKit. I copied
them from WTF:
* Configurations: Added.
* Configurations/Base.xcconfig: Added.
* Configurations/DebugRelease.xcconfig: Added.
* Configurations/bmalloc.xcconfig: Added.
* Configurations/iOS.xcconfig: Added.
* Configurations/mbmalloc.xcconfig: Added.

* bmalloc.xcodeproj/project.pbxproj: I removed per-project-file stuff
from here because everything is in .xcconfig files now.

I had to fix a bunch of minor warnings, since they're enabled in our
.xcconfig files:

* bmalloc/AsyncTask.h:
(bmalloc::Function>::AsyncTask):
* bmalloc/BAssert.h:
* bmalloc/BoundaryTagInlines.h:
(bmalloc::validate):
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
(bmalloc::Heap::allocateLarge):
(bmalloc::Heap::deallocateLarge):
* bmalloc/Mutex.h:
(bmalloc::Mutex::Mutex): Deleted.
* bmalloc/VMAllocate.h:
(bmalloc::vmValidate):
* bmalloc/mbmalloc.cpp:

Tools:

* Scripts/build-webkit: Add the bmalloc target if we're on Mac.
(Note: Just testing Mac is not good enough because in this
script 'Mac' means 'Mac or iOS'.)

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166910 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
ChangeLog
Source/Makefile
Source/bmalloc/ChangeLog
Source/bmalloc/Configurations/Base.xcconfig [new file with mode: 0644]
Source/bmalloc/Configurations/DebugRelease.xcconfig [new file with mode: 0644]
Source/bmalloc/Configurations/bmalloc.xcconfig [new file with mode: 0644]
Source/bmalloc/Configurations/iOS.xcconfig [new file with mode: 0644]
Source/bmalloc/Configurations/mbmalloc.xcconfig [new file with mode: 0644]
Source/bmalloc/Makefile [new file with mode: 0644]
Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Source/bmalloc/bmalloc/AsyncTask.h
Source/bmalloc/bmalloc/BAssert.h
Source/bmalloc/bmalloc/BoundaryTagInlines.h
Source/bmalloc/bmalloc/Heap.cpp
Source/bmalloc/bmalloc/Mutex.h
Source/bmalloc/bmalloc/SegregatedFreeList.cpp
Source/bmalloc/bmalloc/VMAllocate.h
Source/bmalloc/bmalloc/mbmalloc.cpp
Tools/ChangeLog
Tools/Scripts/build-webkit

index 650ca7e..ed2073a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-04-07  Geoffrey Garen  <ggaren@apple.com>
+
+        Build bmalloc on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=131333
+
+        Reviewed by Mark Rowe.
+
+        * Source/Makefile:
+        * WebKitBuild: Added.
+        * WebKitBuild/Debug: Added.
+
 2014-04-07  Ryuan Choi  <ryuan.choi@samsung.com>
 
         [EFL] Turn on ENABLE_MEDIA_CONTROLS_SCRIPT
index 9c6ffd3..a69075b 100644 (file)
@@ -1,4 +1,4 @@
-MODULES = WTF JavaScriptCore ThirdParty/ANGLE WebCore WebInspectorUI WebKit2 WebKit
+MODULES = bmalloc WTF JavaScriptCore ThirdParty/ANGLE WebCore WebInspectorUI WebKit2 WebKit
 
 ifneq (,$(findstring iphoneos,$(SDKROOT)))
        MODULES = WTF JavaScriptCore ThirdParty/ANGLE WebCore WebKit WebKit2
index 6fa75b0..a32c243 100644 (file)
@@ -1,5 +1,44 @@
 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
 
+        Build bmalloc on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=131333
+
+        Reviewed by Mark Rowe.
+
+        * Makefile: Added. For make clients.
+
+        These files are required for building any project in WebKit. I copied
+        them from WTF:
+        * Configurations: Added.
+        * Configurations/Base.xcconfig: Added.
+        * Configurations/DebugRelease.xcconfig: Added.
+        * Configurations/bmalloc.xcconfig: Added.
+        * Configurations/iOS.xcconfig: Added.
+        * Configurations/mbmalloc.xcconfig: Added.
+
+        * bmalloc.xcodeproj/project.pbxproj: I removed per-project-file stuff
+        from here because everything is in .xcconfig files now.
+
+        I had to fix a bunch of minor warnings, since they're enabled in our
+        .xcconfig files:
+
+        * bmalloc/AsyncTask.h:
+        (bmalloc::Function>::AsyncTask):
+        * bmalloc/BAssert.h:
+        * bmalloc/BoundaryTagInlines.h:
+        (bmalloc::validate):
+        * bmalloc/Heap.cpp:
+        (bmalloc::Heap::Heap):
+        (bmalloc::Heap::allocateLarge):
+        (bmalloc::Heap::deallocateLarge):
+        * bmalloc/Mutex.h:
+        (bmalloc::Mutex::Mutex): Deleted.
+        * bmalloc/VMAllocate.h:
+        (bmalloc::vmValidate):
+        * bmalloc/mbmalloc.cpp:
+
+2014-04-07  Geoffrey Garen  <ggaren@apple.com>
+
         bmalloc: Fixed a leak in the per-thread cache
         https://bugs.webkit.org/show_bug.cgi?id=131330
 
diff --git a/Source/bmalloc/Configurations/Base.xcconfig b/Source/bmalloc/Configurations/Base.xcconfig
new file mode 100644 (file)
index 0000000..9f28132
--- /dev/null
@@ -0,0 +1,121 @@
+// Copyright (C) 2009, 2010, 2011, 2013 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+#include "iOS.xcconfig"
+#include "../../../../Internal/Configurations/UseInternalSDK.xcconfig"
+
+CLANG_CXX_LANGUAGE_STANDARD = gnu++0x;
+CLANG_CXX_LIBRARY = libc++;
+CLANG_WARN_BOOL_CONVERSION = YES;
+CLANG_WARN_CONSTANT_CONVERSION = YES;
+CLANG_WARN_CXX0X_EXTENSIONS = NO;
+CLANG_WARN_EMPTY_BODY = YES;
+CLANG_WARN_ENUM_CONVERSION = YES;
+CLANG_WARN_INT_CONVERSION = YES;
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
+GCC_C_LANGUAGE_STANDARD = gnu99;
+GCC_DEBUGGING_SYMBOLS = default;
+GCC_DYNAMIC_NO_PIC = NO;
+GCC_ENABLE_CPP_EXCEPTIONS = NO;
+GCC_ENABLE_CPP_RTTI = NO;
+GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(PLATFORM_NAME));
+GCC_ENABLE_OBJC_GC_iphoneos = NO;
+GCC_ENABLE_OBJC_GC_iphonesimulator = NO;
+GCC_ENABLE_OBJC_GC_macosx = $(GCC_ENABLE_OBJC_GC_macosx_$(CONFIGURATION));
+GCC_ENABLE_OBJC_GC_macosx_Production = supported;
+GCC_ENABLE_OBJC_GC_macosx_Debug = $(GCC_ENABLE_OBJC_GC_macosx_Debug_or_Release);
+GCC_ENABLE_OBJC_GC_macosx_Release = $(GCC_ENABLE_OBJC_GC_macosx_Debug_or_Release);
+GCC_ENABLE_OBJC_GC_macosx_Debug_or_Release = $(GCC_ENABLE_OBJC_GC_macosx_Debug_or_Release_$(USE_INTERNAL_SDK));
+GCC_ENABLE_OBJC_GC_macosx_Debug_or_Release_ = NO;
+GCC_ENABLE_OBJC_GC_macosx_Debug_or_Release_YES = supported;
+GCC_ENABLE_SYMBOL_SEPARATION = NO;
+GCC_FAST_OBJC_DISPATCH = YES;
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
+GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(PLATFORM_NAME));
+GCC_MODEL_TUNING_macosx = G5;
+GCC_OBJC_CALL_CXX_CDTORS = YES;
+GCC_PRECOMPILE_PREFIX_HEADER = YES;
+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST HAVE_HEADER_DETECTION_H $(GCC_PREPROCESSOR_DEFINITIONS);
+GCC_STRICT_ALIASING = YES;
+GCC_THREADSAFE_STATICS = NO;
+GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+// FIXME: <http://webkit.org/b/107093> WTF should build with -Wshorten-64-to-32
+GCC_WARN_64_TO_32_BIT_CONVERSION = $(GCC_WARN_64_TO_32_BIT_CONVERSION_$(CURRENT_ARCH));
+GCC_WARN_64_TO_32_BIT_CONVERSION_ = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION_armv7 = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION_armv7k = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION_armv7s = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION_arm64 = NO;
+GCC_WARN_64_TO_32_BIT_CONVERSION_i386 = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION_x86_64 = NO;
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
+GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+GCC_WARN_ABOUT_RETURN_TYPE = YES;
+GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+GCC_WARN_SIGN_COMPARE = YES;
+GCC_WARN_UNDECLARED_SELECTOR = YES;
+GCC_WARN_UNINITIALIZED_AUTOS = YES;
+GCC_WARN_UNUSED_FUNCTION = YES;
+GCC_WARN_UNUSED_VARIABLE = YES;
+LINKER_DISPLAYS_MANGLED_NAMES = YES;
+PREBINDING = NO;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough;
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
+
+SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx;
+
+// DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL, STRIP_INSTALLED_PRODUCT and DEAD_CODE_STRIPPING vary between the debug and normal variants.
+// We set up the values for each variant here, and have the Debug configuration in the Xcode project use the _debug variant.
+DEBUG_DEFINES_debug = ;
+DEBUG_DEFINES_normal = NDEBUG;
+DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
+
+GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
+GCC_OPTIMIZATION_LEVEL_normal = 3;
+GCC_OPTIMIZATION_LEVEL_debug = 0;
+
+STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT));
+STRIP_INSTALLED_PRODUCT_normal = YES;
+STRIP_INSTALLED_PRODUCT_debug = NO;
+
+DEAD_CODE_STRIPPING_debug = NO;
+DEAD_CODE_STRIPPING_normal = YES;
+DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT));
+
+INSTALL_PATH = $(INSTALL_PATH_PREFIX)$(INSTALL_PATH_ACTUAL);
+
+SDKROOT = macosx.internal;
+
+TOOLCHAINS = $(TOOLCHAINS_$(PLATFORM_NAME));
+TOOLCHAINS_iphoneos = $(TOOLCHAINS);
+TOOLCHAINS_iphonesimulator = $(TOOLCHAINS);
+TOOLCHAINS_macosx = $(TOOLCHAINS_macosx_$(MAC_OS_X_VERSION_MAJOR));
+TOOLCHAINS_macosx_1080 = default;
+TOOLCHAINS_macosx_1090 = $(TOOLCHAINS);
+TOOLCHAINS_macosx_101000 = $(TOOLCHAINS_macosx_1090);
diff --git a/Source/bmalloc/Configurations/DebugRelease.xcconfig b/Source/bmalloc/Configurations/DebugRelease.xcconfig
new file mode 100644 (file)
index 0000000..bf92f3c
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2009, 2010, 2013 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+#include "Base.xcconfig"
+
+ARCHS = $(ARCHS_STANDARD_32_64_BIT);
+ONLY_ACTIVE_ARCH = YES;
+
+MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(PLATFORM_NAME));
+MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5;
+MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5;
+MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+MACOSX_DEPLOYMENT_TARGET_macosx_1080 = 10.8;
+MACOSX_DEPLOYMENT_TARGET_macosx_1090 = 10.9;
+MACOSX_DEPLOYMENT_TARGET_macosx_101000 = 10.10;
+
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
+DEBUG_INFORMATION_FORMAT = dwarf;
+OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
+OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
+
+SDKROOT = $(SDKROOT_$(PLATFORM_NAME));
+SDKROOT_iphoneos = $(SDKROOT);
+SDKROOT_iphonesimulator = $(SDKROOT);
+SDKROOT_macosx = $(SDKROOT_macosx_$(USE_INTERNAL_SDK));
+SDKROOT_macosx_ = macosx;
+SDKROOT_macosx_YES = macosx.internal;
diff --git a/Source/bmalloc/Configurations/bmalloc.xcconfig b/Source/bmalloc/Configurations/bmalloc.xcconfig
new file mode 100644 (file)
index 0000000..fb5c988
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2014 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+EXECUTABLE_PREFIX = lib;
+INSTALL_PATH_ACTUAL = /usr/local/lib;
+PRODUCT_NAME = bmalloc;
+
+GCC_SYMBOLS_PRIVATE_EXTERN = YES;
diff --git a/Source/bmalloc/Configurations/iOS.xcconfig b/Source/bmalloc/Configurations/iOS.xcconfig
new file mode 100644 (file)
index 0000000..177b319
--- /dev/null
@@ -0,0 +1 @@
+#include "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/AspenFamily.xcconfig"
diff --git a/Source/bmalloc/Configurations/mbmalloc.xcconfig b/Source/bmalloc/Configurations/mbmalloc.xcconfig
new file mode 100644 (file)
index 0000000..70974fe
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2014 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+
+EXECUTABLE_PREFIX = lib;
+INSTALL_PATH_ACTUAL = /usr/local/lib;
+PRODUCT_NAME = mbmalloc;
+
+GCC_SYMBOLS_PRIVATE_EXTERN = YES;
diff --git a/Source/bmalloc/Makefile b/Source/bmalloc/Makefile
new file mode 100644 (file)
index 0000000..cb4c11a
--- /dev/null
@@ -0,0 +1 @@
+include ../Makefile.shared
index 2e20ec1..ea4cb4a 100644 (file)
                147AAA9718CE5FB6002201E4 /* SmallTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmallTraits.h; path = bmalloc/SmallTraits.h; sourceTree = "<group>"; };
                1485655E18A43AF900ED6942 /* BoundaryTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoundaryTag.h; path = bmalloc/BoundaryTag.h; sourceTree = "<group>"; };
                1485656018A43DBA00ED6942 /* ObjectType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectType.h; path = bmalloc/ObjectType.h; sourceTree = "<group>"; };
+               14B650C518F39F4800751968 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+               14B650C618F39F4800751968 /* bmalloc.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = bmalloc.xcconfig; sourceTree = "<group>"; };
+               14B650C718F39F4800751968 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
+               14B650C818F39F4800751968 /* iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
+               14B650C918F3A04200751968 /* mbmalloc.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mbmalloc.xcconfig; sourceTree = "<group>"; };
                14CC394418EA8743004AFE34 /* libmbmalloc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmbmalloc.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
                14D9DB4517F2447100EAAB79 /* FixedVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = FixedVector.h; path = bmalloc/FixedVector.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
                14DA32071885F9E6007269E0 /* Line.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Line.h; path = bmalloc/Line.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
                                147AAA9A18CE5FD3002201E4 /* heap: small | medium */,
                                14D9DB4E17F2866E00EAAB79 /* heap */,
                                14D9DB4F17F2868900EAAB79 /* stdlib */,
+                               14B650C418F39F4800751968 /* Configurations */,
                                145F6840179DC45F00D65598 /* Products */,
                        );
                        sourceTree = "<group>";
                        name = "heap: large | xlarge";
                        sourceTree = "<group>";
                };
+               14B650C418F39F4800751968 /* Configurations */ = {
+                       isa = PBXGroup;
+                       children = (
+                               14B650C518F39F4800751968 /* Base.xcconfig */,
+                               14B650C618F39F4800751968 /* bmalloc.xcconfig */,
+                               14B650C718F39F4800751968 /* DebugRelease.xcconfig */,
+                               14B650C818F39F4800751968 /* iOS.xcconfig */,
+                               14B650C918F3A04200751968 /* mbmalloc.xcconfig */,
+                       );
+                       path = Configurations;
+                       sourceTree = "<group>";
+               };
                14D9DB4D17F2865C00EAAB79 /* cache */ = {
                        isa = PBXGroup;
                        children = (
 /* End PBXTargetDependency section */
 
 /* Begin XCBuildConfiguration section */
+               14202F0F18F37C15006C37DB /* Production */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C518F39F4800751968 /* Base.xcconfig */;
+                       buildSettings = {
+                       };
+                       name = Production;
+               };
+               14202F1018F37C15006C37DB /* Production */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C618F39F4800751968 /* bmalloc.xcconfig */;
+                       buildSettings = {
+                       };
+                       name = Production;
+               };
+               14202F1118F37C15006C37DB /* Production */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C918F3A04200751968 /* mbmalloc.xcconfig */;
+                       buildSettings = {
+                       };
+                       name = Production;
+               };
                145F684A179DC45F00D65598 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C718F39F4800751968 /* DebugRelease.xcconfig */;
                        buildSettings = {
-                               ALWAYS_SEARCH_USER_PATHS = NO;
-                               CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
-                               CLANG_CXX_LIBRARY = "libc++";
-                               CLANG_ENABLE_MODULES = YES;
-                               CLANG_ENABLE_OBJC_ARC = YES;
-                               CLANG_WARN_BOOL_CONVERSION = YES;
-                               CLANG_WARN_CONSTANT_CONVERSION = YES;
-                               CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                               CLANG_WARN_EMPTY_BODY = YES;
-                               CLANG_WARN_ENUM_CONVERSION = YES;
-                               CLANG_WARN_INT_CONVERSION = YES;
-                               CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                               COPY_PHASE_STRIP = NO;
-                               GCC_C_LANGUAGE_STANDARD = gnu99;
-                               GCC_DYNAMIC_NO_PIC = NO;
-                               GCC_ENABLE_CPP_EXCEPTIONS = NO;
-                               GCC_ENABLE_CPP_RTTI = NO;
-                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
-                               GCC_OPTIMIZATION_LEVEL = 0;
-                               GCC_PREPROCESSOR_DEFINITIONS = (
-                                       "DEBUG=1",
-                                       "$(inherited)",
-                               );
-                               GCC_SYMBOLS_PRIVATE_EXTERN = NO;
-                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                               GCC_WARN_UNDECLARED_SELECTOR = YES;
-                               GCC_WARN_UNINITIALIZED_AUTOS = YES;
-                               GCC_WARN_UNUSED_FUNCTION = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               MACOSX_DEPLOYMENT_TARGET = 10.9;
-                               ONLY_ACTIVE_ARCH = YES;
-                               SDKROOT = macosx;
+                               DEAD_CODE_STRIPPING = "$(DEAD_CODE_STRIPPING_debug)";
+                               DEBUG_DEFINES = "$(DEBUG_DEFINES_debug)";
+                               GCC_OPTIMIZATION_LEVEL = "$(GCC_OPTIMIZATION_LEVEL_debug)";
+                               STRIP_INSTALLED_PRODUCT = "$(STRIP_INSTALLED_PRODUCT_debug)";
                        };
                        name = Debug;
                };
                145F684B179DC45F00D65598 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C718F39F4800751968 /* DebugRelease.xcconfig */;
                        buildSettings = {
-                               ALWAYS_SEARCH_USER_PATHS = NO;
-                               CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
-                               CLANG_CXX_LIBRARY = "libc++";
-                               CLANG_ENABLE_MODULES = YES;
-                               CLANG_ENABLE_OBJC_ARC = YES;
-                               CLANG_WARN_BOOL_CONVERSION = YES;
-                               CLANG_WARN_CONSTANT_CONVERSION = YES;
-                               CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                               CLANG_WARN_EMPTY_BODY = YES;
-                               CLANG_WARN_ENUM_CONVERSION = YES;
-                               CLANG_WARN_INT_CONVERSION = YES;
-                               CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                               COPY_PHASE_STRIP = YES;
-                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                               ENABLE_NS_ASSERTIONS = NO;
-                               GCC_C_LANGUAGE_STANDARD = gnu99;
-                               GCC_ENABLE_CPP_EXCEPTIONS = NO;
-                               GCC_ENABLE_CPP_RTTI = NO;
-                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
-                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                               GCC_WARN_UNDECLARED_SELECTOR = YES;
-                               GCC_WARN_UNINITIALIZED_AUTOS = YES;
-                               GCC_WARN_UNUSED_FUNCTION = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               MACOSX_DEPLOYMENT_TARGET = 10.9;
-                               SDKROOT = macosx;
                        };
                        name = Release;
                };
                14CC394618EA8743004AFE34 /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C918F3A04200751968 /* mbmalloc.xcconfig */;
                        buildSettings = {
-                               COMBINE_HIDPI_IMAGES = YES;
-                               EXECUTABLE_PREFIX = lib;
-                               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                               PRODUCT_NAME = "$(TARGET_NAME)";
-                               SDKROOT = macosx.internal;
                        };
                        name = Debug;
                };
                14CC394718EA8743004AFE34 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C918F3A04200751968 /* mbmalloc.xcconfig */;
                        buildSettings = {
-                               COMBINE_HIDPI_IMAGES = YES;
-                               EXECUTABLE_PREFIX = lib;
-                               GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1";
-                               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                               PRODUCT_NAME = "$(TARGET_NAME)";
-                               SDKROOT = macosx.internal;
                        };
                        name = Release;
                };
                14F271C018EA3963008C152F /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C618F39F4800751968 /* bmalloc.xcconfig */;
                        buildSettings = {
-                               COMBINE_HIDPI_IMAGES = YES;
-                               DEBUG_INFORMATION_FORMAT = dwarf;
-                               EXECUTABLE_PREFIX = lib;
-                               GCC_ENABLE_OBJC_EXCEPTIONS = NO;
-                               GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-                               GCC_THREADSAFE_STATICS = NO;
-                               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                               PRODUCT_NAME = "$(TARGET_NAME)";
-                               SDKROOT = macosx.internal;
                        };
                        name = Debug;
                };
                14F271C118EA3963008C152F /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 14B650C618F39F4800751968 /* bmalloc.xcconfig */;
                        buildSettings = {
-                               COMBINE_HIDPI_IMAGES = YES;
-                               EXECUTABLE_PREFIX = lib;
-                               GCC_ENABLE_OBJC_EXCEPTIONS = NO;
-                               GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1";
-                               GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-                               GCC_THREADSAFE_STATICS = NO;
-                               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                               PRODUCT_NAME = "$(TARGET_NAME)";
-                               SDKROOT = macosx.internal;
                        };
                        name = Release;
                };
                        buildConfigurations = (
                                145F684A179DC45F00D65598 /* Debug */,
                                145F684B179DC45F00D65598 /* Release */,
+                               14202F0F18F37C15006C37DB /* Production */,
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
+                       defaultConfigurationName = Production;
                };
                14CC394518EA8743004AFE34 /* Build configuration list for PBXNativeTarget "mbmalloc" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                                14CC394618EA8743004AFE34 /* Debug */,
                                14CC394718EA8743004AFE34 /* Release */,
+                               14202F1118F37C15006C37DB /* Production */,
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
+                       defaultConfigurationName = Production;
                };
                14F271BF18EA3963008C152F /* Build configuration list for PBXNativeTarget "bmalloc" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                                14F271C018EA3963008C152F /* Debug */,
                                14F271C118EA3963008C152F /* Release */,
+                               14202F1018F37C15006C37DB /* Production */,
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
+                       defaultConfigurationName = Production;
                };
 /* End XCConfigurationList section */
        };
index dd8fbd5..b8c8bf8 100644 (file)
@@ -68,8 +68,8 @@ template<typename Object, typename Function> const std::chrono::seconds AsyncTas
 template<typename Object, typename Function>
 AsyncTask<Object, Function>::AsyncTask(Object& object, const Function& function)
     : m_state(Exited)
-    , m_thread()
     , m_condition()
+    , m_thread()
     , m_object(object)
     , m_function(function)
 {
index 94998c7..92a627f 100644 (file)
@@ -33,6 +33,8 @@
 
 #define RELEASE_ASSERT(x) ASSERT_IMPL(x)
 
+#define UNUSED(x) (void)x
+
 // ===== Release build =====
 
 #if defined(NDEBUG)
index 2881042..2561c9f 100644 (file)
@@ -36,6 +36,7 @@ namespace bmalloc {
 
 static inline void validate(const Range& range)
 {
+    UNUSED(range);
 IF_DEBUG(
     BeginTag* beginTag = LargeChunk::beginTag(range.begin());
     EndTag* endTag = LargeChunk::endTag(range.begin(), range.size());
index 85884c2..a3646bb 100644 (file)
@@ -44,8 +44,8 @@ static inline void sleep(std::unique_lock<Mutex>& lock, std::chrono::millisecond
 }
 
 Heap::Heap(std::lock_guard<Mutex>&)
-    : m_scavenger(*this, &Heap::concurrentScavenge)
-    , m_isAllocatingPages(false)
+    : m_isAllocatingPages(false)
+    , m_scavenger(*this, &Heap::concurrentScavenge)
 {
 }
 
@@ -168,7 +168,7 @@ void Heap::deallocateXLarge(std::lock_guard<Mutex>&, void* object)
     XLargeChunk::destroy(chunk);
 }
 
-void* Heap::allocateLarge(std::lock_guard<Mutex>& lock, size_t size)
+void* Heap::allocateLarge(std::lock_guard<Mutex>&, size_t size)
 {
     ASSERT(size <= largeMax);
     ASSERT(size >= largeMin);
@@ -192,7 +192,7 @@ void* Heap::allocateLarge(std::lock_guard<Mutex>& lock, size_t size)
     return range.begin();
 }
 
-void Heap::deallocateLarge(std::lock_guard<Mutex>& lock, void* object)
+void Heap::deallocateLarge(std::lock_guard<Mutex>&, void* object)
 {
     Range range = BoundaryTag::deallocate(object);
     m_largeRanges.insert(range);
index 2fef5b9..29c1cb3 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef Mutex_h
 #define Mutex_h
 
+#include "BAssert.h"
 #include <atomic>
 
 // A replacement for std::mutex that does not require an exit-time destructor.
@@ -34,8 +35,6 @@ namespace bmalloc {
 
 class Mutex {
 public:
-    Mutex();
-
     void lock();
     bool try_lock();
     void unlock();
@@ -46,11 +45,6 @@ private:
     std::atomic_flag m_flag;
 };
 
-inline Mutex::Mutex()
-    : m_flag(ATOMIC_FLAG_INIT)
-{
-}
-
 inline bool Mutex::try_lock()
 {
     return !m_flag.test_and_set(std::memory_order_acquire);
index fe0ec85..faf9250 100644 (file)
@@ -32,7 +32,7 @@ namespace bmalloc {
 
 SegregatedFreeList::SegregatedFreeList()
 {
-    ASSERT(&select(largeMax) - m_lists.begin() == m_lists.size() - 1);
+    ASSERT(static_cast<size_t>(&select(largeMax) - m_lists.begin()) == m_lists.size() - 1);
 }
 
 void SegregatedFreeList::insert(const Range& range)
index 9c03357..84e4489 100644 (file)
@@ -49,6 +49,7 @@ inline size_t vmSize(size_t size)
     
 inline void vmValidate(size_t vmSize)
 {
+    UNUSED(vmSize);
     ASSERT(vmSize);
     ASSERT(vmSize == bmalloc::vmSize(vmSize));
 }
@@ -59,6 +60,7 @@ inline void vmValidate(void* p, size_t vmSize)
     
     // We use getpagesize() here instead of vmPageSize because vmPageSize is
     // allowed to be larger than the OS's true page size.
+    UNUSED(p);
     ASSERT(p);
     ASSERT(p == mask(p, ~(getpagesize() - 1)));
 }
index 4651adc..91ec81b 100644 (file)
 
 extern "C" {
 
+void* mbmalloc(size_t);
+void mbfree(void*, size_t);
+void* mbrealloc(void*, size_t, size_t);
+
 void* mbmalloc(size_t size)
 {
     return bmalloc::api::malloc(size);
index bea793c..34ab28d 100644 (file)
@@ -1,3 +1,14 @@
+2014-04-07  Geoffrey Garen  <ggaren@apple.com>
+
+        Build bmalloc on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=131333
+
+        Reviewed by Mark Rowe.
+
+        * Scripts/build-webkit: Add the bmalloc target if we're on Mac.
+        (Note: Just testing Mac is not good enough because in this
+        script 'Mac' means 'Mac or iOS'.)
+
 2014-03-30  Filip Pizlo  <fpizlo@apple.com>
 
         Move slow JSRegress tests out of the way so that they don't show up in run-jsc-benchmarks runs and also skip tests that are extremely long-running
index d06e905..77e5aea 100755 (executable)
@@ -165,6 +165,8 @@ my @projects = ("Source/JavaScriptCore", "Source/WebCore", "Source/WebKit");
 # Build WTF as a separate static library on ports which support it.
 splice @projects, 0, 0, "Source/WTF" if isAppleMacWebKit() or isAppleWinWebKit() or isWinCairo();
 
+splice @projects, 0, 0, "Source/bmalloc" if isAppleMacWebKit() && !isIOSWebKit();
+
 for my $dir (@projects) {
     if (! -d $dir) {
         die "Error: No $dir directory found. Please do a fresh checkout.\n";