<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY 
style="WORD-WRAP: break-word; webkit-nbsp-mode: space; webkit-line-break: after-white-space" 
bgColor=#ffffff>
<DIV><FONT face=Arial size=2>oh, ok.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>actually, I had partly considered this approach at 
one point, but opted with the form I did instead (in large part because it does 
not involve such a tweak, or dependency on the previous location).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>of course, as noted, due to the possibility of 
function pointers, this is a little risky. I had not considered this issue 
previously, but it is definitely worth consideration...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I guess the issue then is how likely and how often 
a function will be replaced...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>it does lead to a possible idea 
though:</FONT></DIV>
<DIV><FONT face=Arial size=2>use of an inter-module jump table.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>in this way, the actual usage of any external 
functions involves jumping through such a table (either directly, or by by 
making use of an implicit jump).</FONT></DIV>
<DIV><FONT face=Arial size=2>sad issue though: this could incure a possibly 
noticable performance overhead (for normal calls, but it could make moving 
functions really cheap).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>a more selective way of doing this would be helpful 
(for example, a special compiler-specific keyword, or some other approach 
for telling the VM/linker that a particular function is 
movable).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>this would probably one-off the function, by 
forcibly relinking it as a proxy to the function (any future attempts at 
relinking the function then simply adjust its associated pointer).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>potentially, this could also be made the default 
behavior for when relinking functions (if they are being forcibly relinked, 
well, assume they are being made movable).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>or such...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>ccMakeMovable(char *func);    //an 
explicit call to the VM</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>__movable void foo(int x)</FONT></DIV>
<DIV><FONT face=Arial size=2>{</FONT></DIV>
<DIV><FONT face=Arial size=2>    //do something...</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>even more interestingly:</FONT></DIV>
<DIV><FONT face=Arial size=2>if the same compiler were also used for static 
compilation, it could be used as a special feature to make such dynamic 
movability available even for statically compiled and linked code (as is, in my 
case, parts of the app which are statically compiled and linked, can't currently 
be relinked...).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>(even more cool: it does not necessarily imply a 
runtime dependency, since the stub and proxy variable would be merely passive 
elements, it could still be possible to compile and link the code apart from the 
VM, nevermind that any such proxy stubs would be useless 
though...).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>absent special compiler support, this could be 
implemented more manually with an existing compiler, such as gcc.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>example convention:</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>int Afsd875gSd57g8Th(int x)    
//invisible autogen name</FONT></DIV>
<DIV>{</DIV>
<DIV>    //do something</DIV>
<DIV>}</DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT face=Arial size=2>int (*__proxy_foo)(int 
x)=&Afsd875gSd57g8Th;</FONT></DIV>
<DIV><FONT face=Arial size=2>int foo(int x) { return(__proxy_foo); 
}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>or (assembler):</FONT></DIV>
<DIV><FONT face=Arial size=2>section .data</FONT></DIV>
<DIV><FONT face=Arial size=2>__proxy_foo dd Afsd875gSd57g8Th</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>section .text</FONT></DIV>
<DIV><FONT face=Arial size=2>Afsd875gSd57g8Th:</FONT></DIV>
<DIV><FONT face=Arial size=2>push ebp</FONT></DIV>
<DIV><FONT face=Arial size=2>mov ebp, esp</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2>pop ebp</FONT></DIV>
<DIV><FONT face=Arial size=2>ret</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>foo:</FONT></DIV>
<DIV><FONT face=Arial size=2>jmp [__proxy_foo]</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>or such...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=gordonhenriksen@mac.com href="mailto:gordonhenriksen@mac.com">Gordon 
  Henriksen</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=llvmdev@cs.uiuc.edu 
  href="mailto:llvmdev@cs.uiuc.edu">LLVM Developers Mailing List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, October 24, 2007 9:26 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [LLVMdev] me being stupid: 
  me vs the llvm codebase...</DIV>
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
  face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR></DIV>
  <DIV>
  <DIV>On Oct 23, 2007, at 18:19, BGB wrote:</DIV>
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
  face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR 
  class=webkit-block-placeholder></DIV>
  <BLOCKQUOTE type="cite"><SPAN class=Apple-style-span 
    style="webkit-text-stroke-width: -1">On Oct 23, 2007, at 11:45, Gordon 
    Henriksen wrote:</SPAN></BLOCKQUOTE>
  <BLOCKQUOTE type="cite"><FONT face=Arial size=2></FONT><FONT face=Arial 
    size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
    size=2></FONT><BR></BLOCKQUOTE>
  <BLOCKQUOTE type="cite">
    <P style="MARGIN: 0px">
    <BLOCKQUOTE type="cite"><FONT style="FONT: 12px Trebuchet MS" 
      face="Trebuchet MS" size=3>Generally speaking, LLVM neither helps nor 
      hinders here. Maybe <SPAN class=Apple-style-span 
      style="webkit-text-stroke-width: -1">someone will follow up with whether 
      the JIT uses stub functions which would enable dynamic relinking If 
      not, it would be a straightforward, if platform-specific, feature to 
      add.</SPAN></FONT></BLOCKQUOTE>
    <P></P>
    <P style="MIN-HEIGHT: 14px; MARGIN: 0px; FONT: 12px Trebuchet MS"><FONT 
    face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
    size=2></FONT><FONT face=Arial size=2></FONT><BR></P>
    <P style="MARGIN: 0px"><FONT style="FONT: 12px Trebuchet MS" 
    face="Trebuchet MS" size=3>I don't use proxy or stub functions, I relink 
    them...</FONT></P></BLOCKQUOTE></DIV><BR>
  <DIV><SPAN class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2">I 
  misspoke. See here:</SPAN></SPAN></SPAN></DIV>
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
  face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
  size=2></FONT><BR class=webkit-block-placeholder></DIV>
  <DIV><SPAN class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><A 
  href="http://llvm.org/doxygen/classllvm_1_1JIT.html#a7">http://llvm.org/doxygen/classllvm_1_1JIT.html#a7</A></SPAN></SPAN></SPAN></DIV>
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
  face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
  size=2></FONT><FONT face=Arial size=2></FONT><BR 
  class=webkit-block-placeholder></DIV>
  <DIV>Relinking the function as you describe is risky in the case that the 
  address of the function has been taken. LLVM's present approach is 
  general.</DIV>
  <DIV><SPAN class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN 
  class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 12px Trebuchet MS; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2">
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
  face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
  size=2></FONT><BR class=khtml-block-placeholder></DIV>— Gordon<BR 
  class=Apple-interchange-newline></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV><BR>
  <P></P><FONT face="Trebuchet MS"></FONT><FONT face="Trebuchet MS"></FONT>
  <HR>

  <P></P>_______________________________________________<BR>LLVM Developers 
  mailing 
  list<BR>LLVMdev@cs.uiuc.edu         
  http://llvm.cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE></BODY></HTML>