什么死了分散在Swift的异常堆栈中? [英] What's Dead & Exploded in Swift's exception stack?

查看:168
本文介绍了什么死了分散在Swift的异常堆栈中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行时崩溃的异常堆栈中,Swift经常说参数为Dead或Exploded。这是什么意思,对调试有用吗?

In the exception stack for runtime crashes, Swift often says arguments are Dead or Exploded. What does it mean, and does it matter for debugging purposes?

例如:

-> 0x100209cf0 <function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ()+44>: brk    #0x1

谢谢。

推荐答案


这是什么意思?

What does it mean?

由于许多原因,Swift编译器标记函数参数,主要与内部优化相关。对于您的问题,我们将专注于管理员,因为这有助于您的美妙的堆栈跟踪,和节点打印机。在这篇文章的时候,功能专业化管理员有6个标记可以应用于一个参数:

The Swift compiler marks function arguments for a number of reasons, mostly related to internal optimizations. For your question, we'll focus on the mangler, as that's what's contributing to your pretty stack trace, and the Node Printer. As of the time of this post, the function specialization mangler has 6 marks it can apply to an argument:


  • 死亡

参数在函数体中未使用,可以在死参数消除传递中删除。

The argument is unused in the function body and can be removed in a dead argument elimination pass.

关闭

参数是一个关闭,可能需要进一步的调整/解散。

The argument is a closure and may require further mangling/demangling.

常量

参数是一个常量。

拥有保证

来电者拥有的参数将所有权转让给被调用方。因此,该参数具有与其相关的强烈引用[呼叫者],并且被保证通过呼叫生存,因此编译器允许呼叫者删除传输,而聚合保留其自身。

A caller-owned argument transfers ownership to the callee. The argument thus has a strong reference associated with it [the caller] and is guaranteed to live through the call, so the compiler allows the caller to elide the transfer and instead aggregate retains itself.

SROA

A

A Scalar Replacement of Aggregates pass should optimize this argument.

Out To Value

In Out To Value

参数被标记为inout,但被调用者实际上并没有突变。

The parameter was marked inout but the callee doesn't actually mutate it.

AST节点打印机再添加一个标记

The AST Node Printer adds one more mark


  • Exploded

该值附带了一个爆炸模式,在进行呼叫时已经实现。

The value comes with an explosion schema that has been realized when the call was made.

对于所有意图和目的,我们只关心 Dead 拥有保证分解

For all intents and purposes we only care about Dead, Owned to Guaranteed, and Exploded.

唯一可能仍然是神秘的是 Exploded 。爆炸是Swift编译器用于确定将小结构和枚举到值中的值解压缩到一个策略的优化构造。因此,当节点打印机表示一个值为 Exploded 时,这意味着它已经在调用之前将值分解为寄存器。

The only one that may still seem mystifying is Exploded. An Explosion is an optimization construct the Swift compiler uses to determine a strategy to unpack values from small structs and enums into registers. Thus, when the Node Printer says a value is Exploded, what it means it has already unpacked the value into registers before the call.


是否有必要进行调试?

does it matter for debugging purposes?

不,

这篇关于什么死了分散在Swift的异常堆栈中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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