diff --git a/.github/workflows/openclaw-checks.yml b/.github/workflows/openclaw-checks.yml index d651cb1493da7..d0b352b32988b 100644 --- a/.github/workflows/openclaw-checks.yml +++ b/.github/workflows/openclaw-checks.yml @@ -16,7 +16,8 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: - fetch-depth: 16 + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 persist-credentials: false sparse-checkout-cone-mode: false sparse-checkout: | @@ -118,3 +119,27 @@ jobs: ${{ runner.temp }}/stack-results/*.log if-no-files-found: error retention-days: 7 + macos-fork-artifact: + if: github.repository == 'openclaw/WebKit' + runs-on: blacksmith-32vcpu-ubuntu-2404 + timeout-minutes: 150 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !/LayoutTests/ + !/JSTests/* + !/PerformanceTests/ + !/Websites/ + !/ManualTests/ + !/WebDriverTests/ + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 + with: + node-version: '26.3.0' + - name: Build the macOS fork artifact on Linux without publishing + run: python3 .github/openclaw/artifacts.py build --lane bun-webkit-macos-arm64 --output "$RUNNER_TEMP/macos-fork-artifact" diff --git a/JSTests/stress/stack-position-regressions-cache.js b/JSTests/stress/stack-position-regressions-cache.js new file mode 100644 index 0000000000000..d9b9fd0375156 --- /dev/null +++ b/JSTests/stress/stack-position-regressions-cache.js @@ -0,0 +1,20 @@ +// Exercise cached offsets from independent providers, including equal offsets +// with different line tables, UTF-16 columns, and compressed-table boundaries. +const sources = []; +for (const terminator of ["\n", "\r\n", "\u2028", "\u2029"]) { + for (const lines of [0, 1, 63, 64, 65, 127]) { + const prefix = "/* 🦞 */ "; + const body = prefix + "(function positionCacheProbe() { return new Error('cache'); })"; + const source = terminator.repeat(lines) + body; + sources.push({ create: eval(source), line: lines + 1, column: body.indexOf("new Error") + 1 }); + } +} +for (let repeat = 0; repeat < Math.min(testLoopCount, 30); ++repeat) { + for (const { create, line, column } of sources) { + const error = create(); + // Anonymous eval frames omit their URL from stack strings, but expose + // the same computed coordinates through JSC's error properties. + if (error.line !== line || error.column !== column) + throw new Error(`Expected ${line}:${column}, got ${error.line}:${error.column}`); + } +} diff --git a/OPENCLAW.md b/OPENCLAW.md index eabfbe42bab60..720377913d125 100644 --- a/OPENCLAW.md +++ b/OPENCLAW.md @@ -54,8 +54,11 @@ Batch 1 is published from `openclaw/batch-1` so concurrently reviewed batch-2 engine changes can land on `openclaw/main` without entering this release. Both branches require the same protected environment and full-SHA/green-job checks. -Pull requests run **OpenClaw engine checks**, a read-only Linux build using the same -lane recipe and Bun qualification gate. It also runs the ArrayBuffer accounting +Pull requests run **OpenClaw engine checks** at the exact PR head, with a native +Linux build using the same lane recipe and Bun qualification gate, plus the +macOS arm64 fork artifact cross-built on a separate Linux runner. Both jobs are +read-only; the macOS lane proves compilation, not native macOS execution. +The native job also runs the ArrayBuffer accounting and confirmed parked-waiter inspection regression with LLInt, DFG, FTL and concurrent GC. This workflow provides the pre-merge check; it cannot publish. @@ -142,6 +145,8 @@ baseline. Engine and Bun headers and libraries must be rebuilt together. ## Unreleased +- Cache source-relative stack line and column lookups on demand, including syntax-selected positions. +- Build both fork engine artifacts at the exact pull-request head before landing, with native Linux qualification and a Linux-hosted macOS arm64 compilation check. - Keep syntax-selected stack positions separate from exception ranges for calls, constructors, property reads, and async continuations. Preserve the positions across bytecode rewriting, optimization, and cache replay. - Add real byte-based JSC heap allocation sampling with weighted allocating-stack profiles and independent major/minor collection inclusion. @@ -156,3 +161,9 @@ baseline. Engine and Bun headers and libraries must be rebuilt together. `CodeBlock::callSitePositionForBytecodeIndex` returns an optional absolute source offset for an exact instruction or async resume label. Stack readers use this position while exception expression ranges and debugger line tables retain their existing divots. RareData owns the two sparse vectors, including decoded cache entries; the bytecode cache revision prevents older layouts from being reused. Bun must be rebuilt with its matching stack-reader adapter. It must also preserve built-in error constructor syntax: rewriting `new Error()` as `Error()` changes the position and allows a returning arrow to become a proper tail call. The engine's proper-tail-call behavior is unchanged. The integration continues @robobun’s upstream Bun source-position work in [#35179](https://github.com/oven-sh/bun/pull/35179), [#37396](https://github.com/oven-sh/bun/pull/37396), and [#41580](https://github.com/oven-sh/bun/pull/41580). + +The source provider caches only requested line/column conversions under its existing +line-table lock. Coordinates remain relative to the provider's text; document +offsets and builtin provider overrides retain their existing behavior. The cache +fills only when a reader requests a position, and the persistent bytecode-cache +format is unchanged. diff --git a/Source/JavaScriptCore/parser/SourceProvider.cpp b/Source/JavaScriptCore/parser/SourceProvider.cpp index bc5c9c6aa51d3..ddd3e0e3871c8 100644 --- a/Source/JavaScriptCore/parser/SourceProvider.cpp +++ b/Source/JavaScriptCore/parser/SourceProvider.cpp @@ -320,8 +320,12 @@ static unsigned lineEndFor(StringView text, const EncodedLineStarts& lineStarts, LineColumn LineStartTable::lineColumnForOffset(StringView text, unsigned offset) { Locker locker { m_lock }; - auto line = EncodedLineStarts { ensureBuilt(text).bytes }.lineContaining(offset); - return { line.line0Based, offset - line.start }; + // Syntax-selected stack positions bypass the per-instruction expression cache. + // Cache provider-relative coordinates so document offsets remain applied by the caller. + return m_cachedLineColumns.ensure(offset, [&] { + auto line = EncodedLineStarts { ensureBuilt(text).bytes }.lineContaining(offset); + return LineColumn { line.line0Based, offset - line.start }; + }).iterator->value; } LineStartTable::PositionInfo LineStartTable::positionInfoForOffset(StringView text, unsigned offset) @@ -365,4 +369,3 @@ LineColumn BuiltinsSourceProvider::lineColumnInTextForOffset(unsigned offset) } } // namespace JSC - diff --git a/Source/JavaScriptCore/parser/SourceProvider.h b/Source/JavaScriptCore/parser/SourceProvider.h index 423b7514e2f09..264633da658b3 100644 --- a/Source/JavaScriptCore/parser/SourceProvider.h +++ b/Source/JavaScriptCore/parser/SourceProvider.h @@ -40,6 +40,7 @@ WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN #include #include #include +#include #include #include #include @@ -125,6 +126,8 @@ class LineStartTable { mutable Lock m_lock; LineStarts m_lineStarts WTF_GUARDED_BY_LOCK(m_lock); + using LineColumnMap = UncheckedKeyHashMap, WTF::UnsignedWithZeroKeyHashTraits>; + LineColumnMap m_cachedLineColumns WTF_GUARDED_BY_LOCK(m_lock); }; class JS_EXPORT_PRIVATE SourceProvider : public ThreadSafeRefCounted { @@ -505,4 +508,4 @@ class SourceProviderBufferGuard { SourceProvider* m_sourceProvider { nullptr }; }; -} // namespace JSC \ No newline at end of file +} // namespace JSC