BZ #144: Patcher locations must be aligned

Status fields:

creation_ts:2010-10-18 19:56
component:jit
version:default branch
rep_platform:All
op_sys:All
bug_status:RESOLVED
resolution:FIXED
reporter:stefan@complang.tuwien.ac.at
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 stefan@complang.tuwien.ac.at 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
changed.
* 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:
http://mips.complang.tuwien.ac.at/hg/cacao/rev/80589ff39d14

Comment #2 by stefan@complang.tuwien.ac.at 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 stefan@complang.tuwien.ac.at on 2011-10-24 12:01:12

Note to myself: I formulated the above criteria after reading this presentation:
http://www.cgo.org/cgo2006/html/progslides/session2_talk3_maier.pdf ("Experiences with
Multi-threading and Dynamic
Class Loading in a Java Just-In-Time Compiler")