<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><span style="font-size: 12pt;">Aligned_procedures</span><br>
</p>
<div id="Signature">
<div><br>
</div>
<div>I'm sure I've mentioned this before...but I'm clearing out my backlog of lingering diffs.</div>
<div><br>
</div>
<div><br>
</div>
<div>In my bid to make more of the targets look more the same,</div>
<div>I suggest making Aligned_procedures always be false.</div>
<div><br>
</div>
<div><br>
</div>
<div>This slightly pessimises mainstream targets: x86 and amd64.</div>
<div><br>
</div>
<div><br>
</div>
<div>I believe it slightly bloats all calls through function pointers.</div>
<div> (including object methods? Maybe, but I don't think those can be closures,</div>
<div> so that could/should be fixed -- though the idea of a method being a closure</div>
<div> is a good one...)</div>
<div><br>
</div>
<div><br>
</div>
<div>It has no affect on PowerPC, ARM, SPARC, MIPS, Alpha, etc. -- 32bit or 64bit.</div>
<div><br>
</div>
<div> </div>
<div>I believe the difference is that when calling a function pointer, on x86/amd64,</div>
<div>we just read it for a pointer-size integer, and compare to -1.</div>
<div><br>
</div>
<div><br>
</div>
<div>If Aligned_procedures is left as always false, that check would first</div>
<div>see if the pointer is aligned on a pointer-size, and if not, skip the check for -1.</div>
<div><br>
</div>
<div><br>
</div>
<div>This is because most architectures will issue an alignment fault for the</div>
<div>unaligned read, and we know such unaligned values are not closures.</div>
<div>x86/amd64 do not care much about alignment.</div>
<div><br>
</div>
<div><br>
</div>
<div>I have proposed, somewhat the opposite, that this check actually be always be 4 bytes,</div>
<div>not a full pointer. That would likely allow it to always be TRUE. Closures would still</div>
<div>be pointer-aligned, but we'd only check for 4 bytes -1 instead of a full pointer.</div>
<div><br>
</div>
<div>The idea is that all functions are 4-aligned on all targets that care about integer alignment.</div>
<div>Even if they aren't 8-aligned on 64bit targets.</div>
<div><br>
</div>
<div><br>
</div>
<div>I believe that would not work for ARM32-Thumb and I can't bring myself to rule</div>
<div><span style="font-size: 12pt;">out such targets.</span><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Another option would be to make this only be for the C backend.</div>
<div><br>
</div>
<div>It isn't clearly useful given the gcc backend -- unless maybe redistributing</div>
<div>same IR across multiple targets.</div>
<div><br>
</div>
<div> - Jay</div>
<br>
</div>
</div>
</body>
</html>