Tailcall optimization in jit stopped working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tailcall optimization in jit stopped working

Arnold Schwaighofer
tailcall optimization stop working in jit (lli) in revision 45527. i  
guess this is because the jit is tailjmping to the wrong function  
address. the following change would reenable tailcallopt in jit. But  
i am pretty sure that this is not the correct fix (since i don't  
really understand what is going on :). maybe evan can comment on this?

regards arnold

Index: lib/Target/X86/X86CodeEmitter.cpp
===================================================================
--- lib/Target/X86/X86CodeEmitter.cpp   (revision 45541)
+++ lib/Target/X86/X86CodeEmitter.cpp   (working copy)
@@ -601,7 +601,8 @@
        if (MO.isMachineBasicBlock()) {
          emitPCRelativeBlockAddress(MO.getMBB());
        } else if (MO.isGlobalAddress()) {
-        bool NeedStub = !IsStatic ||
+        bool NeedStub = Opcode == X86::TAILJMPd || Opcode ==  
X86::TAILJMPr ||
+                        Opcode == X86::TAILJMPm || !IsStatic ||
            (Is64BitMode && TM.getCodeModel() == CodeModel::Large);
          emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word,
                            0, 0, NeedStub);

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Tailcall optimization in jit stopped working

Evan Cheng-2
My bad. I'll fix it after I commit next batch of JIT changes.

Evan

On Jan 3, 2008, at 10:48 AM, Arnold Schwaighofer wrote:

> tailcall optimization stop working in jit (lli) in revision 45527. i
> guess this is because the jit is tailjmping to the wrong function
> address. the following change would reenable tailcallopt in jit. But
> i am pretty sure that this is not the correct fix (since i don't
> really understand what is going on :). maybe evan can comment on this?
>
> regards arnold
>
> Index: lib/Target/X86/X86CodeEmitter.cpp
> ===================================================================
> --- lib/Target/X86/X86CodeEmitter.cpp   (revision 45541)
> +++ lib/Target/X86/X86CodeEmitter.cpp   (working copy)
> @@ -601,7 +601,8 @@
>         if (MO.isMachineBasicBlock()) {
>           emitPCRelativeBlockAddress(MO.getMBB());
>         } else if (MO.isGlobalAddress()) {
> -        bool NeedStub = !IsStatic ||
> +        bool NeedStub = Opcode == X86::TAILJMPd || Opcode ==
> X86::TAILJMPr ||
> +                        Opcode == X86::TAILJMPm || !IsStatic ||
>             (Is64BitMode && TM.getCodeModel() == CodeModel::Large);
>           emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word,
>                             0, 0, NeedStub);
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Tailcall optimization in jit stopped working

Evan Cheng-2
In reply to this post by Arnold Schwaighofer
Hi Arnold,

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- 
Mon-20071231/056781.html

Can you see if it's working for you now?

Thanks,

Evan

On Jan 3, 2008, at 10:48 AM, Arnold Schwaighofer wrote:

> tailcall optimization stop working in jit (lli) in revision 45527. i
> guess this is because the jit is tailjmping to the wrong function
> address. the following change would reenable tailcallopt in jit. But
> i am pretty sure that this is not the correct fix (since i don't
> really understand what is going on :). maybe evan can comment on this?
>
> regards arnold
>
> Index: lib/Target/X86/X86CodeEmitter.cpp
> ===================================================================
> --- lib/Target/X86/X86CodeEmitter.cpp   (revision 45541)
> +++ lib/Target/X86/X86CodeEmitter.cpp   (working copy)
> @@ -601,7 +601,8 @@
>         if (MO.isMachineBasicBlock()) {
>           emitPCRelativeBlockAddress(MO.getMBB());
>         } else if (MO.isGlobalAddress()) {
> -        bool NeedStub = !IsStatic ||
> +        bool NeedStub = Opcode == X86::TAILJMPd || Opcode ==
> X86::TAILJMPr ||
> +                        Opcode == X86::TAILJMPm || !IsStatic ||
>             (Is64BitMode && TM.getCodeModel() == CodeModel::Large);
>           emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word,
>                             0, 0, NeedStub);
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev