@markw65/monkeyc-optimizer 1.1.33 → 1.1.34

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 (80) hide show
  1. package/README.md +1 -932
  2. package/build/api.cjs +31 -31
  3. package/build/{chunk-7ANQTFGD.cjs → chunk-QBCVUVLD.cjs} +163 -46
  4. package/build/optimizer.cjs +17 -17
  5. package/build/sdk-util.cjs +14 -14
  6. package/build/src/api.d.ts +1 -1
  7. package/build/src/readprg.d.ts +0 -6
  8. package/build/src/src/api.d.ts +51 -0
  9. package/build/src/src/ast.d.ts +59 -0
  10. package/build/src/src/build.d.ts +7 -0
  11. package/build/src/src/cftinfo.d.ts +32 -0
  12. package/build/src/src/control-flow.d.ts +22 -0
  13. package/build/src/src/data-flow.d.ts +107 -0
  14. package/build/src/src/driver.d.ts +2 -0
  15. package/build/src/src/function-info.d.ts +14 -0
  16. package/build/src/src/inliner.d.ts +13 -0
  17. package/build/src/src/jungles.d.ts +66 -0
  18. package/build/src/src/launch.d.ts +5 -0
  19. package/build/src/src/logger.d.ts +6 -0
  20. package/build/src/src/manifest.d.ts +11 -0
  21. package/build/src/src/mc-rewrite.d.ts +13 -0
  22. package/build/src/src/negative-fixups.d.ts +1 -0
  23. package/build/src/src/optimizer-types.d.ts +249 -0
  24. package/build/src/src/optimizer.d.ts +100 -0
  25. package/build/src/src/pragma-checker.d.ts +3 -0
  26. package/build/src/src/pre.d.ts +2 -0
  27. package/build/src/src/projects.d.ts +26 -0
  28. package/build/src/src/readprg/array-init.d.ts +3 -0
  29. package/build/src/src/readprg/bytecode.d.ts +72 -0
  30. package/build/src/src/readprg/cflow.d.ts +17 -0
  31. package/build/src/src/readprg/data.d.ts +4 -0
  32. package/build/src/src/readprg/dce.d.ts +6 -0
  33. package/build/src/src/readprg/emit.d.ts +23 -0
  34. package/build/src/src/readprg/exceptions.d.ts +10 -0
  35. package/build/src/src/readprg/header.d.ts +15 -0
  36. package/build/src/src/readprg/interp.d.ts +21 -0
  37. package/build/src/src/readprg/linenum.d.ts +29 -0
  38. package/build/src/src/readprg/locals.d.ts +3 -0
  39. package/build/src/src/readprg/opcodes.d.ts +279 -0
  40. package/build/src/src/readprg/optimize.d.ts +3 -0
  41. package/build/src/src/readprg/pre.d.ts +2 -0
  42. package/build/src/src/readprg/sharing.d.ts +2 -0
  43. package/build/src/src/readprg/signer.d.ts +8 -0
  44. package/build/src/src/readprg/symbols.d.ts +19 -0
  45. package/build/src/src/readprg.d.ts +25 -0
  46. package/build/src/src/resources.d.ts +12 -0
  47. package/build/src/src/sdk-util.d.ts +28 -0
  48. package/build/src/src/type-flow/could-be.d.ts +5 -0
  49. package/build/src/src/type-flow/dead-store.d.ts +18 -0
  50. package/build/src/src/type-flow/interp-binary.d.ts +4 -0
  51. package/build/src/src/type-flow/interp-call.d.ts +16 -0
  52. package/build/src/src/type-flow/interp.d.ts +33 -0
  53. package/build/src/src/type-flow/intersection-type.d.ts +4 -0
  54. package/build/src/src/type-flow/minimize-locals.d.ts +4 -0
  55. package/build/src/src/type-flow/minimize-modules.d.ts +3 -0
  56. package/build/src/src/type-flow/optimize.d.ts +7 -0
  57. package/build/src/src/type-flow/sub-type.d.ts +2 -0
  58. package/build/src/src/type-flow/type-flow-util.d.ts +27 -0
  59. package/build/src/src/type-flow/types.d.ts +204 -0
  60. package/build/src/src/type-flow/union-type.d.ts +4 -0
  61. package/build/src/src/type-flow.d.ts +18 -0
  62. package/build/src/src/unused-exprs.d.ts +3 -0
  63. package/build/src/src/util.d.ts +33 -0
  64. package/build/src/src/variable-renamer.d.ts +4 -0
  65. package/build/src/src/visitor.d.ts +5 -0
  66. package/build/src/src/worker-pool.d.ts +4 -0
  67. package/build/src/src/worker-task.d.ts +88 -0
  68. package/build/src/src/worker-thread.d.ts +1 -0
  69. package/build/src/src/xml-util.d.ts +172 -0
  70. package/build/src/test/mocha/bytecode.spec.d.ts +1 -0
  71. package/build/src/test/mocha/coudbe.spec.d.ts +2 -0
  72. package/build/src/test/mocha/intersection.spec.d.ts +2 -0
  73. package/build/src/test/mocha/root.spec.d.ts +1 -0
  74. package/build/src/test/mocha/subtype.spec.d.ts +2 -0
  75. package/build/src/test/mocha/test-utils.d.ts +6 -0
  76. package/build/src/test/mocha/types.spec.d.ts +1 -0
  77. package/build/src/type-flow/interp.d.ts +3 -1
  78. package/build/src/type-flow/types.d.ts +1 -1
  79. package/build/worker-thread.cjs +3 -3
  80. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import { ProgramStateAnalysis } from "../../src/optimizer-types";
2
+ export declare function couldBeTests(statefn: () => ProgramStateAnalysis | null): void;
@@ -0,0 +1,2 @@
1
+ import { ProgramStateAnalysis } from "../../src/optimizer-types";
2
+ export declare function intersectionTests(statefn: () => ProgramStateAnalysis | null): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ProgramStateAnalysis } from "../../src/optimizer-types";
2
+ export declare function subtypeOfTests(statefn: () => ProgramStateAnalysis | null): void;
@@ -0,0 +1,6 @@
1
+ import { BuildConfig, ProgramStateAnalysis, StateNodeDecl } from "../../src/optimizer-types";
2
+ import { ExactOrUnion } from "../../src/type-flow/types";
3
+ export declare function create_program_analysis(source: string, filename: string, config: BuildConfig): Promise<ProgramStateAnalysis>;
4
+ export declare function find_by_name(state: ProgramStateAnalysis, name: string): StateNodeDecl[];
5
+ export declare function find_type_by_name(state: ProgramStateAnalysis, name: string): ExactOrUnion;
6
+ export declare function assertNonNull<T>(obj: T, message?: string): asserts obj is NonNullable<T>;
@@ -0,0 +1 @@
1
+ export declare function typeTests(): void;
@@ -1,6 +1,6 @@
1
1
  import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
2
  import { DiagnosticType, FunctionStateNode, ProgramStateAnalysis } from "../optimizer-types";
3
- import { ExactOrUnion } from "./types";
3
+ import { ExactOrUnion, ObjectType } from "./types";
4
4
  export type TypeMap = Map<mctree.Node, ExactOrUnion>;
5
5
  export type InterpStackElem = {
6
6
  value: ExactOrUnion;
@@ -29,3 +29,5 @@ export declare function deEnumerate(t: ExactOrUnion): ExactOrUnion;
29
29
  export declare function evaluateNode(istate: InterpState, node: mctree.Node): void;
30
30
  export declare function roundToFloat(value: number): number;
31
31
  export declare function mustBeIdentical(a: ExactOrUnion, b: ExactOrUnion): boolean;
32
+ export declare function isByteArray(object: ExactOrUnion): boolean | undefined;
33
+ export declare function isByteArrayData(objectData: NonNullable<ObjectType["value"]>): boolean | undefined;
@@ -26,7 +26,7 @@ export declare const enum TypeTag {
26
26
  Typedef = 262144,
27
27
  Any = 524287
28
28
  }
29
- export declare function typeTagName(tag: TypeTag): "Never" | "Null" | "False" | "True" | "Boolean" | "Number" | "Long" | "Float" | "Double" | "Decimal" | "Numeric" | "Char" | "String" | "Array" | "Dictionary" | "Method" | "Module" | "Function" | "Class" | "Object" | "Enum" | "Symbol" | "Typedef" | "Any";
29
+ export declare function typeTagName(tag: TypeTag): "Symbol" | "Object" | "Number" | "Float" | "Double" | "Long" | "String" | "Char" | "Boolean" | "Null" | "Never" | "False" | "True" | "Decimal" | "Numeric" | "Array" | "Dictionary" | "Method" | "Module" | "Function" | "Class" | "Enum" | "Typedef" | "Any";
30
30
  export declare const LastTypeTag = TypeTag.Typedef;
31
31
  export declare const SingletonTypeTagsConst: number;
32
32
  export declare const UnionDataTypeTagsConst: number;
@@ -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 import_chunk_7ANQTFGD = require("./chunk-7ANQTFGD.cjs");
24
+ var import_chunk_QBCVUVLD = require("./chunk-QBCVUVLD.cjs");
25
25
  var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.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, import_chunk_7ANQTFGD.init_worker_task)();
31
+ (0, import_chunk_QBCVUVLD.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, import_chunk_7ANQTFGD.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_QBCVUVLD.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.33",
4
+ "version": "1.1.34",
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",