简体   繁体   English

将Psyco移植到64位可能存在哪些陷阱?

[英]What are the possible pitfalls in porting Psyco to 64-bit?

The Psyco docs say: Psyco的文档说:

Just for reference, Psyco does not work on any 64-bit systems at all. 仅供参考,Psyco根本不适用于任何64位系统。 This fact is worth being noted again, now that the latest Mac OS/X 10.6 "Snow Leopart" comes with a default Python that is 64-bit on 64-bit machines. 这个事实值得再次注意,现在最新的Mac OS / X 10.6“Snow Leopart”带有64位机器上64位的默认Python。 The only way to use Psyco on OS/X 10.6 is by recompiling a custom Python in 32-bit mode. 在OS / X 10.6上使用Psyco的唯一方法是在32位模式下重新编译自定义Python。

In general, porting programs from 32 to 64 bits is only really an issue when the code assumes a certain size for a pointer type and other similarly small(ish) issues. 通常,当代码假定指针类型和其他类似的小(ish)问题具有特定大小时,将程序从32位移植到64位只是一个问题。 Considering that Psyco isn't a whole lot of code (~32K lines of C + ~8K lines of Python), how hard could it be? 考虑到Psyco不是很多代码(大约32K行的C + ~8K系列的Python),它有多难? Has anyone tried this and hit a wall? 有没有人试过这个并撞墙? I haven't really had a chance to take a good look at the Psyco sources yet, so I'd really appreciate knowing if I'm wasting my time looking into this... 我还没有机会好好看看Psyco的来源,所以我真的很感激知道我是否在浪费时间研究这个......

Christian Tismer, one of the Psyco developers also seems to disagree with the "how hard could it be" - assumption (quoted from here ): Psyco开发商之一Christian Tismer似乎也不同意“它有多难” - 假设(引自此处 ):

Needs to come to x86-64? 需要来x86-64? Why that! 为什么! Seriously, I would love to do that, but this would be much harder than anybody would expect. 说真的,我很乐意这样做,但这比任何人想象的要困难得多。 Due to the way psyco is written, it would be really half a rewrite to releave it from its 32-bitterness. 由于psyco的编写方式,将它从32位苦味中解脱出来真是半重写。 The 32 bit assumption is implicitly everywhere. 32位假设隐含在任何地方。 It would be straight forward, if the memory model was all 64 bit. 如果内存模型全部是64位,那将是直截了当的。 But no intel platform is that simple. 但没有英特尔平台那么简单。 so long, and thanks for all the fish -- chris 这么久,感谢所有的鱼 - 克里斯

and

hum. 哼。 It would cost at least 3 or 4 months of full-time work do do that, if not more. 如果不是更多的话,至少要花3到4个月的全职工作。 I doubt that I can get sponsorship for that. 我怀疑我能否获得赞助。

If you want more details (firm inside knowledge of Psyco probably needed) I guess you can always try to ask on one of the psyco mailing lists ... 如果你想了解更多细节(可能需要Psyco的内部知识),我猜你总是可以尝试在其中一个psyco邮件列表上询问......

Since psyco is a compiler, it would need to be aware of the underlying assembly language to generate useful code. 由于psyco是一个编译器,因此需要了解底层汇编语言以生成有用的代码。 That would mean it would need to know about the 8 new registers, new opcodes for 64 bit code, etc. 这意味着它需要知道8个新寄存器,64位代码的新操作码等。

Furthermore, to interop with the existing code, it would need to use the same calling conventions as 64 bit code. 此外,为了与现有代码互操作,它需要使用与64位代码相同的调用约定。 The AMD-64 calling convention is similar to the old fast-call conventions in that some parameters are passed in registers (in the 64 bit case rcx,rdx,r8,r9 for pointers and Xmm0-Xmm3 for floating point) and the rest are pushed onto spill space on the stack. AMD-64调用约定类似于旧的快速调用约定,因为一些参数在寄存器中传递(在64位情况下,rcx,rdx,r8,r9用于指针,Xmm0-Xmm3用于浮点),其余的是推到堆栈上的溢出空间。 Unlike x86, this extra space is usually allocated once for all of the possible calls. 与x86不同,这个额外的空间通常为所有可能的调用分配一次。 The IA64 conventions and assembly language are different yet. IA64约定和汇编语言有所不同。

So in short, I think this is probably not as simple as it sounds. 简而言之,我认为这可能不像听起来那么简单。

Psyco assumes that sizeof(int) == sizeof(void*) a bit all over the place. Psyco假设sizeof(int)== sizeof(void *)遍布整个地方。 That's much harder than just writing down 64bit calling conventions and assembler. 这比写下64位调用约定和汇编程序要困难得多。 On the sidenote, pypy has 64bit jit support these days. 在旁注中,pypy现在有64位的jit支持。

Cheers, fijal 干杯,fijal

+1 for "... how hard could it be?". + 1代表“......它有多难?”

Take a look here: http://codespeak.net/svn/psyco/dist/c/i386/iprocessor.c 看看这里: http//codespeak.net/svn/psyco/dist/c/i386/iprocessor.c

All that ASM would have to be ported, and there are assumptions all over the place about the underlying processor. 所有ASM都必须被移植,并且关于底层处理器的所有地方都存在假设。

I think it's fair to say that if it were trivial to port (or not too difficult), it would already have been done. 我认为公平地说,如果移植(或不太困难)是微不足道的,那就已经完成了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM