Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method and device for running Java programs

A technology of java method and java virtual machine, which is applied in the direction of program control device, program loading/starting, etc., can solve the problems of limiting the calling level of Java methods and the depth of recursive calling, not providing enough space to execute Java methods, and less space , to achieve the effect of improving flexibility, expanding size, and avoiding abnormal situations

Active Publication Date: 2012-09-19
FEITIAN TECHNOLOGIES
View PDF3 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The RAM of existing embedded chips usually has only a few K to more than a dozen K of storage space, and most of the space is also used to store C global variables and stacks, as well as caches for communication and heap space for virtual machines , Therefore, the space left for the Java stack is usually relatively small, which will limit the calling level of the Java method and the depth of the recursive call
If the call level of the Java method is too deep, RAM will not provide enough space to execute the Java method

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for running Java programs
  • Method and device for running Java programs
  • Method and device for running Java programs

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0030] Embodiment 1 of the present invention provides a method for running a Java program, such as figure 1 shown, including the following steps:

[0031] Step 101, when the Java virtual machine invokes a Java method, calculate the space required for executing the Java method.

[0032] Specifically, the Java virtual machine can calculate the size of the frame corresponding to the Java method. The frame includes a local variable area, an operand stack, and a frame data area. The size of the local variable area and the operand stack are generated by the compiler and the converter. Known when calling a Java method; the size of the frame data area is implementation-dependent and usually fixed. The Java virtual machine can sum the sizes of the local variable area, the operand stack, and the frame data area to obtain the size of the frame. Since the Java virtual machine executes the Java method in the frame corresponding to the Java method, the size of the frame corresponding to t...

Embodiment 2

[0047] In the first embodiment above, since the frame in the Java stack in RAM is transferred to the non-volatile memory, when the calling level of the Java program is reduced, if there is no called Java method in the Java stack in RAM, Corresponding to the frame, the Java virtual machine can restore part or all of the frame in the non-volatile memory to the Java stack in the RAM.

[0048] Embodiment 2 of the present invention provides a method for running a Java program, such as figure 2 shown, including the following steps:

[0049] Step 201, when the execution of the Java method ends, the Java virtual machine pops the frame corresponding to the Java method from the Java stack and discards it.

[0050] In step 202, the Java virtual machine judges whether there is a frame in the Java stack in RAM, and if yes, executes step 204; otherwise, executes step 203.

[0051] Step 203, the Java virtual machine copies the frame in the non-volatile memory to the Java stack in the RAM,...

Embodiment 3

[0057] In the first embodiment above, since the frames in the Java stack in the RAM are transferred to the non-volatile memory, when the calling level of the Java program decreases, if the number of frames in the Java stack in the RAM is less than the fourth When the preset value (the fourth preset value can be an integer greater than 1), the Java virtual machine can restore some or all frames in the non-volatile memory to the Java stack in the RAM.

[0058] Embodiment 3 of the present invention provides a method for running a Java program, such as image 3 shown, including the following steps:

[0059] Step 301, when the execution of the Java method ends, the Java virtual machine pops the frame corresponding to the Java method from the Java stack and discards it.

[0060] In step 302, the Java virtual machine judges whether there is a frame in the Java stack in RAM, and if yes, executes step 304; otherwise, executes step 303.

[0061] Step 303, the Java virtual machine copi...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The embodiment of the invention discloses a method and device for Java programs. The method comprises the following steps: judging whether a Java stack in a RAM (random access memory) meets a first preset condition or not by a Java virtual machine; if the Java stack does not meet the first preset condition, continuing to run the Java programs, and if the Java stack meets the first preset condition, copying one or a plurality of frames in the Java stack into a nonvolatile memory, moving a Java stack top pointer towards the bottom of the Java stack, and continuing to run the Java programs; judging whether a Java stack in a RAM meets a second preset condition or not by the Java virtual machine; if the Java stack does not meet the second preset condition, continuing to run the Java programs, and if the Java stack meets the first preset condition, copying one or a plurality of frames in the nonvolatile memory into the Java stack, and moving the Java stack top pointer towards the top of the Java stack. In the embodiment of the invention, the nonvolatile memory is used as the expansion and storage space of the Java stack, therefore, the occurrence of abnormal situation due to deficiency of resources can be avoided.

Description

technical field [0001] The invention relates to the technical field of computers, in particular to a method and a device for running a Java program. Background technique [0002] A Java virtual machine is a specification for computing devices that can be implemented by simulating various computer functions on an actual computer. In the Java application development process, developers use IDE (Integrated Development Environment, integrated development environment) to write Java source code files (.java), and call Java compiler to compile Java source code into platform-independent bytecode, The Java virtual machine loads and executes the above bytecode. [0003] The Java Card Virtual Machine is a subset of the Java Virtual Machine, and is used to compile, execute, and return results for the Java Card Applet. Like the Java virtual machine, the operation mode of the Java card virtual machine is also based on the structure of the stack. Local variables are pushed into the stack...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/445
Inventor 陆舟于华章
Owner FEITIAN TECHNOLOGIES
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products