paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Float Self-Tagging

浮点数自标记
OOPSLA 9(OOPSLA2)2025匹配度 2/10 · 论文主题是动态语言中浮点数的运行时表示与 self-tagging 内存布局优化,虽涉及浮点数,但不涉及程序分析、形式化验证或 LLM/Agent,与用户关注的浮点程序分析及 LLM 交叉方向仅有非常间接的关联。引用 1 inbox
Olivier Melançon, Manuel Serrano, Marc Feeley
crossref: 2026-09-10

AI 速览

一句话:提出 self-tagging:用可逆按位变换将浮点值与类型信息叠加在单字中,避免堆分配且性能影响小。

动态语言需在运行时对象携带类型信息,使 IEEE754 浮点数难以高效表示;tagged pointers 需堆分配所有 float,NaN/NuN-boxing 增加类型检查开销。提出 self-tagging:用可逆按位变换把浮点数映射为含类型信息的标记值,将值与类型叠加在单个机器字中;因只能覆盖部分浮点表示,它利用浮点数的非均匀分布避免常见浮点堆分配。作者在两种 Scheme 编译器和四种微架构上评估,并与现有三种编码比较。实验表明,该方法几乎消除所有浮点数堆分配,浮点密集基准性能良好,对其他基准影响可忽略。

问题
动态与多态语言需在运行时对象中存储类型信息,但 IEEE754 浮点数没有适合存放标签的空间;现有 tagged pointers、NaN-boxing、NuN-boxing 在堆分配或类型检查开销上有缺陷。
方法
提出 self-tagging,利用可逆按位变换将浮点数映射为位模式中含正确类型信息的标记值,并借助实际浮点数的非均匀分布覆盖最常见浮点,避免堆分配。
评估
在两种 Scheme 编译器中实现变体,在四种微架构上与 tagged pointers、NaN-boxing、NuN-boxing 对比;结果显示几乎消除所有浮点数的堆分配,浮点密集基准性能良好,其他基准开销可忽略。
原文摘要(Abstract)

Dynamic and polymorphic languages attach information, such as types, to run time objects, and therefore adapt the memory layout of values to include space for this information. This makes it difficult to efficiently implement IEEE754 floating-point numbers as this format does not leave an easily accessible space to store type information. The three main floating-point number encodings in use today, tagged pointers, NaN-boxing, and NuN-boxing, have drawbacks. Tagged pointers entail a heap allocation of all float objects, and NaN/NuN-boxing puts additional run time costs on type checks and the handling of other objects. This paper introduces self-tagging, a new approach to object tagging that uses an invertible bitwise transformation to map floating-point numbers to tagged values that contain the correct type information at the correct position in their bit pattern, superimposing both their value and type information in a single machine word. Such a transformation can only map a subset of all floats to correctly typed tagged values, hence self-tagging takes advantage of the non-uniform distribution of floating point numbers used in practice to avoid heap allocation of the most frequently encountered floats. Variants of self-tagging were implemented in two distinct Scheme compilers and evaluated on four microar¬chitectures to assess their performance and compare them to tagged pointers, NaN-boxing, and NuN-boxing. Experiments demonstrate that, in practice, the approach eliminates heap allocation of nearly all floating-point numbers and provides good execution speed of float-intensive benchmarks in Scheme with a negligible performance impact on other benchmarks, making it an attractive alternative to tagged pointers, alongside NaN-boxing and NuN-boxing.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2950,
  title = {Float Self-Tagging},
  author = {Olivier Melançon and Manuel Serrano and Marc Feeley},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3763108}
}