@markw65/monkeyc-optimizer 1.0.31 → 1.0.32

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 CHANGED
@@ -378,3 +378,9 @@ Bug Fixes
378
378
  - Collect info about what each function may modify and call
379
379
  - Better analysis of inline function bodies
380
380
  - Update the StateNodeDecls when renaming locals
381
+
382
+ ### 1.0.32
383
+
384
+ - Bug fixes
385
+ - Fixup the tests to run unoptimized again, and add running unoptimized to the standard test run
386
+ - Fix PRE to not merge Numbers and Floats (ie 1 is not the same thing as 1.0), and add a test
package/build/api.cjs CHANGED
@@ -1980,6 +1980,7 @@ var priorityqueuejs = __webpack_require__(2789);
1980
1980
 
1981
1981
 
1982
1982
 
1983
+
1983
1984
  /**
1984
1985
  * This implements a pseudo Partial Redundancy Elimination
1985
1986
  * pass. It isn't quite like traditional PRE because we're
@@ -2164,10 +2165,13 @@ function buildPREGraph(state, func) {
2164
2165
  break;
2165
2166
  case "Literal":
2166
2167
  if (refCost(node) > LocalRefCost) {
2167
- let decl = literals.get(node.value);
2168
+ const key = LiteralIntegerRe.test(node.raw)
2169
+ ? BigInt(node.value)
2170
+ : node.value;
2171
+ let decl = literals.get(key);
2168
2172
  if (!decl) {
2169
2173
  decl = node;
2170
- literals.set(node.value, decl);
2174
+ literals.set(key, decl);
2171
2175
  }
2172
2176
  return {
2173
2177
  type: "ref",
@@ -12672,6 +12672,7 @@ var priorityqueuejs = __webpack_require__(2789);
12672
12672
 
12673
12673
 
12674
12674
 
12675
+
12675
12676
  /**
12676
12677
  * This implements a pseudo Partial Redundancy Elimination
12677
12678
  * pass. It isn't quite like traditional PRE because we're
@@ -12856,10 +12857,13 @@ function buildPREGraph(state, func) {
12856
12857
  break;
12857
12858
  case "Literal":
12858
12859
  if (refCost(node) > LocalRefCost) {
12859
- let decl = literals.get(node.value);
12860
+ const key = prettier_plugin_monkeyc_namespaceObject.LiteralIntegerRe.test(node.raw)
12861
+ ? BigInt(node.value)
12862
+ : node.value;
12863
+ let decl = literals.get(key);
12860
12864
  if (!decl) {
12861
12865
  decl = node;
12862
- literals.set(node.value, decl);
12866
+ literals.set(key, decl);
12863
12867
  }
12864
12868
  return {
12865
12869
  type: "ref",
@@ -15458,7 +15462,7 @@ async function generateOneConfig(buildConfig, dependencyFiles, config) {
15458
15462
  // the oldest optimized file, we don't need to regenerate
15459
15463
  const source_time = await (0,external_util_cjs_namespaceObject.last_modified)(Object.keys(fnMap).concat(dependencyFiles));
15460
15464
  const opt_time = await (0,external_util_cjs_namespaceObject.first_modified)(Object.values(fnMap).map((v) => v.output));
15461
- if (source_time < opt_time && 1657670997056 < opt_time) {
15465
+ if (source_time < opt_time && 1657744666168 < opt_time) {
15462
15466
  return { hasTests, diagnostics: prevDiagnostics };
15463
15467
  }
15464
15468
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "module",
4
- "version": "1.0.31",
4
+ "version": "1.0.32",
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",
@@ -20,11 +20,11 @@
20
20
  "build-debug": "webpack --mode development",
21
21
  "build-release": "webpack --mode production",
22
22
  "prepack": "webpack --mode production",
23
- "test": "npm run test-optimized && npm run test-remote",
23
+ "test": "npm run test-optimized && npm run test-unopt && npm run test-remote",
24
24
  "test-remote": "node ./test/test.js --product=pick-one --github",
25
- "test-optimized": "node test/test.js --run-tests --product=fenix5 --product=fr235 --jungle $(pwd)/test/OptimizerTests/monkey.jungle",
26
- "test-unopt": "node test/test.js --skipOptimization --run-tests --product=fenix5 --product=fr235 --jungle $(pwd)/test/OptimizerTests/monkey.jungle",
27
- "test-garmin-opt": "node test/test.js --skipOptimization --garminOptLevel=2 --run-tests --product=fenix5 --product=fr235 --jungle $(pwd)/test/OptimizerTests/monkey.jungle",
25
+ "test-optimized": "node test/test.js --typeCheckLevel Strict --run-tests --product=fenix5 --product=fr235 --jungle $(pwd)/test/OptimizerTests/monkey.jungle",
26
+ "test-unopt": "node test/test.js --typeCheckLevel Strict --skipOptimization --run-tests --product=fenix5 --product=fr235 --jungle $(pwd)/test/OptimizerTests/monkey.jungle",
27
+ "test-garmin-opt": "node test/test.js --typeCheckLevel Strict --skipOptimization --garminOptLevel=2 --run-tests --product=fenix5 --product=fr235 --jungle $(pwd)/test/OptimizerTests/monkey.jungle",
28
28
  "eslint": "npx eslint ."
29
29
  },
30
30
  "files": [