gpt4 book ai didi

.NET 编译器限制添加?

转载 作者:行者123 更新时间:2023-12-04 14:34:25 26 4
gpt4 key购买 nike

我和我的同事刚刚发现 vb.net 代码中可以使用的参数数量似乎有限制。

令我感到奇怪的是,这段代码将构建,但是当我运行它时,它抛出一个 InvalidProgramException 说“JIT 编译器遇到内部限制”。

有没有人见过这样的事情?你能指出为什么会这样吗?

(我在 VS 2010 中使用 .net 4.0。我们在 VS 2008 中发现了这一点,结果略有不同。)

示例代码:

    Dim bigVariable As Double = 10.35
Dim factor As Double = 1.3
Dim hugeNumberOfArgs As Double = (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor)

Console.WriteLine("Result: " & hugeNumberOfArgs)
Console.ReadKey()

最佳答案

经过进一步调查,我认为这不是编译器问题。代码在 Debug 中崩溃,在 Retail 中运行良好。我已经对 IL 进行了几次区分,但无法发现明显的差异。

这个错误也在 C# 中重现。如果您试图自己重现它,请确保将/debug+ 传递给命令行编译器。

这似乎是 JIT 编译中的一个错误。防止在 Debug模式下崩溃的一种方法是添加以下代码行

<Assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations)>

添加后,代码将成功执行。这和两种语言的重新编译强烈表明这是 JIT 过程中的错误。

关于.NET 编译器限制添加?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5407219/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com