@markw65/monkeyc-optimizer 1.1.50 → 1.1.52

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.
@@ -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: () => import_chunk_6KP65YOB.StateNodeAttributes,
22
- buildOptimizedProject: () => import_chunk_6KP65YOB.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_J5XJWBYV.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_J5XJWBYV.buildOptimizedProject,
23
23
  copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
24
- defaultConfig: () => import_chunk_6KP65YOB.defaultConfig,
25
- display: () => import_chunk_6KP65YOB.display,
26
- generateOneConfig: () => import_chunk_6KP65YOB.generateOneConfig,
27
- generateOptimizedProject: () => import_chunk_6KP65YOB.generateOptimizedProject,
28
- getConfig: () => import_chunk_6KP65YOB.getConfig,
29
- getProjectAnalysis: () => import_chunk_6KP65YOB.getProjectAnalysis,
30
- get_jungle: () => import_chunk_6KP65YOB.get_jungle,
31
- isErrorWithLocation: () => import_chunk_6KP65YOB.isErrorWithLocation,
32
- launchSimulator: () => import_chunk_6KP65YOB.launchSimulator,
33
- manifestProducts: () => import_chunk_6KP65YOB.manifestProducts,
34
- mctree: () => import_chunk_6KP65YOB.mctree,
35
- simulateProgram: () => import_chunk_6KP65YOB.simulateProgram
24
+ defaultConfig: () => import_chunk_J5XJWBYV.defaultConfig,
25
+ display: () => import_chunk_J5XJWBYV.display,
26
+ generateOneConfig: () => import_chunk_J5XJWBYV.generateOneConfig,
27
+ generateOptimizedProject: () => import_chunk_J5XJWBYV.generateOptimizedProject,
28
+ getConfig: () => import_chunk_J5XJWBYV.getConfig,
29
+ getProjectAnalysis: () => import_chunk_J5XJWBYV.getProjectAnalysis,
30
+ get_jungle: () => import_chunk_J5XJWBYV.get_jungle,
31
+ isErrorWithLocation: () => import_chunk_J5XJWBYV.isErrorWithLocation,
32
+ launchSimulator: () => import_chunk_J5XJWBYV.launchSimulator,
33
+ manifestProducts: () => import_chunk_J5XJWBYV.manifestProducts,
34
+ mctree: () => import_chunk_J5XJWBYV.mctree,
35
+ simulateProgram: () => import_chunk_J5XJWBYV.simulateProgram
36
36
  });
37
37
  module.exports = __toCommonJS(optimizer_exports);
38
- var import_chunk_6KP65YOB = require("./chunk-6KP65YOB.cjs");
38
+ var import_chunk_J5XJWBYV = require("./chunk-J5XJWBYV.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, import_chunk_6KP65YOB.init_optimizer)();
42
+ (0, import_chunk_J5XJWBYV.init_optimizer)();
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
45
  StateNodeAttributes,
@@ -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: () => import_chunk_6KP65YOB.SectionKinds,
22
- appSupport: () => import_chunk_6KP65YOB.appSupport,
23
- connectiq: () => import_chunk_6KP65YOB.connectiq,
24
- getDeviceInfo: () => import_chunk_6KP65YOB.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_6KP65YOB.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_6KP65YOB.getLanguages,
27
- getSdkPath: () => import_chunk_6KP65YOB.getSdkPath,
28
- isWin: () => import_chunk_6KP65YOB.isWin,
29
- optimizeProgram: () => import_chunk_6KP65YOB.optimizeProgram,
30
- readPrg: () => import_chunk_6KP65YOB.readPrg,
31
- readPrgWithOffsets: () => import_chunk_6KP65YOB.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_6KP65YOB.xml_util_exports
21
+ SectionKinds: () => import_chunk_J5XJWBYV.SectionKinds,
22
+ appSupport: () => import_chunk_J5XJWBYV.appSupport,
23
+ connectiq: () => import_chunk_J5XJWBYV.connectiq,
24
+ getDeviceInfo: () => import_chunk_J5XJWBYV.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_J5XJWBYV.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_J5XJWBYV.getLanguages,
27
+ getSdkPath: () => import_chunk_J5XJWBYV.getSdkPath,
28
+ isWin: () => import_chunk_J5XJWBYV.isWin,
29
+ optimizeProgram: () => import_chunk_J5XJWBYV.optimizeProgram,
30
+ readPrg: () => import_chunk_J5XJWBYV.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_J5XJWBYV.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_J5XJWBYV.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_6KP65YOB = require("./chunk-6KP65YOB.cjs");
35
+ var import_chunk_J5XJWBYV = require("./chunk-J5XJWBYV.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, import_chunk_6KP65YOB.init_sdk_util)();
39
+ (0, import_chunk_J5XJWBYV.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -9,6 +9,7 @@ import { Bytecode, Opcodes } from "./opcodes";
9
9
  import { SymbolTable } from "./symbols";
10
10
  export declare const enum SectionKinds {
11
11
  HEADER = -805253120,
12
+ HEADER_VERSIONED = -805253107,
12
13
  TEXT = -1059145026,
13
14
  DATA = -629491010,
14
15
  SYMBOLS = 1461170197,
@@ -5,6 +5,7 @@ export type SectionOffset = {
5
5
  code: number;
6
6
  };
7
7
  export type Header = {
8
+ headerVersion: number;
8
9
  ciqVersion: number;
9
10
  backgroundOffsets: SectionOffset;
10
11
  appLock: boolean;
@@ -54,7 +54,28 @@ export declare enum Opcodes {
54
54
  throw = 51,
55
55
  cpush = 52,
56
56
  argc = 53,
57
- newba = 54
57
+ newba = 54,
58
+ ipushz = 55,
59
+ ipush1 = 56,
60
+ ipush2 = 57,
61
+ ipush3 = 58,
62
+ fpushz = 59,
63
+ lpushz = 60,
64
+ dpushz = 61,
65
+ btpush = 62,
66
+ bfpush = 63,
67
+ apush = 64,
68
+ bapush = 65,
69
+ hpush = 66,
70
+ getselfv = 67,
71
+ getself = 68,
72
+ getmv = 69,
73
+ getlocalv = 70,
74
+ getsv = 71,
75
+ invokemz = 72,
76
+ aputvdup = 73,
77
+ argcincsp = 74,
78
+ isnotnull = 75
58
79
  }
59
80
  interface BaseOpcode {
60
81
  op: Opcodes;
@@ -76,6 +97,9 @@ export interface ByteArg extends BaseOpcode {
76
97
  export interface ShortArg extends BaseOpcode {
77
98
  arg: number;
78
99
  }
100
+ export interface ThreeByteArg extends BaseOpcode {
101
+ arg: number;
102
+ }
79
103
  export interface WordArg extends BaseOpcode {
80
104
  arg: number;
81
105
  }
@@ -127,18 +151,27 @@ export interface Xorv extends Argless {
127
151
  export interface Getv extends Argless {
128
152
  op: Opcodes.getv;
129
153
  }
154
+ export interface Getselfv extends WordArg {
155
+ op: Opcodes.getselfv;
156
+ }
130
157
  export interface Putv extends Argless {
131
158
  op: Opcodes.putv;
132
159
  }
133
160
  export interface Invokem extends ByteArg {
134
161
  op: Opcodes.invokem;
135
162
  }
163
+ export interface Invokemz extends Argless {
164
+ op: Opcodes.invokemz;
165
+ }
136
166
  export interface Agetv extends Argless {
137
167
  op: Opcodes.agetv;
138
168
  }
139
169
  export interface Aputv extends Argless {
140
170
  op: Opcodes.aputv;
141
171
  }
172
+ export interface Aputvdup extends Argless {
173
+ op: Opcodes.aputvdup;
174
+ }
142
175
  export type LocalRange = {
143
176
  name: string;
144
177
  id: number;
@@ -150,6 +183,9 @@ export interface LocalInst extends ByteArg {
150
183
  export interface Lgetv extends LocalInst {
151
184
  op: Opcodes.lgetv;
152
185
  }
186
+ export interface Getself extends Argless {
187
+ op: Opcodes.getself;
188
+ }
153
189
  export interface Lputv extends LocalInst {
154
190
  op: Opcodes.lputv;
155
191
  }
@@ -180,6 +216,15 @@ export interface Bf extends ShortArg {
180
216
  export interface Jsr extends ShortArg {
181
217
  op: Opcodes.jsr;
182
218
  }
219
+ export interface Apush extends WordArg {
220
+ op: Opcodes.apush;
221
+ }
222
+ export interface Bapush extends WordArg {
223
+ op: Opcodes.bapush;
224
+ }
225
+ export interface Hpush extends WordArg {
226
+ op: Opcodes.hpush;
227
+ }
183
228
  export interface Eq extends Argless {
184
229
  op: Opcodes.eq;
185
230
  }
@@ -201,6 +246,9 @@ export interface Ne extends Argless {
201
246
  export interface Isnull extends Argless {
202
247
  op: Opcodes.isnull;
203
248
  }
249
+ export interface Isnotnull extends Argless {
250
+ op: Opcodes.isnotnull;
251
+ }
204
252
  export interface Isa extends Argless {
205
253
  op: Opcodes.isa;
206
254
  }
@@ -213,9 +261,24 @@ export interface Ts extends Argless {
213
261
  export interface Ipush extends WordArg {
214
262
  op: Opcodes.ipush;
215
263
  }
264
+ export interface Ipushz extends Argless {
265
+ op: Opcodes.ipushz;
266
+ }
267
+ export interface Ipush1 extends ByteArg {
268
+ op: Opcodes.ipush1;
269
+ }
270
+ export interface Ipush2 extends ShortArg {
271
+ op: Opcodes.ipush2;
272
+ }
273
+ export interface Ipush3 extends ThreeByteArg {
274
+ op: Opcodes.ipush3;
275
+ }
216
276
  export interface Fpush extends FloatArg {
217
277
  op: Opcodes.fpush;
218
278
  }
279
+ export interface Fpushz extends Argless {
280
+ op: Opcodes.fpushz;
281
+ }
219
282
  export interface Spush extends WordArg {
220
283
  op: Opcodes.spush;
221
284
  }
@@ -225,6 +288,12 @@ export interface Frpush extends Argless {
225
288
  export interface Bpush extends ByteArg {
226
289
  op: Opcodes.bpush;
227
290
  }
291
+ export interface Btpush extends Argless {
292
+ op: Opcodes.btpush;
293
+ }
294
+ export interface Bfpush extends Argless {
295
+ op: Opcodes.bfpush;
296
+ }
228
297
  export interface Npush extends Argless {
229
298
  op: Opcodes.npush;
230
299
  }
@@ -240,12 +309,36 @@ export interface Newd extends Argless {
240
309
  export interface Getm extends Argless {
241
310
  op: Opcodes.getm;
242
311
  }
312
+ export interface Getmv extends BaseOpcode {
313
+ op: Opcodes.getmv;
314
+ arg: {
315
+ module: number;
316
+ var: number;
317
+ };
318
+ }
319
+ export interface Getlocalv extends BaseOpcode {
320
+ op: Opcodes.getlocalv;
321
+ arg: {
322
+ local: number;
323
+ var: number;
324
+ };
325
+ range?: LocalRange;
326
+ }
327
+ export interface Getsv extends WordArg {
328
+ op: Opcodes.getsv;
329
+ }
243
330
  export interface Lpush extends LongArg {
244
331
  op: Opcodes.lpush;
245
332
  }
333
+ export interface Lpushz extends Argless {
334
+ op: Opcodes.lpushz;
335
+ }
246
336
  export interface Dpush extends DoubleArg {
247
337
  op: Opcodes.dpush;
248
338
  }
339
+ export interface Dpushz extends Argless {
340
+ op: Opcodes.dpushz;
341
+ }
249
342
  export interface Throw extends Argless {
250
343
  op: Opcodes.throw;
251
344
  }
@@ -258,9 +351,16 @@ export interface Newba extends Argless {
258
351
  export interface Argc extends ByteArg {
259
352
  op: Opcodes.argc;
260
353
  }
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;
354
+ export interface Argcincsp extends BaseOpcode {
355
+ op: Opcodes.argcincsp;
356
+ arg: {
357
+ argc: number;
358
+ incsp: number;
359
+ };
360
+ }
361
+ 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 | Ipushz | Ipush1 | Ipush2 | Ipush3 | Fpushz | Lpushz | Dpushz | Btpush | Bfpush | Apush | Bapush | Hpush | Getselfv | Getself | Getmv | Getlocalv | Getsv | Invokemz | Aputvdup | Argcincsp | Isnotnull;
262
362
  export declare function parseCode(view: DataView, lineTable: Map<number, LineNumber>): Bytecode[];
263
- export declare function opcodeSize(op: Opcodes): 1 | 2 | 3 | 5 | 9;
363
+ export declare function opcodeSize(op: Opcodes): 1 | 2 | 3 | 4 | 5 | 6 | 9;
264
364
  export declare function emitBytecode(bytecode: Bytecode, view: DataView, offset: number, linktable: Map<number, number>, shift_hack: boolean): number;
265
365
  export declare function getOpInfo(bytecode: Bytecode): {
266
366
  pop: number;
@@ -274,6 +374,7 @@ export declare const enum Effects {
274
374
  Call = 8
275
375
  }
276
376
  export declare function getOpEffects(bytecode: Bytecode): number;
377
+ export declare function opReadsLocal(bytecode: Bytecode): number | null;
277
378
  export declare function isBoolOp(op: Opcodes): boolean;
278
379
  export declare function isCondBranch(op: Opcodes): boolean;
279
380
  export {};
@@ -14,6 +14,7 @@ export type DeviceInfo = {
14
14
  deviceFamily: string;
15
15
  displayName: string;
16
16
  languages: Record<string, true>;
17
+ ciqVersions: Array<string>;
17
18
  };
18
19
  };
19
20
  export declare function getDeviceInfo(): Promise<DeviceInfo>;
@@ -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_6KP65YOB = require("./chunk-6KP65YOB.cjs");
24
+ var import_chunk_J5XJWBYV = require("./chunk-J5XJWBYV.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, import_chunk_6KP65YOB.init_worker_task)();
31
+ (0, import_chunk_J5XJWBYV.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_6KP65YOB.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_J5XJWBYV.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.50",
4
+ "version": "1.1.52",
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",