Changeset 233547 in webkit


Ignore:
Timestamp:
Jul 5, 2018 4:12:04 PM (6 years ago)
Author:
msaboff@apple.com
Message:

Disable IsoHeaps when Gigacage is off
https://bugs.webkit.org/show_bug.cgi?id=187160

Reviewed by Saam Barati.

Updated determineMallocFallbackState to base enabling of Iso Heaps on Gigacage
being enabled. We do this because if Gigacage is disabled, it may be due to lack
of address space.

To work around a compiler issue uncovered by the change above, I added explicit
instantiation of PerThread's static variables. Defined the same explicit
instantiated static variables with export scope in the new file PerThread.cpp
to eliminate separate variables allocations in each linked framework / library.

  • CMakeLists.txt:
  • bmalloc.xcodeproj/project.pbxproj:
  • bmalloc/IsoTLS.cpp:

(bmalloc::IsoTLS::determineMallocFallbackState):

  • bmalloc/PerThread.cpp: Added.
  • bmalloc/PerThread.h:
Location:
trunk/Source/bmalloc
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/CMakeLists.txt

    r230308 r233547  
    2828    bmalloc/ObjectType.cpp
    2929    bmalloc/PerProcess.cpp
     30    bmalloc/PerThread.cpp
    3031    bmalloc/Scavenger.cpp
    3132    bmalloc/VMHeap.cpp
  • trunk/Source/bmalloc/ChangeLog

    r233501 r233547  
     12018-07-05  Michael Saboff  <msaboff@apple.com>
     2
     3        Disable IsoHeaps when Gigacage is off
     4        https://bugs.webkit.org/show_bug.cgi?id=187160
     5
     6        Reviewed by Saam Barati.
     7
     8        Updated determineMallocFallbackState to base enabling of Iso Heaps on Gigacage
     9        being enabled.  We do this because if Gigacage is disabled, it may be due to lack
     10        of address space.
     11
     12        To work around a compiler issue uncovered by the change above, I added explicit
     13        instantiation of PerThread's static variables.  Defined the same explicit
     14        instantiated static variables with export scope in the new file PerThread.cpp
     15        to eliminate separate variables allocations in each linked framework / library.
     16
     17        * CMakeLists.txt:
     18        * bmalloc.xcodeproj/project.pbxproj:
     19        * bmalloc/IsoTLS.cpp:
     20        (bmalloc::IsoTLS::determineMallocFallbackState):
     21        * bmalloc/PerThread.cpp: Added.
     22        * bmalloc/PerThread.h:
     23
    1242018-07-04  Tim Horton  <timothy_horton@apple.com>
    225
  • trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj

    r232262 r233547  
    132132                4426E2811C838EE0008EB042 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 4426E27F1C838EE0008EB042 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; };
    133133                4426E2831C839547008EB042 /* BSoftLinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 4426E2821C839547008EB042 /* BSoftLinking.h */; };
     134                6543DDB420EEAEF3003B23D8 /* PerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6543DDB320EEAEF3003B23D8 /* PerThread.cpp */; };
    134135                6599C5CC1EC3F15900A2F7BB /* AvailableMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6599C5CA1EC3F15900A2F7BB /* AvailableMemory.cpp */; };
    135136                6599C5CD1EC3F15900A2F7BB /* AvailableMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6599C5CB1EC3F15900A2F7BB /* AvailableMemory.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    293294                4426E27F1C838EE0008EB042 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = bmalloc/Logging.h; sourceTree = "<group>"; };
    294295                4426E2821C839547008EB042 /* BSoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSoftLinking.h; path = bmalloc/darwin/BSoftLinking.h; sourceTree = "<group>"; };
     296                6543DDB320EEAEF3003B23D8 /* PerThread.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = PerThread.cpp; path = bmalloc/PerThread.cpp; sourceTree = "<group>"; };
    295297                6599C5CA1EC3F15900A2F7BB /* AvailableMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AvailableMemory.cpp; path = bmalloc/AvailableMemory.cpp; sourceTree = "<group>"; };
    296298                6599C5CB1EC3F15900A2F7BB /* AvailableMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AvailableMemory.h; path = bmalloc/AvailableMemory.h; sourceTree = "<group>"; };
     
    537539                                14446A0717A61FA400F9EA1D /* PerProcess.h */,
    538540                                144469FD17A61F1F00F9EA1D /* PerThread.h */,
     541                                6543DDB320EEAEF3003B23D8 /* PerThread.cpp */,
    539542                                145F6878179E3A4400D65598 /* Range.h */,
    540543                                148EFAE61D6B953B008E721E /* ScopeExit.h */,
     
    785788                                14F271C718EA3990008C152F /* Heap.cpp in Sources */,
    786789                                0FD557331F7EDB7B00B1F0A3 /* HeapKind.cpp in Sources */,
     790                                6543DDB420EEAEF3003B23D8 /* PerThread.cpp in Sources */,
    787791                                0F7EB83B1F9541B000F1ABCB /* IsoHeapImpl.cpp in Sources */,
    788792                                0F5549EF1FB54704007FF75A /* IsoPage.cpp in Sources */,
  • trunk/Source/bmalloc/bmalloc/IsoTLS.cpp

    r233358 r233547  
    2828#include "DebugHeap.h"
    2929#include "Environment.h"
     30#include "Gigacage.h"
    3031#include "IsoTLSEntryInlines.h"
    3132#include "IsoTLSInlines.h"
     
    202203            if (s_mallocFallbackState != MallocFallbackState::Undecided)
    203204                return;
    204            
     205
     206#if GIGACAGE_ENABLED
     207            if (!Gigacage::shouldBeEnabled()) {
     208                s_mallocFallbackState = MallocFallbackState::FallBackToMalloc;
     209                return;
     210            }
    205211            const char* env = getenv("bmalloc_IsoHeap");
    206212            if (env && (!strcasecmp(env, "false") || !strcasecmp(env, "no") || !strcmp(env, "0")))
     
    208214            else
    209215                s_mallocFallbackState = MallocFallbackState::DoNotFallBack;
     216#else
     217            s_mallocFallbackState = MallocFallbackState::FallBackToMalloc;
     218#endif
    210219        });
    211220}
  • trunk/Source/bmalloc/bmalloc/PerThread.h

    r229504 r233547  
    11/*
    2  * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    109109};
    110110
    111 template<typename T> bool PerThreadStorage<T>::s_didInitialize;
    112 template<typename T> pthread_key_t PerThreadStorage<T>::s_key;
    113 template<typename T> std::once_flag PerThreadStorage<T>::s_onceFlag;
     111class Cache;
     112class Heap;
     113   
     114template<> bool PerThreadStorage<PerHeapKind<Cache>>::s_didInitialize;
     115template<> pthread_key_t PerThreadStorage<PerHeapKind<Cache>>::s_key;
     116template<> std::once_flag PerThreadStorage<PerHeapKind<Cache>>::s_onceFlag;
     117
     118template<> bool PerThreadStorage<PerHeapKind<Heap>>::s_didInitialize;
     119template<> pthread_key_t PerThreadStorage<PerHeapKind<Heap>>::s_key;
     120template<> std::once_flag PerThreadStorage<PerHeapKind<Heap>>::s_onceFlag;
    114121
    115122#endif
Note: See TracChangeset for help on using the changeset viewer.