将 Psyco 移植到 64 位时可能存在哪些陷阱? [英] What are the possible pitfalls in porting Psyco to 64-bit?

查看:16
本文介绍了将 Psyco 移植到 64 位时可能存在哪些陷阱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Psyco 文档说:

仅供参考,Psyco 没有可在任何 64 位系统上工作.这个事实值得再次指出,现在最新的 Mac OS/X 10.6雪豹"自带默认64 位上的 64 位 Python机器.使用 Psyco 的唯一方法OS/X 10.6 是通过重新编译自定义32 位模式下的 Python.

Just for reference, Psyco does not work on any 64-bit systems at all. 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. The only way to use Psyco on OS/X 10.6 is by recompiling a custom Python in 32-bit mode.

一般来说,将程序从 32 位移植到 64 位才是真正的问题,当代码假定指针类型和其他类似的小(ish)问题具有特定大小时.考虑到 Psyco 不是一大堆代码(~32K 行 C +~8K 行 Python),它有多难?有没有人试过这个并撞墙了?我还没有机会好好看看 Psyco 的来源,所以我真的很感激知道我是否在浪费时间研究这个......

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. Considering that Psyco isn't a whole lot of code (~32K lines of C + ~8K lines of Python), how hard could it be? 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 是一个编译器,它需要了解底层汇编语言才能生成有用的代码.这意味着它需要知道 8 个新寄存器、64 位代码的新操作码等.

Since psyco is a compiler, it would need to be aware of the underlying assembly language to generate useful code. That would mean it would need to know about the 8 new registers, new opcodes for 64 bit code, etc.

此外,要与现有代码互操作,需要使用与 64 位代码相同的调用约定.AMD-64 调用约定类似于旧的快速调用约定,其中一些参数在寄存器中传递(在 64 位情况下,rcx,rdx,r8,r9 用于指针,Xmm0-Xmm3 用于浮点),其余的是推到堆栈上的溢出空间.与 x86 不同,这个额外的空间通常为所有可能的调用分配一次.IA64 约定和汇编语言是不同的.

Furthermore, to interop with the existing code, it would need to use the same calling conventions as 64 bit code. 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. Unlike x86, this extra space is usually allocated once for all of the possible calls. The IA64 conventions and assembly language are different yet.

简而言之,我认为这可能并不像听起来那么简单.

So in short, I think this is probably not as simple as it sounds.

这篇关于将 Psyco 移植到 64 位时可能存在哪些陷阱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆