@markw65/monkeyc-optimizer 1.1.14 → 1.1.15
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 +11 -0
- package/build/api.cjs +165 -146
- package/build/optimizer.cjs +154 -142
- package/build/sdk-util.cjs +7915 -7196
- package/build/src/optimizer-types.d.ts +1 -0
- package/build/src/readprg/bytecode.d.ts +7 -0
- package/build/src/readprg/dce.d.ts +1 -1
- package/build/src/readprg/opcodes.d.ts +3 -0
- package/build/src/readprg/sharing.d.ts +2 -0
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ export declare type Block = {
|
|
|
36
36
|
try?: ExceptionEntry[];
|
|
37
37
|
next?: number;
|
|
38
38
|
taken?: number;
|
|
39
|
+
preds?: Set<number>;
|
|
39
40
|
};
|
|
40
41
|
export declare type FuncEntry = {
|
|
41
42
|
name?: string;
|
|
@@ -46,5 +47,11 @@ export declare function offsetToString(offset: number): string;
|
|
|
46
47
|
export declare function fixSectionSize(section: SectionKinds, sections: Context["sections"], newSize: number): void;
|
|
47
48
|
export declare function optimizeBytecode(context: Context): void;
|
|
48
49
|
export declare function printFunction(func: FuncEntry, context: Context | null): void;
|
|
50
|
+
export declare function blockToString(block: Block, context: Context | null): string;
|
|
49
51
|
export declare function bytecodeToString(bytecode: Bytecode, symbolTable: SymbolTable | null | undefined): string;
|
|
52
|
+
export declare function findFunctions({ bytecodes, symbolTable, exceptionsMap, }: Context): Map<number, FuncEntry>;
|
|
50
53
|
export declare function makeArgless(bc: Bytecode, op: Opcodes): void;
|
|
54
|
+
export declare function equalBlocks(b1: Block, b2: Block): boolean;
|
|
55
|
+
export declare function removePred(func: FuncEntry, target: number, pred: number): void;
|
|
56
|
+
export declare function addPred(func: FuncEntry, target: number, pred: number): void;
|
|
57
|
+
export declare function redirect(func: FuncEntry, block: Block, from: number, to: number): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FuncEntry, Context } from "./bytecode";
|
|
2
|
-
export declare function localDCE(func: FuncEntry, context: Context):
|
|
2
|
+
export declare function localDCE(func: FuncEntry, context: Context): boolean;
|
|
@@ -252,9 +252,12 @@ export interface Argc extends ByteArg {
|
|
|
252
252
|
}
|
|
253
253
|
export declare 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;
|
|
254
254
|
export declare function parseCode(view: DataView, lineTable: Map<number, LineNumber>): Bytecode[];
|
|
255
|
+
export declare function opcodeSize(op: Opcodes): 1 | 2 | 3 | 5 | 9;
|
|
255
256
|
export declare function emitBytecode(bytecode: Bytecode, view: DataView, offset: number, linktable: Map<number, number>): number;
|
|
256
257
|
export declare function getOpInfo(bytecode: Bytecode): {
|
|
257
258
|
pop: number;
|
|
258
259
|
push: number;
|
|
259
260
|
};
|
|
261
|
+
export declare function isBoolOp(op: Opcodes): boolean;
|
|
262
|
+
export declare function isCondBranch(op: Opcodes): boolean;
|
|
260
263
|
export {};
|
package/package.json
CHANGED