Low-cost deterministic C++ exceptions for embedded systems

Low-cost deterministic C++ exceptions for embedded systems
复制标题

嵌入式系统的低成本确定性 C 异常

DOI:
10.1145/3302516.3307346
复制
发表时间:
2019
期刊:
Proceedings of the 28th International Conference on Compiler Construction
影响因子:
--
通讯作者:
Björn Franke
Björn Franke
中科院分区:
--
文献类型:
--
作者:
James Renwick;T. Spink;Björn Franke

文献摘要

被引文献

相似文献

C ++编程语言提供了一种有力的异常机制,可以在语言级别上处理错误,从而提高代码可读性,安全性和可维护性。但是,目前的C ++实现是针对通用系统的,通常是为了绩效而牺牲代码大小,内存使用情况和资源决定论。对于嵌入式应用程序,C ++例外通常是最重要的嵌入式应用程序。因此,嵌入式编码指南禁止使用C ++异常,或者嵌入的C ++工具链完全省略了例外处理。在本文中,我们开发了C ++例外的新颖实现,以消除这些问题,并使它们用于嵌入式系统。我们将现有的堆栈放松技术与新的内存管理和运行时类型信息(RTTI)相结合。在此过程中,我们创建了一个合规的C ++例外处理实现,提供有限的运行时和内存使用情况,同时将代码大小的要求最多减少了82%,并且对于常见情况,仅产生最小的运行时开销。
The C++ programming language offers a strong exception mechanism for error handling at the language level, improving code readability, safety, and maintainability. However, current C++ implementations are targeted at general-purpose systems, often sacrificing code size, memory usage, and resource determinism for the sake of performance. This makes C++ exceptions a particularly undesirable choice for embedded applications where code size and resource determinism are often paramount. Consequently, embedded coding guidelines either forbid the use of C++ exceptions, or embedded C++ tool chains omit exception handling altogether. In this paper, we develop a novel implementation of C++ exceptions that eliminates these issues, and enables their use for embedded systems. We combine existing stack unwinding techniques with a new approach to memory management and run-time type information (RTTI). In doing so we create a compliant C++ exception handling implementation, providing bounded runtime and memory usage, while reducing code size requirements by up to 82%, and incurring only a minimal runtime overhead for the common case of no exceptions.