Skip to content

Register only static methods during compilation #11686

@Akirathan

Description

@Akirathan

During compilation, in MethodDefinitions IR pass, we create static method variants for instance methods.

What would it take to register only static methods in each type? What's an invocation of (x:Integer).to_text anyway? It should be convertible to Integer.to_text x - e.g. an instance invocation just resolves the right method based on the type of the instances, but then it invokes the static Function.

Benefit:

  • reduce the amount of Function instances in the system by half
  • reduce size of IR caches by 30%

Prior art:

  • Graal compiler sees all JVM methods as static (instances methods of a class being static and having this as first argument)
  • the compiler only has special InvokeNode that deals with finding the right method to invoke when virtual dispatch is necessary

Originally posted by @JaroslavTulach in #11501 (comment)

Metadata

Metadata

Labels

-compilerp-highShould be completed in the next sprint

Type

No type

Projects

Status

🟢 Accepted

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions