Changeset 225701 in webkit


Ignore:
Timestamp:
Dec 8, 2017 2:28:31 PM (6 years ago)
Author:
sbarati@apple.com
Message:

Enable gigacage on iOS with a 32GB runway and ensure it doesn't break WasmBench
https://bugs.webkit.org/show_bug.cgi?id=178557

Reviewed by Mark Lam.

  • bmalloc/Algorithm.h:

(bmalloc::isPowerOfTwo):

  • bmalloc/Gigacage.cpp:
  • bmalloc/Gigacage.h:
Location:
trunk/Source/bmalloc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r225558 r225701  
     12017-12-08  Saam Barati  <sbarati@apple.com>
     2
     3        Enable gigacage on iOS with a 32GB runway and ensure it doesn't break WasmBench
     4        https://bugs.webkit.org/show_bug.cgi?id=178557
     5
     6        Reviewed by Mark Lam.
     7
     8        * bmalloc/Algorithm.h:
     9        (bmalloc::isPowerOfTwo):
     10        * bmalloc/Gigacage.cpp:
     11        * bmalloc/Gigacage.h:
     12
    1132017-12-05  Andy Estes  <aestes@apple.com>
    214
  • trunk/Source/bmalloc/bmalloc/Algorithm.h

    r224537 r225701  
    6464}
    6565
    66 inline constexpr bool isPowerOfTwo(size_t size)
     66template <typename T>
     67inline constexpr bool isPowerOfTwo(T size)
    6768{
     69    static_assert(std::is_integral<T>::value, "");
    6870    return size && !(size & (size - 1));
    6971}
  • trunk/Source/bmalloc/bmalloc/Gigacage.cpp

    r225413 r225701  
    3535#include <mutex>
    3636
    37 #if BCPU(ARM64)
    38 // FIXME: There is no good reason for ARM64 to be special.
    39 // https://bugs.webkit.org/show_bug.cgi?id=177605
    40 #define GIGACAGE_RUNWAY 0
    41 #else
     37// This is exactly 32GB because inside JSC, indexed accesses for arrays, typed arrays, etc,
     38// use unsigned 32-bit ints as indices. The items those indices access are 8 bytes or less
     39// in size. 2^32 * 8 = 32GB. This means if an access on a caged type happens to go out of
     40// bounds, the access is guaranteed to land somewhere else in the cage or inside the runway.
     41// If this were less than 32GB, those OOB accesses could reach outside of the cage.
    4242#define GIGACAGE_RUNWAY (32llu * 1024 * 1024 * 1024)
    43 #endif
    4443
    4544char g_gigacageBasePtrs[GIGACAGE_BASE_PTRS_SIZE] __attribute__((aligned(GIGACAGE_BASE_PTRS_SIZE)));
  • trunk/Source/bmalloc/bmalloc/Gigacage.h

    r225413 r225701  
    2626#pragma once
    2727
     28#include "Algorithm.h"
    2829#include "BAssert.h"
    2930#include "BExport.h"
     
    3435
    3536#if BCPU(ARM64)
    36 // FIXME: This can probably be a lot bigger on iOS. I just haven't tried to make it bigger yet.
    37 // https://bugs.webkit.org/show_bug.cgi?id=177605
    38 #define PRIMITIVE_GIGACAGE_SIZE 0x40000000llu
     37#define PRIMITIVE_GIGACAGE_SIZE 0x80000000llu
    3938#define JSVALUE_GIGACAGE_SIZE 0x40000000llu
    4039#define STRING_GIGACAGE_SIZE 0x40000000llu
     
    4746#endif
    4847
     48static_assert(bmalloc::isPowerOfTwo(PRIMITIVE_GIGACAGE_SIZE), "");
     49static_assert(bmalloc::isPowerOfTwo(JSVALUE_GIGACAGE_SIZE), "");
     50static_assert(bmalloc::isPowerOfTwo(STRING_GIGACAGE_SIZE), "");
     51
    4952#define GIGACAGE_SIZE_TO_MASK(size) ((size) - 1)
    5053
     
    5356#define STRING_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(STRING_GIGACAGE_SIZE)
    5457
    55 // FIXME: Make WasmBench run with gigacage on iOS and re-enable on ARM64:
    56 // https://bugs.webkit.org/show_bug.cgi?id=178557
    57 #if (BOS(DARWIN) || BOS(LINUX)) && (/* (BCPU(ARM64) && !defined(__ILP32__))  || */ BCPU(X86_64))
     58#if ((BOS(DARWIN) || BOS(LINUX)) && \
     59    (BCPU(X86_64) || (BCPU(ARM64) && !defined(__ILP32__) && (!BPLATFORM(IOS) || __IPHONE_OS_VERSION_MIN_REQUIRED >= 110300))))
    5860#define GIGACAGE_ENABLED 1
    5961#else
Note: See TracChangeset for help on using the changeset viewer.