Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/openclaw-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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"
20 changes: 20 additions & 0 deletions JSTests/stress/stack-position-regressions-cache.js
Original file line number Diff line number Diff line change
@@ -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}`);
}
}
15 changes: 13 additions & 2 deletions OPENCLAW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand All @@ -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.
9 changes: 6 additions & 3 deletions Source/JavaScriptCore/parser/SourceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -365,4 +369,3 @@ LineColumn BuiltinsSourceProvider::lineColumnInTextForOffset(unsigned offset)
}

} // namespace JSC

5 changes: 4 additions & 1 deletion Source/JavaScriptCore/parser/SourceProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
#include <JavaScriptCore/SourceOrigin.h>
#include <JavaScriptCore/SourceTaintedOrigin.h>
#include <span>
#include <wtf/HashMap.h>
#include <wtf/Lock.h>
#include <wtf/Noncopyable.h>
#include <wtf/RefCountedFixedVector.h>
Expand Down Expand Up @@ -125,6 +126,8 @@ class LineStartTable {

mutable Lock m_lock;
LineStarts m_lineStarts WTF_GUARDED_BY_LOCK(m_lock);
using LineColumnMap = UncheckedKeyHashMap<uint64_t, LineColumn, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>;
LineColumnMap m_cachedLineColumns WTF_GUARDED_BY_LOCK(m_lock);
};

class JS_EXPORT_PRIVATE SourceProvider : public ThreadSafeRefCounted<SourceProvider> {
Expand Down Expand Up @@ -505,4 +508,4 @@ class SourceProviderBufferGuard {
SourceProvider* m_sourceProvider { nullptr };
};

} // namespace JSC
} // namespace JSC