@oseo/compiler 0.0.0-stage → 0.1.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +172 -2
  3. package/dist/agent-programs.d.ts +28 -0
  4. package/dist/agent-programs.d.ts.map +1 -0
  5. package/dist/agent-programs.js +134 -0
  6. package/dist/agent-programs.js.map +1 -0
  7. package/dist/agent-templates.d.ts +33 -0
  8. package/dist/agent-templates.d.ts.map +1 -0
  9. package/dist/agent-templates.js +45 -0
  10. package/dist/agent-templates.js.map +1 -0
  11. package/dist/compile.d.ts +20 -0
  12. package/dist/compile.d.ts.map +1 -0
  13. package/dist/compile.js +75 -0
  14. package/dist/compile.js.map +1 -0
  15. package/dist/fragments.d.ts +72 -0
  16. package/dist/fragments.d.ts.map +1 -0
  17. package/dist/fragments.js +158 -0
  18. package/dist/fragments.js.map +1 -0
  19. package/dist/hir-build.d.ts +80 -0
  20. package/dist/hir-build.d.ts.map +1 -0
  21. package/dist/hir-build.js +3077 -0
  22. package/dist/hir-build.js.map +1 -0
  23. package/dist/hir-print.d.ts +10 -0
  24. package/dist/hir-print.d.ts.map +1 -0
  25. package/dist/hir-print.js +271 -0
  26. package/dist/hir-print.js.map +1 -0
  27. package/dist/hir.d.ts +1246 -0
  28. package/dist/hir.d.ts.map +1 -0
  29. package/dist/hir.js +147 -0
  30. package/dist/hir.js.map +1 -0
  31. package/dist/host-scripts.d.ts +14 -0
  32. package/dist/host-scripts.d.ts.map +1 -0
  33. package/dist/host-scripts.js +204 -0
  34. package/dist/host-scripts.js.map +1 -0
  35. package/dist/index.d.ts +26 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +27 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/mir-build.d.ts +8 -0
  40. package/dist/mir-build.d.ts.map +1 -0
  41. package/dist/mir-build.js +5113 -0
  42. package/dist/mir-build.js.map +1 -0
  43. package/dist/mir-print.d.ts +7 -0
  44. package/dist/mir-print.d.ts.map +1 -0
  45. package/dist/mir-print.js +65 -0
  46. package/dist/mir-print.js.map +1 -0
  47. package/dist/mir-specialize.d.ts +7 -0
  48. package/dist/mir-specialize.d.ts.map +1 -0
  49. package/dist/mir-specialize.js +182 -0
  50. package/dist/mir-specialize.js.map +1 -0
  51. package/dist/mir.d.ts +571 -0
  52. package/dist/mir.d.ts.map +1 -0
  53. package/dist/mir.js +1 -0
  54. package/dist/module-builtin.d.ts +20 -0
  55. package/dist/module-builtin.d.ts.map +1 -0
  56. package/dist/module-builtin.js +57 -0
  57. package/dist/module-builtin.js.map +1 -0
  58. package/dist/module-compile.d.ts +64 -0
  59. package/dist/module-compile.d.ts.map +1 -0
  60. package/dist/module-compile.js +690 -0
  61. package/dist/module-compile.js.map +1 -0
  62. package/dist/module-json.d.ts +7 -0
  63. package/dist/module-json.d.ts.map +1 -0
  64. package/dist/module-json.js +88 -0
  65. package/dist/module-json.js.map +1 -0
  66. package/dist/modules.d.ts +87 -0
  67. package/dist/modules.d.ts.map +1 -0
  68. package/dist/modules.js +734 -0
  69. package/dist/modules.js.map +1 -0
  70. package/dist/native-fragments.d.ts +36 -0
  71. package/dist/native-fragments.d.ts.map +1 -0
  72. package/dist/native-fragments.js +110 -0
  73. package/dist/native-fragments.js.map +1 -0
  74. package/dist/native.d.ts +282 -0
  75. package/dist/native.d.ts.map +1 -0
  76. package/dist/native.js +47 -0
  77. package/dist/native.js.map +1 -0
  78. package/dist/regexp-execute.d.ts +74 -0
  79. package/dist/regexp-execute.d.ts.map +1 -0
  80. package/dist/regexp-execute.js +480 -0
  81. package/dist/regexp-execute.js.map +1 -0
  82. package/dist/regexp-matcher.d.ts +279 -0
  83. package/dist/regexp-matcher.d.ts.map +1 -0
  84. package/dist/regexp-matcher.js +1098 -0
  85. package/dist/regexp-matcher.js.map +1 -0
  86. package/dist/regexp-parse.d.ts +22 -0
  87. package/dist/regexp-parse.d.ts.map +1 -0
  88. package/dist/regexp-parse.js +1440 -0
  89. package/dist/regexp-parse.js.map +1 -0
  90. package/dist/regexp-print.d.ts +24 -0
  91. package/dist/regexp-print.d.ts.map +1 -0
  92. package/dist/regexp-print.js +147 -0
  93. package/dist/regexp-print.js.map +1 -0
  94. package/dist/regexp.d.ts +324 -0
  95. package/dist/regexp.d.ts.map +1 -0
  96. package/dist/regexp.js +22 -0
  97. package/dist/regexp.js.map +1 -0
  98. package/dist/source.d.ts +38 -0
  99. package/dist/source.d.ts.map +1 -0
  100. package/dist/source.js +10 -0
  101. package/dist/source.js.map +1 -0
  102. package/dist/syntax.d.ts +1232 -0
  103. package/dist/syntax.d.ts.map +1 -0
  104. package/dist/syntax.js +1 -0
  105. package/package.json +32 -3
@@ -0,0 +1,7 @@
1
+ import { MirProgram } from "./mir.js";
2
+ //#region src/mir-print.d.ts
3
+ /** Print deterministic MIR without host paths or object identities. */
4
+ declare function printMir(program: MirProgram): string;
5
+ //#endregion
6
+ export { printMir };
7
+ //# sourceMappingURL=mir-print.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mir-print.d.ts","names":[],"sources":["../src/mir-print.ts"],"mappings":";;;iBAmJgB,SAAS,SAAS"}
@@ -0,0 +1,65 @@
1
+ import { rangeText } from "./hir-print.js";
2
+
3
+ //#region src/mir-print.ts
4
+ function printTerminator(terminator) {
5
+ if (terminator.kind === "return") return `return %${terminator.value}`;
6
+ if (terminator.kind === "jump") {
7
+ const values = terminator.values?.map((value) => ` %${value}`).join("");
8
+ return `jump bb${terminator.target}${values ?? ""}`;
9
+ }
10
+ if (terminator.kind === "branch") return `branch %${terminator.test} bb${terminator.whenTrue} bb${terminator.whenFalse}`;
11
+ if (terminator.kind === "generator-yield") {
12
+ const resumptions = [terminator.returnResume == null ? void 0 : `return bb${terminator.returnResume}`, terminator.throwResume == null ? void 0 : `throw bb${terminator.throwResume}`].filter((resumption) => resumption != null);
13
+ return `generator-${terminator.awaited === true ? "await" : "yield"} %${terminator.value} resume bb${terminator.resume} sent %${terminator.sent}` + (resumptions.length === 0 ? "" : ` ${resumptions.join(" ")}`);
14
+ }
15
+ if (terminator.kind === "resume-completion") {
16
+ const completion = `resume-completion bb${terminator.completionSlot}`;
17
+ const destinations = [terminator.outerAbrupt == null ? void 0 : `throw bb${terminator.outerAbrupt.blockId}`, terminator.outerFinalizer == null ? void 0 : `finally bb${terminator.outerFinalizer.blockId}`].filter((destination) => destination != null);
18
+ return destinations.length === 0 ? completion : `${completion} via ${destinations.join(", ")}`;
19
+ }
20
+ return "unreachable";
21
+ }
22
+ function appendMirFunction(lines, functionValue) {
23
+ const restParameters = functionValue.parameters.map((parameter, index) => parameter.rest === true ? `...${index}:${parameter.name}` : void 0).filter((parameter) => parameter != null);
24
+ const restText = restParameters.length === 0 ? "" : ` rest=[${restParameters.join()}]`;
25
+ const asynchronous = functionValue.asyncGenerator === true || functionValue.asyncFunction === true;
26
+ const generator = functionValue.generator === true && functionValue.asyncFunction !== true;
27
+ lines.push(`${asynchronous ? "async " : ""}function${generator ? "*" : ""} @f${functionValue.id} ${functionValue.name} roots=${functionValue.rootSlotCount}` + (functionValue.generatorBodyStart == null ? "" : ` body=bb${functionValue.generatorBodyStart}`) + restText + ` @${rangeText(functionValue.range)}`);
28
+ if (functionValue.specialization != null) {
29
+ const specialization = functionValue.specialization;
30
+ const hints = specialization.hints.map((hint) => `${hint.provenance}:${hint.name}`).join(", ");
31
+ lines.push(` specialize ${specialization.kind} hints=[${hints}] generic-fallback bb${specialization.genericBlock} join bb${specialization.joinBlock}`);
32
+ }
33
+ for (const block of functionValue.blocks) {
34
+ const parameters = block.parameters?.map((value) => `%${value}`).join(", ");
35
+ lines.push(` bb${block.id}${parameters == null ? "" : `(${parameters})`}:`);
36
+ for (const operation of block.operations) {
37
+ const argumentText = operation.arguments.map((argument) => `%${argument}`).join(", ");
38
+ const resultText = operation.checkedResult != null ? `%${operation.id}, %${operation.checkedResult}` : operation.iteratorNextMethodResult != null ? `%${operation.id}, %${operation.iteratorNextMethodResult}` : operation.iteratorValueResult != null ? `%${operation.id}, %${operation.iteratorValueResult}` : operation.enumerateRecordResult != null ? `%${operation.id}, %${operation.enumerateRecordResult}` : operation.enumerateKeyResult != null ? `%${operation.id}, %${operation.enumerateKeyResult}` : `%${operation.id}`;
39
+ const hintTextValue = operation.hint == null ? "" : ` hint=${operation.hint.provenance}:${operation.hint.name}`;
40
+ const cacheText = operation.cacheId == null ? "" : ` cache=%${operation.cacheId}`;
41
+ const argumentListText = operation.argumentListId == null ? "" : ` argument-list=%${operation.argumentListId}`;
42
+ const iteratorStateText = operation.iteratorDoneState == null ? "" : ` done-state=%${operation.iteratorDoneState}`;
43
+ const iteratorModeText = operation.iteratorValueOnlyResult == null ? "" : ` value-only=%${operation.iteratorValueOnlyResult}`;
44
+ const iteratorCloseModeText = operation.iteratorCloseResultMode == null ? "" : ` close-mode=%${operation.iteratorCloseResultMode}`;
45
+ const tailText = operation.tail === true ? operation.tailThisBindingId == null ? "tail " : `tail this=%b${operation.tailThisBindingId} ` : "";
46
+ lines.push(` ${resultText} = ${operation.kind} ${tailText}${operation.detail}${argumentText === "" ? "" : ` ${argumentText}`} @${rangeText(operation.range)}${hintTextValue}${cacheText}` + argumentListText + iteratorStateText + iteratorModeText + iteratorCloseModeText);
47
+ }
48
+ lines.push(` ${printTerminator(block.terminator)}`);
49
+ }
50
+ }
51
+ /** Print deterministic MIR without host paths or object identities. */
52
+ function printMir(program) {
53
+ const lines = [`mir ${JSON.stringify(program.sourceId)} specialization ${program.specialization}`];
54
+ if (program.unhandledRejectionPolicy != null) lines.push(`unhandled-rejections ${program.unhandledRejectionPolicy}`);
55
+ for (const binding of program.globalBindings) lines.push(`global %b${binding.id} ${binding.name}`);
56
+ for (const entry of program.globalLexicalNames ?? []) lines.push(`global-lexical ${entry.name} @${rangeText(entry.range)}`);
57
+ for (const binding of program.globalObjectBindings) lines.push(`global-object %b${binding.id} ${binding.name} @${rangeText(binding.range)}`);
58
+ for (const functionValue of program.functions) appendMirFunction(lines, functionValue);
59
+ appendMirFunction(lines, program.script);
60
+ return `${lines.join("\n")}\n`;
61
+ }
62
+
63
+ //#endregion
64
+ export { printMir };
65
+ //# sourceMappingURL=mir-print.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mir-print.js","names":[],"sources":["../src/mir-print.ts"],"sourcesContent":["import { rangeText } from \"./hir-print.ts\";\nimport type { MirFunction, MirProgram, MirTerminator } from \"./mir.ts\";\nfunction printTerminator(terminator: MirTerminator): string {\n if (terminator.kind === \"return\") return `return %${terminator.value}`;\n if (terminator.kind === \"jump\") {\n const values = terminator.values?.map((value) => ` %${value}`).join(\"\");\n return `jump bb${terminator.target}${values ?? \"\"}`;\n }\n if (terminator.kind === \"branch\") {\n return (\n `branch %${terminator.test} bb${terminator.whenTrue} ` +\n `bb${terminator.whenFalse}`\n );\n }\n if (terminator.kind === \"generator-yield\") {\n const resumptions = [\n terminator.returnResume == null\n ? undefined\n : `return bb${terminator.returnResume}`,\n terminator.throwResume == null\n ? undefined\n : `throw bb${terminator.throwResume}`,\n ].filter((resumption) => resumption != null);\n return (\n `generator-${terminator.awaited === true ? \"await\" : \"yield\"} ` +\n `%${terminator.value} ` +\n `resume bb${terminator.resume} sent %${terminator.sent}` +\n (resumptions.length === 0 ? \"\" : ` ${resumptions.join(\" \")}`)\n );\n }\n if (terminator.kind === \"resume-completion\") {\n const completion = `resume-completion bb${terminator.completionSlot}`;\n const destinations = [\n terminator.outerAbrupt == null\n ? undefined\n : `throw bb${terminator.outerAbrupt.blockId}`,\n terminator.outerFinalizer == null\n ? undefined\n : `finally bb${terminator.outerFinalizer.blockId}`,\n ].filter((destination) => destination != null);\n return destinations.length === 0\n ? completion\n : `${completion} via ${destinations.join(\", \")}`;\n }\n return \"unreachable\";\n}\n\nfunction appendMirFunction(lines: string[], functionValue: MirFunction): void {\n const restParameters = functionValue.parameters\n .map((parameter, index) =>\n parameter.rest === true ? `...${index}:${parameter.name}` : undefined,\n )\n .filter((parameter) => parameter != null);\n const restText =\n restParameters.length === 0 ? \"\" : ` rest=[${restParameters.join()}]`;\n const asynchronous =\n functionValue.asyncGenerator === true ||\n functionValue.asyncFunction === true;\n const generator =\n functionValue.generator === true && functionValue.asyncFunction !== true;\n lines.push(\n `${asynchronous ? \"async \" : \"\"}` +\n `function${generator ? \"*\" : \"\"} ` +\n `@f${functionValue.id} ${functionValue.name} roots=` +\n `${functionValue.rootSlotCount}` +\n (functionValue.generatorBodyStart == null\n ? \"\"\n : ` body=bb${functionValue.generatorBodyStart}`) +\n restText +\n ` @${rangeText(functionValue.range)}`,\n );\n if (functionValue.specialization != null) {\n const specialization = functionValue.specialization;\n const hints = specialization.hints\n .map((hint) => `${hint.provenance}:${hint.name}`)\n .join(\", \");\n lines.push(\n ` specialize ${specialization.kind} hints=[${hints}] ` +\n `generic-fallback bb${specialization.genericBlock} ` +\n `join bb${specialization.joinBlock}`,\n );\n }\n for (const block of functionValue.blocks) {\n const parameters = block.parameters?.map((value) => `%${value}`).join(\", \");\n lines.push(\n ` bb${block.id}${parameters == null ? \"\" : `(${parameters})`}:`,\n );\n for (const operation of block.operations) {\n const argumentText = operation.arguments\n .map((argument) => `%${argument}`)\n .join(\", \");\n const resultText =\n operation.checkedResult != null\n ? `%${operation.id}, %${operation.checkedResult}`\n : operation.iteratorNextMethodResult != null\n ? `%${operation.id}, %${operation.iteratorNextMethodResult}`\n : operation.iteratorValueResult != null\n ? `%${operation.id}, %${operation.iteratorValueResult}`\n : operation.enumerateRecordResult != null\n ? `%${operation.id}, %${operation.enumerateRecordResult}`\n : operation.enumerateKeyResult != null\n ? `%${operation.id}, %${operation.enumerateKeyResult}`\n : `%${operation.id}`;\n const hintTextValue =\n operation.hint == null\n ? \"\"\n : ` hint=${operation.hint.provenance}:${operation.hint.name}`;\n const cacheText =\n operation.cacheId == null ? \"\" : ` cache=%${operation.cacheId}`;\n const argumentListText =\n operation.argumentListId == null\n ? \"\"\n : ` argument-list=%${operation.argumentListId}`;\n const iteratorStateText =\n operation.iteratorDoneState == null\n ? \"\"\n : ` done-state=%${operation.iteratorDoneState}`;\n const iteratorModeText =\n operation.iteratorValueOnlyResult == null\n ? \"\"\n : ` value-only=%${operation.iteratorValueOnlyResult}`;\n const iteratorCloseModeText =\n operation.iteratorCloseResultMode == null\n ? \"\"\n : ` close-mode=%${operation.iteratorCloseResultMode}`;\n const tailText =\n operation.tail === true\n ? operation.tailThisBindingId == null\n ? \"tail \"\n : `tail this=%b${operation.tailThisBindingId} `\n : \"\";\n lines.push(\n ` ${resultText} = ${operation.kind} ${tailText}` +\n `${operation.detail}` +\n `${argumentText === \"\" ? \"\" : ` ${argumentText}`} ` +\n `@${rangeText(operation.range)}${hintTextValue}${cacheText}` +\n argumentListText +\n iteratorStateText +\n iteratorModeText +\n iteratorCloseModeText,\n );\n }\n lines.push(` ${printTerminator(block.terminator)}`);\n }\n}\n\n/** Print deterministic MIR without host paths or object identities. */\nexport function printMir(program: MirProgram): string {\n const lines = [\n `mir ${JSON.stringify(program.sourceId)} ` +\n `specialization ${program.specialization}`,\n ];\n if (program.unhandledRejectionPolicy != null) {\n lines.push(`unhandled-rejections ${program.unhandledRejectionPolicy}`);\n }\n for (const binding of program.globalBindings) {\n lines.push(`global %b${binding.id} ${binding.name}`);\n }\n for (const entry of program.globalLexicalNames ?? []) {\n lines.push(`global-lexical ${entry.name} @${rangeText(entry.range)}`);\n }\n for (const binding of program.globalObjectBindings) {\n lines.push(\n `global-object %b${binding.id} ${binding.name} ` +\n `@${rangeText(binding.range)}`,\n );\n }\n for (const functionValue of program.functions) {\n appendMirFunction(lines, functionValue);\n }\n appendMirFunction(lines, program.script);\n return `${lines.join(\"\\n\")}\\n`;\n}\n"],"mappings":";;;AAEA,SAAS,gBAAgB,YAAmC;CAC1D,IAAI,WAAW,SAAS,UAAU,OAAO,WAAW,WAAW;CAC/D,IAAI,WAAW,SAAS,QAAQ;EAC9B,MAAM,SAAS,WAAW,QAAQ,KAAK,UAAU,KA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region src/mir-specialize.d.ts
4
+ declare function specializeAddition(generic: MirFunction, hir: HirFunction): MirFunction;
5
+ //#endregion
6
+ export { specializeAddition };
7
+ //# sourceMappingURL=mir-specialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mir-specialize.d.ts","names":[],"sources":["../src/mir-specialize.ts"],"mappings":";;;iBAiGgB,mBACd,SAAS,aACT,KAAK,cACJ"}
@@ -0,0 +1,182 @@
1
+ //#region src/mir-specialize.ts
2
+ function maximumMirValue(functionValue) {
3
+ let maximum = -1;
4
+ for (const block of functionValue.blocks) for (const operation of block.operations) {
5
+ maximum = Math.max(maximum, operation.id);
6
+ if (operation.checkedResult != null) maximum = Math.max(maximum, operation.checkedResult);
7
+ if (operation.argumentListId != null) maximum = Math.max(maximum, operation.argumentListId);
8
+ if (operation.iteratorNextMethodResult != null) maximum = Math.max(maximum, operation.iteratorNextMethodResult);
9
+ if (operation.iteratorDoneState != null) maximum = Math.max(maximum, operation.iteratorDoneState);
10
+ if (operation.iteratorValueResult != null) maximum = Math.max(maximum, operation.iteratorValueResult);
11
+ if (operation.iteratorValueOnlyResult != null) maximum = Math.max(maximum, operation.iteratorValueOnlyResult);
12
+ if (operation.iteratorCloseResultMode != null) maximum = Math.max(maximum, operation.iteratorCloseResultMode);
13
+ if (operation.enumerateRecordResult != null) maximum = Math.max(maximum, operation.enumerateRecordResult);
14
+ if (operation.enumerateKeyResult != null) maximum = Math.max(maximum, operation.enumerateKeyResult);
15
+ }
16
+ return maximum;
17
+ }
18
+ function numberHint(parameter) {
19
+ if (parameter.hints.length === 0) return void 0;
20
+ if (parameter.hints.some((hint) => hint.name !== "number")) return;
21
+ return parameter.hints[0];
22
+ }
23
+ function eligibleAddition(functionValue) {
24
+ const [leftParameter, rightParameter] = functionValue.parameters;
25
+ if (functionValue.parameters.length !== 2 || leftParameter == null || rightParameter == null || leftParameter.bindingId === rightParameter.bindingId) return;
26
+ const leftHint = numberHint(leftParameter);
27
+ const rightHint = numberHint(rightParameter);
28
+ if (leftHint == null || rightHint == null) return void 0;
29
+ const statement = functionValue.body[0];
30
+ if (functionValue.body.length !== 1 || statement?.kind !== "return" || statement.expression?.kind !== "binary" || statement.expression.operator !== "+" || statement.expression.left.kind !== "binding" || statement.expression.right.kind !== "binding" || statement.expression.left.bindingId !== leftParameter.bindingId || statement.expression.right.bindingId !== rightParameter.bindingId) return;
31
+ return {
32
+ expression: statement.expression,
33
+ hints: [leftHint, rightHint]
34
+ };
35
+ }
36
+ function copyHint(hint) {
37
+ return {
38
+ name: hint.name,
39
+ provenance: hint.provenance,
40
+ range: {
41
+ end: { ...hint.range.end },
42
+ start: { ...hint.range.start }
43
+ }
44
+ };
45
+ }
46
+ function specializeAddition(generic, hir) {
47
+ const eligible = eligibleAddition(hir);
48
+ const original = generic.blocks[0];
49
+ if (eligible == null || generic.derivedThisBindingId != null || generic.blocks.length !== 1 || original == null || original.terminator.kind !== "return") return generic;
50
+ const binaryIndex = original.operations.findIndex((operation) => operation.kind === "binary" && operation.operator === "+");
51
+ const binary = original.operations[binaryIndex];
52
+ const safepoint = original.operations[binaryIndex - 1];
53
+ if (binaryIndex < 1 || binary == null || binary.arguments.length !== 2 || safepoint?.kind !== "safepoint") return generic;
54
+ const leftValue = binary.arguments[0];
55
+ const rightValue = binary.arguments[1];
56
+ if (leftValue == null || rightValue == null) return generic;
57
+ let nextValue = maximumMirValue(generic) + 1;
58
+ const takeValue = () => {
59
+ const value = nextValue;
60
+ nextValue += 1;
61
+ return value;
62
+ };
63
+ const leftGuard = takeValue();
64
+ const rightGuard = takeValue();
65
+ const leftRaw = takeValue();
66
+ const rightRaw = takeValue();
67
+ const checked = takeValue();
68
+ const checkedResult = takeValue();
69
+ const hitCounter = takeValue();
70
+ const boxed = takeValue();
71
+ const missCounter = takeValue();
72
+ const overflowCounter = takeValue();
73
+ const joinValue = takeValue();
74
+ const joinMarker = takeValue();
75
+ const range = eligible.expression.range;
76
+ const hints = [copyHint(eligible.hints[0]), copyHint(eligible.hints[1])];
77
+ const operation = (id, kind, detail, argumentsValue, extra = {}) => ({
78
+ arguments: argumentsValue,
79
+ detail,
80
+ id,
81
+ kind,
82
+ range,
83
+ ...extra
84
+ });
85
+ const prefix = original.operations.slice(0, binaryIndex - 1);
86
+ const genericOperations = original.operations.slice(binaryIndex - 1);
87
+ const blocks = [
88
+ {
89
+ id: 0,
90
+ operations: [...prefix, operation(leftGuard, "guard-smi", "left -> bb1, miss -> bb4", [leftValue], { hint: hints[0] })],
91
+ terminator: {
92
+ kind: "branch",
93
+ test: leftGuard,
94
+ whenFalse: 4,
95
+ whenTrue: 1
96
+ }
97
+ },
98
+ {
99
+ id: 1,
100
+ operations: [operation(rightGuard, "guard-smi", "right -> bb2, miss -> bb4", [rightValue], { hint: hints[1] })],
101
+ terminator: {
102
+ kind: "branch",
103
+ test: rightGuard,
104
+ whenFalse: 4,
105
+ whenTrue: 2
106
+ }
107
+ },
108
+ {
109
+ id: 2,
110
+ operations: [
111
+ operation(leftRaw, "unbox-smi", "left", [leftValue]),
112
+ operation(rightRaw, "unbox-smi", "right", [rightValue]),
113
+ operation(checked, "add-smi-checked", "in-range -> bb3, overflow -> bb5", [leftRaw, rightRaw], { checkedResult })
114
+ ],
115
+ terminator: {
116
+ kind: "branch",
117
+ test: checked,
118
+ whenFalse: 5,
119
+ whenTrue: 3
120
+ }
121
+ },
122
+ {
123
+ id: 3,
124
+ operations: [operation(hitCounter, "count-guard-hit", "smi-add", []), operation(boxed, "box-smi", "checked result", [checkedResult])],
125
+ terminator: {
126
+ kind: "jump",
127
+ target: 7,
128
+ values: [boxed]
129
+ }
130
+ },
131
+ {
132
+ id: 4,
133
+ operations: [operation(missCounter, "count-guard-miss", "generic-fallback bb6", [])],
134
+ terminator: {
135
+ kind: "jump",
136
+ target: 6
137
+ }
138
+ },
139
+ {
140
+ id: 5,
141
+ operations: [operation(overflowCounter, "count-overflow-miss", "generic-fallback bb6", [])],
142
+ terminator: {
143
+ kind: "jump",
144
+ target: 6
145
+ }
146
+ },
147
+ {
148
+ id: 6,
149
+ operations: genericOperations,
150
+ terminator: {
151
+ kind: "jump",
152
+ target: 7,
153
+ values: [original.terminator.value]
154
+ }
155
+ },
156
+ {
157
+ id: 7,
158
+ operations: [operation(joinMarker, "join", "specialized bb3 + generic bb6", [boxed, original.terminator.value])],
159
+ parameters: [joinValue],
160
+ terminator: {
161
+ kind: "return",
162
+ value: joinValue
163
+ }
164
+ }
165
+ ];
166
+ return {
167
+ ...generic,
168
+ blocks,
169
+ rootSlotCount: Math.max(generic.rootSlotCount, nextValue + 1),
170
+ specialization: {
171
+ genericBlock: 6,
172
+ hints,
173
+ joinBlock: 7,
174
+ kind: "smi-add",
175
+ range
176
+ }
177
+ };
178
+ }
179
+
180
+ //#endregion
181
+ export { specializeAddition };
182
+ //# sourceMappingURL=mir-specialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mir-specialize.js","names":[],"sources":["../src/mir-specialize.ts"],"sourcesContent":["import type { HirExpression, HirFunction, HirParameter } from \"./hir.ts\";\nimport type { MirBlock, MirFunction, MirHint, MirOperation } from \"./mir.ts\";\nimport type { Hint } from \"./syntax.ts\";\n\nfunction maximumMirValue(functionValue: MirFunction): number {\n let maximum = -1;\n for (const block of functionValue.blocks) {\n for (const operation of block.operations) {\n maximum = Math.max(maximum, operation.id);\n if (operation.checkedResult != null) {\n maximum = Math.max(maximum, operation.checkedResult);\n }\n if (operation.argumentListId != null) {\n maximum = Math.max(maximum, operation.argumentListId);\n }\n if (operation.iteratorNextMethodResult != null) {\n maximum = Math.max(maximum, operation.iteratorNextMethodResult);\n }\n if (operation.iteratorDoneState != null) {\n maximum = Math.max(maximum, operation.iteratorDoneState);\n }\n if (operation.iteratorValueResult != null) {\n maximum = Math.max(maximum, operation.iteratorValueResult);\n }\n if (operation.iteratorValueOnlyResult != null) {\n maximum = Math.max(maximum, operation.iteratorValueOnlyResult);\n }\n if (operation.iteratorCloseResultMode != null) {\n maximum = Math.max(maximum, operation.iteratorCloseResultMode);\n }\n if (operation.enumerateRecordResult != null) {\n maximum = Math.max(maximum, operation.enumerateRecordResult);\n }\n if (operation.enumerateKeyResult != null) {\n maximum = Math.max(maximum, operation.enumerateKeyResult);\n }\n }\n }\n return maximum;\n}\n\nfunction numberHint(parameter: HirParameter): Hint | undefined {\n if (parameter.hints.length === 0) return undefined;\n if (parameter.hints.some((hint) => hint.name !== \"number\")) {\n return undefined;\n }\n return parameter.hints[0];\n}\n\nfunction eligibleAddition(functionValue: HirFunction):\n | {\n readonly expression: HirExpression & { readonly kind: \"binary\" };\n readonly hints: readonly [Hint, Hint];\n }\n | undefined {\n const [leftParameter, rightParameter] = functionValue.parameters;\n if (\n functionValue.parameters.length !== 2 ||\n leftParameter == null ||\n rightParameter == null ||\n leftParameter.bindingId === rightParameter.bindingId\n ) {\n return undefined;\n }\n const leftHint = numberHint(leftParameter);\n const rightHint = numberHint(rightParameter);\n if (leftHint == null || rightHint == null) return undefined;\n const statement = functionValue.body[0];\n if (\n functionValue.body.length !== 1 ||\n statement?.kind !== \"return\" ||\n statement.expression?.kind !== \"binary\" ||\n statement.expression.operator !== \"+\" ||\n statement.expression.left.kind !== \"binding\" ||\n statement.expression.right.kind !== \"binding\" ||\n statement.expression.left.bindingId !== leftParameter.bindingId ||\n statement.expression.right.bindingId !== rightParameter.bindingId\n ) {\n return undefined;\n }\n return {\n expression: statement.expression,\n hints: [leftHint, rightHint],\n };\n}\n\nfunction copyHint(hint: Hint): MirHint {\n return {\n name: hint.name,\n provenance: hint.provenance,\n range: {\n end: { ...hint.range.end },\n start: { ...hint.range.start },\n },\n };\n}\n\nexport function specializeAddition(\n generic: MirFunction,\n hir: HirFunction,\n): MirFunction {\n const eligible = eligibleAddition(hir);\n const original = generic.blocks[0];\n if (\n eligible == null ||\n // A derived class constructor routes every `return` through a\n // trailing `derived-return` operation. The specialized path leaves\n // the block before that operation, so it would return the sum the\n // generic path rejects with a `TypeError`.\n generic.derivedThisBindingId != null ||\n generic.blocks.length !== 1 ||\n original == null ||\n original.terminator.kind !== \"return\"\n ) {\n return generic;\n }\n const binaryIndex = original.operations.findIndex(\n (operation) => operation.kind === \"binary\" && operation.operator === \"+\",\n );\n const binary = original.operations[binaryIndex];\n const safepoint = original.operations[binaryIndex - 1];\n if (\n binaryIndex < 1 ||\n binary == null ||\n binary.arguments.length !== 2 ||\n safepoint?.kind !== \"safepoint\"\n ) {\n return generic;\n }\n const leftValue = binary.arguments[0];\n const rightValue = binary.arguments[1];\n if (leftValue == null || rightValue == null) return generic;\n\n let nextValue = maximumMirValue(generic) + 1;\n const takeValue = (): number => {\n const value = nextValue;\n nextValue += 1;\n return value;\n };\n const leftGuard = takeValue();\n const rightGuard = takeValue();\n const leftRaw = takeValue();\n const rightRaw = takeValue();\n const checked = takeValue();\n const checkedResult = takeValue();\n const hitCounter = takeValue();\n const boxed = takeValue();\n const missCounter = takeValue();\n const overflowCounter = takeValue();\n const joinValue = takeValue();\n const joinMarker = takeValue();\n const range = eligible.expression.range;\n const hints: readonly [MirHint, MirHint] = [\n copyHint(eligible.hints[0]),\n copyHint(eligible.hints[1]),\n ];\n const operation = (\n id: number,\n kind: MirOperation[\"kind\"],\n detail: string,\n argumentsValue: readonly number[],\n extra: Partial<MirOperation> = {},\n ): MirOperation => ({\n arguments: argumentsValue,\n detail,\n id,\n kind,\n range,\n ...extra,\n });\n const prefix = original.operations.slice(0, binaryIndex - 1);\n const genericOperations = original.operations.slice(binaryIndex - 1);\n const blocks: readonly MirBlock[] = [\n {\n id: 0,\n operations: [\n ...prefix,\n operation(\n leftGuard,\n \"guard-smi\",\n \"left -> bb1, miss -> bb4\",\n [leftValue],\n { hint: hints[0] },\n ),\n ],\n terminator: {\n kind: \"branch\",\n test: leftGuard,\n whenFalse: 4,\n whenTrue: 1,\n },\n },\n {\n id: 1,\n operations: [\n operation(\n rightGuard,\n \"guard-smi\",\n \"right -> bb2, miss -> bb4\",\n [rightValue],\n { hint: hints[1] },\n ),\n ],\n terminator: {\n kind: \"branch\",\n test: rightGuard,\n whenFalse: 4,\n whenTrue: 2,\n },\n },\n {\n id: 2,\n operations: [\n operation(leftRaw, \"unbox-smi\", \"left\", [leftValue]),\n operation(rightRaw, \"unbox-smi\", \"right\", [rightValue]),\n operation(\n checked,\n \"add-smi-checked\",\n \"in-range -> bb3, overflow -> bb5\",\n [leftRaw, rightRaw],\n { checkedResult },\n ),\n ],\n terminator: {\n kind: \"branch\",\n test: checked,\n whenFalse: 5,\n whenTrue: 3,\n },\n },\n {\n id: 3,\n operations: [\n operation(hitCounter, \"count-guard-hit\", \"smi-add\", []),\n operation(boxed, \"box-smi\", \"checked result\", [checkedResult]),\n ],\n terminator: { kind: \"jump\", target: 7, values: [boxed] },\n },\n {\n id: 4,\n operations: [\n operation(missCounter, \"count-guard-miss\", \"generic-fallback bb6\", []),\n ],\n terminator: { kind: \"jump\", target: 6 },\n },\n {\n id: 5,\n operations: [\n operation(\n overflowCounter,\n \"count-overflow-miss\",\n \"generic-fallback bb6\",\n [],\n ),\n ],\n terminator: { kind: \"jump\", target: 6 },\n },\n {\n id: 6,\n operations: genericOperations,\n terminator: {\n kind: \"jump\",\n target: 7,\n values: [original.terminator.value],\n },\n },\n {\n id: 7,\n operations: [\n operation(joinMarker, \"join\", \"specialized bb3 + generic bb6\", [\n boxed,\n original.terminator.value,\n ]),\n ],\n parameters: [joinValue],\n terminator: { kind: \"return\", value: joinValue },\n },\n ];\n return {\n ...generic,\n blocks,\n rootSlotCount: Math.max(generic.rootSlotCount, nextValue + 1),\n specialization: {\n genericBlock: 6,\n hints,\n joinBlock: 7,\n kind: \"smi-add\",\n range,\n },\n };\n}\n"],"mappings":";AAIA,SAAS,gBAAgB,eAAoC;CAC3D,IAAI,UAAU;CACd,KAAK,MAAM,SAAS,cAAc,QAChC,KAAK,MAAM,aAAa,MAAM,YAAY;EACxC,UAAU,KAAK,IAAI,SAAS,UAAU,EAAE;EACxC,IAAI,UAAU,iBAAiB,MAC7B,UAAU,KAAK,IAA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