仅使用绝对跳转在虚拟机中正确分配短/长跳转

发布于 2025-01-16 04:33:26 字数 307 浏览 3 评论 0原文

使用相对跳转并假设代码是从结构化语言降低的(因此跳转是嵌套的),可以“从内到外”生成代码:内部跳转被解析(短或长),从而导致精确的偏移,从而允许外部跳转立即解决。

如果跳转是绝对的,尽管这似乎是一个问题:显然不可能在外部跳转之前解决内部跳转(因为目标偏移量尚不清楚),但是解决外部跳转需要假设内部跳转的大小以及任何错误预测需要更新外部跳转,它可以级联更新内部跳转,然后需要重新更新外部跳转,...

是否有比此迭代更好的解决方案,直到跳转收敛?

这假设长跳转具有更长的编码并且比短跳转更昂贵,因此是不希望的(或者可能完全禁止,例如 ISA 禁止“超长”编码)。

Using relative jumps and assuming the code is being lowered from a structured language (so jumps are nested), the code can be generated "inside out": the inner jumps are resolved (to short or long) leading to precise offset allowing outer jumps to be resolved immediately.

If jumps are absolute though that seems like an issue: it's obviously impossible to resolve inner jumps before outer ones (as the destination offsets are not yet known), but resolving outer jumps require assuming a size for the inner jumps, and any mis-prediction requires updating the outer jump which can cascade into updating the inner jumps, which then requires re-updating the outer jumps, ....

Is there a better solution than this iteration until the jumps converge?

This assumes long jumps have a longer encoding and are more expensive than short jumps, so are undesirable (or possibly forbidden entirely e.g. the ISA forbids "overlong" encodings).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文