Skip to content

Commit 9afbaf9

Browse files
add comments back
1 parent c291860 commit 9afbaf9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Python/jit.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,15 +598,24 @@ patch_aarch64_trampoline_addr(unsigned char *location, int ordinal, uint64_t val
598598
{
599599
int64_t range = (int64_t)value - (int64_t)(uintptr_t)location;
600600

601+
// If we are in range of 28 signed bits, we patch the instruction with
602+
// the address of the symbol.
601603
if (range >= -(1 << 27) && range < (1 << 27)) {
602604
patch_aarch64_26r(location, value);
603605
return;
604606
}
605607

608+
// Out of range - need a trampoline
606609
uint32_t *p = (uint32_t *)get_symbol_slot(ordinal, &state->trampolines, TRAMPOLINE_SIZE);
607610

608-
p[0] = 0x58000048; // ldr x8, 8
609-
p[1] = 0xD61F0100; // br x8
611+
/* Generate the trampoline
612+
0: 58000048 ldr x8, 8
613+
4: d61f0100 br x8
614+
8: 00000000 // The next two words contain the 64-bit address to jump to.
615+
c: 00000000
616+
*/
617+
p[0] = 0x58000048;
618+
p[1] = 0xD61F0100;
610619
p[2] = value & 0xffffffff;
611620
p[3] = value >> 32;
612621

0 commit comments

Comments
 (0)