Follow us on Twitter
twitter icon@FreshPatents

Browse patents:
Next
Prev

new patent Mechanism for increasing the performance of multiple language programs by inserting called language ir into the calling language / Oracle International Corporation




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


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.



Browse recent Oracle International Corporation patents


USPTO Applicaton #: #20170046137
Inventors: Matthias Grimmer, Chris Seaton, Thomas Wuerthinger


The Patent Description & Claims data below is from USPTO Patent Application 20170046137, Mechanism for increasing the performance of multiple language programs by inserting called language ir into the calling language.


BACKGROUND

- Top of Page


Computer programs are often primarily written in one programming language. However, in some instances, a program may be a multiple language program in which one or more additional languages are utilized. For example, a program may call a routine or access information of using another programming language in order, for example, to utilize modules already written in the other language to perform some task, or to allow different parts of a system to utilize the most appropriate language. The performance of the program during execution may be higher when executing portions of the program written in the primary language than those of a secondary language. Additionally, the work necessary to allow use of a second language may be costly and/or time consuming. Furthermore, moving from one language to another language often requires using an additional compilation unit to allow one or more compilers to compile the multiple language program. Compiling a multiple language program from multiple compilation units may reduce the number of modification (e.g., optimization) opportunities for the program.

SUMMARY

- Top of Page


In general, in one aspect, the invention relates to a method 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.

In general, in one aspect, the invention relates to a system for cross language inlining that includes a machine code generation unit 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. The machine code generation unit includes a first translator configured to translate the main language to obtain a main language intermediate representation (IR); a second translator configured to translate the first additional language to obtain a first IR snippet; a cross-language IR generation module configured to compose the main program IR and the first IR snippet to obtain a cross-language IR; and a compiler configured to perform a compilation of the cross-language IR to obtain machine code corresponding to the multiple language program.

In general, in one aspect, the invention relates to a non-transitory computer readable medium that includes instructions which, when executed by a computer processor, perform a method of cross-language inlining that includes 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 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.

Other aspects of the invention will be apparent from the following description and the appended claims.

BRIEF DESCRIPTION OF DRAWINGS

- Top of Page


FIG. 1 shows a system in accordance with one or more embodiments of the invention.

FIG. 2 shows a flowchart in accordance with one or more embodiments of the invention.

FIG. 3 shows a flowchart in accordance with one or more embodiments of the invention.

FIG. 4A, FIG. 4B, FIG. 4C, FIG. 4D, FIG. 4E, FIG. 4F, and FIG. 4G, show an example in accordance with one or more embodiments of the invention.

FIG. 5 shows a computing system in accordance with one or more embodiments of the invention.

DETAILED DESCRIPTION

- Top of Page


Specific embodiments of the invention will now be described in detail with reference to the accompanying figures. Like elements in the various figures may be denoted by like reference numerals and/or like names for consistency.

In the following detailed description of embodiments of the invention, numerous specific details are set forth in order to provide a more thorough understanding of the invention. However, it will be apparent to one of ordinary skill in the art that the invention may be practiced without these specific details. In other instances, well-known features have not been described in detail to avoid unnecessarily complicating the description.

Throughout the application, ordinal numbers (e.g., first, second, third, etc.) may be used as an adjective for an element (i.e., any noun in the application). The use of ordinal numbers is not to necessarily imply or create any particular ordering of the elements nor to limit any element to being only a single element unless expressly disclosed, such as by the use of the terms “before”, “after”, “single”, and other such terminology. Rather, the use of ordinal numbers is to distinguish between the elements. By way of an example, a first element is distinct from a second element, and the first element may encompass more than one element and succeed (or precede) the second element in an ordering of elements.

In general, embodiments of the invention relate to a method and system for performing cross-language inlining for a multiple language program before the multiple language program is compiled by a compiler. Specifically, in one or more embodiments of the invention, a program that utilizes two or more programming languages (i.e., a multiple language program) is received by a machine code generation unit and, after a series of actions, is compiled into machine code. More specifically, in one or more embodiments of the invention, before compilation, source code of each language of the program is translated to an intermediate representation (IR) (e.g., abstract syntax tree (AST)), which is then interpreted (i.e., executed) by an interpreter. In one or more embodiments of the invention, the IR may include the functionality of an interpreter, and as such, may include functionality to execute itself. The IRs for the various languages of the multiple language program are then composed into a single cross-language IR before being passed to a compiler for the compilation. Various modifications may also be implemented in the IR by an interpreter during runtime before the IR of the multiple language program is compiled and/or during compilation. For example, if the IR is an AST, while the program is being executed via interpretation, various node replacements may occur. Such node replacements may represent specializations or optimizations that improve some aspect of the program, such as execution speed and/or program size.

FIG. 1 shows a system in accordance with one or more embodiments of the invention. As shown in FIG. 1, the system includes a multiple language program (100) that includes source code in two or more languages (e.g., language A (120), language B (122)). The multiple language program (100) may be provided to a machine code generation unit (118). The machine code generation unit (118) may include two or more language interpreters (e.g., language A interpreter (102), language B interpreter (104)), an intermediate representation (IR) repository (106), a cross-language IR generation module (108), a compilation unit (110), an IR modification module (112), and a compiler (114). The compiler may produce machine code (116). Each of these components is described below.

In one or more embodiments of the invention, a multiple language program (100) is a computer program. A computer program may be any sequence of instructions, written as source code in any number of any programming languages (e.g., Java, Ruby, C, C++, JavaScript, Python, Perl, etc.) now known or that may be later developed. A computer program may be a syntactic and semantic method of expression for communicating a program\'s instructions to a computing device. As used herein, a multiple language program (100) is any program that utilizes (i.e., includes source code expressed in) at least two programming languages (e.g., language A (120), language B (122)). For example, the multiple language program (100) may be written source code of a main language (e.g., language A (120)), and include certain portions written in source code of one or more additional languages (e.g., language B (122)).

In one or more embodiments of the invention, a main language of a multiple language program (100) is the language, out of the various languages of the multiple language program, in which the greatest quantity of source code is expressed. Additional languages may be used instead of the main language for certain actions, for example, to avoid unnecessarily having to rewrite code, to use code that is more appropriate for performing a given task, to use the most appropriate code when making use of a given type of hardware of an underlying computing device, and/or for any other reason as decided by the entity that generates the source code of the multiple language program (100).

In one or more embodiments of the invention, the additional languages may be used, for example, to access data (e.g., an object) and/or to call functions using the additional language. In one or more embodiments of the invention, an object (not shown) that is being accessed in a multiple language program (100) by its language of origin (e.g., the main language) may be referred to as a regular object. For example, if the main language of the multiple language program is Ruby, and a Ruby object is used by the Ruby portion of the multiple language program, then the object may be considered a regular object. In one or more embodiments of the invention, an object that is being accessed in a multiple language program by a language other than the object\'s language of origin (e.g., one of the additional languages), then the object may be referred to as a foreign object. For example, if a Ruby object is accessed by a C extension of the multiple language program, then the Ruby object may be considered a foreign object. A foreign object may be an object in any language of the multiple language program (100) that is accessed by any other language of the multiple language program.

An object (not shown) may be a representation of data (e.g., numbers, strings, arrays, functions, etc.) via a collection of one or more properties, such as data attributes, and associated methods, such as routines and procedures to manipulate properties. A method of an object may be a function. As used herein, any non-primitive entity of a multiple language program (100) may be referred to as an object. For example, object may refer to Ruby objects, classes, modules and/or methods. As another example, object may refer to C intermediate values and/or pointers.

In one or more embodiments of the invention, a multiple language program (100) may be provided to a machine code generation unit (118). In one or more embodiments of the invention, a machine code generation unit (118) is any hardware, circuitry, integrated circuit(s), software, firmware, and/or any combination thereof capable of receiving a program (e.g., multiple language program (100)) and, after performing a series of steps (e.g., interpretation, IR modification, compilation, etc.) to translate the program into machine code (116) that may be stored and/or executed. In one or more embodiments of the invention, the machine code generation unit (118), and/or one or more components therein, includes functionality to execute the multiple language program (100). Execution of the multiple language program (100) may occur via interpretation, during compilation, after compilation, and/or any combination thereof. In one or more embodiments of the invention, the machine code generation unit (118) executes on one or more computing devices.

In one or more embodiments of the invention, a computing device is any device and/or any set of devices (e.g., a distributed computing system) capable of electronically processing instructions, serially or in parallel, and that includes at least the minimum processing power, memory, input and output device(s), operatively connected storage device(s) and/or network connectivity in order to contribute to the performance of at least some portion of the functions described in accordance with one or more embodiments of the invention. Examples of computing devices include, but are not limited to, one or more server machines (e.g., a blade-server in a blade-server chassis), virtual machines (VMs), desktop computers, mobile devices (e.g., laptop computer, smartphone, personal digital assistant, tablet computer, and/or any other mobile computing device), and/or any other type of computing device with the aforementioned minimum requirements.

In one or more embodiments of the invention, the machine code generation unit (118) includes one or more interpreters (e.g., language A interpreter (102), language B interpreter (104)). An interpreter may be a computer program that includes functionality to first translate the source code of a program (e.g., multiple language program (100)) into an IR, and then to execute the IR via interpretation. In one or more embodiments of the invention, an IR, once translated, may be include the functionality of an interpreter and, as such, may include functionality to execute itself. Additionally or alternatively, though not shown in FIG. 1, the machine code generation unit (118) may include any number of translators that include functionality to translate one or more languages of a multiple language program (100) into an IR, which then, performing the functionality of an interpreter, executes itself. In one or more embodiments of the invention, each element of an IR (e.g., each AST node) has an interpreter unit directly embedded, which provides the IR functionality to execute itself after the translation occurs. For example, if the IR is an AST, an add node of the AST may include functionality to compute the sum.

An interpreter (e.g., language A interpreter (102), language B interpreter (104)), which may be implemented via division into units that are integrated into IR elements, may include functionality to execute an IR of a program for at least some period of time without necessarily compiling the program into machine code (116). For example, an IR of a program may execute until a predefined execution count is reached, and/or, in the case of an interpreter capable of performing AST node replacements (e.g., to specialize/optimize the AST), until the AST reaches a stable state with no more node replacements occurring, after which compilation may occur. Additionally or alternatively, an interpreter may include functionality to execute previously compiled code and/or a combination of an IR and previously compiled code.

In one or more embodiments of the invention, an interpreter (e.g., language A interpreter (102), language B interpreter (104)) is any kind of interpreter for any programming language now known or later developed. The IR of the program generated by an interpreter may take any IR form including, but not limited to: ASTs, bytecodes, graphs, flows, and/or any other suitable IR forms. The machine code generation unit (118) may include any number of interpreters, and at least some portion of the interpreters may be designed to interpret and/or translate source code written in one or more programming languages. For example, language A interpreter (102) may be an IR of source code expressed in the Ruby language, and language B interpreter (104) may be an IR of source code expressed in the C language, with each IR including functionality to execute itself via integrated interpretation units in each element of the IR.

The machine code generation unit (118) may additionally include one or more interpreters capable of executing composed cross-language IRs (discussed further below). In one or more embodiments of the invention, an IR of the main language of a multiple language program may be referred to as a main language IR, and an IR of the one or more additional languages of a multiple language IR may be referred to as IR snippets. In one or more embodiments of the invention, an IR snippet is a non-standalone sequence of an IR and, as such, may be referred to as a fragment of an IR. For example, if a translator translates one or more additional languages of a multiple language program into one or more AST snippet representations, then the AST snippets may be an AST sub-trees.

In one or more embodiments of the invention, the machine generation unit (118) also includes an IR repository (106). In one or more embodiments of the invention, the IR repository (106) is a data repository and includes functionality to store IRs generated by an interpreter and/or a translator based on various languages of an input multiple language program. Stored IRs may include, but are not limited to main language IRs and IR snippets. In one or more embodiments of the invention, a data repository is any type of storage unit and/or device (e.g., random access memory (RAM), a file system, database, collection of tables, or any other storage mechanism) for storing data/information. Specifically, the IR repository (106) may include hardware, circuitry, integrated circuit(s) and/or software. Further, the IR repository (106) may include multiple different storage units and/or devices. The multiple different storage units and/or devices may or may not be of the same type or located at the same physical site. In one or more embodiments of the invention, the IR repository (106) is located in memory (e.g., RAM) operatively connected to one or more computing devices. In one or more embodiments of the invention, the IR repository (106) is included as a part of a computing device on which the machine code generation unit (118) executes. In other embodiments of the invention, the IR repository (106) includes one or more stand-alone repositories that are accessible by, at least, the machine code generation unit (118).

In one or more embodiments of the invention, the machine code generation unit (118) also includes a cross-language IR generation module (108). In one or more embodiments of the invention, the cross-language IR generation module (108) includes hardware, circuitry, integrated circuit(s), software, firmware, and/or any combination thereof. For example, the cross-language IR generation module (108) may be software executing on a processing system that includes circuitry and/or integrated circuits along with operatively connected memory. In one or more embodiments of the invention, the cross-language IR generation module (108) includes functionality to compose a cross-language IR using IRs of two or more languages of a multiple language program. For example, the cross-language IR generation module (108) may compose a cross-language IR consisting of a main language IR corresponding to JavaScript source code of the multiple language program and an IR snippet corresponding to Ruby source code of the multiple language program. The cross-language IR generation (108) module may be operatively connected to the IR repository (106) and/or to a modification module (112). Generating a cross-language IR from a main language IR and one or more IR snippets may occur, at least in part, during execution (e.g., interpretation) of the main language IR. The cross-language IR generation module (108) and generation of cross-language IRs are discussed further in the description of FIG. 2 and FIG. 3, below.

In one or more embodiments of the invention, the machine code generation unit (118) also includes a compilation unit (110). In one or more embodiments of the invention, a compilation unit (110) is a representation of source code (e.g., an IR) that may be compiled into a single executable machine code representation of a multiple language program. As such, modifications (e.g., optimization, specialization, constant propagation, etc.) may occur before and/or during compilation of the compilation unit instead of having to cease when switching from a main language to an additional language occurs (e.g., when a foreign object is accessed by the additional language). As used herein, the compilation unit (110) includes IRs of the languages of the multiple language program that have been composed by the cross-language IR generation module (108) as a single cross-language IR. Said another way, a cross-language IR, once composed, may be considered a compilation unit (110).




← Previous       Next →

Download full PDF for full patent description, claims and images

Advertise on FreshPatents.com - Rates & Info


You can also Monitor Keywords and Search for tracking patents relating to this Mechanism for increasing the performance of multiple language programs by inserting called language ir into the calling language patent application.

###


Browse recent Oracle International Corporation patents

Keyword Monitor How KEYWORD MONITOR works... a FREE service from FreshPatents
1. Sign up (takes 30 seconds). 2. Fill in the keywords to be monitored.
3. Each week you receive an email with patent applications related to your keywords.  
Start now! - Receive info on patent apps like Mechanism for increasing the performance of multiple language programs by inserting called language ir into the calling language or other areas of interest.
###


Previous Patent Application:
Mechanical timepiece movement provided with a feedback system for the movement
Next Patent Application:
Media content analysis system and method
Industry Class:

Thank you for viewing the Mechanism for increasing the performance of multiple language programs by inserting called language ir into the calling language patent info.
- - -

Results in 0.06315 seconds


Other interesting Freshpatents.com categories:
Electronics: Semiconductor Audio Illumination Connectors Crypto

###

Data source: patent applications published in the public domain by the United States Patent and Trademark Office (USPTO). Information published here is for research/educational purposes only. FreshPatents is not affiliated with the USPTO, assignee companies, inventors, law firms or other assignees. Patent applications, documents and images may contain trademarks of the respective companies/authors. FreshPatents is not responsible for the accuracy, validity or otherwise contents of these public document patent application filings. When possible a complete PDF is provided, however, in some cases the presented document/images is an abstract or sampling of the full patent application for display purposes. FreshPatents.com Terms/Support
-g2-0.1356

66.232.115.224
Browse patents:
Next
Prev

stats Patent Info
Application #
US 20170046137 A1
Publish Date
02/16/2017
Document #
14822489
File Date
08/10/2015
USPTO Class
Other USPTO Classes
International Class
06F9/45
Drawings
12




Follow us on Twitter
twitter icon@FreshPatents

Oracle International Corporation


Browse recent Oracle International Corporation patents





Browse patents:
Next
Prev
20170216|20170046137|mechanism for increasing the performance of multiple language programs by inserting called language ir into the calling language|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); |Oracle-International-Corporation
';