arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.14175cs.PL
收藏

MetaFFI——多语言间接互操作系统

MetaFFI -- Multilingual Indirect Interoperability System

Tel Aviv University(特拉维夫大学)

Tsvi Cherny-Shahar, Amiram Yehudai

AI总结:

提出MetaFFI,一个可插拔的进程内间接互操作系统,通过浅层绑定机制实现深层绑定,支持跨语言实体加载与调用,仅需2n个机制支持n种语言,并在Windows和Ubuntu上验证了Go、Python3.11和Java的互操作。

摘要:

近年来,使用多种编程语言开发软件应用的情况有所增加,因为这允许为系统的每个组件选择最合适的语言和运行时,并集成第三方库。然而,由于缺乏适当的多语言互操作系统,这种做法涉及复杂性且容易出错。开发者不得不求助于权宜之计,例如库重实现或特定语言的包装器,这些通常依赖于C作为互操作的最大公约数。这些挑战使得使用多种编程语言成为一项繁重且要求苛刻的任务,需要高技能开发者进行实现、调试和维护,并引发对互操作益处的质疑。为了克服这些挑战,我们提出了MetaFFI,这是一个可插拔的进程内间接互操作系统,允许加载和利用来自多种编程语言的实体。这是通过利用限制较少的浅层绑定机制(例如,Foreign Function Interface)来提供深层绑定功能(例如,对象创建、方法、字段)实现的。MetaFFI提供了一个运行时无关的框架,用于加载和xcall(Cross-Call)外部实体(例如,函数、对象)。MetaFFI使用Common Data Types(CDTs)来传递参数和返回值,包括对象和复杂类型,甚至跨语言回调。MetaFFI的间接互操作方法具有显著优势,仅需$2n$个机制即可支持$n$种语言,而直接互操作方法需要$n^2$个机制。我们已在Windows和Ubuntu上的概念验证中成功测试了Go、Python3.11和Java之间的绑定。

英文摘要:

The development of software applications using multiple programming languages has increased in recent years, as it allows the selection of the most suitable language and runtime for each component of the system and the integration of third-party libraries. However, this practice involves complexity and error proneness, due to the absence of an adequate system for the interoperability of multiple programming languages. Developers are compelled to resort to workarounds, such as library reimplementation or language-specific wrappers, which are often dependent on C as the common denominator for interoperability. These challenges render the use of multiple programming languages a burdensome and demanding task that necessitates highly skilled developers for implementation, debugging, and maintenance, and raise doubts about the benefits of interoperability. To overcome these challenges, we propose MetaFFI, a pluggable in-process indirect-interoperability system that allows the loading and utilization of entities from multiple programming languages. This is achieved by exploiting the less restrictive shallow binding mechanisms (e.g., Foreign Function Interface) to offer deep binding features (e.g., object creation, methods, fields). MetaFFI provides a runtime-independent framework to load and \emph{xcall} (Cross-Call) foreign entities (e.g., functions, objects). MetaFFI uses Common Data Types (CDTs) to pass parameters and return values, including objects and complex types, and even cross-language callbacks. The indirect interoperability approach of MetaFFI has the significant advantage of requiring only $2n$ mechanisms to support $n$ languages, as opposed to the direct interoperability approaches that need $n^2$ mechanisms. We have successfully tested the binding between Go, Python3.11, and Java in a proof-of-concept on Windows and Ubuntu.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑