Apparatus and method for avoiding deadlocks in a multithreaded environment
First Claim
1. A method of calling a portion of computer code in a multithreaded environment, wherein the portion of computer code is a Java method having an associated method block including a field that includes a pointer that points to a Java Virtual Machine (JVM) interpreter before a Just-In-Time (JIT) compiler is loaded, points to a JIT compiler routing CompileThisMethod when the JIT compiler is loaded, and points to a routine which calls a compiled version of the method once the method is compiled by the JIT compiler, the method comprising:
- receiving a call to the portion of computer code;
determining if the portion of computer code is currently being compiled based on information stored in fields of the method block; and
redirecting the call to an interpreter, if the portion of computer code is currently being compiled.
1 Assignment
0 Petitions
Accused Products
Abstract
An apparatus and method for avoiding deadlocks in a multithreaded environment is provided. The apparatus and method provide a mechanism by which multiple threads are allowed to call a method virtually simultaneously without experiencing the problems regarding multiple compilations of the same method or a lock being held by one thread while other threads wait on the lock. With the apparatus and method, the first thread to call a method is the thread that causes the method to be compiled. Subsequent calls to the method, during a period of time in which the method is being compiled, are redirected to the JVM interpreter, thereby avoiding any deadlock situation.
108 Citations
18 Claims
-
1. A method of calling a portion of computer code in a multithreaded environment, wherein the portion of computer code is a Java method having an associated method block including a field that includes a pointer that points to a Java Virtual Machine (JVM) interpreter before a Just-In-Time (JIT) compiler is loaded, points to a JIT compiler routing CompileThisMethod when the JIT compiler is loaded, and points to a routine which calls a compiled version of the method once the method is compiled by the JIT compiler, the method comprising:
-
receiving a call to the portion of computer code;
determining if the portion of computer code is currently being compiled based on information stored in fields of the method block; and
redirecting the call to an interpreter, if the portion of computer code is currently being compiled. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. An apparatus for calling a portion of computer code in a multithreaded environment, wherein the portion of computer code is a Java method having an associated method block including a field that includes a pointer that points to a Java Virtual Machine (JVM) interpreter before a Just-In-Time (JIT) compiler is loaded, points to a JIT compiler routing CompileThisMethod when the JIT compiler is loaded, and points to a routine which calls a compiled version of the method once the method is compiled by the JIT compiler, comprising:
-
a processor;
receiving means for receiving a call to the portion of computer code;
first determination means for determining if the portion of computer code is currently being compiled based on information stored in fields of the method block; and
first redirection means for redirecting the call to an interpreter, if the portion of computer code is currently being compiled. - View Dependent Claims (8, 9, 10, 11, 12, 15, 16, 17, 18)
-
-
13. A computer program product in a computer readable medium for calling a portion of computer code in a multithreaded environment, wherein the portion of computer code is a Java method having an associated method block including a field that includes a pointer that points to a Java Virtual Machine (JVM) interpreter before a Just-In-Time (JIT) compiler is loaded, points to a JIT compiler routing CompileThisMethod when the JIT compiler is loaded, and points to a routine which calls a compiled version of the method once the method is compiled by the JIT compiler, comprising:
-
first instructions for receiving a call to the portion of computer code;
second instructions for determining if the portion of computer code is currently being compiled based on information stored in fields of the method block; and
third instructions for redirecting the call to an interpreter, if the portion of computer code is currently being compiled. - View Dependent Claims (14)
-
Specification