Closed Bug 1786494 Opened 3 years ago Closed 3 years ago

Rewrite MainThreadErrorContext with OffThreadErrorContext + a step to convert to runtime error

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(16 files, 5 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Things to do:

  • factor out the code around conversion fro OffThreadFrontendErrors to runtime error, from helper thread

https://searchfox.org/mozilla-central/rev/00e504083572d47f2199168f0f79c75c0ddaefb3/js/src/vm/HelperThreads.cpp#2334-2336

for (const UniquePtr<CompileError>& error : parseTask->ec_.errors()) {
  error->throwError(cx);
}
  • possibly temporarily add a workaround to support MainThreadErrorContext-specific thing in OffThreadErrorContext as optional path. such as onAllocationOverflow and WASI recursion limit
  • rewrite MainThreadErrorContext consumer to use OffThreadErrorContext and the conversion above
  • remove MainThreadErrorContext

after them we can cleanup the code path around error reporting and OffThreadErrorContext in bug 1785762, and rename things with Frontend*

Depends on: 1786512
Severity: -- → N/A
Priority: -- → P1

This requires all exceptions being set through ErrorContext in frontend,
including OOM during allocation.

Depends on: 1782573

Depends on D156093

remaining things to do:

  • rewrite query on JSContext error status
  • rewrite recover from error

Also:

  • split error and warnings, and add different accessor
Attachment #9292485 - Attachment is obsolete: true
Attachment #9292486 - Attachment is obsolete: true
Attachment #9292487 - Attachment is obsolete: true
Attachment #9292483 - Attachment is obsolete: true
Attachment #9292484 - Attachment is obsolete: true
Attachment #9292482 - Attachment description: WIP: Bug 1786494 - Part 1: Move the OffThreadFrontendErrors-to-runtime-error conversion to OffThreadErrorContext. → Bug 1786494 - Part 1: Move the OffThreadFrontendErrors-to-runtime-error conversion to OffThreadErrorContext. r=bthrall

The frontend error is converted into the runtime error in
AutoReportFrontendContext destructor, and it can GC.

If the function's return value is GC thing, AutoReportFrontendContext
destructor must be called before the return statement, and thus
AutoReportFrontendContext must be put into a block, and the return value
must be stored into JS::Rooted outside of the block.

Depends on D157450

Attachment #9294857 - Attachment description: Bug 1786494 - Part 5: Add OffThreadFrontendErrors::warnings. r=bthrall → Bug 1786494 - Part 5: Add OffThreadFrontendErrors::warnings and Warning parameter to convertToRuntimeError. r=bthrall!
Attachment #9294855 - Attachment description: Bug 1786494 - Part 3: Cleanup ErrorContext::hadErrors. r=bthrall → Bug 1786494 - Part 3: Cleanup ErrorContext::hadErrors. r=bthrall!
Attachment #9294856 - Attachment description: Bug 1786494 - Part 4: Add OffThreadErrorContext::maybeCx_. r=bthrall → Bug 1786494 - Part 4: Add OffThreadErrorContext::maybeCx_. r=bthrall!
Attachment #9294858 - Attachment description: Bug 1786494 - Part 6: Always use ErrorContext::hadErrors in AutoAssertReportedException. r=bthrall → Bug 1786494 - Part 6: Always use ErrorContext::hadErrors in AutoAssertReportedException. r=bthrall!
Attachment #9294859 - Attachment description: Bug 1786494 - Part 7: Use ErrorContext in XDR error check. r=bthrall → Bug 1786494 - Part 7: Use ErrorContext in XDR error check. r=bthrall!
Attachment #9294860 - Attachment description: Bug 1786494 - Part 8: Use ErrorContext for checking errors in asm.js. r=bthrall → Bug 1786494 - Part 8: Use ErrorContext for checking errors in asm.js. r=bthrall!
Attachment #9294861 - Attachment description: Bug 1786494 - Part 9: Use ErrorContext for checking errors in BytecodeCompiler. r=bthrall → Bug 1786494 - Part 9: Use ErrorContext for checking errors in BytecodeCompiler. r=bthrall!
Attachment #9294862 - Attachment description: Bug 1786494 - Part 10: Use ErrorContext::recoverFromOutOfMemory in EmitterScope. r=bthrall → Bug 1786494 - Part 10: Use ErrorContext::recoverFromOutOfMemory in EmitterScope. r=bthrall!
Attachment #9294863 - Attachment description: Bug 1786494 - Part 11: Add AutoReportFrontendContext and use it in CompilationAndEvaluation.cpp. r=bthrall → Bug 1786494 - Part 11: Add AutoReportFrontendContext and use it in CompilationAndEvaluation.cpp. r=bthrall!
Attachment #9294864 - Attachment description: Bug 1786494 - Part 12: Use AutoReportFrontendContext in simple cases. r=bthrall → Bug 1786494 - Part 12: Use AutoReportFrontendContext in simple cases. r=bthrall!
Attachment #9294865 - Attachment description: Bug 1786494 - Part 13: Use AutoReportFrontendContext with block for functions that returns GC things. r=bthrall → Bug 1786494 - Part 13: Use AutoReportFrontendContext with block for functions that returns GC things. r=bthrall!
Attachment #9294866 - Attachment description: Bug 1786494 - Part 14: Add AutoReportFrontendContext::{clearAutoReport,convertToRuntimeErrorAndClear} and use it in complex cases. r=bthrall → Bug 1786494 - Part 15: Add AutoReportFrontendContext::{clearAutoReport,convertToRuntimeErrorAndClear} and use it in complex cases. r=bthrall!
Attachment #9294867 - Attachment description: Bug 1786494 - Part 15: Remove MainThreadErrorContext. r=bthrall → Bug 1786494 - Part 16: Remove MainThreadErrorContext. r=bthrall!
Attachment #9292482 - Attachment description: Bug 1786494 - Part 1: Move the OffThreadFrontendErrors-to-runtime-error conversion to OffThreadErrorContext. r=bthrall → Bug 1786494 - Part 1: Move the OffThreadFrontendErrors-to-runtime-error conversion to OffThreadErrorContext. r=bthrall!
Attachment #9294854 - Attachment description: Bug 1786494 - Part 2: Support allocation overflow in OffThreadErrorContext. r=bthrall → Bug 1786494 - Part 2: Support allocation overflow in OffThreadErrorContext. r=bthrall!
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/3b43722447cb Part 1: Move the OffThreadFrontendErrors-to-runtime-error conversion to OffThreadErrorContext. r=bthrall https://hg.mozilla.org/integration/autoland/rev/320050bb2c1d Part 2: Support allocation overflow in OffThreadErrorContext. r=bthrall https://hg.mozilla.org/integration/autoland/rev/387a484747dd Part 3: Cleanup ErrorContext::hadErrors. r=bthrall https://hg.mozilla.org/integration/autoland/rev/b29e3a509e61 Part 4: Add OffThreadErrorContext::maybeCx_. r=bthrall https://hg.mozilla.org/integration/autoland/rev/a9c6b783ae5f Part 5: Add OffThreadFrontendErrors::warnings and Warning parameter to convertToRuntimeError. r=bthrall https://hg.mozilla.org/integration/autoland/rev/1d7e29232e58 Part 6: Always use ErrorContext::hadErrors in AutoAssertReportedException. r=bthrall https://hg.mozilla.org/integration/autoland/rev/deb867238cb2 Part 7: Use ErrorContext in XDR error check. r=bthrall https://hg.mozilla.org/integration/autoland/rev/c0fbf5e9476b Part 8: Use ErrorContext for checking errors in asm.js. r=bthrall https://hg.mozilla.org/integration/autoland/rev/dd22e38e5474 Part 9: Use ErrorContext for checking errors in BytecodeCompiler. r=bthrall https://hg.mozilla.org/integration/autoland/rev/d8a24b7bd7d8 Part 10: Use ErrorContext::recoverFromOutOfMemory in EmitterScope. r=bthrall https://hg.mozilla.org/integration/autoland/rev/ca77d788facb Part 11: Add AutoReportFrontendContext and use it in CompilationAndEvaluation.cpp. r=bthrall https://hg.mozilla.org/integration/autoland/rev/86a890c4b6fa Part 12: Use AutoReportFrontendContext in simple cases. r=bthrall https://hg.mozilla.org/integration/autoland/rev/5210028e7137 Part 13: Use AutoReportFrontendContext with block for functions that returns GC things. r=bthrall https://hg.mozilla.org/integration/autoland/rev/328ec7d3e3ba Part 14: Add AutoPrintSelfHostingFrontendContext. r=bthrall https://hg.mozilla.org/integration/autoland/rev/f31a45362842 Part 15: Add AutoReportFrontendContext::{clearAutoReport,convertToRuntimeErrorAndClear} and use it in complex cases. r=bthrall https://hg.mozilla.org/integration/autoland/rev/0ac06d10a688 Part 16: Remove MainThreadErrorContext. r=bthrall
Regressions: 1792960
Regressions: 1904747
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: