[webkit-changes] [WebKit/WebKit] a9c99e: [JavaScriptCore] Build with InstallAPI

Elliott Williams noreply at github.com
Mon May 8 19:34:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a9c99ebb0bfd3a03a7f532d39f9a18f984c9a8b0
      https://github.com/WebKit/WebKit/commit/a9c99ebb0bfd3a03a7f532d39f9a18f984c9a8b0
  Author: Elliott Williams <emw at apple.com>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    A Source/JavaScriptCore/API/ExtraSymbolsForTAPI.h
    M Source/JavaScriptCore/Configurations/Base.xcconfig
    M Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/assembler/JITOperationList.h
    M Source/JavaScriptCore/b3/air/opcode_generator.rb
    M Source/JavaScriptCore/dfg/DFGArgumentPosition.h
    M Source/JavaScriptCore/dfg/DFGDoesGCCheck.h
    M Source/JavaScriptCore/dfg/DFGForAllKills.h
    M Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h
    M Source/JavaScriptCore/ftl/FTLLazySlowPathCall.h
    M Source/JavaScriptCore/runtime/JSArrayBufferPrototypeInlines.h
    M Source/JavaScriptCore/runtime/VM.h
    M Source/WTF/Configurations/WTF.xcconfig
    A Source/WTF/Scripts/generate-tapi-filelist.py
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/Compiler.h
    M Source/WTF/wtf/PlatformEnable.h
    M Source/WTF/wtf/PtrTag.h
    M Source/bmalloc/Configurations/bmalloc.xcconfig
    M Source/bmalloc/Configurations/libpas.xcconfig
    M Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
    M Source/bmalloc/libpas/src/libpas/pas_report_crash.h
    M Tools/Scripts/webkitpy/style/checkers/cpp.py

  Log Message:
  -----------
  [JavaScriptCore] Build with InstallAPI
https://bugs.webkit.org/show_bug.cgi?id=254784
rdar://108843961

Reviewed by Alexey Proskuryakov.

InstallAPI is a build phase in Xcode that uses tapi(1) to create API
stubs for framework targets by parsing their headers. These .tbd files
can then be linked against by clients of the framework, such that
clients are able to build and link before the framework itself has
finished building.

We already use InstallAPI in iOS WebKit/WebKitLegacy. Enable it in
JavaScriptCore.

Because JavaScriptCore exports the WTF and bmalloc static libraries,
TAPI needs to read headers from those projects in addition to its own. Add
a script to bmalloc and WTF which generates header file lists based on
all-product-headers.yaml, which is metadata created by XCBuild that
contains the public/private headers of a target. Changes to the headers
being installed will rerun both the file list generator and InstallAPI.

In production-style builds, all-products-headers.yaml is not available
during the installhdrs phase, so the script produces its file list by
scanning the headers directory being installed. This doesn't carry the
staleness risk of scanning directories in normal builds, because
install-style builds are always clean.

Also in production-style builds, the SDKROOT path, which is referenced
in generated filelists, may change when building different projects. We
handle this by writing "<SDKROOT>" in path names when the filelists are
generated, and then replacing that token with the actual SDKROOT right
before JavaScriptCore invokes tapi.

* Source/JavaScriptCore/API/ExtraSymbolsForTAPI.h: Added, lists a few
  symbols that really shouldn't be declared in any headers.
* Source/JavaScriptCore/Configurations/Base.xcconfig: JavaScriptCore
  includes private OS headers from inside System.framework, but was
  adding this path using OTHER_CPLUSPLUSFLAGS. Move it to
  SYSTEM_HEADER_SEARCH_PATHS so that TAPI gets the search path, too.
* Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig: Enable
  TAPI and add flags for dialect settings and extra filelists.
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Add
  reference to ExtraSymbolsForTAPI.h. Remove LLIntAssembly.h's target
  membership, because it is not generated in installapi style builds and
  is not needed by tapi.
* Source/WTF/Configurations/WTF.xcconfig: Enable
  INSTALLHDRS_SCRIPT_PHASE to invoke generate-tapi-filelist.py during
  installhdrs. Remove INSTALLHDRS_COPY_PHASE as headers were moved out
  of Copy Files phases last year.
* Source/WTF/Scripts/generate-tapi-filelist.py: Added.
* Source/WTF/WTF.xcodeproj/project.pbxproj: Add build phase to generate
  a TAPI filelist using the new script.
* Source/bmalloc/Configurations/bmalloc.xcconfig: Turn on
  INSTALLHDRS_SCRIPT_PHASE to invoke generate-tapi-filelist.py during
  installhdrs.
* Source/bmalloc/Configurations/libpas.xcconfig: Build with
  -DPAS_BMALLOC_HIDDEN, needed to fix symbol visibility when building
  with ThinLTO (rdar://86242029).
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj: Ditto pbxproj
  changes.
* Tools/Scripts/webkitpy/style/checkers/cpp.py: Allow bmalloc and WTF
  export macros in Source/JavaScriptCore/API/ExtraSymbolsForTAPI.h.

Fix up some generated headers' target membership to make tapi succeed.
These headers are still tracked in the project, but are either removed
from the target or no longer installed.

* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project/pbxproj:
  - Remove LLIntAssembly.h's target membership. It is not generated
    during the installapi phase and is not needed by tapi.
  - Remove target membership from AirOpcodeGenerated.h and
    AirOpcodeUtils.h. They are missing some includes when they are
    processed by tapi, and they do not contain any API or SPI.
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj: Change
  thingy_heap.h's visibility to Project, because one of the headers it
  includes, thingy_heap_prefix.h, is project-only. This never broke a
  build because none of bmalloc's clients actually use this header.

Fix a number of symbol visibility discrepencies to make tapi succeed.

* Source/JavaScriptCore/assembler/JITOperationList.h: Declare
  populatePointersInEmbedder inside an ENABLE(JIT_OPERATION_VALIDATION)
  block, matching its implementation.
* Source/JavaScriptCore/dfg/DFGDoesGCCheck.h: Declare verifyCanGC inside
  a ENABLE(DFG_DOES_GC_VALIDATION) block, matching its implementation.
* Source/JavaScriptCore/runtime/VM.h: Move ENABLE_DFG_DOES_GC_VALIDATION
  definition to PlatformEnable.h so that it can be used in
  DFGDoesGCCheck.h.
* Source/WTF/wtf/Compiler.h: Silence error macro about
  -DRELEASE_WITHOUT_OPTIMIZATIONS.
* Source/WTF/wtf/PlatformEnable.h: Add ENABLE_DFG_DOES_GC_VALIDATION
  from <JavaScriptCore/VM.h>, see above.
* Source/WTF/wtf/PtrTag.h: Declare tag debugging symbols inside an
  ENABLE(PTRTAG_DEBUGGING) block, matching their implementation.
* Source/bmalloc/libpas/src/libpas/pas_report_crash.h: Correct a manual
  visibility attribute to be PAS_API, so that the declaration follows
  PAS_BMALLOC_HIDDEN. Also, fix style errors on this line.

Additionally, add missing includes and visibility decrepencies for
non-JIT configurations of JavaScriptCore, namely the watchOS build.

* Source/JavaScriptCore/b3/air/opcode_generator.rb: Surround generated
  AirOpcode.h header with ENABLE(B3_JIT).
* Source/JavaScriptCore/bytecode/FullBytecodeLiveness.h: Add include
  needed by FuleBytecodeLiveness::virtualRegisterIsLive inline
  definition.
* Source/JavaScriptCore/dfg/DFGArgumentPosition.h: Surround with
  ENABLE(DFG_JIT).
* Source/JavaScriptCore/dfg/DFGForAllKills.h: Surround with
  ENABLE(DFG_JIT).
* Source/JavaScriptCore/dfg/DFGGraph.cpp: Surround with ENABLE(DFG_JIT).
* Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h: Surround with
  ENABLE(DFG_JIT).
* Source/JavaScriptCore/ftl/FTLLazySlowPathCall.h: Surround with
  ENABLE(FTL_JIT).
* Source/JavaScriptCore/runtime/JSArrayBufferPrototypeInlines.h: Add
  needed include for parsing JSArrayBuffer, which is only implicitly
  included when building with JIT.
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj: LineMetadata.h and
  HeapConstants.h declare API when libpas is disabled. Give the
  "private" membership so that tapi sees them.

Canonical link: https://commits.webkit.org/263845@main




More information about the webkit-changes mailing list