@@ -1455,10 +1455,6 @@ int Assembler::branch_offset(Label* L) {
14551455 L->link_to (pc_offset ());
14561456 }
14571457
1458- // Block the emission of the constant pool, since the branch instruction must
1459- // be emitted at the pc offset recorded by the label.
1460- if (!is_const_pool_blocked ()) BlockConstPoolFor (1 );
1461-
14621458 return target_pos - (pc_offset () + Instruction::kPcLoadDelta );
14631459}
14641460
@@ -1469,6 +1465,11 @@ void Assembler::b(int branch_offset, Condition cond, RelocInfo::Mode rmode) {
14691465 int imm24 = branch_offset >> 2 ;
14701466 const bool b_imm_check = is_int24 (imm24);
14711467 CHECK (b_imm_check);
1468+
1469+ // Block the emission of the constant pool before the next instruction.
1470+ // Otherwise the passed-in branch offset would be off.
1471+ BlockConstPoolFor (1 );
1472+
14721473 emit (cond | B27 | B25 | (imm24 & kImm24Mask ));
14731474
14741475 if (cond == al) {
@@ -1483,6 +1484,11 @@ void Assembler::bl(int branch_offset, Condition cond, RelocInfo::Mode rmode) {
14831484 int imm24 = branch_offset >> 2 ;
14841485 const bool bl_imm_check = is_int24 (imm24);
14851486 CHECK (bl_imm_check);
1487+
1488+ // Block the emission of the constant pool before the next instruction.
1489+ // Otherwise the passed-in branch offset would be off.
1490+ BlockConstPoolFor (1 );
1491+
14861492 emit (cond | B27 | B25 | B24 | (imm24 & kImm24Mask ));
14871493}
14881494
@@ -1492,6 +1498,11 @@ void Assembler::blx(int branch_offset) {
14921498 int imm24 = branch_offset >> 2 ;
14931499 const bool blx_imm_check = is_int24 (imm24);
14941500 CHECK (blx_imm_check);
1501+
1502+ // Block the emission of the constant pool before the next instruction.
1503+ // Otherwise the passed-in branch offset would be off.
1504+ BlockConstPoolFor (1 );
1505+
14951506 emit (kSpecialCondition | B27 | B25 | h | (imm24 & kImm24Mask ));
14961507}
14971508
0 commit comments