Skip to content

Commit 6a54c14

Browse files
committed
[mono][interp] Completely remove short branches
They don't seem to have any benefit at the expense of a lot of code and added complexity.
1 parent 189a250 commit 6a54c14

File tree

6 files changed

+15
-377
lines changed

6 files changed

+15
-377
lines changed

src/mono/browser/runtime/jiterpreter-trace-generator.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ export function generateBackwardBranchTable (
218218

219219
switch (opcode) {
220220
case MintOpcode.MINT_CALL_HANDLER:
221-
case MintOpcode.MINT_CALL_HANDLER_S:
222221
// While this formally isn't a backward branch target, we want to record
223222
// the offset of its following instruction so that the jiterpreter knows
224223
// to generate the necessary dispatch code to enable branching back to it.
@@ -506,21 +505,15 @@ export function generateWasmBody (
506505
}
507506

508507
// Other conditional branch types are handled by the relop table.
509-
case MintOpcode.MINT_BRFALSE_I4_S:
510-
case MintOpcode.MINT_BRTRUE_I4_S:
511508
case MintOpcode.MINT_BRFALSE_I4_SP:
512509
case MintOpcode.MINT_BRTRUE_I4_SP:
513-
case MintOpcode.MINT_BRFALSE_I8_S:
514-
case MintOpcode.MINT_BRTRUE_I8_S:
515510
if (!emit_branch(builder, ip, frame, opcode))
516511
ip = abort;
517512
else
518513
isConditionallyExecuted = true;
519514
break;
520515

521-
case MintOpcode.MINT_BR_S:
522516
case MintOpcode.MINT_CALL_HANDLER:
523-
case MintOpcode.MINT_CALL_HANDLER_S:
524517
if (!emit_branch(builder, ip, frame, opcode))
525518
ip = abort;
526519
else {
@@ -1293,7 +1286,6 @@ export function generateWasmBody (
12931286
// These are generated in place of regular LEAVEs inside of the body of a catch clause.
12941287
// We can safely assume that during normal execution, catch clauses won't be running.
12951288
case MintOpcode.MINT_LEAVE_CHECK:
1296-
case MintOpcode.MINT_LEAVE_S_CHECK:
12971289
append_bailout(builder, ip, BailoutReason.LeaveCheck);
12981290
pruneOpcodes = true;
12991291
break;
@@ -2745,8 +2737,7 @@ function append_call_handler_store_ret_ip (
27452737
builder: WasmBuilder, ip: MintOpcodePtr,
27462738
frame: NativePointer, opcode: MintOpcode
27472739
) {
2748-
const shortOffset = (opcode === MintOpcode.MINT_CALL_HANDLER_S),
2749-
retIp = shortOffset ? <any>ip + (3 * 2) : <any>ip + (4 * 2),
2740+
const retIp = <any>ip + (4 * 2),
27502741
clauseIndex = getU16(retIp - 2),
27512742
clauseDataOffset = get_imethod_clause_data_offset(frame, clauseIndex);
27522743

@@ -2773,9 +2764,6 @@ function getBranchDisplacement (
27732764
case MintOpArgType.MintOpBranch:
27742765
result = getI32_unaligned(payloadAddress);
27752766
break;
2776-
case MintOpArgType.MintOpShortBranch:
2777-
result = getI16(payloadAddress);
2778-
break;
27792767
case MintOpArgType.MintOpShortAndBranch:
27802768
result = getI32_unaligned(payloadAddress + 2);
27812769
break;
@@ -2808,11 +2796,8 @@ function emit_branch (
28082796
// branch target (if possible), bailing out at the end otherwise
28092797
switch (opcode) {
28102798
case MintOpcode.MINT_CALL_HANDLER:
2811-
case MintOpcode.MINT_CALL_HANDLER_S:
2812-
case MintOpcode.MINT_BR:
2813-
case MintOpcode.MINT_BR_S: {
2814-
const isCallHandler = (opcode === MintOpcode.MINT_CALL_HANDLER) ||
2815-
(opcode === MintOpcode.MINT_CALL_HANDLER_S);
2799+
case MintOpcode.MINT_BR: {
2800+
const isCallHandler = opcode === MintOpcode.MINT_CALL_HANDLER;
28162801

28172802
const destination = <any>ip + (displacement * 2);
28182803

0 commit comments

Comments
 (0)