Skip to content

Commit

Permalink
Revert rdar://126195542
Browse files Browse the repository at this point in the history
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
(JSC::GenericCacheEntry::GenericCacheEntry):
(JSC::GenericCacheEntry::isUpToDate const):
* Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp: Removed.
* Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp.in: Added.
* Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.h:
* Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:
* Source/WTF/wtf/spi/darwin/dyldSPI.h:
  • Loading branch information
Mohsin Qureshi committed Apr 17, 2024
1 parent 68075b6 commit 6c3336b
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 94 deletions.
22 changes: 21 additions & 1 deletion Source/JavaScriptCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,30 @@ set(JavaScriptCore_OBJECT_LUT_SOURCES
)

list(APPEND JavaScriptCore_SOURCES
runtime/CachedTypes.cpp
${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp
${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBuiltins.cpp
)

find_program(TOUCH_EXECUTABLE touch)
if (TOUCH_EXECUTABLE)
add_custom_command(
OUTPUT ${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp
MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/runtime/JSCBytecodeCacheVersion.cpp.in
COMMAND ${PERL_EXECUTABLE} -pe s/CACHED_TYPES_CKSUM/__TIMESTAMP__/ ${JAVASCRIPTCORE_DIR}/runtime/JSCBytecodeCacheVersion.cpp.in > ${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp
COMMAND ${TOUCH_EXECUTABLE} -r ${JAVASCRIPTCORE_DIR}/runtime/JSCBytecodeCacheVersion.cpp.in ${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp
VERBATIM
)
else ()
message(WARNING "Unable to find touch executable; ${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp is built non-reproducibly from ${JAVASCRIPTCORE_DIR}/runtime/JSCBytecodeCacheVersion.cpp.in")
add_custom_command(
OUTPUT ${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp
MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/runtime/JSCBytecodeCacheVersion.cpp.in
COMMAND ${PERL_EXECUTABLE} -pe s/CACHED_TYPES_CKSUM/__TIMESTAMP__/ ${JAVASCRIPTCORE_DIR}/runtime/JSCBytecodeCacheVersion.cpp.in > ${JavaScriptCore_DERIVED_SOURCES_DIR}/JSCBytecodeCacheVersion.cpp
VERBATIM
)
endif ()

set(JavaScriptCore_FRAMEWORKS
WTF
)
Expand Down Expand Up @@ -1086,7 +1107,6 @@ set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
runtime/JSArrayIterator.h
runtime/JSBigInt.h
runtime/JSBoundFunction.h
runtime/JSCBytecodeCacheVersion.h
runtime/JSCConfig.h
runtime/JSCInlines.h
runtime/JSCJSValue.h
Expand Down
32 changes: 26 additions & 6 deletions Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,9 @@
DCF3D56D1CD29476003D5C65 /* LazyPropertyInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF3D5681CD29468003D5C65 /* LazyPropertyInlines.h */; };
DCFDFBD91D1F5D9B00FE3D72 /* B3BottomProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = DCFDFBD71D1F5D9800FE3D72 /* B3BottomProvider.h */; };
DCFDFBDA1D1F5D9E00FE3D72 /* B3TypeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = DCFDFBD81D1F5D9800FE3D72 /* B3TypeMap.h */; };
DD284672291A217E0009A61D /* CachedTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DAFA4521E3B871004B68F7 /* CachedTypes.cpp */; };
DD284679291A29900009A61D /* JSCBytecodeCacheVersion.cpp.in in Sources */ = {isa = PBXBuildFile; fileRef = DD284677291A280D0009A61D /* JSCBytecodeCacheVersion.cpp.in */; };
DD28467B291A35120009A61D /* JSCBytecodeCacheVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = DD28467A291A35120009A61D /* JSCBytecodeCacheVersion.h */; };
DD28467C291AF1B20009A61D /* JSCBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D801A61880D6A80026C39B /* JSCBuiltins.cpp */; };
DD41FA8627CDAD3200394D95 /* LowLevelInterpreter.asm in Sources */ = {isa = PBXBuildFile; fileRef = 86A054461556451B00445157 /* LowLevelInterpreter.asm */; };
DD41FA8727CDAD4300394D95 /* LowLevelInterpreter.asm in Sources */ = {isa = PBXBuildFile; fileRef = 86A054461556451B00445157 /* LowLevelInterpreter.asm */; };
Expand Down Expand Up @@ -2184,7 +2187,6 @@
FEF934472B4DC61500DFA7F5 /* ExpressionInfoInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF934462B4DC61500DFA7F5 /* ExpressionInfoInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
FEFD6FC61D5E7992008F2F0B /* JSStringInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
FF41590C28FF3C6B00F80B96 /* WaiterListManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FF41590B28FF3C6B00F80B96 /* WaiterListManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
FFF3373F2BCDF1240070D04B /* JSCBytecodeCacheVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = FFF3373E2BCDF1240070D04B /* JSCBytecodeCacheVersion.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */

/* Begin PBXBuildRule section */
Expand All @@ -2201,6 +2203,21 @@
);
script = "exec \"${SRCROOT}/Scripts/postprocess-header-rule\"\n";
};
DD284676291A27C90009A61D /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = com.apple.compilers.proxy.script;
filePatterns = "*/JSCBytecodeCacheVersion.cpp.in";
fileType = pattern.proxy;
inputFiles = (
"$(OBJECT_FILE_DIR_normal)/$(arch)/JSCBuiltins.o",
"$(OBJECT_FILE_DIR_normal)/$(arch)/CachedTypes.o",
);
isEditable = 1;
outputFiles = (
"$(DERIVED_FILE_DIR)/$(arch)/JSCBytecodeCacheVersion.cpp",
);
script = "set -eo pipefail\nCKSUM=(`( cat \"${SCRIPT_INPUT_FILE_0}\" \"${SCRIPT_INPUT_FILE_1}\"; echo ${RC_ProjectSourceVersion} ) | shasum`)\nsed -e s/CACHED_TYPES_CKSUM/\\\"${CKSUM[0]}\\\"/ \"${INPUT_FILE_PATH}\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
};
DD41FA7D27CDA6FE00394D95 /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = com.apple.compilers.proxy.script;
Expand Down Expand Up @@ -5425,6 +5442,8 @@
DCF3D5681CD29468003D5C65 /* LazyPropertyInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyPropertyInlines.h; sourceTree = "<group>"; };
DCFDFBD71D1F5D9800FE3D72 /* B3BottomProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3BottomProvider.h; path = b3/B3BottomProvider.h; sourceTree = "<group>"; };
DCFDFBD81D1F5D9800FE3D72 /* B3TypeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3TypeMap.h; path = b3/B3TypeMap.h; sourceTree = "<group>"; };
DD284677291A280D0009A61D /* JSCBytecodeCacheVersion.cpp.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = JSCBytecodeCacheVersion.cpp.in; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
DD28467A291A35120009A61D /* JSCBytecodeCacheVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCBytecodeCacheVersion.h; sourceTree = "<group>"; };
DD4BEC0E29CB85AF00398E35 /* B3CanonicalizePrePostIncrements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3CanonicalizePrePostIncrements.cpp; path = b3/B3CanonicalizePrePostIncrements.cpp; sourceTree = "<group>"; };
DD4BEC0F29CB85AF00398E35 /* B3CanonicalizePrePostIncrements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3CanonicalizePrePostIncrements.h; path = b3/B3CanonicalizePrePostIncrements.h; sourceTree = "<group>"; };
DD5F74F8283EF4380027A8C6 /* copy-profiling-data.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "copy-profiling-data.sh"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6039,8 +6058,6 @@
FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringInlines.h; sourceTree = "<group>"; };
FF41590B28FF3C6B00F80B96 /* WaiterListManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaiterListManager.h; sourceTree = "<group>"; };
FFB77C2828FF561B00F3C55B /* WaiterListManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WaiterListManager.cpp; sourceTree = "<group>"; };
FFF3373D2BCDF1240070D04B /* JSCBytecodeCacheVersion.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCBytecodeCacheVersion.cpp; sourceTree = "<group>"; };
FFF3373E2BCDF1240070D04B /* JSCBytecodeCacheVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCBytecodeCacheVersion.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -8274,8 +8291,8 @@
657CF45719BF6662004ACBF2 /* JSCallee.h */,
276B38B52A71D25A00252F4E /* JSCalleeInlines.h */,
53B601EB2034B8C5006BE667 /* JSCast.h */,
FFF3373D2BCDF1240070D04B /* JSCBytecodeCacheVersion.cpp */,
FFF3373E2BCDF1240070D04B /* JSCBytecodeCacheVersion.h */,
DD284677291A280D0009A61D /* JSCBytecodeCacheVersion.cpp.in */,
DD28467A291A35120009A61D /* JSCBytecodeCacheVersion.h */,
FE48BD4323245E8700F136D0 /* JSCConfig.cpp */,
FE48BD4223245E8700F136D0 /* JSCConfig.h */,
BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */,
Expand Down Expand Up @@ -11153,7 +11170,7 @@
276B38DA2A71D26400252F4E /* JSCalleeInlines.h in Headers */,
53B601EC2034B8C5006BE667 /* JSCast.h in Headers */,
A7D801A91880D6A80026C39B /* JSCBuiltins.h in Headers */,
FFF3373F2BCDF1240070D04B /* JSCBytecodeCacheVersion.h in Headers */,
DD28467B291A35120009A61D /* JSCBytecodeCacheVersion.h in Headers */,
FE48BD4423245E9300F136D0 /* JSCConfig.h in Headers */,
BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */,
0F9749711687ADE400A4FF6A /* JSCellInlines.h in Headers */,
Expand Down Expand Up @@ -12106,6 +12123,7 @@
44F93DFF2AE71F5300FFA37C /* Frameworks */,
);
buildRules = (
DD284676291A27C90009A61D /* PBXBuildRule */,
DD41FA7D27CDA6FE00394D95 /* PBXBuildRule */,
535E08C222545AC800DF00CA /* PBXBuildRule */,
);
Expand Down Expand Up @@ -12932,6 +12950,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DD284672291A217E0009A61D /* CachedTypes.cpp in Sources */,
5333BBDC2110F7D9007618EC /* DFGSpeculativeJIT.cpp in Sources */,
5333BBDB2110F7D2007618EC /* DFGSpeculativeJIT32_64.cpp in Sources */,
5333BBDD2110F7E1007618EC /* DFGSpeculativeJIT64.cpp in Sources */,
Expand All @@ -12943,6 +12962,7 @@
E30873E7272559410053B601 /* IntlPluralRules.cpp in Sources */,
A3EE8543262514B000FC9B8D /* IntlWorkaround.cpp in Sources */,
DD28467C291AF1B20009A61D /* JSCBuiltins.cpp in Sources */,
DD284679291A29900009A61D /* JSCBytecodeCacheVersion.cpp.in in Sources */,
E38E8790254B978400F6F9E4 /* JSDateMath.cpp in Sources */,
539900052A218CC4007F4335 /* JSWebAssemblyArray.cpp in Sources */,
4BE92D442898522400FA48E1 /* LowLevelInterpreter.asm in Sources */,
Expand Down
2 changes: 0 additions & 2 deletions Source/JavaScriptCore/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ runtime/CacheUpdate.cpp
runtime/CacheableIdentifier.cpp
runtime/CachedBytecode.cpp
runtime/CachedSpecialPropertyAdaptiveStructureWatchpoint.cpp
runtime/CachedTypes.cpp
runtime/CatchScope.cpp
runtime/ClassInfo.cpp
runtime/ClonedArguments.cpp
Expand Down Expand Up @@ -901,7 +900,6 @@ runtime/JSAsyncGeneratorFunction.cpp
runtime/JSArrayIterator.cpp
runtime/JSBigInt.cpp
runtime/JSBoundFunction.cpp
runtime/JSCBytecodeCacheVersion.cpp
runtime/JSCConfig.cpp
runtime/JSCJSValue.cpp
runtime/JSCPtrTag.cpp
Expand Down
7 changes: 3 additions & 4 deletions Source/JavaScriptCore/runtime/CachedTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2414,8 +2414,7 @@ class GenericCacheEntry {

protected:
GenericCacheEntry(Encoder& encoder, CachedCodeBlockTag tag)
: m_cacheVersion(computeJSCBytecodeCacheVersion())
, m_tag(tag)
: m_tag(tag)
{
m_bootSessionUUID.encode(encoder, bootSessionUUIDString());
}
Expand All @@ -2424,15 +2423,15 @@ class GenericCacheEntry {

bool isUpToDate(Decoder& decoder) const
{
if (m_cacheVersion != computeJSCBytecodeCacheVersion())
if (m_cacheVersion != JSCBytecodeCacheVersion)
return false;
if (m_bootSessionUUID.decode(decoder) != bootSessionUUIDString())
return false;
return true;
}

private:
uint32_t m_cacheVersion;
uint32_t m_cacheVersion { JSCBytecodeCacheVersion };
CachedString m_bootSessionUUID;
CachedCodeBlockTag m_tag;
};
Expand Down
73 changes: 0 additions & 73 deletions Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp

This file was deleted.

7 changes: 7 additions & 0 deletions Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#include "JSCBytecodeCacheVersion.h"

#include "config.h"
#include <wtf/text/SuperFastHash.h>

const uint32_t JSCBytecodeCacheVersion = SuperFastHash::computeHash(CACHED_TYPES_CKSUM);
10 changes: 4 additions & 6 deletions Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Apple Inc. All rights reserved.
* Copyright (C) 2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -27,8 +27,6 @@

#include <stdint.h>

namespace JSC {

JS_EXPORT_PRIVATE NEVER_INLINE uint32_t computeJSCBytecodeCacheVersion();

}
// Generated during the build based on a hash of JSCBuiltins.o, CachedTypes.o, and any production
// build source version number.
extern const uint32_t JSCBytecodeCacheVersion;
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "JSSet.h"
#include "Lexer.h"
#include "LiteralParser.h"
#include "ObjectConstructorInlines.h"
#include "ObjectConstructor.h"
#include "ParseInt.h"
#include <stdio.h>
#include <wtf/ASCIICType.h>
Expand Down
1 change: 0 additions & 1 deletion Source/WTF/wtf/spi/darwin/dyldSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ WTF_EXTERN_C_BEGIN
uint32_t dyld_get_program_sdk_version();
bool dyld_program_sdk_at_least(dyld_build_version_t);
extern const char* dyld_shared_cache_file_path(void);
extern const struct mach_header* dyld_image_header_containing_address(const void* addr);
extern const struct mach_header* _dyld_get_dlopen_image_header(void* handle);
extern bool _dyld_get_image_uuid(const struct mach_header* mh, uuid_t);
extern bool _dyld_get_shared_cache_uuid(uuid_t);
Expand Down

0 comments on commit 6c3336b

Please sign in to comment.