IP Library Granted Patent US 9,740,463
Granted Patent B2
US 9,740,463 · App. 14/822,489 · Granted Aug 22, 2017

Mechanism for increasing the performance of multiple language programs by inserting called language IR into the calling language

Inventors: Matthias Grimmer (Linz, AT); Chris Seaton (Heswall, GB); Thomas Wuerthinger (Zurich, CH)
Assignee: Oracle International Corporation
G06F8/41G06F8/51
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,740,463
App. No.
14/822,489
Granted
Aug 22, 2017
Kind
B2
Abstract

A method and system of cross-language inlining that includes receiving source code of a multiple language program, the source code including a main language and a first access of a first foreign object in a first additional language; translating the main language to obtain a main language intermediate representation (IR); translating the first additional language to obtain a first IR snippet; composing, before performing a compilation, the main language IR and the first IR snippet to obtain a cross-language IR; and performing the compilation of the cross-language IR to obtain machine code corresponding to the multiple language program.

Claims (90)

1. A method of cross-language inlining comprising:

receiving source code of a multiple language program, the source code comprising a main language and a first access of a first foreign object in a first additional language;

translating the main language to obtain a main language intermediate representation (IR); translating the first access of the first foreign object to obtain a first IR snippet;

composing, before performing a compilation, the main language IR and the first IR snippet to obtain a cross-language IR, wherein composing the main language IR and the first IR snippet comprises:

encountering, during execution of the main language IR, a foreign object access site for performing the first access of the first foreign object; and

adding a first language check element to the first IR snippet at the foreign object access site, wherein the first language check element determines that the first access of the first foreign object is in the first additional language; and

performing the compilation of the cross-language IR to obtain machine code corresponding to the multiple language program.

2. The method of claim 1 , wherein composing the main language IR and the first IR snippet further comprises:

mapping the first access of the first foreign object to a first message;

inserting into the main language IR, at the foreign object access site, a first message element corresponding to the first message to obtain a first intermediate IR;

sending the first message to a first receiver corresponding to the first foreign object;

receiving, from the first receiver in response to sending the first message, the first IR snippet; and

inserting the first IR snippet into the first intermediate IR to obtain the cross-language IR, wherein the first language check element is executed before the first IR snippet.

3. The method of claim 2 , wherein the first message comprises one selected from a group consisting of a read message, a write message, an execute message, and an unbox message.

4. The method of claim 2 , wherein the foreign object access site is language polymorphic, the method further comprising:

executing, before the compilation, at least a portion of the multiple language program;

determining, while executing the portion of the multiple language program, that the first access of the first foreign object at the object access site has changed to a second access of a second foreign object via a second additional language;

mapping the second access of the second foreign object to a second message;

inserting a second message element corresponding to the second message into the first intermediate IR at the foreign object access site as part of a chain to obtain a second intermediate IR;

sending the second message to a second receiver corresponding to the second foreign object;

receiving, from the second receiver in response to sending the second message, a second IR snippet;

adding a second language check element to the second IR snippet to be executed before the second IR snippet;

inserting the second IR snippet into the second intermediate IR to obtain the cross-language IR, wherein the second language check element to be executed before the second IR snippet is inserted into the chain at the foreign object access site.

5. The method of claim 1 , wherein the main language IR and the first IR snippet are each at least a portion of an abstract syntax tree (AST).

6. The method of claim 1 , further comprising:

performing, before the compilation of the cross-language IR, a modification to obtain a modified cross-language IR;

determining that the modified cross-language IR has reached a stable state;

compiling the modified cross-language IR instead of the cross-language IR based on the determination.

7. The method of claim 1 , wherein the cross-language inlining occurs in the cross-language IR and before the compilation of the cross-language IR.

8. The method of claim 1 , wherein the cross-language IR comprises a single compilation unit.

9. A system for cross language inlining comprising:

a machine code generation unit comprising circuitry and configured to receive source code of a multiple language program, the source code comprising a main language and a first access of a first foreign object via a first additional language and comprising:

a first translator comprising circuitry and configured to translate the main language to obtain a main language intermediate representation (IR);

a second translator comprising circuitry and configured to translate the first access of the first foreign object to obtain a first IR snippet;

a cross-language IR generation module comprising circuitry and configured to compose the main language IR and the first IR snippet to obtain a cross-language IR, wherein the main language IR and the first IR snippet are configured to perform:

encountering, during execution of the main language IR, a foreign object access site for performing the first access of the first foreign object; and

adding a first language check element to the first IR snippet at the foreign object access site, wherein the first language check element determines that the first access of the first foreign object is in the first additional language; and

a compiler comprising circuitry and configured to perform a compilation of the cross-language IR to obtain machine code corresponding to the multiple language program.

10. The system of claim 9 , wherein the main language IR and the first IR snippet are further configured to perform:

mapping the first access of the first foreign object to a first message;

inserting into the main language IR, at the foreign object access site, a first message element corresponding to the first message to obtain a first intermediate IR;

sending the first message to a first receiver corresponding to the first foreign object;

receiving, from the first receiver in response to sending the first message, the first IR snippet; and

inserting the first IR snippet into the first intermediate IR to obtain the cross-language IR, wherein the first language check element is executed before the first IR snippet.

11. The system of claim 10 , wherein the first message comprises one selected from a group consisting of a read message, a write message, an execute message, and an unbox message.

12. The system of claim 10 , wherein the foreign object access site is language polymorphic, and wherein the cross-language IR generation module is further configured to compose the cross-language IR by:

executing, before the compilation, at least a portion of the multiple language program;

determining, while executing the portion of the multiple language program, that the first access of the first foreign object at the foreign object access site has changed to a second access of a second foreign object via a second additional language;

mapping the second access of the second foreign object to a second message;

inserting a second message element corresponding to the second message into the first intermediate IR at the foreign object access site as part of a chain to obtain second a second intermediate IR;

sending the second message to a second receiver corresponding to the second foreign object;

receiving, from the second receiver in response to sending the second message, a second IR snippet;

adding a second language check element to the second IR snippet to be executed before the second IR snippet;

inserting the second IR snippet into the second intermediate IR to obtain the cross-language IR, wherein the second language check element to be executed before the second IR snippet is inserted into the chain at the foreign object access site.

13. The system of claim 12 , wherein the main language IR and the first IR snippet are each at least a portion of an abstract syntax tree (AST).

14. The system of claim 9 ,

wherein the machine code generation unit further comprises an IR modification module comprising circuitry and configured to:

perform, before the compilation of the cross-language IR, a modification to obtain a modified cross-language IR; and

determine that the modified cross language IR has reached a stable state; and

wherein the compiler is further configured to:

compile the modified cross-language IR instead of the cross-language IR based on the determination.

15. A non-transitory computer readable medium comprising instructions that, when executed by a computer processor, perform a method of cross-language inlining comprising:

receiving source code of a multiple language program, the source code comprising a main language and a first access of a first foreign object in a first additional language;

translating the main language to obtain a main language intermediate representation (IR);

translating the first access of the first foreign object to obtain a first IR snippet;

composing, before performing a compilation, the main language IR and the first IR snippet to obtain a cross-language IR, wherein composing the main language IR and the first IR snippet comprises:

encountering, during execution of the main language IR, a foreign object access site for performing the first access of the first foreign object; and

adding a first language check element to the first IR snippet at the foreign object access site, wherein the first language check element determines that the first access of the first foreign object is in the first additional language; and

performing the compilation of the cross-language IR to obtain machine code corresponding to the multiple language program.

16. The non-transitory computer readable medium of claim 15 , wherein composing the main language IR and the first IR snippet further comprises:

mapping the first access of the first foreign object to a first message;

inserting into the main language IR, at the foreign object access site, a first message element corresponding to the first message to obtain a first intermediate IR;

sending the first message to a first receiver corresponding to the first foreign object;

receiving, from the first receiver in response to sending the first message, the first IR snippet; and

inserting the first IR snippet into the first intermediate IR to obtain the cross-language IR, wherein the first language check element is executed before the first IR snippet.

17. The non-transitory computer readable medium of claim 16 , wherein the first message comprises one selected from a group consisting of a read message, a write message, an execute message, and an unbox message.

18. The non-transitory computer readable medium of claim 16 , wherein the foreign object access site is language polymorphic, the method further comprising:

executing, before the compilation, at least a portion of the multiple language program;

determining, while executing the portion of the multiple language program, that the first access of the first foreign object at the foreign object access site has changed to a second access of a second foreign object via a second additional language;

mapping the second access of the second foreign object to a second message;

inserting a second message element corresponding to the second message into the first intermediate IR at the foreign object access site as part of a chain to obtain a second intermediate IR;

sending the second message to a second receiver corresponding to the second foreign object;

receiving, from the second receiver in response to sending the second message, a second IR snippet;

adding a second language check element to the second IR snippet to be executed before the second IR snippet;

inserting the second IR snippet into the second intermediate IR to obtain the cross-language IR, wherein the second language check element to be executed before the second IR snippet is inserted into the chain at the foreign object access site.

19. The non-transitory computer readable medium of claim 15 , further comprising:

performing, before the compilation of the cross-language IR, a modification to obtain a modified cross-language IR;

determining that the modified cross-language IR has reached a stable state;

compiling the modified cross-language IR instead of the cross-language IR based on the determination.

20. The non-transitory computer readable medium of claim 15 , wherein the cross-language inlining occurs in the cross-language IR and before the compilation of the cross-language IR, and wherein cross-language IR comprises a single compilation unit.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 11, 2015
From: GRIMMER, MATTHIAS; SEATON, CHRIS; WUERTHINGER, THOMAS
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 036296/0949 →
Continuity (1)
Related Publication 20170046137A1 · Feb 16, 2017