Skip to content

Commit

Permalink
Slightly optimize skipping of a binary segment
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorng committed Aug 21, 2023
1 parent e86952e commit e7d2ce0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions erts/emulator/beam/jit/arm/instr_bs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,23 @@ void BeamModuleAssembler::emit_i_bs_skip_bits2(const ArgRegister &Ctx,
a.cmp(TMP3, TMP4);
a.b_hi(resolve_beam_label(Fail, disp1MB));

a.stur(TMP3, emit_boxed_val(ctx.reg, position_offset));
} else if (Unit.get() == 8) {
const int position_offset = offsetof(ErlBinMatchState, mb.offset);
const int size_offset = offsetof(ErlBinMatchState, mb.size);
auto [ctx, size] = load_sources(Ctx, TMP1, Size, TMP2);

a.eor(ARG1, size.reg, imm(_TAG_IMMED1_SMALL));
a.tst(ARG1, imm(0xFFF0000000000000UL | _TAG_IMMED1_MASK));
a.b_ne(resolve_beam_label(Fail, disp1MB));

a.ldur(TMP3, emit_boxed_val(ctx.reg, position_offset));
a.ldur(TMP4, emit_boxed_val(ctx.reg, size_offset));

a.add(TMP3, TMP3, ARG1, arm::lsr(1));
a.cmp(TMP3, TMP4);
a.b_hi(resolve_beam_label(Fail, disp1MB));

a.stur(TMP3, emit_boxed_val(ctx.reg, position_offset));
} else if (emit_bs_get_field_size(Size, Unit.get(), fail, ARG1) >= 0) {
emit_bs_skip_bits(Fail, Ctx);
Expand Down

0 comments on commit e7d2ce0

Please sign in to comment.