@markw65/monkeyc-optimizer 1.1.38 → 1.1.40
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.
- package/CHANGELOG.md +12 -0
- package/build/api.cjs +34 -34
- package/build/{chunk-IMIM4BE2.cjs → chunk-Z2SLP4FQ.cjs} +38 -13
- package/build/optimizer.cjs +16 -16
- package/build/sdk-util.cjs +14 -14
- package/build/src/readprg/opcodes.d.ts +3 -3
- package/build/src/type-flow/types.d.ts +1 -1
- package/build/worker-thread.cjs +3 -3
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the "monkeyc-optimizer" package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### 1.1.40
|
|
6
|
+
|
|
7
|
+
- Update the bytecode optimizer to be compatible with Sdk-7.x
|
|
8
|
+
|
|
9
|
+
### 1.1.39
|
|
10
|
+
|
|
11
|
+
- Update to [@markw65/prettier-plugin-monkeyc@1.0.54](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1054)
|
|
12
|
+
|
|
13
|
+
- Fixes the parser to understand tuples
|
|
14
|
+
|
|
15
|
+
- Add basic type analysis for tuples
|
|
16
|
+
|
|
5
17
|
### 1.1.38
|
|
6
18
|
|
|
7
19
|
- Fix a bug introduced in 1.1.37 that could lead to duplicate diagnostics, and diagnostics with strange contents.
|
package/build/api.cjs
CHANGED
|
@@ -18,47 +18,47 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var api_exports = {};
|
|
20
20
|
__export(api_exports, {
|
|
21
|
-
checkCompilerVersion: () =>
|
|
22
|
-
collectNamespaces: () =>
|
|
23
|
-
createDocumentationMap: () =>
|
|
24
|
-
diagnostic: () =>
|
|
25
|
-
diagnosticHelper: () =>
|
|
26
|
-
findNamesInScope: () =>
|
|
27
|
-
findUsingForNode: () =>
|
|
28
|
-
formatAst: () =>
|
|
29
|
-
formatAstLongLines: () =>
|
|
30
|
-
formatScopedName: () =>
|
|
31
|
-
getApiFunctionInfo: () =>
|
|
32
|
-
getApiMapping: () =>
|
|
33
|
-
getSuperClasses: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_Z2SLP4FQ.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_Z2SLP4FQ.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_Z2SLP4FQ.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_Z2SLP4FQ.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_Z2SLP4FQ.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_Z2SLP4FQ.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_Z2SLP4FQ.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_Z2SLP4FQ.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_Z2SLP4FQ.formatAstLongLines,
|
|
30
|
+
formatScopedName: () => import_chunk_Z2SLP4FQ.formatScopedName,
|
|
31
|
+
getApiFunctionInfo: () => import_chunk_Z2SLP4FQ.getApiFunctionInfo,
|
|
32
|
+
getApiMapping: () => import_chunk_Z2SLP4FQ.getApiMapping,
|
|
33
|
+
getSuperClasses: () => import_chunk_Z2SLP4FQ.getSuperClasses,
|
|
34
34
|
hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
|
|
35
|
-
isClassVariable: () =>
|
|
36
|
-
isLocal: () =>
|
|
37
|
-
isLookupCandidate: () =>
|
|
38
|
-
isStateNode: () =>
|
|
39
|
-
lookupByFullName: () =>
|
|
40
|
-
lookupNext: () =>
|
|
41
|
-
lookupResultContains: () =>
|
|
42
|
-
lookupWithType: () =>
|
|
43
|
-
makeToyboxLink: () =>
|
|
44
|
-
mapVarDeclsByType: () =>
|
|
45
|
-
markInvokeClassMethod: () =>
|
|
46
|
-
parseSdkVersion: () =>
|
|
47
|
-
resolveDiagnostics: () =>
|
|
48
|
-
resolveDiagnosticsMap: () =>
|
|
49
|
-
sameLookupResult: () =>
|
|
35
|
+
isClassVariable: () => import_chunk_Z2SLP4FQ.isClassVariable,
|
|
36
|
+
isLocal: () => import_chunk_Z2SLP4FQ.isLocal,
|
|
37
|
+
isLookupCandidate: () => import_chunk_Z2SLP4FQ.isLookupCandidate,
|
|
38
|
+
isStateNode: () => import_chunk_Z2SLP4FQ.isStateNode,
|
|
39
|
+
lookupByFullName: () => import_chunk_Z2SLP4FQ.lookupByFullName,
|
|
40
|
+
lookupNext: () => import_chunk_Z2SLP4FQ.lookupNext,
|
|
41
|
+
lookupResultContains: () => import_chunk_Z2SLP4FQ.lookupResultContains,
|
|
42
|
+
lookupWithType: () => import_chunk_Z2SLP4FQ.lookupWithType,
|
|
43
|
+
makeToyboxLink: () => import_chunk_Z2SLP4FQ.makeToyboxLink,
|
|
44
|
+
mapVarDeclsByType: () => import_chunk_Z2SLP4FQ.mapVarDeclsByType,
|
|
45
|
+
markInvokeClassMethod: () => import_chunk_Z2SLP4FQ.markInvokeClassMethod,
|
|
46
|
+
parseSdkVersion: () => import_chunk_Z2SLP4FQ.parseSdkVersion,
|
|
47
|
+
resolveDiagnostics: () => import_chunk_Z2SLP4FQ.resolveDiagnostics,
|
|
48
|
+
resolveDiagnosticsMap: () => import_chunk_Z2SLP4FQ.resolveDiagnosticsMap,
|
|
49
|
+
sameLookupResult: () => import_chunk_Z2SLP4FQ.sameLookupResult,
|
|
50
50
|
traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
|
|
51
|
-
variableDeclarationName: () =>
|
|
52
|
-
visitReferences: () =>
|
|
53
|
-
visit_resources: () =>
|
|
54
|
-
visitorNode: () =>
|
|
51
|
+
variableDeclarationName: () => import_chunk_Z2SLP4FQ.variableDeclarationName,
|
|
52
|
+
visitReferences: () => import_chunk_Z2SLP4FQ.visitReferences,
|
|
53
|
+
visit_resources: () => import_chunk_Z2SLP4FQ.visit_resources,
|
|
54
|
+
visitorNode: () => import_chunk_Z2SLP4FQ.visitorNode
|
|
55
55
|
});
|
|
56
56
|
module.exports = __toCommonJS(api_exports);
|
|
57
|
-
var
|
|
57
|
+
var import_chunk_Z2SLP4FQ = require("./chunk-Z2SLP4FQ.cjs");
|
|
58
58
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
59
59
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
60
60
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
61
|
-
(0,
|
|
61
|
+
(0, import_chunk_Z2SLP4FQ.init_api)();
|
|
62
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
63
|
0 && (module.exports = {
|
|
64
64
|
checkCompilerVersion,
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_Z2SLP4FQ_exports = {};
|
|
30
|
+
__export(chunk_Z2SLP4FQ_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -130,7 +130,7 @@ __export(chunk_IMIM4BE2_exports, {
|
|
|
130
130
|
visitorNode: () => visitorNode,
|
|
131
131
|
xml_util_exports: () => xml_util_exports
|
|
132
132
|
});
|
|
133
|
-
module.exports = __toCommonJS(
|
|
133
|
+
module.exports = __toCommonJS(chunk_Z2SLP4FQ_exports);
|
|
134
134
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
135
135
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
136
136
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
@@ -11077,6 +11077,24 @@ function typeFromSingleTypeSpec(state, type, stack) {
|
|
|
11077
11077
|
type = { type: "TypeSpecPart", name: type };
|
|
11078
11078
|
}
|
|
11079
11079
|
switch (type.type) {
|
|
11080
|
+
case "ArrayExpression": {
|
|
11081
|
+
return {
|
|
11082
|
+
type: 512,
|
|
11083
|
+
value: type.elements.reduce(
|
|
11084
|
+
(prev, cur) => {
|
|
11085
|
+
unionInto(
|
|
11086
|
+
prev,
|
|
11087
|
+
typeFromTypespec(state, cur)
|
|
11088
|
+
);
|
|
11089
|
+
return prev;
|
|
11090
|
+
},
|
|
11091
|
+
{
|
|
11092
|
+
type: 0
|
|
11093
|
+
/* Never */
|
|
11094
|
+
}
|
|
11095
|
+
)
|
|
11096
|
+
};
|
|
11097
|
+
}
|
|
11080
11098
|
case "ObjectExpression": {
|
|
11081
11099
|
const fields = /* @__PURE__ */ new Map();
|
|
11082
11100
|
type.properties.forEach((property) => {
|
|
@@ -19506,6 +19524,8 @@ function parseCode(view, lineTable) {
|
|
|
19506
19524
|
case 20:
|
|
19507
19525
|
case 54:
|
|
19508
19526
|
case 47:
|
|
19527
|
+
case 10:
|
|
19528
|
+
case 11:
|
|
19509
19529
|
return { op, offset, size: 1 };
|
|
19510
19530
|
case 1:
|
|
19511
19531
|
case 15:
|
|
@@ -19514,8 +19534,6 @@ function parseCode(view, lineTable) {
|
|
|
19514
19534
|
case 43:
|
|
19515
19535
|
case 46:
|
|
19516
19536
|
case 53:
|
|
19517
|
-
case 10:
|
|
19518
|
-
case 11:
|
|
19519
19537
|
return { op, arg: view.getUint8(current++), offset, size: 2 };
|
|
19520
19538
|
case 25:
|
|
19521
19539
|
case 35:
|
|
@@ -19638,10 +19656,18 @@ function opcodeSize(op) {
|
|
|
19638
19656
|
unhandledType(op);
|
|
19639
19657
|
}
|
|
19640
19658
|
}
|
|
19641
|
-
function emitBytecode(bytecode, view, offset, linktable) {
|
|
19659
|
+
function emitBytecode(bytecode, view, offset, linktable, shift_hack) {
|
|
19642
19660
|
view.setUint8(offset++, bytecode.op);
|
|
19643
|
-
if (bytecode.arg == null)
|
|
19661
|
+
if (bytecode.arg == null) {
|
|
19662
|
+
if (shift_hack && (bytecode.op === 10 || bytecode.op === 11)) {
|
|
19663
|
+
view.setUint8(
|
|
19664
|
+
offset++,
|
|
19665
|
+
0
|
|
19666
|
+
/* nop */
|
|
19667
|
+
);
|
|
19668
|
+
}
|
|
19644
19669
|
return offset;
|
|
19670
|
+
}
|
|
19645
19671
|
switch (bytecode.op) {
|
|
19646
19672
|
case 1:
|
|
19647
19673
|
case 15:
|
|
@@ -19650,8 +19676,6 @@ function emitBytecode(bytecode, view, offset, linktable) {
|
|
|
19650
19676
|
case 43:
|
|
19651
19677
|
case 46:
|
|
19652
19678
|
case 53:
|
|
19653
|
-
case 10:
|
|
19654
|
-
case 11:
|
|
19655
19679
|
view.setUint8(offset++, bytecode.arg);
|
|
19656
19680
|
break;
|
|
19657
19681
|
case 25:
|
|
@@ -22660,6 +22684,7 @@ var init_optimize2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
22660
22684
|
function emitFunc(func, view, start, updateInfo, context) {
|
|
22661
22685
|
cleanCfg2(func, context);
|
|
22662
22686
|
groupBlocks(func);
|
|
22687
|
+
const shift_hack = context.header.ciqVersion < 327680;
|
|
22663
22688
|
const { liveInLocals } = getLocalsInfo(func);
|
|
22664
22689
|
const liveLocalRanges = /* @__PURE__ */ new Map();
|
|
22665
22690
|
const { localRanges, offsetMap } = updateInfo;
|
|
@@ -22754,7 +22779,7 @@ function emitFunc(func, view, start, updateInfo, context) {
|
|
|
22754
22779
|
bytecode.arg = taken;
|
|
22755
22780
|
bytecode.op = bytecode.op === 40 ? 41 : 40;
|
|
22756
22781
|
}
|
|
22757
|
-
offset = emitBytecode(bytecode, view, offset, linktable);
|
|
22782
|
+
offset = emitBytecode(bytecode, view, offset, linktable, shift_hack);
|
|
22758
22783
|
});
|
|
22759
22784
|
if (block.next != null && block.next !== blocks[i + 1]?.offset) {
|
|
22760
22785
|
const bc = {
|
|
@@ -22763,7 +22788,7 @@ function emitFunc(func, view, start, updateInfo, context) {
|
|
|
22763
22788
|
offset: block.offset,
|
|
22764
22789
|
size: 3
|
|
22765
22790
|
};
|
|
22766
|
-
offset = emitBytecode(bc, view, offset, linktable);
|
|
22791
|
+
offset = emitBytecode(bc, view, offset, linktable, shift_hack);
|
|
22767
22792
|
}
|
|
22768
22793
|
});
|
|
22769
22794
|
(0, import_node_assert13.default)(exceptionStack.length === 0);
|
|
@@ -28093,7 +28118,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
28093
28118
|
const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
|
|
28094
28119
|
Object.values(fnMap).map((v) => v.output)
|
|
28095
28120
|
);
|
|
28096
|
-
if (source_time < opt_time &&
|
|
28121
|
+
if (source_time < opt_time && 1706315973765 < opt_time) {
|
|
28097
28122
|
return {
|
|
28098
28123
|
hasTests,
|
|
28099
28124
|
diagnostics: prevDiagnostics,
|
|
@@ -28132,7 +28157,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
28132
28157
|
hasTests: hasTests2,
|
|
28133
28158
|
diagnostics,
|
|
28134
28159
|
sdkVersion,
|
|
28135
|
-
optimizerVersion: "1.1.
|
|
28160
|
+
optimizerVersion: "1.1.40",
|
|
28136
28161
|
...Object.fromEntries(
|
|
28137
28162
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
28138
28163
|
)
|
package/build/optimizer.cjs
CHANGED
|
@@ -18,28 +18,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var optimizer_exports = {};
|
|
20
20
|
__export(optimizer_exports, {
|
|
21
|
-
StateNodeAttributes: () =>
|
|
22
|
-
buildOptimizedProject: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_Z2SLP4FQ.StateNodeAttributes,
|
|
22
|
+
buildOptimizedProject: () => import_chunk_Z2SLP4FQ.buildOptimizedProject,
|
|
23
23
|
copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
|
|
24
|
-
defaultConfig: () =>
|
|
25
|
-
display: () =>
|
|
26
|
-
generateOneConfig: () =>
|
|
27
|
-
generateOptimizedProject: () =>
|
|
28
|
-
getConfig: () =>
|
|
29
|
-
getProjectAnalysis: () =>
|
|
30
|
-
get_jungle: () =>
|
|
31
|
-
isErrorWithLocation: () =>
|
|
32
|
-
launchSimulator: () =>
|
|
33
|
-
manifestProducts: () =>
|
|
34
|
-
mctree: () =>
|
|
35
|
-
simulateProgram: () =>
|
|
24
|
+
defaultConfig: () => import_chunk_Z2SLP4FQ.defaultConfig,
|
|
25
|
+
display: () => import_chunk_Z2SLP4FQ.display,
|
|
26
|
+
generateOneConfig: () => import_chunk_Z2SLP4FQ.generateOneConfig,
|
|
27
|
+
generateOptimizedProject: () => import_chunk_Z2SLP4FQ.generateOptimizedProject,
|
|
28
|
+
getConfig: () => import_chunk_Z2SLP4FQ.getConfig,
|
|
29
|
+
getProjectAnalysis: () => import_chunk_Z2SLP4FQ.getProjectAnalysis,
|
|
30
|
+
get_jungle: () => import_chunk_Z2SLP4FQ.get_jungle,
|
|
31
|
+
isErrorWithLocation: () => import_chunk_Z2SLP4FQ.isErrorWithLocation,
|
|
32
|
+
launchSimulator: () => import_chunk_Z2SLP4FQ.launchSimulator,
|
|
33
|
+
manifestProducts: () => import_chunk_Z2SLP4FQ.manifestProducts,
|
|
34
|
+
mctree: () => import_chunk_Z2SLP4FQ.mctree,
|
|
35
|
+
simulateProgram: () => import_chunk_Z2SLP4FQ.simulateProgram
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(optimizer_exports);
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_Z2SLP4FQ = require("./chunk-Z2SLP4FQ.cjs");
|
|
39
39
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
40
40
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
41
41
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
42
|
-
(0,
|
|
42
|
+
(0, import_chunk_Z2SLP4FQ.init_optimizer)();
|
|
43
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
44
|
0 && (module.exports = {
|
|
45
45
|
StateNodeAttributes,
|
package/build/sdk-util.cjs
CHANGED
|
@@ -18,25 +18,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var sdk_util_exports = {};
|
|
20
20
|
__export(sdk_util_exports, {
|
|
21
|
-
SectionKinds: () =>
|
|
22
|
-
appSupport: () =>
|
|
23
|
-
connectiq: () =>
|
|
24
|
-
getDeviceInfo: () =>
|
|
25
|
-
getFunctionDocumentation: () =>
|
|
26
|
-
getLanguages: () =>
|
|
27
|
-
getSdkPath: () =>
|
|
28
|
-
isWin: () =>
|
|
29
|
-
optimizeProgram: () =>
|
|
30
|
-
readPrg: () =>
|
|
31
|
-
readPrgWithOffsets: () =>
|
|
32
|
-
xmlUtil: () =>
|
|
21
|
+
SectionKinds: () => import_chunk_Z2SLP4FQ.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_Z2SLP4FQ.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_Z2SLP4FQ.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_Z2SLP4FQ.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_Z2SLP4FQ.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_Z2SLP4FQ.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_Z2SLP4FQ.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_Z2SLP4FQ.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_Z2SLP4FQ.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_Z2SLP4FQ.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_Z2SLP4FQ.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_Z2SLP4FQ.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_Z2SLP4FQ = require("./chunk-Z2SLP4FQ.cjs");
|
|
36
36
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
37
37
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
38
38
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
39
|
-
(0,
|
|
39
|
+
(0, import_chunk_Z2SLP4FQ.init_sdk_util)();
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
42
|
SectionKinds,
|
|
@@ -115,10 +115,10 @@ export interface Orv extends Argless {
|
|
|
115
115
|
export interface Modv extends Argless {
|
|
116
116
|
op: Opcodes.modv;
|
|
117
117
|
}
|
|
118
|
-
export interface Shlv extends
|
|
118
|
+
export interface Shlv extends Argless {
|
|
119
119
|
op: Opcodes.shlv;
|
|
120
120
|
}
|
|
121
|
-
export interface Shrv extends
|
|
121
|
+
export interface Shrv extends Argless {
|
|
122
122
|
op: Opcodes.shrv;
|
|
123
123
|
}
|
|
124
124
|
export interface Xorv extends Argless {
|
|
@@ -261,7 +261,7 @@ export interface Argc extends ByteArg {
|
|
|
261
261
|
export type Bytecode = Nop | Incsp | Popv | Addv | Subv | Mulv | Divv | Andv | Orv | Modv | Shlv | Shrv | Xorv | Getv | Putv | Invokem | Agetv | Aputv | Lgetv | Lputv | Newa | Newc | Return | Ret | News | Goto | Eq | Lt | Lte | Gt | Gte | Ne | Isnull | Isa | Canhazplz | Jsr | Ts | Ipush | Fpush | Spush | Bt | Bf | Frpush | Bpush | Npush | Invv | Dup | Newd | Getm | Lpush | Dpush | Throw | Cpush | Argc | Newba;
|
|
262
262
|
export declare function parseCode(view: DataView, lineTable: Map<number, LineNumber>): Bytecode[];
|
|
263
263
|
export declare function opcodeSize(op: Opcodes): 1 | 2 | 3 | 5 | 9;
|
|
264
|
-
export declare function emitBytecode(bytecode: Bytecode, view: DataView, offset: number, linktable: Map<number, number
|
|
264
|
+
export declare function emitBytecode(bytecode: Bytecode, view: DataView, offset: number, linktable: Map<number, number>, shift_hack: boolean): number;
|
|
265
265
|
export declare function getOpInfo(bytecode: Bytecode): {
|
|
266
266
|
pop: number;
|
|
267
267
|
push: number;
|
|
@@ -193,7 +193,7 @@ export declare function typeFromTypeStateNodes(state: ProgramStateAnalysis, sns:
|
|
|
193
193
|
export declare function objectLiteralKeyFromExpr(key: mctree.Expression): string | null;
|
|
194
194
|
export declare function objectLiteralKeyFromType(key: ExactOrUnion): string | null;
|
|
195
195
|
export declare function typeFromObjectLiteralKey(key: string): ValueTypes;
|
|
196
|
-
export declare function typeFromSingleTypeSpec(state: ProgramStateAnalysis, type: mctree.
|
|
196
|
+
export declare function typeFromSingleTypeSpec(state: ProgramStateAnalysis, type: mctree.SingleTypeSpec, stack?: ProgramStateStack | undefined): ExactOrUnion;
|
|
197
197
|
export declare function typeFromTypespec(state: ProgramStateAnalysis, ts: mctree.TypeSpecList, stack?: ProgramStateStack | undefined): ExactOrUnion;
|
|
198
198
|
export declare function typeFromLiteral(literal: mctree.Literal): ExactTypes;
|
|
199
199
|
export declare function mcExprFromType(type: ValueTypes): mctree.Expression | null;
|
package/build/worker-thread.cjs
CHANGED
|
@@ -21,17 +21,17 @@ __export(worker_thread_exports, {
|
|
|
21
21
|
default: () => worker_thread_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(worker_thread_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_Z2SLP4FQ = require("./chunk-Z2SLP4FQ.cjs");
|
|
25
25
|
var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
|
|
26
26
|
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
27
27
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
28
28
|
var import_node_worker_threads = require("node:worker_threads");
|
|
29
29
|
var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
30
30
|
"src/worker-thread.ts"() {
|
|
31
|
-
(0,
|
|
31
|
+
(0, import_chunk_Z2SLP4FQ.init_worker_task)();
|
|
32
32
|
if (import_node_worker_threads.parentPort) {
|
|
33
33
|
import_node_worker_threads.parentPort.on("message", async (task) => {
|
|
34
|
-
return import_node_worker_threads.parentPort.postMessage(await (0,
|
|
34
|
+
return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_Z2SLP4FQ.performTask)(task));
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markw65/monkeyc-optimizer",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.40",
|
|
5
5
|
"description": "Source to source optimizer for Garmin Monkey C code",
|
|
6
6
|
"main": "build/optimizer.cjs",
|
|
7
7
|
"types": "build/src/optimizer.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"watch": "node esbuild.mjs --watch",
|
|
20
20
|
"prettier-live": "test -z \"$(git status --untracked-files=no --porcelain || echo dirty)\" && npm install ../prettier-plugin-monkeyc && git commit -am 'prettier-plugin-monkeyc-live'",
|
|
21
|
+
"prettier-package": "npm install; npm install @markw65/prettier-plugin-monkeyc; git commit -am \"Update to $(npm list @markw65/prettier-plugin-monkeyc | sed -ne 's/^.*\\(@markw65\\/prettier-plugin-monkeyc\\)/\\1/p')\"",
|
|
21
22
|
"build-debug": "node esbuild.mjs",
|
|
22
23
|
"build-release": "node esbuild.mjs --release",
|
|
23
24
|
"prepack": "node esbuild.mjs --release && mkdir -p bin && cp test/cft-font-info.js bin",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"license": "MIT",
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"@markw65/peggy-optimizer": "^1.0.1",
|
|
53
|
-
"@markw65/prettier-plugin-monkeyc": "^1.0.
|
|
54
|
+
"@markw65/prettier-plugin-monkeyc": "^1.0.54"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@types/chai": "^4.3.4",
|