Closed Bug 1725379 Opened 3 years ago Closed 3 years ago

Remove unnecessary includes in js/src/jit

Categories

(Core :: JavaScript Engine: JIT, task)

task

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(8 files)

  • Remove unnecessary includes in js/src/jit
  • Remove "vm/{JS,Native}Object.h" in MacroAssembler.h
  • Remove the transitive include of "MacroAssembler.h" into the vm/ and frontend/

Fix unused functions and "code after return" warnings when building in non-unified
mode.

Bug 1669181 focused on removing unnecessary includes in header files. As a
follow-up, this bug also removes unnecessary includes in non-header files.

The unnecessary includes were determined through IWYU as follows:

  1. Touch a cpp file.
  2. Recompile through IWYU. Step 1 ensures only the unnecessary includes for
    this cpp file (and its header file) are reported.
  3. Remove the unnecessary includes and recompile normally. Fix up any missing
    includes.
  4. Go back to step 1 to modify the next cpp file.

Depends on D122461

The include of "vm/NativeObject.h" is only needed for static assertions. When
we move these assertions into a separate cpp file, we can avoid the #include.

And then fix up any missing includes after the removal of the "vm/NativeObject.h"
include in "Assembler-shared.h".

Depends on D122462

"MacroAssembler.h" includes "WasmFrame.h", which in turn includes
"WasmValue.h" and "WasmValue.h" includes "NativeObject.h". If we move
wasm::DebugFrame from "WasmFrame.h" into a separate header file, we can
avoid the transitive include of "NativeObject.h" in "MacroAssembler.h".

Depends on D122463

Move both includes into "MacroAssembler-inl.h" to reduce the number of direct
includes to "vm" headers from "MacroAssembler.h".

Depends on D122464

Move the definition into the cpp-file to match "MacroAssembler-arm.cpp".

Depends on D122465

"wasm/WasmFrameIter.h" includes "wasm/WasmCode.h", which in turn includes "wasm/WasmGC.h" and
"wasm/WasmGC.h" includes "jit/MacroAssembler.h". And because "wasm/WasmFrameIter.h" is included
by "vm/JitActivation.h", which in turn is included by "vm/Activation-inl.h", which in turn is
included by "vm/JSContext-inl.h", "jit/MacroAssembler.h" ends up being included in many cpp files
throughout SpiderMonkey. Thankfully "wasm/WasmFrameIter.h" doesn't actually need some includes,
so we can easily avoid the transitive includes.

Drive-by fix:

  • Also remove some unnecessary includes in "wasm/WasmCode.h".

And after removing the unnecessary includes in the header files, fix up any missing includes
which prevents successful recompilation.

Depends on D122466

This way we can avoid including all of "MacroAssembler.h" in "WasmGC.h".

Depends on D122467

Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/d637593c7871 Part 1: Fix non-unified builds for codegen=none. r=jandem https://hg.mozilla.org/integration/autoland/rev/5926f8d136f0 Part 2: Remove unnecessary includes in js/src/jit. r=jandem,nbp https://hg.mozilla.org/integration/autoland/rev/8af00325c0c2 Part 3: Remove NativeObject include from Assembler. r=jandem https://hg.mozilla.org/integration/autoland/rev/32005d328e91 Part 4: Split WasmDebugFrame from WasmFrame. r=jandem https://hg.mozilla.org/integration/autoland/rev/b32b20a1d3c5 Part 5: Remove JSObject.h and StringType.h includes from MacroAssembler. r=jandem https://hg.mozilla.org/integration/autoland/rev/4eba746b6dc5 Part 6: Remove BigIntType.h includes from MacroAssembler. r=jandem https://hg.mozilla.org/integration/autoland/rev/a1f612022e4c Part 7: Remove transitive MacroAssembler includes into the vm through wasm. r=jandem https://hg.mozilla.org/integration/autoland/rev/4792c28298b3 Part 8: Introduce jit/ABIArgGenerator.h. r=jandem
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: