为什么长 cfc 文件可以在 CF8 中使用,但不能在 CF9 中使用?获取“分支目标偏移量对于短期而言太大”错误

发布于 2024-08-17 02:47:05 字数 458 浏览 2 评论 0原文

我有一个相当长的 cfc 文件,大约 1800 行长,在 ColdFusion 8 中运行良好,但是在将我的开发系统升级到 ColdFusion 9 并进行一些测试后,我收到 cfc 的编译错误,并且消息显示“分支目标偏移太大而短”。我修改了该文件以消除一些未使用的功能,并合并了一个文件以使其更短,这解决了问题以使其正常工作。但是,为什么当我升级到 CF9 后它就死了?还有其他人在以前或当前版本的 ColdFusion 中遇到过此问题吗?除了修改cfc文件例如升级jvm之外还有其他解决办法吗?

编辑 如果您能回答我的问题,那就太好了!发布该内容,但不要浪费时间告诉我一些我已经知道的事情。如果您要发表回复,请仔细阅读问题,只有在您知道答案的情况下才回答。不要进行谷歌搜索并发布我已经知道并用来使代码正常工作的废话。 问题是,为什么它在CF8中有效,而现在在CF9中不起作用?除了我所做的之外还有其他解决方案吗?

I have a fairly long cfc file, about 1800 lines long, that worked fine in ColdFusion 8, but after upgrading my development system to ColdFusion 9 and doing some testing I get a compile error for a cfc and the message says "Branch target offset too large for short". I modified the file to eliminate some unused functions and consolidated one to make it shorter and this resolved the problem to get it to work. But still, why did it die on me now when I upgraded to CF9? Anyone else run into this problem in previous or the current version of ColdFusion? Are there any solutions other than modifying the cfc file such as upgrading the jvm?

EDIT
If you have an answer to the questions I have, great! Post that, but don't waste time telling me something that I already know. If you are going to post a response, please read the question carefully and answer only if you know the answer. Don't do a google search and post crap that I already know and utilized to get the code to work. The question is, why did it work in CF8 and now not in CF9? Are there other solutions besides what I did?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼泪淡了忧伤 2024-08-24 02:47:05

正如您所知,这是 JVM 固有的问题,CF9 可能向组件添加了更多固有函数,如果这些方法都是通过一个巨大的 switch 语句引用的,并使用短字符作为偏移量,那么我们的偏移指针空间就会更少与每个后续版本一起使用。从 CF7 迁移到 CF8 的人也遇到了同样的问题。

所以简短的答案是否定的。

您发现的大多数建议基本上都会告诉您将一个大方法拆分为一个较小的方法和几个辅助方法。我第一次遇到这个问题时,它对我拥有的大型 cfc 有效。但随着它变得越来越大,没有任何辅助函数可以修复它。最终它不得不被分成多个cfc。

PS:这家伙说删除交易有帮助(CF7),但没有人包装我的电话,所以我猜这不是一个有保证的修复http://www.coldfusionmuse.com/index.cfm/2007/9/28/Branch.Target.Offset

编辑< /strong>
看来我之前的问题是不同的函数太大,将 CFC 拆分为多个 CFC 是错误的。此后,我将该问题方法拆分为更小的方法,并且能够将所有功能合并到一个 CFC 中。这看起来就是解决方案。

This is a problem inherent with the JVM as you already know, CF9 has likely added more innate functions to a component and if the methods are all referenced via a giant switch statement with a short being used as the offset, we have less offset pointer space to work with each successive version. People moving from CF7 to CF8 also had the same problems.

So short answer is no.

Most recommendations you find basically tell you to split a large method into a smaller method and several helper methods. The first time I ran into an issue this worked for a large cfc I had. But then as it got bigger no number of helper functions would fix it. Eventually it had to be split into multiple cfcs.

PS: This guy said removing a transaction helped (CF7), there are none wrapping my calls though, so it's not a guaranteed fix I guess http://www.coldfusionmuse.com/index.cfm/2007/9/28/Branch.Target.Offset

Edit
Looks like my previous issue was a different function being too large, splitting the CFC into multiple CFCs was in error. I've since split that problem method into smaller methods, and have been able to consolidate all the functions in one CFC. So that is the solution it seems.

蹲在坟头点根烟 2024-08-24 02:47:05

如果您还没有这样做,请尝试在 CFAdmin 页面“调试和日志记录 > 代码分析器”中运行代码分析器。这是一个有用的工具,可以查找 CF8 和 CF9 之间语言中所做的一些更改。

我们必须更改几个变量名称和函数名称,因为 CF 在 9 中添加了它们。

另请检查此处:

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ff0.html

If you haven't already, try running the Code Analyzer in the CFAdmin page, "Debugging & Logging > Code Analyzer". This is a useful tool to find some changes which were made in the language between CF8 and CF9.

We had to change several variable names and function names as CF added them in 9.

Also check here:

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ff0.html

反差帅 2024-08-24 02:47:05

CF版本:10
操作系统:Linux CentOS 6.0

确实遇到了类似的问题,我的 cfc 中有 1300 多行代码,有一天我收到了“分支目标偏移..”错误。我尝试

  1. 代码分析器来查找旧版的任何漏洞 - 未修复

  2. 编辑了 cfc 以删除任何最后一点多余的代码或注释- 减少了大约 20 多行代码 - 没有修复

  3. 我将代码分成2 个 cfc 并将一个扩展为另一个 - 没有修复

  4. 我删除了任何不需要的查询和数组转储(测试的一部分) :这有效

所以我建议确保您没有任何大数据内容的转储。希望这有帮助。

CF version: 10
OS: Linux CentOS 6.0

Did face a similar issue where I had 1300+ lines of code in my cfc and one fine day I get the "Branch Target offset.." error. I tried

  1. Code Analyser to find any loopholes of legacy- DID NOT FIX

  2. Edited the cfc to trim down any last bit of redundant code or comments - reduced around 20+ lines of code - DID NOT FIX

  3. I split the code into 2 cfc and extended one to the other- DID NOT FIX

  4. I removed any unwanted dump of queries and arrays (part of testing) : THIS WORKED

so I would suggest ensure you don't have any dumps of large data content. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文