@markw65/monkeyc-optimizer 1.1.20 → 1.1.22
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/README.md +31 -0
- package/build/api.cjs +34 -34
- package/build/{chunk-DCGJCC63.cjs → chunk-563GVBVT.cjs} +19481 -18385
- package/build/{chunk-APACX34C.cjs → chunk-HHQDDCTP.cjs} +6 -4
- package/build/optimizer.cjs +19 -19
- package/build/sdk-util.cjs +15 -15
- package/build/src/api.d.ts +1 -1
- package/build/src/optimizer-types.d.ts +1 -0
- package/build/src/readprg/array-init.d.ts +2 -1
- package/build/src/readprg/bytecode.d.ts +5 -2
- package/build/src/readprg/cflow.d.ts +10 -0
- package/build/src/readprg/dce.d.ts +4 -1
- package/build/src/readprg/interp.d.ts +20 -0
- package/build/src/readprg/locals.d.ts +3 -0
- package/build/src/readprg.d.ts +4 -3
- package/build/src/type-flow/type-flow-util.d.ts +1 -1
- package/build/src/worker-task.d.ts +1 -0
- package/build/util.cjs +24 -24
- package/build/worker-thread.cjs +5 -5
- package/package.json +3 -3
- package/build/worker-pool.cjs +0 -34
package/README.md
CHANGED
|
@@ -793,3 +793,34 @@ Bug Fixes
|
|
|
793
793
|
|
|
794
794
|
- Optimizations
|
|
795
795
|
- Improve dce in the post build optimizer a little, by computing which locals are live out of each block.
|
|
796
|
+
|
|
797
|
+
### 1.1.21
|
|
798
|
+
|
|
799
|
+
- Bug fixes
|
|
800
|
+
|
|
801
|
+
- fixed a bug that could cause dead-store elimination to delete stores that might be used if an exception was thrown. eg `try { x=1; foo(); x=2; } catch (ex) { System.println(x); x=3; }` could delete the first store to `x`, breaking the println if `foo` actually throws.
|
|
802
|
+
|
|
803
|
+
- Source to Source Optimizations
|
|
804
|
+
|
|
805
|
+
- convert `++` and `--` to `+= 1` and `-= 1`. Garmin's compiler generates exactly the same code for both, but when the `1` is written explicitly, its available for `sizeBasedPRE` to optimize.
|
|
806
|
+
- convert `-x` to `0 - x`. Again, Garmin's compiler generates exactly the same code, but being explicit makes the `0` available to `sizeBasedPRE`.
|
|
807
|
+
- rewrite some optimizations so that `-x` and `0-x` are treated identically. eg `(0-x) + y` => `y - x` (for suitably typed `x` and `y`).
|
|
808
|
+
- optimize `-1 - x` to `~x` (for suitably typed x), saving 5 bytes (or 2 if pre was going to replace the -1 with a local)
|
|
809
|
+
|
|
810
|
+
- Post Build Optimizations
|
|
811
|
+
- Keep better track of exceptional edges in dce, allowing it to be more aggressive.
|
|
812
|
+
- Add a (very simple) bytecode interpreter which keeps track of the values in locals, and on the stack. This allows us to opportunistically replace constants (typically 5+ bytes) with a 2 byte load from a register, or from a stack location. This (together with dce) will form the infrastructure for a future minimize-locals pass.
|
|
813
|
+
- when replacing constants with locals/stack accesses, look for uses of `~`. Eg if the value `2` is in the local `x`, and we need to produce the value `-3`, we can use `~x` (costing 3 bytes, instead of 5).
|
|
814
|
+
|
|
815
|
+
### 1.1.22
|
|
816
|
+
|
|
817
|
+
- Bug fixes
|
|
818
|
+
|
|
819
|
+
- [Fixes a bug in Single Use Copy Prop](https://github.com/markw65/prettier-extension-monkeyc/issues/8)
|
|
820
|
+
|
|
821
|
+
- Post Build Optimizations
|
|
822
|
+
- Updates the array-init optimizations to include `ByteArray`s
|
|
823
|
+
- Integrate the array-init optimization with the new interp pass, so that changes made by interp don't interfere with array-init
|
|
824
|
+
- Handle more bytecodes in interp
|
|
825
|
+
- If an array is initialized to its default value, drop the initializers
|
|
826
|
+
- Add an option to [remove argc bytecodes](https://github.com/markw65/monkeyc-optimizer/wiki/Post-Build-Optimizer#remove-argc)
|
package/build/api.cjs
CHANGED
|
@@ -18,42 +18,42 @@ 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
|
-
getApiFunctionInfo: () =>
|
|
31
|
-
getApiMapping: () =>
|
|
32
|
-
getSuperClasses: () =>
|
|
33
|
-
hasProperty: () =>
|
|
34
|
-
isClassVariable: () =>
|
|
35
|
-
isLocal: () =>
|
|
36
|
-
isLookupCandidate: () =>
|
|
37
|
-
isStateNode: () =>
|
|
38
|
-
lookupByFullName: () =>
|
|
39
|
-
lookupNext: () =>
|
|
40
|
-
lookupResultContains: () =>
|
|
41
|
-
lookupWithType: () =>
|
|
42
|
-
makeToyboxLink: () =>
|
|
43
|
-
mapVarDeclsByType: () =>
|
|
44
|
-
markInvokeClassMethod: () =>
|
|
45
|
-
parseSdkVersion: () =>
|
|
46
|
-
sameLookupResult: () =>
|
|
47
|
-
traverseAst: () =>
|
|
48
|
-
variableDeclarationName: () =>
|
|
49
|
-
visitReferences: () =>
|
|
50
|
-
visit_resources: () =>
|
|
51
|
-
visitorNode: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_563GVBVT.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_563GVBVT.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_563GVBVT.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_563GVBVT.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_563GVBVT.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_563GVBVT.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_563GVBVT.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_563GVBVT.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_563GVBVT.formatAstLongLines,
|
|
30
|
+
getApiFunctionInfo: () => import_chunk_563GVBVT.getApiFunctionInfo,
|
|
31
|
+
getApiMapping: () => import_chunk_563GVBVT.getApiMapping,
|
|
32
|
+
getSuperClasses: () => import_chunk_563GVBVT.getSuperClasses,
|
|
33
|
+
hasProperty: () => import_chunk_563GVBVT.hasProperty,
|
|
34
|
+
isClassVariable: () => import_chunk_563GVBVT.isClassVariable,
|
|
35
|
+
isLocal: () => import_chunk_563GVBVT.isLocal,
|
|
36
|
+
isLookupCandidate: () => import_chunk_563GVBVT.isLookupCandidate,
|
|
37
|
+
isStateNode: () => import_chunk_563GVBVT.isStateNode,
|
|
38
|
+
lookupByFullName: () => import_chunk_563GVBVT.lookupByFullName,
|
|
39
|
+
lookupNext: () => import_chunk_563GVBVT.lookupNext,
|
|
40
|
+
lookupResultContains: () => import_chunk_563GVBVT.lookupResultContains,
|
|
41
|
+
lookupWithType: () => import_chunk_563GVBVT.lookupWithType,
|
|
42
|
+
makeToyboxLink: () => import_chunk_563GVBVT.makeToyboxLink,
|
|
43
|
+
mapVarDeclsByType: () => import_chunk_563GVBVT.mapVarDeclsByType,
|
|
44
|
+
markInvokeClassMethod: () => import_chunk_563GVBVT.markInvokeClassMethod,
|
|
45
|
+
parseSdkVersion: () => import_chunk_563GVBVT.parseSdkVersion,
|
|
46
|
+
sameLookupResult: () => import_chunk_563GVBVT.sameLookupResult,
|
|
47
|
+
traverseAst: () => import_chunk_563GVBVT.traverseAst,
|
|
48
|
+
variableDeclarationName: () => import_chunk_563GVBVT.variableDeclarationName,
|
|
49
|
+
visitReferences: () => import_chunk_563GVBVT.visitReferences,
|
|
50
|
+
visit_resources: () => import_chunk_563GVBVT.visit_resources,
|
|
51
|
+
visitorNode: () => import_chunk_563GVBVT.visitorNode
|
|
52
52
|
});
|
|
53
53
|
module.exports = __toCommonJS(api_exports);
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
(0,
|
|
54
|
+
var import_chunk_563GVBVT = require("./chunk-563GVBVT.cjs");
|
|
55
|
+
var import_chunk_HHQDDCTP = require("./chunk-HHQDDCTP.cjs");
|
|
56
|
+
(0, import_chunk_563GVBVT.init_api)();
|
|
57
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
58
|
0 && (module.exports = {
|
|
59
59
|
checkCompilerVersion,
|