BZ #144: Patcher locations must be aligned

Status fields:

creation_ts:2010-10-18 19:56
version:default branch
This affects mostly i386 and x86_64. For code patching to be (mostly) safe, two
conditions must hold:

1. Instructions lengths of the patched-out and the new instruction must match.
2. The instruction must not cross a cache line boundary.

The first condition is probably not violated anymore, but the second most certainly is.

Comment #1 by on 2011-01-19 11:26:26

Item 2 above should say: “The changed portion of an instruction must not cross a cache
line boundary.”

There are basically only two forms of patching:
* replacing fences or barriers with NOPs – in this case the entire instruction is
* changing a 32 bit displacement inside the instruction – that’s what the rewording
above aims at.

This should be all done now for x86_64:

Comment #2 by on 2011-01-20 22:05:24

It would need fixing on i386 as well, but I'll mark it resolved anyway as I don't care
that much about (and passionately hate) i386.

Comment #3 by on 2011-10-24 12:01:12

Note to myself: I formulated the above criteria after reading this presentation: ("Experiences with
Multi-threading and Dynamic
Class Loading in a Java Just-In-Time Compiler")