仅使用绝对跳转在虚拟机中正确分配短/长跳转
使用相对跳转并假设代码是从结构化语言降低的(因此跳转是嵌套的),可以“从内到外”生成代码:内部跳转被解析(短或长),从而导致精确的偏移,从而允许外部跳转立即解决。
如果跳转是绝对的,尽管这似乎是一个问题:显然不可能在外部跳转之前解决内部跳转(因为目标偏移量尚不清楚),但是解决外部跳转需要假设内部跳转的大小以及任何错误预测需要更新外部跳转,它可以级联更新内部跳转,然后需要重新更新外部跳转,...
是否有比此迭代更好的解决方案,直到跳转收敛?
这假设长跳转具有更长的编码并且比短跳转更昂贵,因此是不希望的(或者可能完全禁止,例如 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论