rm push/pop

This commit is contained in:
2026-02-26 08:13:18 -06:00
parent eb19b18594
commit a1b41d5ecf
59 changed files with 19546 additions and 19265 deletions

18
cfg.ce
View File

@@ -168,7 +168,7 @@ var run = function() {
if (is_array(instr)) {
if (block_start_pcs[text(pc)]) {
if (current_block != null) {
push(blocks, current_block)
blocks[] = current_block
}
current_block = {
id: length(blocks),
@@ -184,7 +184,7 @@ var run = function() {
}
if (current_block != null) {
push(current_block.instrs, {pc: pc, instr: instr})
current_block.instrs[] = {pc: pc, instr: instr}
current_block.end_pc = pc
n = length(instr)
line_num = instr[n - 2]
@@ -200,7 +200,7 @@ var run = function() {
ii = ii + 1
}
if (current_block != null) {
push(blocks, current_block)
blocks[] = current_block
}
// Build block index
@@ -235,19 +235,19 @@ var run = function() {
if (target_bi <= bi) {
edge_type = "loop back-edge"
}
push(blk.edges, {target: target_bi, kind: edge_type})
blk.edges[] = {target: target_bi, kind: edge_type}
}
if (is_conditional_jump(last_op)) {
if (bi + 1 < length(blocks)) {
push(blk.edges, {target: bi + 1, kind: "fallthrough"})
blk.edges[] = {target: bi + 1, kind: "fallthrough"}
}
}
} else if (is_terminator(last_op)) {
push(blk.edges, {target: -1, kind: "EXIT (" + last_op + ")"})
blk.edges[] = {target: -1, kind: "EXIT (" + last_op + ")"}
} else {
if (bi + 1 < length(blocks)) {
push(blk.edges, {target: bi + 1, kind: "fallthrough"})
blk.edges[] = {target: bi + 1, kind: "fallthrough"}
}
}
}
@@ -308,7 +308,7 @@ var run = function() {
parts = []
j = 1
while (j < n - 2) {
push(parts, fmt_val(instr[j]))
parts[] = fmt_val(instr[j])
j = j + 1
}
operands = text(parts, ", ")
@@ -381,7 +381,7 @@ var run = function() {
parts = []
j = 1
while (j < n - 2) {
push(parts, fmt_val(instr[j]))
parts[] = fmt_val(instr[j])
j = j + 1
}
operands = text(parts, ", ")