为什么长 cfc 文件在 CF8 中有效,而在 CF9 中无效?获得“分支目标偏移量太大"错误 [英] Why does a long cfc file work in CF8, but not CF9? Getting "Branch target offset too large for short" error

查看:19
本文介绍了为什么长 cfc 文件在 CF8 中有效,而在 CF9 中无效?获得“分支目标偏移量太大"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

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

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?

推荐答案

这是你已经知道的 JVM 固有的问题,CF9 可能在组件中添加了更多的固有函数,如果方法都通过巨人引用使用 short 作为偏移量的 switch 语句,我们有更少的偏移量指针空间来处理每个后续版本.从 CF7 迁移到 CF8 的人也有同样的问题.

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.

这么短的答案是否定的.

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

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

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

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

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.

这篇关于为什么长 cfc 文件在 CF8 中有效,而在 CF9 中无效?获得“分支目标偏移量太大"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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