Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SystemV ABI for C++ entrypoints for JS LLInt #28723

Merged
merged 1 commit into from
May 19, 2024

Conversation

iangrunert
Copy link
Contributor

@iangrunert iangrunert commented May 17, 2024

8f1711c

Use SystemV ABI for C++ entrypoints for JS LLInt
https://bugs.webkit.org/show_bug.cgi?id=274064

Reviewed by Yusuke Suzuki.

Switched register mapping on Windows to match the other x86-64 platforms
Added SystemV ABI function annotation to C++ entrypoints for JS LLInt
Disabed WebAssembly LLInt, as it doesn't work without JIT anyway, so we
can review the necessary changes there in another pull request.

* Source/JavaScriptCore/assembler/MaxFrameExtentForSlowPathCall.h:
* Source/JavaScriptCore/assembler/X86_64Registers.h:
* Source/JavaScriptCore/heap/MachineStackMarker.cpp:
(JSC::osRedZoneAdjustment):
* Source/JavaScriptCore/interpreter/VMEntryRecord.h:
* Source/JavaScriptCore/jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::selectScratchGPR):
* Source/JavaScriptCore/jit/GPRInfo.h:
(JSC::GPRInfo::toRegister):
(JSC::GPRInfo::toArgumentRegister):
(JSC::GPRInfo::toIndex):
(JSC::PreferredArgumentImpl::preferredArgumentJSR):
* Source/JavaScriptCore/jit/RegisterSet.cpp:
(JSC::RegisterSetBuilder::vmCalleeSaveRegisters):
(JSC::RegisterSetBuilder::llintBaselineCalleeSaveRegisters):
(JSC::RegisterSetBuilder::dfgCalleeSaveRegisters):
* Source/JavaScriptCore/llint/LLIntData.cpp:
* Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::llint_default_call):
(JSC::LLInt::llint_virtual_call):
(JSC::LLInt::llint_slow_path_checkpoint_osr_exit_from_inlined_call):
(JSC::LLInt::llint_slow_path_checkpoint_osr_exit):
(JSC::LLInt::llint_throw_stack_overflow_error):
(JSC::LLInt::llint_stack_check_at_vm_entry):
(JSC::LLInt::llint_check_vm_entry_permission):
(JSC::LLInt::llint_dump_value):
(JSC::LLInt::llint_crash):
* Source/JavaScriptCore/llint/LLIntSlowPaths.h:
* Source/JavaScriptCore/llint/LLIntThunks.h:
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/offlineasm/x86.rb:
* Source/JavaScriptCore/runtime/MachineContext.h:
(JSC::MachineContext::llintInstructionPointer):
* Source/JavaScriptCore/runtime/PutPropertySlot.h:
* Source/JavaScriptCore/runtime/VM.h:
* Source/WTF/wtf/CodePtr.h:
(WTF::CodePtr::CodePtr):
* Source/WTF/wtf/FunctionPtr.h:
* Source/WTF/wtf/PlatformCallingConventions.h:

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

3aee41b

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2 βœ… πŸ§ͺ wincairo-tests
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt ❌ πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-cairo
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ api-gtk
βœ… πŸ›  watch βœ… πŸ›  jsc-armv7
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-armv7-tests

@iangrunert iangrunert requested a review from a team as a code owner May 17, 2024 19:12
@iangrunert iangrunert added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label May 17, 2024
@iangrunert iangrunert self-assigned this May 17, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 17, 2024
Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with one comment.

@@ -1982,14 +1946,10 @@ else
# The PC base is in t3, as this is what _llint_entry leaves behind through
# initPCRelative(t3)
macro setEntryAddressCommon(kind, index, label, map)
if X86_64
if X86_64 or X86_64_WIN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about X86_64_WIN definition in LLInt completely and unify both to X86_64?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. If we're going to have the same ABI on Windows we shouldn't bother with a different setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I agree with that goal, but I think we're a couple of steps away from it.

There is unfortunately still one place in LowLevelInterpreter.asm (line 329) and one in LowLevelInterpreter64.asm (line 696) where we do something different on X86_64_WIN, I think both are due to UNIFIED_AND_FREEZABLE_CONFIG_RECORD. There might also be some in WebAssembly LLInt, so I'd like to get WebAssembly LLInt re-enabled with SystemV first to get the full scope of how X86_64_WIN is used.

If the differences are all tied to UNIFIED_AND_FREEZABLE_CONFIG_RECORD, we can switch those places to use that setting directly and get rid of X86_64_WIN. Also we potentially might be able to get rid of UNIFIED_AND_FREEZABLE_CONFIG_RECORD all together - I think it might be feasible now #28538 has landed, but I haven't given it a shot yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's go with this for now.

@Constellation Constellation added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels May 19, 2024
https://bugs.webkit.org/show_bug.cgi?id=274064

Reviewed by Yusuke Suzuki.

Switched register mapping on Windows to match the other x86-64 platforms
Added SystemV ABI function annotation to C++ entrypoints for JS LLInt
Disabed WebAssembly LLInt, as it doesn't work without JIT anyway, so we
can review the necessary changes there in another pull request.

* Source/JavaScriptCore/assembler/MaxFrameExtentForSlowPathCall.h:
* Source/JavaScriptCore/assembler/X86_64Registers.h:
* Source/JavaScriptCore/heap/MachineStackMarker.cpp:
(JSC::osRedZoneAdjustment):
* Source/JavaScriptCore/interpreter/VMEntryRecord.h:
* Source/JavaScriptCore/jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::selectScratchGPR):
* Source/JavaScriptCore/jit/GPRInfo.h:
(JSC::GPRInfo::toRegister):
(JSC::GPRInfo::toArgumentRegister):
(JSC::GPRInfo::toIndex):
(JSC::PreferredArgumentImpl::preferredArgumentJSR):
* Source/JavaScriptCore/jit/RegisterSet.cpp:
(JSC::RegisterSetBuilder::vmCalleeSaveRegisters):
(JSC::RegisterSetBuilder::llintBaselineCalleeSaveRegisters):
(JSC::RegisterSetBuilder::dfgCalleeSaveRegisters):
* Source/JavaScriptCore/llint/LLIntData.cpp:
* Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::llint_default_call):
(JSC::LLInt::llint_virtual_call):
(JSC::LLInt::llint_slow_path_checkpoint_osr_exit_from_inlined_call):
(JSC::LLInt::llint_slow_path_checkpoint_osr_exit):
(JSC::LLInt::llint_throw_stack_overflow_error):
(JSC::LLInt::llint_stack_check_at_vm_entry):
(JSC::LLInt::llint_check_vm_entry_permission):
(JSC::LLInt::llint_dump_value):
(JSC::LLInt::llint_crash):
* Source/JavaScriptCore/llint/LLIntSlowPaths.h:
* Source/JavaScriptCore/llint/LLIntThunks.h:
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/offlineasm/x86.rb:
* Source/JavaScriptCore/runtime/MachineContext.h:
(JSC::MachineContext::llintInstructionPointer):
* Source/JavaScriptCore/runtime/PutPropertySlot.h:
* Source/JavaScriptCore/runtime/VM.h:
* Source/WTF/wtf/CodePtr.h:
(WTF::CodePtr::CodePtr):
* Source/WTF/wtf/FunctionPtr.h:
* Source/WTF/wtf/PlatformCallingConventions.h:

Canonical link: https://commits.webkit.org/278967@main
@webkit-commit-queue
Copy link
Collaborator

Committed 278967@main (8f1711c): https://commits.webkit.org/278967@main

Reviewed commits have been landed. Closing PR #28723 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 8f1711c into WebKit:main May 19, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Projects
None yet
6 participants