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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
# san = ASan + RC audit over the same suite; anything but "1" is plain.
SCRIPTC_SAN: ${{ matrix.flavor == 'san' && '1' || '' }}
# Within-file partition for the large case-driven harnesses
# (differential, llvm-differential, npm, server, Test262, coverage, and
# (Effect, differential, llvm-differential, npm, server, Test262, coverage, and
# Vercel E2E): they hash stable case names into slice i of 10
# (tests/harness/shard.ts), so the ten shards' unions run every case
# exactly once. vitest's own --shard is FILE-granular and cannot split
Expand Down Expand Up @@ -88,6 +88,7 @@ jobs:
- name: Tests (file-sharded, case-sharded files excluded)
run: >-
pnpm test --shard=${{ matrix.shard }}/10
--exclude=tests/harness/effect.test.ts
--exclude=tests/harness/differential.test.ts
--exclude=tests/harness/llvm-differential.test.ts
--exclude=tests/harness/npm.test.ts
Expand Down Expand Up @@ -152,6 +153,7 @@ jobs:
SCRIPTC_LLVM_TEST_MODE: dev
run: >-
pnpm test
tests/harness/effect.test.ts
tests/harness/differential.test.ts
tests/harness/llvm-differential.test.ts
tests/harness/npm.test.ts
Expand Down
1 change: 1 addition & 0 deletions packages/compiler/src/backend/cycle-analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function computeTraced(mod: IrModule): { shapes: Set<string>; unions: Set
case "dyn":
case "classval":
case "promise":
case "caught":
return true;
case "object":
return tracedShapes.has(`object:${t.className}`);
Expand Down
23 changes: 20 additions & 3 deletions packages/compiler/src/backend/llvm/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
mangleClassTrace,
mangleCtorThunk,
mangleFunction,
mangleGlobal,
mangleVtInstance,
mangleVtStruct,
} from "../mangle.js";
Expand Down Expand Up @@ -537,18 +538,34 @@ export function emitClassObjDefs(
let localOwner = meta;
let localValue = "%class";
let localIndex = 0;
while (localOwner.def.localBaseCapture !== undefined && localOwner.base) {
while (localOwner.base) {
if (localOwner.def.localBaseCapture === undefined && localOwner.def.baseValueGlobal === undefined) {
localOwner = localOwner.base;
continue;
}
host.declare(`declare ptr @scr_box_get_ref(ptr)`);
const id = localIndex++;
const base = localOwner.base;
localBaseInits.push(
if (localOwner.def.baseValueGlobal !== undefined) {
host.declare(`declare ptr @scr_classobj_retain_v(ptr)`);
localBaseInits.push(
` %base.raw${id} = load ptr, ptr @${mangleGlobal(localOwner.def.baseValueGlobal)}`,
` %base.value${id} = call ptr @scr_classobj_retain_v(ptr %base.raw${id})`,
);
} else localBaseInits.push(
` %base.caps${id} = getelementptr inbounds %ScrClassObj, ptr ${localValue}, i64 1`,
` %base.cap${id} = getelementptr inbounds ptr, ptr %base.caps${id}, ${host.sizeType} ${localOwner.def.localBaseCapture}`,
` %base.box${id} = load ptr, ptr %base.cap${id}`,
` %base.value${id} = call ptr @scr_box_get_ref(ptr %base.box${id})`,
);
if (base.def.localCaptures !== undefined) localBaseInits.push(
` %base.slot${id} = getelementptr inbounds %${mangleClassStruct(base.def.name)}, ptr %o, i64 0, i32 ${classEnvironmentIndex(base)}`,
` store ptr %base.value${id}, ptr %base.slot${id}`,
);
else {
host.declare(`declare void @scr_classobj_release_v(ptr)`);
localBaseInits.push(` call void @scr_classobj_release_v(ptr %base.value${id})`);
}
localOwner = base;
localValue = `%base.value${id}`;
}
Expand All @@ -567,7 +584,7 @@ export function emitClassObjDefs(
` ret ptr %o`,
`}`,
`@${mangleClassObj(className)} = internal global %ScrClassObj ` +
`{ ${host.sizeType} -1, ${host.sizeType} ${intervalMeta.pre}, ${host.sizeType} ${intervalMeta.post}, ptr @${mangleCtorThunk(className)}, ptr ${nameSym}, ${host.sizeType} 0, ${host.sizeType} ${meta.def.jsLength ?? 0}, ptr null } ; class ${className}`,
`{ ${host.sizeType} -1, ${host.sizeType} ${intervalMeta.pre}, ${host.sizeType} ${intervalMeta.post}, ptr @${mangleCtorThunk(className)}, ptr ${nameSym}, ${host.sizeType} 0, ${host.sizeType} ${meta.def.jsLength ?? 0}, ptr null, ptr null } ; class ${className}`,
``,
);
}
Expand Down
Loading
Loading