[llvm-dev] RFC: New function attribute "patchable-prologue"="<kind>"

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 6 11:01:55 PDT 2016


> On Apr 6, 2016, at 10:52 AM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> 
> 
> 
> Mehdi Amini wrote:
>>> On Apr 6, 2016, at 12:10 AM, Sanjoy Das via llvm-dev<llvm-dev at lists.llvm.org>  wrote:
>>> 
>>> [Proposed langref entry]
>>> 
>>> The "patchable-prologue" attribute on a function is a general
>>> mechanism to control the form of a function's prologue in ways that
>>> make it easy to patch at runtime.
>>> 
>>> Currently only one value is supported:
>>> 
>>> # "hotpatch-compact"
>>> 
>>> If a function is marked with "patchable-prologue"="hotpatch-compact"
>>> then:
>>> 
>>> 1. The first instruction of the function is at least two bytes long.
>> 
>> IIRC the motivation is to insert a branch instruction in a thread-safe way?
> 
> Yes.
> 
>> Isn’t the “two bytes” something that is target specific?
> 
> Yes, that's a good point.  I can think of two ways to fix this:
> 
> - Change the spec to say "large enough to accommodate a short jump instruction”

Yeah this is somehow what I had in mind.

— 
Mehdi


> 
> - Rename the "hotpatch-compact" scheme to "hotpatch-compact-x86-64" and basically live with the fact that it is a target specific attribute.
> 
> I like the first one better, but I can live with either since at this time I really only care about x86_64.
> 
> -- Sanjoy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160406/ed456659/attachment.html>


More information about the llvm-dev mailing list