WO2017018644A1 - 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체 - Google Patents

전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체 Download PDF

Info

Publication number
WO2017018644A1
WO2017018644A1 PCT/KR2016/005025 KR2016005025W WO2017018644A1 WO 2017018644 A1 WO2017018644 A1 WO 2017018644A1 KR 2016005025 W KR2016005025 W KR 2016005025W WO 2017018644 A1 WO2017018644 A1 WO 2017018644A1
Authority
WO
WIPO (PCT)
Prior art keywords
compiler
source code
programming language
dynamic programming
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/KR2016/005025
Other languages
English (en)
French (fr)
Inventor
박재만
조준영
최영일
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Samsung Electronics Co Ltd
Original Assignee
Samsung Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Samsung Electronics Co Ltd filed Critical Samsung Electronics Co Ltd
Priority to US15/742,740 priority Critical patent/US10635421B2/en
Publication of WO2017018644A1 publication Critical patent/WO2017018644A1/ko
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/49Partial evaluation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • G06F9/4552Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM

Definitions

  • the present invention relates to an electronic device, a compilation method, and a computer readable recording medium, and more particularly, compilation of source code of a dynamic programming language such as JavaScript to the level of a static programming language such as C.
  • An electronic device, a compilation method, and a computer-readable recording medium for optimizing is a particularly, compilation of source code of a dynamic programming language such as JavaScript to the level of a static programming language such as C.
  • AOTC Ahead-of-Time Compilation
  • JITC Just-in-Time Compilation
  • JITC which is commonly used in dynamic programming languages like JavaScript, compiles into machine code (or machine language) while executing a program. Divide the source code into specific units (usually function units), and compile and run them the first time the code in that section is called. The compiled machine code is cached and reused when the same part is later called again. Thus, the programmer provides high-level source code, and the user of the program compiles in a JITC fashion whenever the program runs.
  • JITC can use program analysis information that can be obtained only at runtime because JITC is compiled during runtime. For example, when executing a JavaScript program, the exact type of the function argument is only available when the function is called. These advantages make JITC suitable for dynamic languages such as JavaScript.
  • the second is to compile only the code called at runtime, which reduces the size of the code area. In other words, JITC does not load into memory any part of the source code that is not actually executed. However, program analysis and compilation are performed at run time, resulting in additional memory and power consumption.
  • the AOTC method which is mainly used for compiling static programming languages such as the C language, precompiles the entire source code of a program before execution of the program and provides the program user in the form of machine code.
  • the biggest advantage of AOTC is that it does not compile source code at run time, resulting in higher performance compared to JITC in runtime.
  • this AOTC method is difficult to apply to a dynamic programming language because information analyzed at runtime, such as JITC, cannot be used. That is, in the related art, in the case of a dynamic programming language, JITC has to be used because of characteristics of the language that make AOTC difficult, for example, all syntax cannot be supported.
  • JITC for dynamic programming languages such as JavaScript in constrained embedded or mobile environments is disadvantageous in terms of time, memory, and power consumption.
  • Embodiments of the present invention provide an electronic device, a compilation method, and a computer-readable recording medium for optimizing the compilation of source code of a dynamic programming language such as JavaScript to a level of a static programming language such as C. There is this.
  • an electronic device for compiling source code of a dynamic programming language compiled during program execution at a level of a static programming language compiled before execution may be received. Determining whether the source code of the dynamic programming language generated by the first compiler can be processed by the first compiler in the same manner as the source code of the static programming language, and if it is possible to process the source code of the dynamic programming language, It may include a processor for converting by the first compiler.
  • the source code of the dynamic programming language may include a form in which the type of the variable may be maintained with respect to the source code of the same function.
  • the processor may convert and output source code of the dynamic programming language by the first compiler, and if the determination result processing is impossible, convert the source code by a second compiler and output the converted code.
  • the first compiler may include a compiler capable of Ahead-of-Time Compilation (AOTC), and the second compiler may include a compiler capable of Just-in-Time Compilation (JITC).
  • AOTC Ahead-of-Time Compilation
  • JITC Just-in-Time Compilation
  • the processor converts the generated source code of the generated dynamic programming language into tokens, generates the decomposed partial code in a tree form, and analyzes the partial code in the tree form to perform conversion by the first compiler. You can determine if it is possible.
  • the processor determines, in source code of the dynamic programming language, whether there is a variable that does not remain the same for the same function associated with the instruction, and when the variable does not exist, the source code of the dynamic programming language It may be determined whether the grammar matches the first compiler, and when the grammar of the language included in the source code of the dynamic programming language matches the first compiler, it may be determined that the conversion is possible.
  • the processor may determine that the syntax of the dynamic language corresponds to the first compiler when a grammar of a predetermined language does not exist in the source code of the dynamic programming language.
  • the grammar of the preset language may include a specific function designated by a user or a system designer.
  • the specified specific function may include an 'eval (uate)' case.
  • the compilation method in a method for compiling source code of a dynamic programming language compiled during program execution at the level of a static programming language compiled before execution, Determining whether the source code can be processed by the first compiler having the same method as that of processing the source code of the static programming language, and if the processing result, source code of the dynamic programming language to the first compiler And converting and outputting the same.
  • the source code of the dynamic programming language may include a form in which the type of the variable may be maintained for the same source code of the same function.
  • the compiling method includes converting and outputting source code of the dynamic programming language by the first compiler, and if it is impossible to process, converting source code of the dynamic programming language by a second compiler and outputting the result. It may further comprise the step.
  • the first compiler may include an AOTC capable compiler
  • the second compiler may include a JITC capable compiler.
  • the compilation method may further include generating a tokenized source code of the input dynamic programming language, decomposing the generated source code, and generating the decomposed partial code in a tree form.
  • the partial code in the tree form may be analyzed to determine whether conversion by the first compiler is possible.
  • the determining whether the first compiler is convertible may include determining whether, in the source code of the dynamic programming language, a variable does not remain the same for the same function related to the instruction, the variable may not exist.
  • the conversion is Determining that it is possible.
  • the determining whether the grammar matches the first compiler may determine that the grammar corresponds to the first compiler when the grammar of the preset language does not exist in the source code of the dynamic programming language.
  • the grammar of the preset language may include a specific function designated by a user or a system designer.
  • the specified specific function may include an 'eval (uate)' case.
  • a computer-readable recording medium includes a program for executing a method for compiling source code of a dynamic programming language compiled during program execution at the level of a static programming language compiled before execution.
  • the compilation method may further include determining whether an input source code of the dynamic programming language satisfies a predetermined condition, and if the predetermined condition is satisfied, the source of the dynamic programming language.
  • the code executes the step of converting and outputting the same compilation method as that of processing the source code of the static programming language.
  • the source code of the dynamic programming language can be improved with limited or selectively AOTC, thereby improving the compilation performance of the device.
  • FIG. 1 is a block diagram of an electronic device according to a first embodiment of the present invention.
  • FIG. 2 is a block diagram of an electronic device according to a second embodiment of the present invention.
  • FIG. 3 is an exemplary diagram of a hybrid compilation execution unit shown in FIG. 2;
  • FIGS. 1 and 3 are first exemplary views of the hybrid compilation unit of FIGS. 1 and 3;
  • FIG. 5 is a second exemplary view of the hybrid compilation unit of FIGS. 1 and 3;
  • 6A to 6C are added to help understand the processing of each module of FIG. 5, for example.
  • FIG. 7 is a flowchart of a compilation process according to a first embodiment of the present invention.
  • FIG. 8 is a flowchart of a compiling process according to a second embodiment of the present invention.
  • FIG. 9 is a flowchart of a compiling process according to a third embodiment of the present invention.
  • FIG. 10 is a flowchart of a compilation process according to a fourth embodiment of the present invention.
  • FIG. 1 is a block diagram of an electronic device according to a first embodiment of the present invention.
  • the electronic device 90 provides a mobile device such as a smartphone, an MP3, a PMP, a laptop computer, a wearable device, an image display device such as a DTV, a desktop computer, and a web service. And a service providing device such as a web server.
  • a mobile device such as a smartphone, an MP3, a PMP, a laptop computer, a wearable device, an image display device such as a DTV, a desktop computer, and a web service.
  • a service providing device such as a web server.
  • the following description may be made with a mobile device or a PC.
  • the electronic device 90 may include a communication interface 100, a user interface 110, a controller 120, a storage 130, and a display. 140 and some or all of the hybrid compilation unit 150.
  • the inclusion of some or all may include omitting some components such as the storage unit 130 or the display unit 140, or the hybrid compilation unit 150 may be integrated into the control unit 120. Meaning, it will be described to include all in order to help a sufficient understanding of the invention.
  • the communication interface unit 100 accesses an external web server to receive image data.
  • the image data may include, for example, video / audio data and additional information in the case of a broadcast program provided by a broadcasting station.
  • the communication interface 100 may receive image data provided by wire or wirelessly by including a wired / wireless communication module.
  • a short-range communication module can be connected to the access point (AP) of the peripheral to receive the image data.
  • the user interface 110 receives a user command for operating the electronic device 90, for example, the mobile device.
  • a user command may be input through the display unit 140 when it is implemented as a touch screen.
  • the display 140 may be included in the category of the user interface 110.
  • the user interface 110 may mean a physical button such as a power button for turning on or off the power of the electronic device 90.
  • a keypad that can be displayed on the touch screen that is, a number and a letter button or the like is composed of physical buttons, the physical buttons may be included.
  • the user interface 110 may include an image capturing unit including a camera taking an image and a sound output unit including a speaker for outputting sound.
  • the user interface 110 may include all elements associated with the user.
  • the controller 120 controls overall operations in the electronic device 90.
  • the controller 120 may include an image processor (not shown) to separate image data received through the communication interface unit 100 into video / audio data and additional information, and to separate the separated video and audio data. Each can be decoded. After the operation of scaling each decoded data, the video data may be displayed on the display 140, and the operation of outputting sound to the sound output unit may be controlled.
  • control unit 120 executes the hybrid compiling unit 150 when there is a command to execute the hybrid compiling unit 150.
  • the controller 120 executes the hybrid compilation unit 150 based on a user command to generate an executable file in the storage unit 130.
  • the controller 120 converts the input user command through the hybrid compiling unit 150 to output a machine language, that is, a binary code.
  • the display unit 140 may recognize the corresponding binary code and execute the corresponding application according to the user's additional command.
  • the controller 120 executes the hybrid compiling unit 150 to execute a binary.
  • a calculator executable file is generated, and when a user selects a calculator menu displayed on the screen of the display unit 140, the user command is recognized and executed accordingly.
  • This operation is not necessarily executed only when there is a command (or user command) by the user interface.
  • a command or user command
  • the electronic device 90 or the control unit 120 of the electronic device 90 may automatically interwork with the hybrid compiling unit 150.
  • the user command and the event according to the embodiment of the present invention may be a command for operating a specific program.
  • the storage unit 130 may include a hard disk drive (HDD), a ROM, and a RAM.
  • HDD hard disk drive
  • ROM read-only memory
  • the RAM may store data that the controller 120 temporarily processes.
  • the controller 120 may temporarily store additional information separated from the received image data in the RAM of the storage unit 130, and recall and use the additional information. When reused in this way, the space where the corresponding additional information is stored becomes empty. RAM is used to temporarily store data and to read stored data quickly.
  • the display 140 displays an image.
  • the display unit 140 may include a liquid crystal panel or an OLED panel.
  • a touch panel may be further attached on the liquid crystal panel to implement a touch screen in which user commands can be input.
  • the display unit 140 according to an exemplary embodiment of the present invention may include a panel in which a touch function is added to one liquid crystal panel in addition to the liquid crystal panel and the touch panel.
  • the hybrid compilation unit 150 may have a form of a program stored in a memory such as a ROM, but may have a form in which a part of the stored program, that is, a SW module performing a specific function is formed of hardware. have.
  • a SW module a registry is like a hardware memory that can be replaced.
  • the hybrid compilation unit 150 will not be specified as a program.
  • the hybrid compiling unit 150 may include a plurality of compilers. Of course, each compiler, namely the first compiler and the second compiler, may be SW modules, but only one of them may be formed of hardware.
  • the hybrid compilation unit 150 selectively executes the first compiler and the second compiler configured as described above with respect to source codes of different programming languages.
  • the source code forms a system including a function related to a plurality of commands related to a user command and a variable dependent on the function, and may be composed of a set thereof.
  • the hybrid compilation unit 150 may selectively execute the source code of the same programming language.
  • the same programming language may mean a dynamic programming language such as JavaScript according to an embodiment of the present invention. More specifically, the hybrid compilation unit 150 necessarily executes the first compiler when the instruction for executing the operation of the program is a static programming language such as C language.
  • the hybrid compiling unit 150 executes the first compiler if it is possible to compile at the level of the static programming language.
  • the hybrid compiling unit 150 executes the second compiler.
  • the first compiler is a higher performance compiler than the second compiler.
  • high performance includes processing data as fast as converting an input command to output machine language.
  • the second compiler may be JITC.
  • the hybrid compilation unit 150 can be regarded as compiling with the AOTC compiler when AOTC can be processed in the dynamic programming language.
  • AOTC may or may not be possible depending on the program source code in the case of dynamic programming languages. Therefore, in the embodiment of the present invention, in the case of the AOTC-capable source code, the processing power of the dynamic programming language is increased.
  • the hybrid compilation unit 150 may change the variable type for the same variable in the source code of the dynamic programming language corresponding to the instruction in order to determine whether AOTC is possible. You can first determine if there is. For example, when the variable type int representing 'integer' and the variable type char representing 'character' are used together for the same variable i, the variable type is changed. In this case, AOTC is not possible. Therefore, when the same variable has the same function, the hybrid compiling unit 150 checks whether the AOTC is impossible in syntax again. For example, the function 'eval', which represents 'evaluate' is a case where AOTC is inherently impossible. Thus, without this syntax, AOTC may be possible. According to an embodiment of the present invention, the former corresponds to a type inference process, and the latter corresponds to a grammar checking process.
  • the performance of the electronic device 90 may be increased in an embedded (ex. PC) environment or a mobile environment.
  • the application may be provided by the high performance AOTC. If the AOTC is not possible, the JITC mode application may be generated to ensure language compatibility.
  • JITC is selected, it is executed by the existing JIT compiler, and thus has the same performance as the existing JIT compilation.
  • the electronic device 90 provides the program developer with a grammar that prevents type inference or a dynamic grammar that makes AOTC difficult, thereby increasing the probability that the program written by the developer is compiled in the AOTC mode. It may help to increase the performance of dynamic language programming of the electronic device 90.
  • a user using the electronic device 90 may experience an application with improved processing performance on average without having to know whether the application is in AOTC mode or JITC mode.
  • FIG. 2 is a block diagram of an electronic device according to a second embodiment of the present invention
  • FIG. 3 is an exemplary view of the hybrid compilation execution unit shown in FIG. 2.
  • the electronic device 190 may be a part or all of the interface unit 200, the hybrid compilation execution unit 210, and the storage unit 220. It includes.
  • the electronic device 190 is a device such as a computer main body or a web server without the display unit 140 of FIG. 1 compared with the electronic device 90 shown in FIG. 1.
  • the control unit 120 and the hybrid compilation unit 150 illustrated in FIG. 1 may refer to a device in which at least one of HW / SW is integrated.
  • the interface unit 200 and the storage unit 220 are the same as or similar to some or all of the communication interface unit 100 and the user interface unit 110 described with reference to FIG. 1, and the storage unit 130, the contents thereof are the same.
  • the hybrid compilation execution unit 210 may have a structure as shown in FIG. 3. 3 illustrates, as an example, the processor 210-1 and a hybrid compiling unit 210-2 in which a compiler is stored in a memory. However, since both the processor 210-1 and the hybrid compilation unit 210-2 of FIG. 3 may be implemented in software, the hybrid compilation execution unit 210 shown in FIG. It will not be specifically limited to the structure of FIG.
  • the structures of the processor 210-1 and the hybrid compiling unit 210-2 illustrated in FIG. 3 may be considered to be modified forms of the controller 120 and the hybrid compiling unit 150 illustrated in FIG. 1. However, the operation may be somewhat different. In other words, in FIG. 1, if the control unit 120 receives only the processing result by executing the hybrid compiling unit 150, the hybrid compiling execution unit 210 of FIG. 2 is applied when the power of the electronic device 190 is applied. That is, at the beginning of system operation (eg, during booting or after booting), the processor 210-1 of FIG. 3 may call a compiler stored in the storage unit 220 and store it in an internal memory. Of course, it is also possible to modularize the compiler in the internal memory at the time of shipment of the electronic device 90 will not be particularly limited to the above.
  • the hybrid compilation execution unit 210 of FIG. 2 may have a structure as shown in FIG. 3, and thus may perform data processing more quickly than in FIG. 2.
  • a specific web server is configured to update specific data stored in the storage unit 220 of the electronic device 90 such as a computer main body.
  • the hybrid compilation execution unit 210 will update the data stored in the storage unit 220 by accessing the external device, for example, the server through this when the event to update occurs.
  • the hybrid compilation execution unit 210 needs to recognize an instruction of a specific programming language and perform an operation based on the recognition result, the hybrid compilation unit 150 described above with reference to FIG. 1. Will perform the same or similar operation. Therefore, the description is replaced by the description, and further description is omitted.
  • FIGS. 1 and 3 are first exemplary views of the hybrid compilation unit of FIGS. 1 and 3.
  • the hybrid compilation units 150 and 210-2 may include a lexer and a parser 400, a compiler determiner 410, a first compiler 420, and a first compiler. 2 includes some or all of the compiler 430.
  • the inclusion of some or all includes some components such as the lexer and the parser 400 may be omitted, or some or all of the compiler determining unit 410, the first compiler 420, and the second compiler 430. Means that can be configured integrated, etc., will be described as including all to help a full understanding of the invention.
  • generating the partial code obtained by decomposing the source code related to the instruction in the lexer and the parser 400 in the form of a tree may operate the first compiler 420 including the low level virtual machine (LLVM) of the AOTC.
  • LLVM low level virtual machine
  • the compiler determiner 410, the first compiler 420, and the second compiler 430 may mean a module unit for a specific software, that is, a program. Therefore, since the SW module can be configured as HW, the compiler determining unit 410, the first compiler 420, and the second compiler 430 will not particularly limit whether SW means or HW. .
  • FIG. 4 is for explaining the configuration of the HW
  • FIG. 5 to be described later is for explaining the configuration of the SW.
  • the embodiment of the present invention sees the case of Figure 5 more preferably.
  • the lexer and the parser 400 may be provided with source code related to an instruction for operating a program. If the source code is already stored in a separate memory, the stored source code can be called and used.
  • the lexer and parser 400 tokenizes the received source code to decompose it, and generates a tree using the decomposed partial code.
  • the partial code is part of the source code.
  • the compilation determining unit 410 may first determine whether the received source code is a dynamic programming language.
  • the source code of the static programming language such as C language may be compiled by the first compiler 420 by first determining whether the program is a dynamic program.
  • the first compiler 420 may include an AOTC.
  • the compilation determining unit 410 determines whether processing by the first compiler 420 such as AOTC is possible if the input source code is a dynamic programming language. If possible, the first compiler 420 may be selected to execute AOTC, but if not, the second compiler 430 may be selected to perform compilation. In other words, in the embodiment of the present invention, the source code of the input dynamic programming language is selectively compiled by the first compiler 420 and the second compiler 430.
  • variable type int representing an integer
  • variable type char representing a character
  • this is a type inference according to an embodiment of the present invention. It does not meet the conditions of the process. Therefore, in this case, the second compiler 430 of the JITC may be selected.
  • JITC's second compiler 430 is selected even when there is a function 'eval' meaning 'evaluate' as a syntax that AOTC cannot. Therefore, when both conditions are satisfied in the former type inference process and grammar checking process according to an embodiment of the present invention, the source code of the dynamic programming language may be compiled by the first compiler 420 of the AOTC. .
  • the first compiler 420 has better compilation performance than the second compiler 430 and can execute AOTC. Accordingly, the first compiler 420 basically compiles the source code of the input static programming language into, for example, AOTC, and in the case of the source code of the dynamic programming language, only the source code selected by the compilation determining unit 410. Only perform compilation with AOTC.
  • the second compiler 430 may execute JITC for compiling the source code of the dynamic programming language, but performs only the compilation of the source code of the selected limited dynamic programming language determined by the compilation determining unit 410.
  • the selected limited dynamic programming language means a case where the conditions of the type inference process and the grammar check process are not satisfied.
  • FIG. 5 is a second exemplary view of the hybrid compilation unit of FIGS. 1 and 3.
  • FIG. 5 is a SW module, assuming that the first compiler 420 of FIG. 4 is AOTC, and the second compiler 430 is JITC.
  • the hybrid compilation units 150 ′ and 210-2 ′ may include a lexer and parser module 500, a compilation determination module 510, and a first compilation. Some or all of module 520 and second compiling module 530.
  • the lexer and parser module 500 tokenizes the given source code to decompose it, and generates an abstract syntax tree (AST) of the decomposed (partial) codes.
  • AST abstract syntax tree
  • the compilation determination module 510 may be divided into a type inference module 510-1 and a syntax checker 510-2. This allows you to select the appropriate compilation mode. In other words, the type inference module 510-1 proceeds with type inference for variables in the AST, and the grammar checking module 510-2 checks whether the grammar is suitable for AOTC. If it is determined that the result is suitable for the AOTC, a typed function AST is generated and provided to the AOTC, that is, the first compilation module 520. Otherwise compilation decision module 510 is provided to second compilation module 530 that executes JITC.
  • the first compilation module 520 performs the compilation using the AOTC method
  • the second compilation module 530 performs the compilation using the JITC method.
  • the hybrid compiling units 150 'and 210-2' are hybrids that apply AOTC to a portion capable of AOTC, and otherwise apply JITC to a dynamic programming language in which AOTC is difficult. It can be seen as a way.
  • the biggest barrier to AOTC in common dynamic programming languages is the lack of type. Therefore, in the embodiment of the present invention, the type inference module 510-1 is placed in the compiler as described above to add a type to a variable used through inference. The type inference module 510-1 performs type inference for each variable while performing tree traversal analysis on the AST obtained from the lexer and parser module 500, and a type annotated variable. ).
  • the type inference module 510-1 does not always completely perform type inference of all variables. There are also cases where the type is not fixed. In this case, an inference error occurs, and the second compilation module 530 moves to proceed with compilation of the JIT mode.
  • the grammar checking module 510-2 operates. Dynamic programming languages often contain dynamic features as well as dynamic features that prevent various static compilations. For example, the JavaScript 'eval' property has extra code as a string argument that compiles (and executes) the code when the eval function is called. In the case of a program that contains these dynamic characteristics, static compilation is difficult, so it is impossible to proceed in AOTC mode. Therefore, the grammar check module 510-2 generates a grammar error by checking whether the AOTC mode is impossible or includes a grammar that is difficult to expect the performance of JITC even if AOTC is possible as described above, and then returns to the second compilation module 530. Go ahead and compile JIT mode.
  • each AST node is traversing, or traversing, and a code generator completes an intermediate representation (ex. LLVM IR).
  • LLVM IR intermediate representation
  • the code generator can be considered to complete the intermediate form before conversion to the target language.
  • the hybrid compiler When the JITC mode is selected, the hybrid compiler according to the embodiment of the present invention generates a C ++ application that wraps program source code and embeds an existing JIT compiler. For example, for JavaScript, you can use a JIT compiler such as the JavaScript engine (V8) or JSC. When the program user executes this C ++ application, it executes it through JITC through the source code of the nested dynamic language.
  • a JIT compiler such as the JavaScript engine (V8) or JSC.
  • FIG. 6A to 6C are diagrams added to help understand the processing of each module of FIG. 5, for example. 6A-6C illustrate the results of progress for different source codes.
  • Each of (a) of Figs. 6A to 6C shows the form of source code. For example, when a user provides a command "store two integers in a variable and output them", the source code as in FIG. 6A (a) occurs.
  • the lexer and parser module 500 of FIG. 5 may generate a tree as in FIG. 6A (b) with respect to the source code as shown in FIG. 6A (a).
  • the compiler determination module 510 of FIG. 5 determines whether the variable int representing an integer for the variable v is maintained 600 as shown in (c) of FIG. 6A while analyzing through the tree traversal. In case of the source code of (a) of FIG. 6B, the case where the variable type is changed (610) for the same variable as in (c) of FIG. 6B is determined and compiled into JITC as shown in (d) of FIG. 6B. Will be performed.
  • the compiler determination module 510 then checks the case where the same variable type is maintained as shown in (c) of FIG. 6B and simultaneously performs grammar checking. As a result of checking the grammar, if a grammar 620 such as eval exists as shown in (a) of FIG. 6C, it is treated as JITC as shown in (d) of FIG. ) Does not exist, it is processed by AOTC. In other words, in the case of FIG. 6A, the AOTC is processed through the compiler determination module 510.
  • FIG. 7 is a flowchart illustrating a compilation process according to a first embodiment of the present invention.
  • an electronic device 90 may include a first method in which a source code of an input dynamic programming language is the same as a source code of a static programming language. It is determined whether the compiler can process (S700).
  • the first compiler includes a compiler capable of AOTC. Therefore, the electronic device 90 may proceed with the type inference process and the grammar check process described above to determine the possibility.
  • the electronic device 90 converts and outputs the source code of the dynamic programming language by the first compiler.
  • the converted source code is a machine language such as binary code.
  • the electronic device 90 may perform a process of converting and outputting the source code of the dynamic programming language by the second compiler.
  • the second compiler executes the JITC, it can be seen that the source code of the input dynamic programming language is executed when it is impossible to process by the first compiler.
  • the electronic device 90 Recognizing the output machine language, that is, the binary code, the electronic device 90 performs an operation on a command to operate a program. For example, the operation of recognizing the binary code, which is a machine language, is performed for the command to store an image in memory.
  • FIG. 8 is a flowchart illustrating a compilation process according to a second embodiment of the present invention.
  • FIG. 8 is a modified operation of FIG. 7 and assumes a case in which a second compiler may not be included as in FIG. 7.
  • the electronic device 90 determines whether a source code of an input dynamic programming language satisfies a preset condition (S800).
  • the predetermined condition may be related to whether the same variable (ex. Integer int) is used for the same function (ex. Add) or does not include a specific grammar (ex. Eval).
  • the electronic device 90 converts and outputs the source code by the same compiling method (eg, AOTC method) as that of processing the source code of the static programming language (S810).
  • the same compiling method eg, AOTC method
  • FIG. 9 is a flowchart illustrating a compilation process according to a third embodiment of the present invention.
  • FIG. 9 assumes a case where parsing should be performed in order to include a low level virtual machine (LLVM) in order to perform the AOTC method.
  • LLVM low level virtual machine
  • the electronic device 90 performs lexing and parsing of a given source code (S900).
  • the electronic device 90 determines whether AOTC is possible (S910). To this end, the electronic device 90 may first determine whether the source code is an operation programming language.
  • the possibility of AOTC has been described using the type inference process and the grammar checking process as an example, and the description thereof is replaced with the description thereof.
  • the electronic device 90 executes AOTC on the source code of the dynamic programming language (S920).
  • the electronic device 90 processes a code generated by the executed AOTC, that is, a binary code as a machine language (S920).
  • processing means that the compiler outputs the code.
  • the electronic device 90 performs an operation based on the command, more precisely based on the output (binary) code.
  • FIG. 10 is a flowchart illustrating a compilation process according to a fourth embodiment of the present invention.
  • FIG. 10 includes a process of determining the type of language in FIG. 9 and assumes a case in which a first compiler and a second compiler are included.
  • the electronic device 90 generates a source code in operation S1000.
  • the generation of the source code may be made when there is a user command or an event of a predetermined condition occurs.
  • the preset condition may be related to whether the mobile device receives a request for updating specific data from an external web server.
  • the electronic device 90 determines whether the generated source code is a source code of a dynamic programming language (S1010).
  • the electronic device 90 may further determine whether it is possible to compile with a first compiler that executes AOTC (S1020). Of course, this assumes that the first compiler performs better than the second compiler. In addition, since it has been fully described above with respect to the possibility of further description will be omitted.
  • the source code generated in step S1010 is not a dynamic programming language, for example, a static programming language such as C language, the source code is compiled by the first compiler (S1030).
  • the electronic device 90 when it is determined that compilation is possible with the first compiler, the electronic device 90 compiles source code of the dynamic programming language by the first compiler in operation S1040.
  • step S1020 source code of the dynamic programming language may be compiled with a second compiler such as JITC (S1050).
  • the electronic device 90 processes the compiled code generated by the processes of S1030, S1040, and S1050, respectively (S1060).
  • the processing here may be understood as outputting the generated binary code as before.
  • the present invention is not necessarily limited to these embodiments.
  • all of the components may be selectively operated in combination with one or more.
  • each or some of the components of the components are selectively combined to perform some or all functions combined in one or a plurality of hardware. It may be implemented as a computer program having a. Codes and code segments constituting the computer program may be easily inferred by those skilled in the art. Such a computer program may be stored in a computer-readable non-transitory computer readable media and read and executed by a computer, thereby implementing an embodiment of the present invention.
  • the non-transitory readable recording medium refers to a medium that stores data semi-permanently and can be read by a device, not a medium storing data for a short time such as a register, a cache, or a memory.
  • the above-described programs may be stored and provided in a non-transitory readable recording medium such as a CD, a DVD, a hard disk, a Blu-ray disk, a USB, a memory card, a ROM, or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Computing Systems (AREA)

Abstract

본 발명은 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체에 관한 것으로서, 본 발명의 실시예에 따른 전자 장치는 프로그램 실행 중에 컴파일되는 동적 프로그래밍 언어의 소스 코드를, 실행 전에 컴파일되는 정적 프로그래밍 언어의 수준으로 컴파일링하는 전자 장치에 있어서, 프로그램을 동작시키기 위한 명령어가 수신될 때 발생된 동적 프로그래밍 언어의 소스 코드가, 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 방식의 제1 컴파일러로 처리 가능한지 판단하며, 판단 결과 처리 가능하면 동적 프로그래밍 언어의 소스 코드를 제1 컴파일러에 의해 변환하는 프로세서를 포함할 수 있다.

Description

전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체
본 발명은 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체에 관한 것으로서, 더 상세하게는 자바스크립트(JavaScript)와 같은 동적 프로그래밍 언어의 소스 코드를 C 언어와 같은 정적 프로그래밍 언어의 수준으로 컴파일링을 최적화하는 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체에 관한 것이다.
프로그래밍 언어의 컴파일을 위해 일반적으로 쓰이는 두 가지 방법은 AOTC(Ahead-of Time Compilation)과 JITC(Just-in-Time Compilation)이다.
자바스크립트와 같은 동적 프로그래밍 언어에서 주로 사용하는 JITC에서는 프로그램을 실행하면서 기계 코드(또는 기계어)로의 컴파일이 진행된다. 소스 코드(source code)를 특정 단위(주로, 함수 단위)로 나누고 해당 부분의 코드가 처음 호출되는 순간에 컴파일하고 실행한다. 컴파일된 해당 기계 코드는 저장(cache)되어 이후 같은 부분이 다시 호출되었을 때 재사용된다. 그리하여 프로그래머는 높은 수준(high-level)의 소스 코드를 제공하고 프로그램 사용자는 프로그램을 실행할 때마다 그때그때 JITC 방식으로 컴파일을 실행하게 된다.
JITC 방법에는 주요한 두 가지 장점이 있다. 첫 번째는 JITC는 런타임(runtime) 즉 프로그램의 실행 중에 컴파일이 진행되기 때문에 실행시에만 얻을 수 있는 프로그램 분석 정보들을 사용할 수 있다. 예를 들어, 자바 스크립트 프로그램을 실행시 함수 argument의 정확한 유형(type)은 함수 호출시에만 얻을 수 있는 정보이다. 이러한 장점으로 JITC는 자바스크립트와 같은 동적 언어에 적합하다. 두 번째는 런타임 시 호출된 코드만을 컴파일하기 때문에 메모리 영역 중 코드 영역의 크기를 줄일 수 있다는 것이다. 즉, JITC는 소스 코드 내 실제로 실행되지 않는 부분에 대해서는 메모리에 로딩하지 않는다. 하지만, 실행시에 프로그램 분석과 컴파일이 수행되다 보니 추가로 드는 메모리 및 전력 소비가 커지는 경우도 있다.
한편, C 언어와 같은 정적 프로그래밍 언어의 컴파일에 주로 사용되는 AOTC 방법은 프로그램의 소스 코드 전체를 (프로그램의) 실행 전에 미리 컴파일하여 기계 코드 형태로 프로그램 사용자에게 제공한다. AOTC의 가장 큰 장점은 런타임 중에 소스 코드를 컴파일하지 않기 때문에 수행 시간에 있어서 JITC와 비교해 높은 성능을 보여 준다는 점이다.
그런데, 이러한 AOTC 방법은 JITC처럼 런타임에서 분석한 정보가 이용될 수 없기 때문에 동적 프로그래밍 언어에는 적용하기 힘들다. 즉 종래에는 동적 프로그래밍 언어의 경우 언어의 특성상 AOTC를 어렵게 하는 특성들, 가령 모든 문법(syntax)을 지원할 수 없는 문제 때문에 JITC를 사용할 수밖에 없었다.
하지만 제약이 많은 임베디드 환경이나 모바일 환경에서 자바스크립트와 같은 동적 프로그래밍 언어에 대하여 JITC를 사용하는 것은 시간, 메모리, 전력 소비 측면에서 불리한 점이 많다.
본 발명의 실시예는 가령 자바스크립트와 같은 동적 프로그래밍 언어의 소스 코드를 C 언어와 같은 정적 프로그래밍 언어의 수준으로 컴파일링을 최적화하는 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체를 제공함에 그 목적이 있다.
본 발명의 실시예에 따른 전자 장치는 프로그램 실행 중에 컴파일되는 동적 프로그래밍 언어의 소스 코드를, 실행 전에 컴파일되는 정적 프로그래밍 언어의 수준으로 컴파일링하는 전자 장치에 있어서, 프로그램을 동작시키기 위한 명령어가 수신될 때 발생된 상기 동적 프로그래밍 언어의 소스 코드가, 상기 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 방식의 제1 컴파일러로 처리 가능한지 판단하며, 상기 판단 결과 처리 가능하면 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하는 프로세서를 포함할 수 있다.
상기 동적 프로그래밍 언어의 소스 코드는, 명령어에 관련된 함수(func)와 상기 함수에 종속되는 변수를 포함하는 경우, 동일한 함수의 소스 코드에 대하여 변수의 유형이 동일하게 유지 가능한 형태를 포함할 수 있다.
상기 프로세서는, 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하여 출력하며, 상기 판단 결과 처리가 불가능하면 상기 소스 코드를 제2 컴파일러에 의해 변환하여 출력할 수 있다.
상기 제1 컴파일러는 AOTC(Ahead-of Time Compilation)가 가능한 컴파일러를 포함하고, 상기 제2 컴파일러는 JITC(Just-in-Time Compilation)가 가능한 컴파일러를 포함할 수 있다.
상기 프로세서는, 상기 발생된 동적 프로그래밍 언어의 소스 코드를 토큰화하여 분해하고, 상기 분해된 부분 코드를 트리 형태로 생성하며, 상기 트리 형태의 상기 부분 코드를 분석하여 상기 제1 컴파일러에 의한 변환이 가능한지 판단할 수 있다.
상기 프로세서는, 상기 동적 프로그래밍 언어의 소스 코드에서, 명령어에 관련된 동일 함수에 대하여 유형이 동일하게 유지되지 않는 변수가 존재하는지 판단하고, 상기 변수가 존재하지 않을 때 상기 동적 프로그래밍 언어의 상기 소스 코드가 상기 제1 컴파일러에 부합한 문법인지 판단하며, 상기 동적 프로그래밍 언어의 소스 코드에 포함된 언어의 문법이 상기 제1 컴파일러에 부합할 때, 상기 변환이 가능하다고 판단할 수 있다.
상기 프로세서는, 상기 동적 프로그래밍 언어의 소스 코드 내에, 기설정된 언어의 문법이 존재하지 않을 때 상기 제1 컴파일러에 부합하다고 판단할 수 있다.
상기 기설정된 언어의 문법은, 사용자 또는 시스템 설계자가 지정한 특정 함수를 포함할 수 있다.
상기 지정한 특정 함수는 경우 'eval(uate)' 함수를 포함할 수 있다.
또한 본 발명의 실시예에 따른 컴파일링 방법은, 프로그램 실행 중에 컴파일되는 동적 프로그래밍 언어의 소스 코드를, 실행 전에 컴파일되는 정적 프로그래밍 언어의 수준으로 컴파일링하는 방법에 있어서, 입력된 상기 동적 프로그래밍 언어의 소스 코드가, 상기 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 방식의 제1 컴파일러로 처리 가능한지 판단하는 단계, 및 상기 판단 결과, 처리 가능하면 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하여 출력하는 단계를 포함한다.
상기 동적 프로그래밍 언어의 소스 코드는, 명령어에 관련된 함수와 상기 함수에 종속되는 변수를 포함하는 경우, 동일한 함수의 소스 코드에 대하여 변수의 유형이 동일하게 유지 가능한 형태를 포함할 수 있다.
상기 컴파일링 방법은 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하여 출력하는 단계, 및 상기 판단 결과, 처리가 불가능하면 상기 동적 프로그래밍 언어의 소스 코드를 제2 컴파일러에 의해 변환하여 출력하는 단계를 더 포함할 수 있다.
상기 제1 컴파일러는 AOTC가 가능한 컴파일러를 포함하며, 상기 제2 컴파일러는 JITC가 가능한 컴파일러를 포함할 수 있다.
상기 컴파일링 방법은 상기 입력된 동적 프로그래밍 언어의 소스 코드를 토큰화하여 분해하고, 분해된 부분 코드를 트리 형태로 생성하는 단계를 더 포함하며, 상기 제1 컴파일러에 의해 변환 가능한지 판단하는 단계는, 상기 트리 형태의 상기 부분 코드를 분석하여 상기 제1 컴파일러에 의한 변환이 가능한지 판단할 수 있다.
상기 제1 컴파일러에 의해 변환 가능한지 판단하는 단계는, 상기 동적 프로그래밍 언어의 소스 코드에서, 명령어에 관련된 동일 함수에 대하여 유형이 동일하게 유지되지 않는 변수가 존재하는지 판단하는 단계, 상기 변수가 존재하지 않을 때, 상기 동적 프로그래밍 언어의 소스 코드가 상기 제1 컴파일러에 부합한 문법인지 판단하는 단계, 및 상기 동적 프로그래밍 언어의 소스 코드에 포함된 언어의 문법이 상기 제1 컴파일러에 부합할 때, 상기 변환이 가능하다고 판단하는 단계를 포함할 수 있다.
상기 제1 컴파일러에 부합한 문법인지 판단하는 단계는, 상기 동적 프로그래밍 언어의 소스 코드 내에, 기설정된 언어의 문법이 존재하지 않을 때 상기 제1 컴파일러에 부합하다고 판단할 수 있다.
상기 기설정된 언어의 문법은, 사용자 또는 시스템 설계자가 지정한 특정 함수를 포함할 수 있다.
상기 지정한 특정 함수는 경우 'eval(uate)' 함수를 포함할 수 있다.
한편, 본 발명의 실시예에 따른 컴퓨터 판독가능 기록매체는 프로그램 실행 중에 컴파일되는 동적 프로그래밍 언어의 소스 코드를, 실행 전에 컴파일되는 정적 프로그래밍 언어의 수준으로 컴파일링하는 방법을 실행하기 위한 프로그램을 포함하는 컴퓨터 판독가능 기록매체에 있어서, 상기 컴파일링 방법은, 입력된 상기 동적 프로그래밍 언어의 소스 코드가, 기설정된 조건을 만족하는지 판단하는 단계, 및 상기 기설정된 조건을 만족하면, 상기 동적 프로그래밍 언어의 소스 코드는 상기 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 컴파일링 방식에 의해 변환하여 출력하는 단계를 실행한다.
종래에 동적 프로그램 언어의 소스 코드를 모두 JITC로 처리하던 것에 비하여 동적 프로그램 언어의 소스 코드를 제한적으로 또는 선택적으로 AOTC로 처리함으로써 기기의 컴파일 성능을 개선할 수 있을 것이다.
도 1은 본 발명의 제1 실시예에 따른 전자 장치의 블록다이어그램,
도 2는 본 발명의 제2 실시예에 따른 전자 장치의 블록다이어그램,
도 3은 도 2에 나타낸 하이브리드 컴파일링 실행부의 예시도,
도 4는 도 1 및 도 3의 하이브리드 컴파일링부의 제1 예시도,
도 5는 도 1 및 도 3의 하이브리드 컴파일링부의 제2 예시도,
도 6A 내지 도 6C는 가령 도 5의 각 모듈에 대한 처리 과정의 이해를 돕기 위하여 추가된 도면,
도 7은 본 발명의 제1 실시예에 따른 컴파일링 과정의 흐름도,
도 8은 본 발명의 제2 실시예에 따른 컴파일링 과정의 흐름도,
도 9는 본 발명의 제3 실시예에 따른 컴파일링 과정의 흐름도, 그리고
도 10은 본 발명의 제4 실시예에 따른 컴파일링 과정의 흐름도이다.
-
이하, 도면을 참조하여 본 발명의 실시예에 대하여 상세히 설명한다.
도 1은 본 발명의 제1 실시예에 따른 전자 장치의 블록다이어그램이다.
설명에 앞서, 본 발명의 실시예에 따른 전자 장치(90)는 스마트폰, MP3, PMP, 랩탑 컴퓨터, 웨어러블 장치 등과 같은 모바일 장치와, DTV, 데스크탑 컴퓨터 등의 영상표시장치, 그리고 웹 서비스를 제공하는 웹 서버 등의 서비스제공장치 등을 포함한다. 설명의 편의를 위해 이하, 모바일 장치 또는 PC로 설명할 수 있다.
도 1에 도시된 바와 같이, 본 발명의 제1 실시예에 따른 전자 장치(90)는 통신 인터페이스부(100), 사용자 인터페이스부(110), 제어부(120), 저장부(130), 디스플레이부(140) 및 하이브리드 컴파일링부(150)의 일부 또는 전부를 포함한다.
여기서, 일부 또는 전부를 포함한다는 것은 저장부(130) 또는 디스플레이부(140)와 같은 일부 구성요소가 생략되거나, 하이브리드 컴파일링부(150)가 제어부(120)에 통합되어 구성될 수 있는 것 등을 의미하는 것으로서, 발명의 충분한 이해를 돕기 위하여 전부 포함하는 것으로 설명한다.
먼저 통신 인터페이스부(100)는 사용자가 웹 브라우저를 실행하는 경우 외부의 웹 서버에 접속하여 영상 데이터를 수신한다. 여기서, 영상 데이터는 가령 방송국에서 제공하는 방송 프로그램의 경우 비디오/오디오 데이터 및 부가 정보를 포함할 수 있다. 통신 인터페이부(100)는 유무선 통신모듈을 포함함으로써 유선 또는 무선으로 제공되는 영상 데이터를 수신할 수 있다. 또한 근거리 통신모듈을 포함함으로써 주변의 액세스포인트(AP)에 접속하여 영상 데이터를 수신할 수 있다.
사용자 인터페이스부(110)는 전자 장치(90), 가령 모바일 장치를 동작시키기 위한 사용자 명령을 수신한다. 물론 이러한 사용자 명령은 가령 디스플레이부(140)가 터치 스크린으로 구현되는 경우, 이를 통해서도 입력될 수 있다. 이러한 점에서, 디스플레이부(140)는 사용자 인터페이스부(110)의 범주에 포함될 수 있다. 다만, 본 발명의 실시예에 따른 사용자 인터페이스부(110)는 전자 장치(90)의 전원을 온오프하기 위한 전원버튼 등의 물리적 버튼을 의미할 수 있다. 물론 터치 스크린에 표시 가능한 키패드, 즉 숫자 및 문자 버튼 등이 물리적 버튼으로 구성된다면, 이러한 물리적 버튼을 포함할 수 있을 것이다.
그 이외에도 사용자 인터페이스부(110)는 영상 촬영을 취한 카메라가 포함된 촬상부, 음향을 출력하는 스피커가 포함된 음향 출력부 등을 포함할 수 있다. 이러한 점에서 사용자 인터페이스부(110)는 사용자와 연관되는 모든 요소를 포함할 수 있을 것이다.
제어부(120)는 전자 장치(90) 내의 전반적인 동작을 제어한다. 예를 들어, 제어부(120)는 영상 처리부(미도시)를 포함함으로써 통신 인터페이스부(100)를 통해 수신된 영상 데이터를 비디오/오디오 데이터 및 부가 정보로 각각 분리하고, 분리된 비디오 및 오디오 데이터를 각각 디코딩할 수 있다. 그리고, 디코딩된 각각의 데이터를 스케일링하는 등의 동작 이후에 디스플레이부(140)에 비디오 데이터를 표시하고, 음향 출력부에 음향을 출력하기 위한 동작을 제어할 수 있다.
무엇보다 본 발명의 실시예에 따른 제어부(120)는 하이브리드 컴파일링부(150)를 실행시키기 위한 명령이 있을 때, 하이브리드 컴파일링부(150)를 실행시킨다. 사용자가 저장부(130)에 존재하는 소스 코드를 컴파일하려고 선택한 경우, 제어부(120)는 사용자 명령에 근거하여 하이브리드 컴파일링부(150)를 실행시켜 저장부(130)에 실행파일을 생성한다. 다시 말해, 제어부(120)는 입력된 사용자 명령에 대하여 하이브리드 컴파일링부(150)를 통해 변환되어 기계어 즉 이진 코드를 출력한다. 추후 디스플레이부(140)에서 사용자의 추가 명령에 따라 해당 이진 코드를 인식하여 해당 애플리케이션을 실행시킬 수 있다. 예를 들어, 사용자가 저장부(130)에 존재하는 특정 프로그래밍 언어로 작성되어있는 계산기에 해당하는 소스코드에 대한 컴파일 명령을 내릴 경우, 제어부(120)는 하이브리드 컴파일링부(150)를 실행시켜 이진 코드로 된 계산기 실행파일을 생성하고, 추후 사용자가 디스플레이부(140)의 화면에 표시된 계산기 메뉴를 선택했을 때 사용자 명령을 인식하여 그에 따른 동작을 실행하게 된다.
이러한 동작은 반드시 사용자 인터페이스에 의한 명령(또는 사용자 명령)이 있을 때에만 실행된다고 볼 수 없다. 다시 말해, 사용자가 특정 애플리케이션이 컴파일 및 실행되도록 예약된 경우를 생각해 보자. 이의 경우에는 실행 시간이 도래할 때, 즉 특정 이벤트(event)가 발생할 때 전자 장치(90) 또는 전자 장치(90)의 제어부(120)가 하이브리드 컴파일링부(150)와 자동으로 연동할 수 있다. 이러한 점에서, 본 발명의 실시예에 따른 사용자 명령 및 이벤트 등은 특정 프로그램을 동작시키기 위한 명령어가 될 수 있다.
저장부(130)는 하드디스크드라이브(HDD), 롬(ROM) 및 램(RAM)을 포함할 수 있다. 예를 들어, 안드로이드 폰의 경우 운영체제(OS)는 하드디스크드라이브에 저장될 것이다. 또한, 사용자가 장시간 간직하고 싶은 사진이나 동영상 등은 롬에 저장될 수 있다. 램은 제어부(120)가 일시적으로 처리하는 데이터를 저장할 수 있을 것이다. 예를 들어, 제어부(120)는 수신된 영상 데이터로부터 분리된 부가 정보를 저장부(130)의 램에 일시적으로 저장하고, 이를 불러내어 이용할 수 있다. 이와 같이 재사용될 때, 해당 부가 정보가 저장되었던 공간은 비워지게 된다. 즉 램은 데이터를 일시 저장하고, 저장된 데이터를 빠르게 독출하기 위해 사용된다.
디스플레이부(140)는 영상을 표시한다. 영상을 표시하기 위하여 디스플레이부(140)는 액정 패널(Liquid crystal panel)을 포함하거나 OLED 패널을 포함할 수 있다. 그리고, 사용자 명령이 입력 가능한 터치 스크린을 구현하기 위하여 액정 패널 상에는 터치 패널이 더 부착될 수 있다. 물론 본 발명의 실시예에 따른 디스플레이부(140)는 액정 패널과 터치 패널이 결합되어 구성되는 것 이외에도, 하나의 액정 패널에 터치 기능이 부가되어 형성된 패널을 포함할 수 있다.
본 발명의 실시예에 따른 하이브리드 컴파일링부(150)는 롬과 같은 메모리에 저장된 프로그램의 형태를 가질 수 있지만, 저장된 프로그램의 일부, 즉 특정 기능을 수행하는 SW 모듈이 하드웨어로 형성되는 형태를 가질 수 있다. 예를 들어, SW 모듈에서 레지스트리(registry)는 하드웨어 메모리로 대체될 수 있는 것과 같다. 이러한 점에서 하이브리드 컴파일링부(150)는 프로그램이라 특정하지 않을 것이다. 하이브리드 컴파일링부(150)는 복수의 컴파일러를 포함할 수 있다. 물론 각각의 컴파일러, 즉 제1 컴파일러와 제2 컴파일러는 SW 모듈일 수 있지만, 그 중 하나만 하드웨어로 형성될 수도 있을 것이다.
하이브리드 컴파일링부(150)는 위와 같이 구성된 제1 컴파일러 및 제2 컴파일러를 서로 다른 프로그래밍 언어의 소스 코드에 대하여 선택적으로 실행시킨다. 여기서, 소스 코드는 가령 사용자 명령에 관련되는 복수의 명령어에 관련된 함수와 함수에 종속되는 변수를 포함하는 체계를 이루며, 이들의 집합으로 구성될 수 있다. 뿐만 아니라, 하이브리드 컴파일링부(150)는 동일한 프로그래밍 언어의 소스 코드에 대하여도 선택적으로 실행시킬 수 있다. 여기서, 동일한 프로그래밍 언어는 본 발명의 실시예에 따라 자바스크립트와 같은 동적 프로그래밍 언어를 의미할 수 있다. 좀더 구체적으로, 하이브리드 컴파일링부(150)는 프로그램의 동작을 실행하기 위한 명령어가 C 언어와 같이 정적 프로그래밍 언어인 경우 제1 컴파일러를 반드시 실행시킨다. 또한 명령어로서 동적 프로그래밍 언어가 수신되는 경우 정적 프로그래밍 언어의 수준으로 컴파일링이 가능하면 하이브리드 컴파일링부(150)는 제1 컴파일러를 실행시킨다. 반면, 동적 프로그래밍 언어가 지정된 조건을 만족하지 못하면 하이브리드 컴파일링부(150)는 제2 컴파일러를 실행시킨다. 여기서, 제1 컴파일러는 제2 컴파일러에 비해 높은 성능의 컴파일러인 것으로 가정한다. 또한 높은 성능이란 입력된 명령어를 변환하여 기계어를 출력할 때, 그만큼 빠른 데이터 처리가 이루어지는 것을 포함한다. 이에 따라 예컨대, 제1 컴파일러가 AOTC라면, 제2 컴파일러는 JITC가 될 수 있다.
예를 들어, 임베디드 환경이나 모바일 환경에서는 동적 프로그래밍 언어의 활용이 많을 것이다. 이러한 점에서, 자바 스크립트와 같은 동적 프로그래밍 언어를 AOTC로 처리하는 경우, 전자 장치(90)의 성능은 극대화될 수 있을 것이다.
이후에 다시 자세히 다루겠지만, 요약해 보면 본 발명의 실시예에 따른 하이브리드 컴파일링부(150)는 동적 프로그래밍 언어에서 AOTC의 처리가 가능한 경우 이를 AOTC 컴파일러로 컴파일시킨다고 볼 수 있다. 다시 말해, 동적 프로그래밍 언어의 경우 프로그램 소스 코드에 따라 AOTC가 가능할 수 있고 불가능한 경우가 있을 수도 있다. 따라서 본 발명의 실시예에는 이와 같이 AOTC가 가능한 소스 코드의 경우 동적 프로그래밍 언어의 처리 성능을 증가시키는 것이다.
간략하게 언급하면, 본 발명의 실시예에 따른 하이브리드 컴파일링부(150)는 AOTC가 가능한지 여부를 결정하기 위하여, 명령어에 상응하는 동적 프로그래밍 언어의 소스 코드에서 동일한 변수에 대하여 변수 유형이 변화되는 경우가 있는지를 우선 판단할 수 있다. 예를 들어, 동일 변수 i에 대하여 '정수'를 나타내는 변수 유형 int와 '문자'를 나타내는 변수 유형 char가 함께 쓰일 경우 변수 유형이 변화되는 경우에 해당된다. 이의 경우에는 AOTC가 불가능하다. 따라서 동일 함수에 대하여 동일 변수를 갖는 경우, 하이브리드 컴파일링부(150)는 다시 문법(syntax)적으로 AOTC가 불가능한 경우가 있는지를 검사한다. 예를 들어, '평가하다'를 나타내는 함수 'eval'은 태생적으로 AOTC가 불가능한 경우이다. 따라서, 이러한 문법이 없다면 AOTC가 가능할 수 있다. 본 발명의 실시예에 따라 전자는 유형(type) 추론 과정이고, 후자는 문법 검사 과정에 해당된다.
상기의 구성 결과, 동적 프로그래밍 언어라 할지라도, AOTC가 가능한 경우에는 선택적으로 AOTC가 실행되므로 임베디드(ex. PC) 환경이나 모바일 환경에서 전자 장치(90)의 성능이 증가될 수 있을 것이다.
구체적으로, 사용자가 제공한 소스 코드를 AOTC가 가능한 경우에 고성능의 AOTC에 의한 애플리케이션을 제공하고, AOTC가 불가능한 경우에는 JITC 모드의 애플리케이션을 생성해 언어의 호환성을 보장할 수 있을 것이다.
또한 JITC가 선택된 경우, 기존의 JIT 컴파일러를 통해 실행되고, 따라서 기존의 JIT 컴파일과 동일한 성능을 가지게 된다.
나아가, 유형 추론이 완벽하게 이루어지고, AOTC 처리된 애플리케이션의 경우 동적 프로그래밍 언어임에도 불구하고, C나 C++과 같은 정적 프로그래밍 언어에 가까운 최적화된 성능을 보여줄 수 있을 것이다.
한편, 전자 장치(90)의 제조사 입장에서 보면, 유형 추론을 저해하는 문법이나 AOTC를 어렵게 하는 동적 문법을 프로그램 개발자에게 미리 제공해 주어 개발자가 작성한 프로그램이 AOTC 모드(mode)로 컴파일될 확률을 높임으로써 전자 장치(90)의 동적 언어 프로그래밍의 성능을 높이는 데 도움을 줄 수 있다.
나아가, 전자 장치(90)를 사용하는 사용자 입장에서는 애플리케이션이 AOTC 모드인지 JITC 모드인지 인지할 필요없이 평균적으로 처리 성능이 향상된 애플리케이션을 경험할 수 있게 될 것이다.
도 2는 본 발명의 제2 실시예에 따른 전자 장치의 블록다이어그램이고, 도 3은 도 2에 나타낸 하이브리드 컴파일링 실행부의 예시도이다.
도 2 및 도 3에 도시된 바와 같이, 본 발명의 제2 실시예에 따른 전자 장치(190)는 인터페이스부(200), 하이브리드 컴파일링 실행부(210) 및 저장부(220)의 일부 또는 전부를 포함한다.
여기서, 일부 또는 전부를 포함한다는 것은 앞서서의 의미와 동일하다.
먼저 본 발명의 제2 실시예에 따른 전자 장치(190)는 도 1에 도시된 전자 장치(90)와 비교해 볼 때, 도 1의 디스플레이부(140)가 없는 가령 컴퓨터 본체나 웹 서버와 같은 장치일 수 있으며, 도 1에 도시된 제어부(120)와 하이브리드 컴파일링부(150)가 HW/SW 중 적어도 하나의 형태로 통합된 장치를 의미할 수 있다.
인터페이스부(200) 및 저장부(220)는 도 1을 참조하여 설명한 통신 인터페이스부(100) 및 사용자 인터페이스부(110)의 일부 또는 전부, 그리고 저장부(130)와 동일 또는 유사하므로 그 내용들로 대신하고자 한다.
다만, 하이브리드 컴파일링 실행부(210)의 경우, 도 3에서와 같은 구조를 가질 수 있다. 물론 도 3의 구조는 일례로서 프로세서(210-1)와, 컴파일러가 메모리에 저장된 형태의 하이브리드 컴파일링부(210-2)를 나타내고 있다. 그러나, 도 3의 프로세서(210-1)나 하이브리드 컴파일링부(210-2)가 모두 소프트웨어로 구현되는 경우도 얼마든지 가능하므로 본 발명의 실시예에서는 도 2에 나타낸 하이브리드 컴파일링 실행부(210)의 구조를 도 3에 특별히 한정하지는 않을 것이다.
도 3에 나타낸 프로세서(210-1)와 하이브리드 컴파일링부(210-2)의 구조는 도 1에 도시된 제어부(120) 및 하이브리드 컴파일링부(150)의 변형된 형태라 보아도 좋다. 그렇지만, 동작은 다소 상이할 수 있다. 다시 말해, 도 1에서는 제어부(120)가 하이브리드 컴파일링부(150)를 실행시켜 처리 결과만을 제공받는 것이라면, 도 2의 하이브리드 컴파일링 실행부(210)는 전자 장치(190)의 전원이 인가될 때 즉 시스템 동작 초기(ex. 부팅시 또는 부팅 후)에, 도 3의 프로세서(210-1)가 저장부(220)에 저장된 컴파일러를 불러내어 내부의 메모리에 저장할 수 있다. 물론 전자 장치(90)의 출고시에 내부 메모리에 컴파일러를 모듈화하는 것도 얼마든지 가능하므로 위의 내용에 특별히 한정하지는 않을 것이다.
실제로, 도 2의 하이브리드 컴파일링 실행부(210)는 도 3에서와 같은 구조를 가짐으로써 도 2에 비하여 신속하게 데이터 처리를 수행할 수 있을 것이다.
또한 가령 특정 웹 서버가 컴퓨터 본체와 같은 전자 장치(90)의 저장부(220)에 저장된 특정 데이터를 갱신하도록 설정된 경우를 가정해 보자. 이의 경우, 하이브리드 컴파일링 실행부(210)는 갱신하라는 이벤트가 발생하면 이를 통해 인터페이스부(200)는 외부 장치 가령 서버에 접속하여 저장부(220)에 저장된 데이터를 갱신할 것이다.
이의 과정에서, 하이브리드 컴파일링 실행부(210)는 특정 프로그래밍 언어의 명령을 인식해야 하고, 또 인식 결과에 근거해 동작을 수행해야 하기 때문에, 앞서서의 도 1을 참조하여 설명한 하이브리드 컴파일링부(150)와 동일 또는 유사한 동작을 수행할 것이다. 따라서, 그 내용들로 대신하며 더 이상의 설명은 생략한다.
도 4는 도 1 및 도 3의 하이브리드 컴파일링부의 제1 예시도이다.
도 4에 도시된 바와 같이, 본 발명의 제1 실시예에 따른 하이브리드 컴파일링부(150, 210-2)는 렉서 및 파서(400), 컴파일러 결정부(410), 제1 컴파일러(420) 및 제2 컴파일러(430)의 일부 또는 전부를 포함한다.
여기서, 일부 또는 전부를 포함한다는 것은 렉서 및 파서(400)와 같은 일부 구성요소가 생략되어 구성되거나, 컴파일러 결정부(410), 제1 컴파일러(420) 및 제2 컴파일러(430) 중 일부 또는 전부가 통합되어 구성될 수 있는 것 등을 의미하는 것으로서, 발명의 충분한 이해를 돕기 위하여 전부 포함하는 것으로 설명한다.
예를 들어, 렉서 및 파서(400)에서 명령어에 관련된 소스 코드를 분해하여 얻은 부분 코드를 트리 형태로 생성하는 것은 AOTC의 LLVM(Low Level Virtual Machine)을 포함하는 제1 컴파일러(420)의 동작을 용이하게 하려는 프로그램 설계자(또는 시스템 설계자)들의 약속 즉 프로그램 규정이라 볼 수 있다. 따라서, AOTC가 아니라면 얼마든지 생략될 수 있을 것이다.
또한 앞서 충분히 설명하였지만 컴파일러 결정부(410), 제1 컴파일러(420) 및 제2 컴파일러(430)는 특정 소프트웨어 즉 프로그램에 대한 모듈 단위를 의미할 수 있다. 따라서 이러한 SW 모듈은 HW로도 얼마든지 구성 가능하므로 컴파일러 결정부(410), 제1 컴파일러(420) 및 제2 컴파일러(430)가 SW를 의미하는 것이냐, HW를 의미하는 것이냐에 특별히 한정하지는 않을 것이다.
다만, 설명의 편의를 위해 도 4는 HW의 구성을 설명하기 위한 것이라면, 이후에 설명할 도 5는 SW의 구성을 설명하기 위한 것이라 가정할 수 있다. 물론 본 발명의 실시예에서는 도 5의 경우를 좀더 바람직하게 보고 있다.
먼저 렉서 및 파서(400)는 프로그램을 동작시키는 명령어에 관련된 소스 코드를 제공받을 수 있다. 만약 소스 코드가 별도의 메모리에 기저장되어 있다면, 저장된 소스 코드를 불러내어 사용할 수 있을 것이다. 렉서 및 파서(400)는 수신된 소스 코드를 토큰화하여 분해한다, 그리고 분해된 부분 코드를 이용하여 트리를 생성한다. 여기서, 부분 코드는 소스 코드의 일부이다.
컴파일링 결정부(410)는 수신된 소스 코드가 동적 프로그래밍 언어인지 먼저 판단할 수 있다. 물론 동적 프로그램인지 여부를 먼저 판단함에 따라 C 언어와 같은 정적 프로그래밍 언어의 소스 코드에 대하여는 제1 컴파일러(420)에 의해 컴파일링할 수 있다. 이때 제1 컴파일러(420)는 AOTC를 포함할 수 있다.
또한 컴파일링 결정부(410)는 만약 입력된 소스 코드가 동적 프로그래밍 언어이면, AOTC와 같은 제1 컴파일러(420)에 의한 처리가 가능한지를 결정한다. 만약 가능하다면 제1 컴파일러(420)를 선택하여 AOTC를 실행하겠지만, 불가능하다면 제2 컴파일러(430)를 선택하여 컴파일링을 수행할 수 있다. 다시 말해, 본 발명의 실시예에서는 입력된 동적 프로그래밍 언어의 소스 코드가 제1 컴파일러(420)와 제2 컴파일러(430)에 의해 선택적으로 컴파일링되는 것이다.
좀더 구체적으로 동적 프로그래밍 언어의 소스 코드에 대하여 가령 AOTC가 실행되기 위해서는 동일한 변수에 대해서는 같은 함수 내에서 동일한 변수 유형으로 사용되어야 하고, 또 태생적으로 AOTC가 불가능한 문법을 포함하지 않아야 한다. 예를 들어, 이후에 다시 설명하겠지만, 소스 코드에서 '더하라'는 의미의 함수 add에 대하여 정수를 나타내는 변수 유형 int와 문자를 나타내는 변수 유형 char이 서로 존재한다면 이는 본 발명의 실시예에 따른 유형 추론 과정의 조건에 부합하지 않는 경우이다. 따라서 이의 경우에는 JITC의 제2 컴파일러(430)가 선택될 수 있다. 또한 동일한 변수에 대하여 동일한 변수 유형으로 사용된 경우라 하더라도, AOTC가 불가능한 문법으로서 가령 '평가하다'라는 의미의 함수 'eval'이 있는 경우에도 JITC의 제2 컴파일러(430)가 선택된다. 따라서 본 발명의 실시예에 따른 전자의 유형 추론 과정과 문법 검사 과정에서 2가지 조건을 모두 만족할 때, 동적 프로그래밍 언어의 소스 코드는 AOTC의 제1 컴파일러(420)에 의해 컴파일링이 수행될 수 있다.
앞서 이미 설명하였지만, 제1 컴파일러(420)는 제2 컴파일러(430)에 비해 컴파일 성능이 우수하며, AOTC를 실행할 수 있다. 따라서, 제1 컴파일러(420)는 입력된 정적 프로그램 언어의 소스 코드를 기본적으로 가령 AOTC로 컴파일링하고, 또한 동적 프로그래밍 언어의 소스 코드의 경우에는 컴파일링 결정부(410)에서 선택된 소스 코드에 한하여만 AOTC로 컴파일링을 수행한다.
반면 제2 컴파일러(430)는 동적 프로그램 언어의 소스 코드를 컴파일링하는 JITC를 실행할 수 있지만, 컴파일링 결정부(410)에서 결정된 즉 선택된 제한적인 동적 프로그래밍 언어의 소스 코드에 대해서만 컴파일링을 수행한다고 볼 수 있다. 여기서, 선택된 제한적인 동적 프로그래밍 언어란 유형 추론 과정과 문법 검사 과정의 조건을 만족하지 않는 경우를 의미한다.
상기의 구성 결과, 종래에 동적 프로그램 언어의 소스 코드를 모두 JITC로 처리하던 것에 비하여 동적 프로그램 언어의 소스 코드를 제한적으로 또는 선택적으로 AOTC로 처리함으로써 기기의 컴파일 성능을 개선할 수 있을 것이다.
도 5는 도 1 및 도 3의 하이브리드 컴파일링부의 제2 예시도이다.
설명의 편의상 도 4와 구분하기 위하여 도 5는 SW 모듈이고, 도 4의 제1 컴파일러(420)가 AOTC이며, 제2 컴파일러(430)가 JITC인 것으로 상정하여 설명한다.
도 5에 도시된 바와 같이, 본 발명의 제2 실시예에 따른 하이브리드 컴파일링부(150', 210-2')는 렉서 및 파서 모듈(500), 컴파일링 결정 모듈(510), 제1 컴파일링 모듈(520) 및 제2 컴파일링 모듈(530)의 일부 또는 전부를 포함한다.
여기서, 일부 또는 전부를 포함한다는 것은 앞서서의 도 4에서 설명한 바 있는 의미와 동일 또는 유사하다.
렉서 및 파서 모듈(500)은 주어진 소스 코드를 토큰화하여 분해하고, 분해된 (부분) 코드들로 이루어진 AST(Abstract Syntax Tree)를 생성한다.
또한 컴파일링 결정 모듈(510)은 유형 추론 모듈(type inference module)(510-1)과 문법 검사 모듈(syntax checker)(510-2)로 구분될 수 있다. 이를 통해 적절한 컴파일 모드를 선택할 수 있다. 다시 말해, 유형 추론 모듈(510-1)에서는 AST 내 변수들에 대한 유형 추론을 진행하며, 문법 검사 모듈(510-2)에서는 AOTC에 적합한 문법인지 검사한다. 검사 결과 AOTC에 적합하다고 판단되면 유형화된 함수 AST(typed function AST)가 생성되어 AOTC, 즉 제1 컴파일링 모듈(520)로 제공된다. 그렇지 않으면 컴파일링 결정 모듈(510)은 JITC를 실행하는 제2 컴파일링 모듈(530)로 제공된다.
제1 컴파일링 모듈(520)은 본 발명의 실시예에 따라 AOTC 방법을 사용하여 컴파일링을 수행하고, 제2 컴파일링 모듈(530)은 JITC 방법을 사용하여 컴파일링을 수행한다.
좀더 살펴보면, 본 발명의 실시예에 따른 하이브리드 컴파일링부(150', 210-2')는 AOTC가 어려운 동적 프로그래밍 언어를 대상으로 AOTC가 가능한 부분에 대해서는 AOTC를, 그 밖의 경우는 JITC를 적용하는 하이브리드 방식이라 볼 수 있다. 우선, 일반적인 동적 프로그래밍 언어에서 AOTC를 가로막는 가장 큰 장벽은 유형이 없다는 점이다. 따라서 본 발명의 실시예에서는 컴파일러 내에 위에서와 같이 유형 추론 모듈(510-1)을 두어 추론을 통해 사용하는 변수에 유형 추가를 하게 된다. 유형 추론 모듈(510-1)에서는 렉서 및 파서 모듈(500)에서 얻은 AST 상에서 트리 순회를 통해 분석을 진행하면서 각 변수(variable)에 대한 유형 추론을 진행하고, 유형 주석이 있는 변수(type annotated variable)로 변환시킨다. 동적 프로그래밍 언어의 특성상 유형 추론 모듈(510-1)이 항상 모든 변수의 유형 추론을 완벽히 해내는 것은 아니다. 또한 유형이 고정되지 않은 경우도 존재한다. 이러한 경우 추론 에러(Inference Error)가 발생하며, 제2 컴파일링 모듈(530)로 이동하여 JIT 모드의 컴파일링을 진행한다.
유형 추론 모듈(510-1)에서 에러 없이 진행된 경우 문법 검사 모듈(510-2)이 동작한다. 동적 프로그래밍 언어는 동적 유형(dynamic typing)뿐만 아니라 여러 가지 정적 컴파일링을 저해하는 동적 특성(dynamic feature)들을 포함한 경우가 많다. 예를 들어, 자바스크립트의 'eval'이라는 특성은 별도의 코드를 스트링(string) 형태의 argument로 가지고 있어 eval 함수가 호출될 때 해당 코드를 컴파일(및 실행)하게 된다. 이러한 동적 특성을 내포하고 있는 프로그램의 경우 정적 컴파일링이 어려워 AOTC 모드에서 진행이 불가능하다. 그러므로 문법 검사 모듈(510-2)에서는 앞서 설명한 바와 같이 AOTC 모드가 불가능하거나 AOTC가 가능하더라도 JITC 이상의 성능을 기대하기 어려운 문법을 포함하는지를 검사하여 문법 에러를 발생시키고 제2 컴파일링 모듈(530)로 이동하여 JIT 모드의 컴파일링을 진행한다.
도 5에서는 유형 추론 모듈(510-1)과 문법 검사 모듈(510-2)을 성공적으로 통과한 경우에 유형 주석이 추가된 AST가 완성되고 제1 컴파일링 모듈(520)로 이동하여 AOTC가 진행된다. 각 AST 노드(node)를 트래버싱(traversing) 즉 탐색하며 코드 발생기(Code Generator)가 IR(Intermediate Representation)(ex. LLVM IR)을 완성한다. 즉 코드 발생기는 표적 언어로 변환하기 전의 중간 형태를 완성한다고 볼 수 있다. 이러한 IR은 백엔드(Backend)의 최적화기(Optimizer)를 통해 최적화 과정을 거치고 각 표적 플랫폼에 적합한 기계 코드가 생성되어 (프로그램 사용자에게) 제공된다.
JITC 모드가 선택된 경우 본 발명의 실시예에 따른 하이브리드 컴파일러는 프로그램 소스 코드를 랩핑(wrapping)하는 C++ 애플리케이션을 생성하고 이미 존재하는 JIT 컴파일러를 임베딩(embedding)하고 있다. 예를 들어, 자바스크립트의 경우, 자바스크립트 엔진(V8)이나 JSC 같은 JIT 컴파일러를 활용할 수 있다. 프로그램 사용자가 이 C++ 애플리케이션을 실행할 경우 내포하고 있는 동적 언어의 소스 코드를 통해 JITC를 통해 실행시킨다.
도 6A 내지 도 6C는 가령 도 5의 각 모듈에 대한 처리 과정의 이해를 돕기 위하여 추가된 도면이다. 도 6A 내지 도 6C는 각기 다른 소스 코드에 대한 진행 결과를 설명한다. 도 6A 내지 도 6C의 각 (a)는 소스 코드의 형태를 나타내고 있다. 예를 들어, 사용자가 "두 정수를 변수에 저장하고 이를 출력하라"라는 명령을 제공했을 때, 도 6A의 (a)에서와 같은 소스 코드가 발생한다.
이때, 도 5의 렉서 및 파서 모듈(500)은 도 6A의 (a)에서와 같은 소스 코드에 대하여 도 6A의 (b)에서와 같은 트리를 생성할 수 있다.
그리고, 도 5의 컴파일러 결정 모듈(510)은 트리 순회를 통해 분석을 진행하면서 도 6A의 (c)에서와 같이 변수 v에 대하여 정수를 나타내는 변수 int가 유지되는지(600) 여부를 판단한다. 도 6B의 (a) 소스코드의 경우, 도 6B의 (c)에서와 같이 동일한 변수에 대해서 변수 유형이 변화하는 경우(610)가 판단되어 도 6B의 (d)에서와 같이 JITC로 컴파일링을 수행하게 된다.
이어 컴파일러 결정 모듈(510)은 도 6B의 (c)에서처럼 동일한 변수 유형이 유지되는 경우를 검사함과 동시에 문법 검사를 진행한다. 문법을 검사한 결과 함수 도 6C의 (a)에서와 같이 eval 같은 문법(620)이 존재하면 도 6C의 (d)에서와 같이 JITC로 처리되지만, 언어의 특성상 AOTC가 불가능한 함수 eval 같은 문법(620)이 존재하지 않으면 AOTC로 처리하게 되는 것이다. 즉 최종적으로 도 6A의 경우 컴파일러 결정 모듈(510)을 거쳐 AOTC로 처리한다.
도 7은 본 발명의 제1 실시예에 따른 컴파일링 과정을 나타내는 흐름도이다.
설명의 편의상 도 7을 도 1과 함께 참조하면, 본 발명의 실시예에 따른 전자 장치(90)는 입력된 동적 프로그래밍 언어의 소스 코드가, 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 제1 컴파일러로 처리 가능한지 판단한다(S700). 여기서, 제1 컴파일러는 AOTC가 가능한 컴파일러를 포함한다. 따라서, 전자 장치(90)는 가능성을 판단하기 위하여 앞서 설명한 바 있는 유형 추론 과정과 문법 검사 과정을 진행할 수 있다.
또한 전자 장치(90)는 판단 결과 처리 가능하다고 판단되면, 동적 프로그래밍 언어의 소스 코드를 제1 컴파일러에 의해 변환하여 출력한다. 여기서, 변환된 소스 코드는 바이너리 코드와 같은 기계어이다.
물론 그 이외에 경우 전자 장치(90)는 동적 프로그래밍 언어의 소스 코드를 제2 컴파일러에 의해 변환하여 출력하는 과정을 수행할 수 있다. 예를 들어, 제2 컴파일러가 JITC를 수행하는 경우, 입력된 동적 프로그래밍 언어의 소스 코드가 제1 컴파일러에 의해 처리가 불가능할 때에 실행된다고 볼 수 있다.
출력된 기계어, 즉 이진 코드를 인식하여 전자 장치(90)는 프로그램을 동작시키는 명령에 대한 동작을 수행한다. 예를 들어, '이미지를 메모리에 저장하라'는 명령에 대하여 기계어인 이진 코드를 인식하여 동작을 수행하는 것이다.
도 8은 본 발명의 제2 실시예에 따른 컴파일링 과정을 나타내는 흐름도이다.
도 8은 도 7의 변형된 동작으로서, 도 7에서와 같이 제2 컴파일러를 포함하지 않을 수 있는 경우를 상정한 경우이다.
설명의 편의상 도 7을 도 1과 함께 참조하면, 본 발명의 다른 실시예에 따른 전자 장치(90)는 입력된 동적 프로그래밍 언어의 소스 코드가 기설정된 조건을 만족하는지 판단한다(S800). 여기서, 기설정된 조건이란 가령 동일한 함수(ex. add)에 대하여 동일한 변수(ex. 정수 int)를 사용하는지, 또 특정 문법(ex. eval)을 포함하지 않는지에 관련될 수 있다.
판단 결과 기설정된 조건을 만족하면, 전자 장치(90)는 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 컴파일링 방식(ex. AOTC 방법)에 의해 소스 코드를 변환하여 출력한다(S810).
도 9는 본 발명의 제3 실시예에 따른 컴파일링 과정을 나타내는 흐름도이다.
도 9는 AOTC 방법을 수행하기 위하여 가령 LLVM(Low Level Virtual Machine)을 포함함에 따라 파싱을 수행해야 하는 경우를 상정한 것이다.
설명의 편의상 도 9를 도 1과 함께 참조하면, 본 발명의 실시예에 따른 전자 장치(90)는 주어진 소스 코드의 렉싱 및 파싱을 수행한다(S900).
이어 전자 장치(90)는 주어진 소스 코드가 동작 프로그래밍 언어일 경우 AOTC 가능 여부를 판단한다(S910). 이를 위하여 전자 장치(90)는 소스 코드가 동작 프로그래밍 언어인지 여부를 먼저 판단할 수 있다. 여기서, AOTC의 가능 여부는 앞서 유형 추론 과정 및 문법 검사 과정을 예로 들어 설명하였으므로 그 내용들로 대신하며 더 이상의 설명은 생략한다.
또한 전자 장치(90)는 AOTC가 가능하다고 판단되면, 동적 프로그래밍 언어의 소스 코드에 대하여 AOTC를 실행한다(S920).
이후 전자 장치(90)는 실행된 AOTC에 의해 생성된 코드, 즉 기계어로서 이진 코드를 처리한다(S920). 여기서, 처리한다는 것은 컴파일러가 코드를 출력하는 것을 의미한다.
상기의 결과, 전자 장치(90)는 명령어에 근거한, 더 정확하게는 출력된 (이진) 코드에 근거하여 동작을 수행하게 된다.
도 10은 본 발명의 제4 실시예에 따른 컴파일링 과정을 나타내는 흐름도이다.
도 10은 도 9에서 언어의 유형을 판단하는 과정을 포함하고, 제1 컴파일러와 제2 컴파일러를 포함한 경우를 상정한 것이다.
설명의 편의상 도 10을 도 1과 함께 참조하면, 본 발명의 실시예에 따른 전자 장치(90)는 소스 코드를 발생시킨다(S1000). 여기서, 소스 코드의 발생은 사용자 명령이 있거나, 기설정된 조건의 이벤트가 발생할 때 이루어질 수 있다. 예를 들어, 기설정된 조건이란 모바일 장치가 외부의 웹 서버로부터 특정 데이터의 갱신 요청을 수신하는지와 관련될 수 있다.
이어 전자 장치(90)는 발생된 소스 코드에 대하여 동적 프로그래밍 언어의 소스 코드인지 판단한다(S1010).
만약 동적 프로그래밍 언어의 소스 코드로 판단되면, 전자 장치(90)는 이어 가령 AOTC를 실행하는 제1 컴파일러로 컴파일링이 가능한지를 추가로 판단할 수 있다(S1020). 물론 이는 제1 컴파일러가 제2 컴파일러보다 성능이 우수한 것을 전제로 한 것이다. 또한 가능 여부와 관련해서는 앞서 충분히 설명하였으므로 더 이상의 설명은 생략한다.
반면, S1010 단계에서 발생된 소스 코드가 동적 프로그래밍 언어가 아닌, 가령 C 언어와 같은 정적 프로그래밍 언어로 판단되면, 제1 컴파일러로 소스 코드를 컴파일링한다(S1030).
또한 S1020 단계에서, 제1 컴파일러로 컴파일링이 가능하다고 판단되면, 전자 장치(90)는 제1 컴파일러에 의해 동적 프로그래밍 언어의 소스 코드를 컴파일링한다(S1040).
그러나, 만약 S1020 단계에서 제1 컴파일러로 컴파일링이 불가능하다고 판단되면, 가령 JITC와 같은 제2 컴파일러로 동적 프로그래밍 언어의 소스 코드를 컴파일링할 수 있다(S1050).
이어 전자 장치(90)는 S1030, S1040 및 S1050의 과정에 의해 각각 컴파일링되어 생성된 코드를 처리한다(S1060). 여기에서의 처리도 앞서와 마찬가지로 생성된 이진 코드를 출력하는 것으로 이해해도 좋다.
한편, 본 발명의 실시 예를 구성하는 모든 구성 요소들이 하나로 결합하거나 결합하여 동작하는 것으로 설명되었다고 해서, 본 발명이 반드시 이러한 실시 예에 한정되는 것은 아니다. 즉, 본 발명의 목적 범위 안에서라면, 그 모든 구성 요소들이 하나 이상으로 선택적으로 결합하여 동작할 수도 있다. 또한, 그 모든 구성요소들이 각각 하나의 독립적인 하드웨어로 구현될 수 있지만, 각 구성 요소들의 그 일부 또는 전부가 선택적으로 조합되어 하나 또는 복수 개의 하드웨어에서 조합된 일부 또는 전부의 기능을 수행하는 프로그램 모듈을 갖는 컴퓨터 프로그램으로서 구현될 수도 있다. 그 컴퓨터 프로그램을 구성하는 코드들 및 코드 세그먼트들은 본 발명의 기술 분야의 당업자에 의해 용이하게 추론될 수 있을 것이다. 이러한 컴퓨터 프로그램은 컴퓨터가 읽을 수 있는 비일시적 저장매체(non-transitory computer readable media)에 저장되어 컴퓨터에 의하여 읽혀지고 실행됨으로써, 본 발명의 실시 예를 구현할 수 있다.
여기서 비일시적 판독 가능 기록매체란, 레지스터, 캐시(cache), 메모리 등과 같이 짧은 순간 동안 데이터를 저장하는 매체가 아니라, 반영구적으로 데이터를 저장하며, 기기에 의해 판독(reading)이 가능한 매체를 의미한다. 구체적으로, 상술한 프로그램들은 CD, DVD, 하드 디스크, 블루레이 디스크, USB, 메모리 카드, ROM 등과 같은 비일시적 판독가능 기록매체에 저장되어 제공될 수 있다.
이상에서는 본 발명의 바람직한 실시 예에 대하여 도시하고 설명하였지만, 본 발명은 상술한 특정의 실시 예에 한정되지 아니하며, 청구범위에 청구하는 본 발명의 요지를 벗어남이 없이 당해 발명이 속하는 기술분야에서 통상의 지식을 가진 자에 의해 다양한 변형실시가 가능한 것은 물론이고, 이러한 변형실시들은 본 발명의 기술적 사상이나 전망으로부터 개별적으로 이해되어서는 안 될 것이다.
-
-

Claims (15)

  1. 프로그램 실행 중에 컴파일되는 동적 프로그래밍 언어의 소스 코드를, 실행 전에 컴파일되는 정적 프로그래밍 언어의 수준으로 컴파일링하는 방법에 있어서,
    입력된 상기 동적 프로그래밍 언어의 소스 코드가, 상기 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 방식의 제1 컴파일러로 처리 가능한지 판단하는 단계; 및
    상기 판단 결과, 처리 가능하면 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하여 출력하는 단계;를
    포함하는 컴파일링 방법.
  2. 제1항에 있어서,
    상기 동적 프로그래밍 언어의 소스 코드는, 명령어에 관련된 함수(func)와 상기 함수에 종속되는 변수를 포함하는 경우, 동일한 함수의 소스 코드에 대하여 변수의 유형(type)이 동일하게 유지 가능한 형태를 포함하는 것을 특징으로 하는 컴파일링 방법.
  3. 제1항에 있어서,
    상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하여 출력하는 단계; 및
    상기 판단 결과, 처리가 불가능하면 상기 동적 프로그래밍 언어의 소스 코드를 제2 컴파일러에 의해 변환하여 출력하는 단계;를
    더 포함하는 것을 특징으로 하는 컴파일링 방법.
  4. 제3항에 있어서,
    상기 제1 컴파일러는 AOTC(Ahead-of Time Compilation)가 가능한 컴파일러를 포함하며, 상기 제2 컴파일러는 JITC(Just-in-Time Compilation)가 가능한 컴파일러를 포함하는 것을 특징으로 하는 컴파일링 방법.
  5. 제1항에 있어서,
    상기 입력된 동적 프로그래밍 언어의 소스 코드를 토큰화하여(tokenized) 분해하고, 분해된 부분 코드를 트리(tree) 형태로 생성하는 단계;를 더 포함하며
    상기 제1 컴파일러에 의해 변환 가능한지 판단하는 단계는,
    상기 트리 형태의 상기 부분 코드를 분석하여 상기 제1 컴파일러에 의한 변환이 가능한지 판단하는 것을 특징으로 하는 컴파일링 방법.
  6. 제1항에 있어서,
    상기 제1 컴파일러에 의해 변환 가능한지 판단하는 단계는,
    상기 동적 프로그래밍 언어의 소스 코드에서, 명령어에 관련된 동일 함수에 대하여 유형이 동일하게 유지되지 않는 변수가 존재하는지 판단하는 단계;
    상기 변수가 존재하지 않을 때, 상기 동적 프로그래밍 언어의 소스 코드가 상기 제1 컴파일러에 부합한 문법(syntax)인지 판단하는 단계; 및
    상기 동적 프로그래밍 언어의 소스 코드에 포함된 언어의 문법이 상기 제1 컴파일러에 부합할 때, 상기 변환이 가능하다고 판단하는 단계;를
    포함하는 것을 특징으로 하는 컴파일링 방법.
  7. 프로그램 실행 중에 컴파일되는 동적 프로그래밍 언어의 소스 코드를, 실행 전에 컴파일되는 정적 프로그래밍 언어의 수준으로 컴파일링하는 전자 장치에 있어서,
    프로그램을 동작시키기 위한 명령어가 수신될 때 발생된 상기 동적 프로그래밍 언어의 소스 코드가, 상기 정적 프로그래밍 언어의 소스 코드를 처리하는 방식과 동일한 방식의 제1 컴파일러로 처리 가능한지 판단하며, 상기 판단 결과 처리 가능하면 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하는 프로세서;를
    포함하는 전자 장치.
  8. 제7항에 있어서,
    상기 동적 프로그래밍 언어의 소스 코드는, 명령어에 관련된 함수(func)와 상기 함수에 종속되는 변수를 포함하는 경우, 동일한 함수의 소스 코드에 대하여 변수의 유형이 동일하게 유지 가능한 형태를 포함하는 것을 특징으로 하는 전자 장치.
  9. 제7항에 있어서,
    상기 프로세서는, 상기 동적 프로그래밍 언어의 소스 코드를 상기 제1 컴파일러에 의해 변환하여 출력하며, 상기 판단 결과 처리가 불가능하면 상기 소스 코드를 제2 컴파일러에 의해 변환하여 출력하는 것을 특징으로 하는 전자 장치.
  10. 제9항에 있어서,
    상기 제1 컴파일러는 AOTC(Ahead-of Time Compilation)가 가능한 컴파일러를 포함하고, 상기 제2 컴파일러는 JITC(Just-in-Time Compilation)가 가능한 컴파일러를 포함하는 것을 특징으로 하는 전자 장치.
  11. 제7항에 있어서,
    상기 프로세서는, 상기 발생된 동적 프로그래밍 언어의 소스 코드를 토큰화하여 분해하고, 상기 분해된 부분 코드를 트리 형태로 생성하며, 상기 트리 형태의 상기 부분 코드를 분석하여 상기 제1 컴파일러에 의한 변환이 가능한지 판단하는 것을 특징으로 하는 전자 장치.
  12. 제7항에 있어서,
    상기 프로세서는, 상기 동적 프로그래밍 언어의 소스 코드에서, 명령어에 관련된 동일 함수에 대하여 유형이 동일하게 유지되지 않는 변수가 존재하는지 판단하고, 상기 변수가 존재하지 않을 때 상기 동적 프로그래밍 언어의 상기 소스 코드가 상기 제1 컴파일러에 부합한 문법인지 판단하며, 상기 동적 프로그래밍 언어의 소스 코드에 포함된 언어의 문법이 상기 제1 컴파일러에 부합할 때, 상기 변환이 가능하다고 판단하는 것을 특징으로 하는 전자 장치.
  13. 제12항에 있어서,
    상기 프로세서는, 상기 동적 프로그래밍 언어의 소스 코드 내에, 기설정된 언어의 문법이 존재하지 않을 때 상기 제1 컴파일러에 부합하다고 판단하는 것을 특징으로 하는 전자 장치.
  14. 제13항에 있어서,
    상기 기설정된 언어의 문법은, 사용자 또는 시스템 설계자가 지정한 특정 함수를 포함하는 것을 특징으로 하는 전자 장치.
  15. 제14항에 있어서,
    상기 지정한 특정 함수는 경우 'eval(uate)' 함수를 포함하는 것을 특징으로 하는 전자 장치.
PCT/KR2016/005025 2015-07-30 2016-05-12 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체 Ceased WO2017018644A1 (ko)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/742,740 US10635421B2 (en) 2015-07-30 2016-05-12 Electronic device, compiling method and computer-readable recording medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020150108276A KR102414250B1 (ko) 2015-07-30 2015-07-30 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체
KR10-2015-0108276 2015-07-30

Publications (1)

Publication Number Publication Date
WO2017018644A1 true WO2017018644A1 (ko) 2017-02-02

Family

ID=57884739

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2016/005025 Ceased WO2017018644A1 (ko) 2015-07-30 2016-05-12 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체

Country Status (3)

Country Link
US (1) US10635421B2 (ko)
KR (1) KR102414250B1 (ko)
WO (1) WO2017018644A1 (ko)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861729A (zh) * 2017-11-08 2018-03-30 中国信息安全测评中心 一种固件装载基址的定位方法、装置及电子设备
CN110471666A (zh) * 2019-07-18 2019-11-19 五八有限公司 代码自动转换方法和装置、代码转换器及介质

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220043806A1 (en) * 2015-10-28 2022-02-10 QOMPLX, Inc Parallel decomposition and restoration of data chunks
CN112183712B (zh) * 2019-07-03 2025-07-22 安徽寒武纪信息科技有限公司 深度学习算法的编译方法、装置及相关产品
CN112183735B (zh) * 2019-07-03 2025-10-03 安徽寒武纪信息科技有限公司 操作数据的生成方法、装置及相关产品
US11301302B2 (en) * 2020-02-25 2022-04-12 EMC IP Holding Company LLC Techniques for converting jobs into scripts
CN113031932B (zh) * 2021-03-11 2023-10-20 腾讯科技(深圳)有限公司 项目开发方法、装置、电子设备及存储介质
US11829745B2 (en) * 2021-09-20 2023-11-28 Salesforce, Inc. Augmented circuit breaker policy
CN114356337B (zh) * 2021-12-20 2025-01-28 北京东土科技股份有限公司 一种参数可扩展程序组织单元的执行方法、装置和设备
CN114756238B (zh) * 2022-03-11 2025-09-23 北京百度网讯科技有限公司 一种动态化编译的方法、装置、设备和存储介质
CN114968260B (zh) * 2022-06-13 2025-03-18 深圳市汇川技术股份有限公司 混合预编译方法、装置、电子设备及存储介质
CN118672585A (zh) * 2023-03-15 2024-09-20 华为技术有限公司 应用程序的编译方法及电子设备
CN116643727B (zh) * 2023-05-11 2024-02-06 北京秒如科技有限公司 编程语言检测及自动编译为wasm字节码的方法和系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05265768A (ja) * 1992-03-20 1993-10-15 Hitachi Software Eng Co Ltd 計算機言語の解釈実行方式
KR20100106409A (ko) * 2007-11-20 2010-10-01 내셔널 아이씨티 오스트레일리아 리미티드 다중 언어 소프트웨어 코드 분석
KR20110081720A (ko) * 2010-01-08 2011-07-14 한국과학기술연구원 수행 중 선행 컴파일링을 이용한 내장형 시스템을 위한 자바 컴파일링 방법
KR20130083764A (ko) * 2012-01-13 2013-07-23 주식회사 오비고 웹 애플리케이션에 포함되는 자바스크립트를 aot 방식으로 컴파일하기 위한 방법, 단말 장치 및 컴퓨터 판독 가능한 기록 매체
US20140082597A1 (en) * 2012-09-14 2014-03-20 Hassan Chafi Unifying static and dynamic compiler optimizations in source-code bases

Family Cites Families (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6233725B1 (en) 1998-12-03 2001-05-15 International Business Machines Corporation Method and apparatus to coordinate and control the simultaneous use of multiple just in time compilers with a java virtual machine
US6851109B1 (en) 1999-05-06 2005-02-01 International Business Machines Corporation Process and system for dynamically compiling a partially interpreted method
KR100441115B1 (ko) * 2001-06-27 2004-07-19 주식회사 인터와이즈 정보 단말기의 자바 프로그램 처리 속도 향상을 위한 자바컴파일 온 디멘드 서비스 시스템 및 그 방법
US20060158354A1 (en) * 2002-08-02 2006-07-20 Jan Aberg Optimised code generation
US7685581B2 (en) 2003-06-27 2010-03-23 Microsoft Corporation Type system for representing and checking consistency of heterogeneous program components during the process of compilation
US20050149910A1 (en) * 2003-10-31 2005-07-07 Prisament Raymond J. Portable and simplified scripting language parser
US20060271920A1 (en) * 2005-05-24 2006-11-30 Wael Abouelsaadat Multilingual compiler system and method
EP1887462A1 (en) * 2006-07-26 2008-02-13 Semiconductor Energy Laboratory Co., Ltd. Semiconductor device, memory circuit, and machine language program generation device, and method for operating semiconductor device and memory circuit
EP2092424B1 (en) * 2006-10-19 2015-12-30 Checkmarx Ltd. Locating security vulnerabilities in source code
US20090106743A1 (en) * 2007-10-18 2009-04-23 Paul Parisien Methods and systems for converting automation software
US8935683B2 (en) * 2011-04-20 2015-01-13 Qualcomm Incorporated Inline function linking
US8819649B2 (en) 2011-09-09 2014-08-26 Microsoft Corporation Profile guided just-in-time (JIT) compiler and byte code generation
US20130185626A1 (en) 2012-01-13 2013-07-18 Obigo Inc. METHOD, TERMINAL AND COMPUTER-READABLE RECORDING MEDIUM FOR COMPILING JAVASCRIPT INCLUDED IN WEB APPLICATION USING Ahead-Of-Time (AOT)
US9542166B2 (en) 2012-10-30 2017-01-10 Oracle International Corporation System and method for inferring immutability of program variables
US9182980B2 (en) * 2012-12-11 2015-11-10 Microsoft Technology Licensing, Llc. Expansion and reduction of source code for code refactoring
WO2014176587A2 (en) * 2013-04-26 2014-10-30 The Trustees Of Columbia University In The City Of New York Systems and methods for mobile applications
WO2015034526A1 (en) * 2013-09-08 2015-03-12 Intel Corporation Device, system and method of configuring a radio transceiver
CN103631632B (zh) * 2013-11-29 2017-08-04 华为技术有限公司 移植方法及源到源编译器
US9292270B2 (en) * 2014-03-27 2016-03-22 Microsoft Technology Licensing, Llc Supporting dynamic behavior in statically compiled programs
US9430200B1 (en) * 2015-06-04 2016-08-30 Microsoft Technology Licensing Llc Cross-library framework architecture feature sets
US10776115B2 (en) * 2015-09-19 2020-09-15 Microsoft Technology Licensing, Llc Debug support for block-based processor
US20170270245A1 (en) * 2016-01-11 2017-09-21 Edico Genome, Corp. Bioinformatics systems, apparatuses, and methods for performing secondary and/or tertiary processing
US10579498B2 (en) * 2016-07-31 2020-03-03 Microsoft Technology Licensing, Llc. Debugging tool for a JIT compiler
US11068247B2 (en) * 2018-02-06 2021-07-20 Microsoft Technology Licensing, Llc Vectorizing conditional min-max sequence reduction loops

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05265768A (ja) * 1992-03-20 1993-10-15 Hitachi Software Eng Co Ltd 計算機言語の解釈実行方式
KR20100106409A (ko) * 2007-11-20 2010-10-01 내셔널 아이씨티 오스트레일리아 리미티드 다중 언어 소프트웨어 코드 분석
KR20110081720A (ko) * 2010-01-08 2011-07-14 한국과학기술연구원 수행 중 선행 컴파일링을 이용한 내장형 시스템을 위한 자바 컴파일링 방법
KR20130083764A (ko) * 2012-01-13 2013-07-23 주식회사 오비고 웹 애플리케이션에 포함되는 자바스크립트를 aot 방식으로 컴파일하기 위한 방법, 단말 장치 및 컴퓨터 판독 가능한 기록 매체
US20140082597A1 (en) * 2012-09-14 2014-03-20 Hassan Chafi Unifying static and dynamic compiler optimizations in source-code bases

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861729A (zh) * 2017-11-08 2018-03-30 中国信息安全测评中心 一种固件装载基址的定位方法、装置及电子设备
CN110471666A (zh) * 2019-07-18 2019-11-19 五八有限公司 代码自动转换方法和装置、代码转换器及介质

Also Published As

Publication number Publication date
US10635421B2 (en) 2020-04-28
US20180203678A1 (en) 2018-07-19
KR20170014613A (ko) 2017-02-08
KR102414250B1 (ko) 2022-06-29

Similar Documents

Publication Publication Date Title
WO2017018644A1 (ko) 전자 장치, 컴파일링 방법 및 컴퓨터 판독가능 기록매체
US11579856B2 (en) Multi-chip compatible compiling method and device
CN111736840B (zh) 小程序应用的编译方法、运行方法、存储介质及电子设备
US8276130B2 (en) Method and compiler of compiling a program
CN108549538B (zh) 一种代码检测方法、装置、存储介质及测试终端
US7171649B1 (en) Optimizing safe downcasting in an object-oriented programming language
WO2013191458A1 (en) License verification method and apparatus, and computer readable storage medium storing program therefor
WO2019164205A1 (ko) 전자 장치 및 그의 동작 방법
US10698667B2 (en) Compiler with type inference and target code generation
KR20020094760A (ko) 컴퓨터용 소프트웨어의 언어표시방법 및언어표시시스템과, 언어표시방법과 언어표시시스템이저장된 기록매체
KR20090011974A (ko) 컴파일 대상 파일 추출 방법
WO2022030903A1 (ko) 어플리케이션 설치 방법 및 이를 지원하는 전자 장치
US7917899B2 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
CN114153463B (zh) 基于脚本编译器的管理系统业务功能创建方法及系统
US10152307B2 (en) Specifying user defined or translator definitions to use to interpret mnemonics in a computer program
CN109933410B (zh) 一种基于虚拟化技术的虚拟指令下发方法及系统
WO2016076583A1 (ko) 주석기반의 의사코드를 이용한 프로그램 변환 방법 및 그 방법을 구현하기 위한 프로그램이 기록된 컴퓨터 판독 가능한 기록매체
CN118333020A (zh) 代码标注方法、设备及计算机可读存储介质
WO2016085213A1 (ko) 컴퓨터 수행 가능한 모델 역공학 방법 및 장치
CN114840411B (zh) 单元测试方法、装置及存储介质
CN112579088A (zh) 面向异构混合编程的一站式程序编译方法
CN116483736B (zh) 插桩位置确定方法及电子设备
JP3682050B2 (ja) 組込みソフトウェア開発装置
CN116483289B (zh) 基本块管理方法及电子设备
CN113031952A (zh) 深度学习模型的执行代码的确定方法、装置及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16830677

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15742740

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16830677

Country of ref document: EP

Kind code of ref document: A1