当前位置: X-MOL 学术Sci. Comput. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Reshape your layouts, not your programs: A safe language extension for better cache locality
Science of Computer Programming ( IF 1.3 ) Pub Date : 2020-05-27 , DOI: 10.1016/j.scico.2020.102481
Alexandros Tasos , Juliana Franco , Sophia Drossopoulou , Tobias Wrigstad , Susan Eisenbach

The vast divide between the speed of CPU and RAM means that effective use of CPU caches is often a prerequisite for high performance on modern architectures. Hence, developers need to consider how to place data in memory so as to exploit spatial locality and achieve high memory bandwidth. Such manual memory optimisations are common in unmanaged languages (e.g. C, C++), but they sacrifice readability, maintainability, memory safety, and object abstraction. In managed languages, such as Java and C#, where the runtime abstracts away the memory from the developer, such optimisations are almost impossible.

We present a language extension called SHAPES, which aims to offer developers more fine-grained control over the placement of data, without sacrificing memory safety or object abstraction. In SHAPES, programmers group related objects into pools, and specify how objects are laid out in these pools. Classes and types are annotated by pool parameters, which allow placement aspects to be changed orthogonally to the code that operates on the objects in the pool. These design decisions disentangle business logic and memory concerns.

We give a formal model of SHAPES, present its type and memory safety model, and present its translation to a low-level language. We argue why we expect this translation to be efficient in terms of runtime representation of objects and access to their fields. We argue that SHAPES can be incorporated into existing managed and unmanaged language runtimes and fit well with garbage collection.



中文翻译:

重塑您的布局,而不是程序:重塑安全的语言扩展以更好地缓存位置

CPU和RAM速度之间的巨大差异意味着有效使用CPU缓存通常是现代体系结构上实现高性能的先决条件。因此,开发人员需要考虑如何将数据放置在内存中,以利用空间局部性并实现高内存带宽。这种手动内存优化在非托管语言(例如C,C ++)中很常见,但是它们牺牲了可读性,可维护性,内存安全性和对象抽象性。在Java和C#之类的托管语言中,运行时从开发人员那里提取了内存,这种优化几乎是不可能的。

我们提供了一种语言扩展,称为SHAPES,旨在为开发人员提供对数据放置的更细粒度的控制,而不会牺牲内存安全性或对象抽象性。在SHAPES中,程序员将相关对象分组到池中,并指定如何在这些池中布置对象。类和类型由池参数注释,该参数允许将放置方面与在池中对象上运行的代码正交地更改。这些设计决策消除了业务逻辑和内存问题。

我们给出SHAPES的正式模型,介绍其类型和内存安全模型,并将其翻译成低级语言。我们争论为什么我们期望这种转​​换在对象的运行时表示形式和对它们的字段的访问方面是有效的。我们认为SHAPES可以合并到现有的托管和非托管语言运行时中,并且非常适合垃圾回收。

更新日期:2020-05-27
down
wechat
bug