@@ -1444,10 +1444,6 @@ int Assembler::branch_offset(Label* L) {
14441444 L->link_to (pc_offset ());
14451445 }
14461446
1447- // Block the emission of the constant pool, since the branch instruction must
1448- // be emitted at the pc offset recorded by the label.
1449- if (!is_const_pool_blocked ()) BlockConstPoolFor (1 );
1450-
14511447 return target_pos - (pc_offset () + Instruction::kPcLoadDelta );
14521448}
14531449
@@ -1458,6 +1454,11 @@ void Assembler::b(int branch_offset, Condition cond, RelocInfo::Mode rmode) {
14581454 int imm24 = branch_offset >> 2 ;
14591455 const bool b_imm_check = is_int24 (imm24);
14601456 CHECK (b_imm_check);
1457+
1458+ // Block the emission of the constant pool before the next instruction.
1459+ // Otherwise the passed-in branch offset would be off.
1460+ BlockConstPoolFor (1 );
1461+
14611462 emit (cond | B27 | B25 | (imm24 & kImm24Mask ));
14621463
14631464 if (cond == al) {
@@ -1472,6 +1473,11 @@ void Assembler::bl(int branch_offset, Condition cond, RelocInfo::Mode rmode) {
14721473 int imm24 = branch_offset >> 2 ;
14731474 const bool bl_imm_check = is_int24 (imm24);
14741475 CHECK (bl_imm_check);
1476+
1477+ // Block the emission of the constant pool before the next instruction.
1478+ // Otherwise the passed-in branch offset would be off.
1479+ BlockConstPoolFor (1 );
1480+
14751481 emit (cond | B27 | B25 | B24 | (imm24 & kImm24Mask ));
14761482}
14771483
@@ -1481,6 +1487,11 @@ void Assembler::blx(int branch_offset) {
14811487 int imm24 = branch_offset >> 2 ;
14821488 const bool blx_imm_check = is_int24 (imm24);
14831489 CHECK (blx_imm_check);
1490+
1491+ // Block the emission of the constant pool before the next instruction.
1492+ // Otherwise the passed-in branch offset would be off.
1493+ BlockConstPoolFor (1 );
1494+
14841495 emit (kSpecialCondition | B27 | B25 | h | (imm24 & kImm24Mask ));
14851496}
14861497
0 commit comments