watr 4.3.4 → 4.4.0
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/dist/watr.js +1159 -440
- package/dist/watr.min.js +6 -6
- package/package.json +1 -1
- package/src/optimize.js +1381 -534
- package/types/src/optimize.d.ts +90 -0
- package/types/src/optimize.d.ts.map +1 -1
- package/dist/watr.wat +0 -128517
package/types/src/optimize.d.ts
CHANGED
|
@@ -83,5 +83,95 @@ export namespace OPTS {
|
|
|
83
83
|
let branch: boolean;
|
|
84
84
|
let propagate: boolean;
|
|
85
85
|
let inline: boolean;
|
|
86
|
+
let vacuum: boolean;
|
|
87
|
+
let peephole: boolean;
|
|
88
|
+
let globals: boolean;
|
|
89
|
+
let offset: boolean;
|
|
90
|
+
let unbranch: boolean;
|
|
91
|
+
let stripmut: boolean;
|
|
92
|
+
let brif: boolean;
|
|
93
|
+
let foldarms: boolean;
|
|
94
|
+
let dedupe: boolean;
|
|
95
|
+
let reorder: boolean;
|
|
96
|
+
let dedupTypes: boolean;
|
|
97
|
+
let packData: boolean;
|
|
98
|
+
let minifyImports: boolean;
|
|
86
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Remove no-op code: nops, drop of pure expressions, empty branches,
|
|
102
|
+
* and select with identical arms.
|
|
103
|
+
* @param {Array} ast
|
|
104
|
+
* @returns {Array}
|
|
105
|
+
*/
|
|
106
|
+
export function vacuum(ast: any[]): any[];
|
|
107
|
+
/**
|
|
108
|
+
* Apply peephole optimizations.
|
|
109
|
+
* @param {Array} ast
|
|
110
|
+
* @returns {Array}
|
|
111
|
+
*/
|
|
112
|
+
export function peephole(ast: any[]): any[];
|
|
113
|
+
/**
|
|
114
|
+
* Replace global.get of immutable globals with their constant init values.
|
|
115
|
+
* @param {Array} ast
|
|
116
|
+
* @returns {Array}
|
|
117
|
+
*/
|
|
118
|
+
export function globals(ast: any[]): any[];
|
|
119
|
+
/** Match (type.load/store (i32.add ptr (type.const N))) and fold offset */
|
|
120
|
+
export function offset(ast: any): any;
|
|
121
|
+
/**
|
|
122
|
+
* Remove br to a block's own label when it is the last instruction.
|
|
123
|
+
* @param {Array} ast
|
|
124
|
+
* @returns {Array}
|
|
125
|
+
*/
|
|
126
|
+
export function unbranch(ast: any[]): any[];
|
|
127
|
+
/**
|
|
128
|
+
* Strip mutability from globals that are never written.
|
|
129
|
+
* Enables globals constant-propagation for more globals.
|
|
130
|
+
* @param {Array} ast
|
|
131
|
+
* @returns {Array}
|
|
132
|
+
*/
|
|
133
|
+
export function stripmut(ast: any[]): any[];
|
|
134
|
+
/**
|
|
135
|
+
* Simplify (if cond (then (br $label))) → (br_if $label cond)
|
|
136
|
+
* and (if cond (then) (else (br $label))) → (br_if $label (i32.eqz cond))
|
|
137
|
+
* Only when the br is the sole instruction in the arm.
|
|
138
|
+
* @param {Array} ast
|
|
139
|
+
* @returns {Array}
|
|
140
|
+
*/
|
|
141
|
+
export function brif(ast: any[]): any[];
|
|
142
|
+
/**
|
|
143
|
+
* Fold identical trailing code out of if/else arms.
|
|
144
|
+
* (if cond (then A X) (else B X)) → (if cond (then A) (else B)) X
|
|
145
|
+
* @param {Array} ast
|
|
146
|
+
* @returns {Array}
|
|
147
|
+
*/
|
|
148
|
+
export function foldarms(ast: any[]): any[];
|
|
149
|
+
/**
|
|
150
|
+
* Eliminate duplicate functions by hashing bodies.
|
|
151
|
+
* Keeps the first occurrence and redirects all references to it.
|
|
152
|
+
* @param {Array} ast
|
|
153
|
+
* @returns {Array}
|
|
154
|
+
*/
|
|
155
|
+
export function dedupe(ast: any[]): any[];
|
|
156
|
+
export function reorder(ast: any): any;
|
|
157
|
+
/**
|
|
158
|
+
* Merge structurally identical (type ...) definitions.
|
|
159
|
+
* Keeps the first occurrence and redirects all references.
|
|
160
|
+
* @param {Array} ast
|
|
161
|
+
* @returns {Array}
|
|
162
|
+
*/
|
|
163
|
+
export function dedupTypes(ast: any[]): any[];
|
|
164
|
+
/**
|
|
165
|
+
* Pack data segments: trim trailing zeros and merge adjacent constant-offset segments.
|
|
166
|
+
* @param {Array} ast
|
|
167
|
+
* @returns {Array}
|
|
168
|
+
*/
|
|
169
|
+
export function packData(ast: any[]): any[];
|
|
170
|
+
/**
|
|
171
|
+
* Minify import module and field names for smaller binaries.
|
|
172
|
+
* Only safe when you control the host environment.
|
|
173
|
+
* @param {Array} ast
|
|
174
|
+
* @returns {Array}
|
|
175
|
+
*/
|
|
176
|
+
export function minifyImports(ast: any[]): any[];
|
|
87
177
|
//# sourceMappingURL=optimize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimize.d.ts","sourceRoot":"","sources":["../../src/optimize.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optimize.d.ts","sourceRoot":"","sources":["../../src/optimize.js"],"names":[],"mappings":"AA2+DA;;;;;;;;;;;GAWG;AACH,sCATW,QAAM,MAAM,SACZ,OAAO,GAAC,MAAM,MAAO,SA6C/B;AA34DD;;;;;GAKG;AACH,6CAsIC;AA6ID;;;;GAIG;AACH,wCAwBC;AAoMD;;;;GAIG;AACH,4CAuBC;AA+CD;;;;;GAKG;AACH,8CAqDC;AAjRD;;;;GAIG;AACH,4CASC;AAID;;;;GAIG;AACH,4CA6DC;AAID;;;;GAIG;AACH,0CAuCC;AAwVD;;;;GAIG;AACH,yCAwBC;AAID;;;;GAIG;AACH,0CAwFC;AApiCD;;;;GAIG;AACH,gCAHW,OAAO,GAAC,MAAM,MAAO,OAgB/B;;;;;;;;;;;;;;;;;;;;;;;;;AAshCD;;;;;GAKG;AACH,0CAgDC;AAyED;;;;GAIG;AACH,4CAQC;AAID;;;;GAIG;AACH,2CA0CC;AAID,2EAA2E;AAC3E,sCAgEC;AAID;;;;GAIG;AACH,4CAuCC;AAID;;;;;GAKG;AACH,4CAsBC;AAID;;;;;;GAMG;AACH,wCAmBC;AAID;;;;;GAKG;AACH,4CAsCC;AAoCD;;;;;GAKG;AACH,0CA+DC;AAoWD,uCA0BC;AA1XD;;;;;GAKG;AACH,8CA0EC;AAoID;;;;GAIG;AACH,4CA0DC;AAqBD;;;;;GAKG;AACH,iDAiBC"}
|