Skip to content

Optimize native wrappers #1192

Closed
Closed
@nikomatsakis

Description

@nikomatsakis

As of @b6af844, we generate Rust wrappers for native functions. These allow for easy interop with Rust code but introduce some performance inefficiencies. This could be improved in two ways:

  1. Inline the calls to the wrapper functions. Ideally, this would be done at the LLVM level as part of a general inlining pass, so as not to complicate trans.
  2. Specialize to the i386 architecture (and possibly other targets as well). In i386 in particular, we could eliminate some copies by writing the function arguments directly into memory allocated using alloc_on_c_stack(), as we used to do originally. This was removed because it does not apply to x86_64 nor does it work well for stdcall functions (layout on stack is different), whereas the current technique lets LLVM handle details of the target calling convention. Nonetheless, if it is deemed worthwhile, we could specialize the case of cdecl functions on i386 (and stdcall, for that matter).

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationI-slowIssue: Problems and improvements with respect to performance of generated code.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions