Don't special-case br_table with an empty table.
Empty br_table tables are very uncommon (they're easy for wasm producers to optimize away), so we don't need to special-case them.
This commit is contained in:
@@ -523,7 +523,6 @@ fn translate_operator(op: &Operator,
|
||||
if jump_args_count == 0 {
|
||||
// No jump arguments
|
||||
let val = stack.pop().unwrap();
|
||||
if depths.len() > 0 {
|
||||
let jt = builder.create_jump_table();
|
||||
for (index, depth) in depths.iter().enumerate() {
|
||||
let i = control_stack.len() - 1 - (*depth as usize);
|
||||
@@ -533,7 +532,6 @@ fn translate_operator(op: &Operator,
|
||||
frame.set_reachable();
|
||||
}
|
||||
builder.ins().br_table(val, jt);
|
||||
}
|
||||
let i = control_stack.len() - 1 - (default as usize);
|
||||
let frame = &mut control_stack[i];
|
||||
let ebb = frame.br_destination();
|
||||
@@ -546,7 +544,6 @@ fn translate_operator(op: &Operator,
|
||||
let val = stack.pop().unwrap();
|
||||
let cut_index = stack.len() - jump_args_count;
|
||||
let jump_args = stack.split_off(cut_index);
|
||||
if depths.len() > 0 {
|
||||
let jt = builder.create_jump_table();
|
||||
let dest_ebbs: HashMap<usize, Ebb> = depths
|
||||
.iter()
|
||||
@@ -577,13 +574,6 @@ fn translate_operator(op: &Operator,
|
||||
frame.set_reachable();
|
||||
}
|
||||
state.real_unreachable_stack_depth = 1 + min_depth as usize;
|
||||
} else {
|
||||
let ebb = control_stack[control_stack.len() - 1 - (default as usize)]
|
||||
.br_destination();
|
||||
builder.ins().jump(ebb, jump_args.as_slice());
|
||||
stack.extend(jump_args);
|
||||
state.real_unreachable_stack_depth = 1 + min_depth as usize;
|
||||
}
|
||||
}
|
||||
}
|
||||
Operator::Return => {
|
||||
|
||||
Reference in New Issue
Block a user