IP Library Granted Patent US 6,934,946
Granted Patent B2
US 6,934,946 · App. 09/858,252 · Granted Aug 23, 2005

Lightweight native method invocation interface for java computing environments

Assignee: Sun Microsystems, Inc.
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 6,934,946
App. No.
09/858,252
Granted
Aug 23, 2005
Kind
B2
Abstract

Improved techniques for invocations of native methods in Java computing environments are disclosed. The techniques can be implemented in Java computing environments to facilitate efficient use of methods (functions or subroutines) written in programming languages other than Java (e.g., C, C++, etc.). As such, the techniques are highly suitable for use by virtual machines operating with relatively less memory and/or computing power (e.g., embedded systems). A lightweight native method invocation interface can be implemented to provide direct access to Java parameters on the execution stack. In addition, the lightweight native method invocation can include macro instructions that operate efficiently to convert the Java parameters into native parameters. Thus, the lightweight native method invocation can significantly reduce the overhead associated with conventional Java native method invocation techniques. As a result, performance of virtual machines, especially those operating with relatively less memory and/or computing power, can be improved.

Claims (26)

1. In a Java computing environment, a method of invoking a native method written in a native programming language without calling a Java Native Interface (JNI), said method comprising:

providing a set of macro instructions which are written in said native programming language with a direct reference to one or more Java parameters stored on a Java execution stack, wherein said one or more Java parameters are associated with said native method;

converting, by said set of macro instructions, said one or more Java parameters into at least one native parameter suitable for invocation of said native method, wherein said one or more Java parameters are converted by said converting without calling a Java Native Interface (JNI);

placing said at least one native parameter on a native execution stack associated with said native programming language after said converting operates to generate said at least one native parameter by accessing said direct reference; and

invoking said native method with said at least one native parameter after said converting of said at least one native parameter and said placing of said at least one native parameter on said execution stack, thereby allowing said native method to be invoked without calling said Java Native Interface (JNI).

2. A method as recited in claim 1 , wherein said set of macro instructions and said native method are written in C programming language.

3. A method as recited in claim 1 , wherein said at least one Java parameter is a Java reference object or a Java primitive data type.

4. A method as recited in claim 1 ,

wherein said set of macros operate to insulate the native method from the internals of a virtual machine that is invoking said native method.

5. A computer readable medium including computer program code for invoking a native method written in a native programming language without calling a Java Native Interface (JNI), said compute readable medium comprising:

computer program code for providing a set of macro instructions which are written in said native programming language with a direct reference to one or more Java parameters stored on a Java execution stack, wherein said one or more Java parameters are associated with said native method;

computer program code for converting, by said set of macro instructions, said one or more Java parameters into at least one native parameter suitable for invocation of said native method, wherein said one or more Java parameters are converted by said converting without calling a Java Native Interface (JNI);

computer program code for placing said at least one native parameter on a native execution stack associated with said native programming language after said converting operates to generate said at least one native parameter by accessing said direct reference; and

computer program code for invoking said native method with said at least one native parameter after said converting of said at least one native parameter and said placing of said at least one native parameter on said execution stack, thereby allowing said native method to be invoked without calling said Java Native Interface (JNI).

6. A computer readable medium as recited in claim 5 , wherein said native programming language is the C or C++ programming language.

7. A computer readable medium as recited in claim 5 , wherein said at least one Java parameter is a Java reference object or a Java primitive data type.

8. A computer readable medium as recited in claim 5 , wherein said set of macros operate to insulate the native method from the internals of a virtual machine that is invoking said native method.

9. A computer system, comprising:

at least one processor which supports a virtual machine capable of invoking a native method written in a native programming language without calling a Java Native Interface (JNI), wherein said virtual machine is capable of:

providing a set of macro instructions which are written in said native programming language with a direct reference to one or more Java parameters stored on a Java execution stack, wherein said one or more Java parameters are associated with said native method

converting, by said set of macro instructions, said one or more Java parameters into at least one native parameter suitable for invocation of said native method, wherein said one or more Java parameters are converted by said converting without calling a Java Native Interface (JNI);

placing said at least one native parameter on a native execution stack associated with said native programming language after said converting operates to generate said at least one native parameter by accessing said direct reference; and

invoking said native method with said at least one native parameter after said converting of said at least one native parameter and said placing of said at least one native parameter on said execution stack, thereby allowing said native method to be invoked without calling said Java Native Interface (JNI).

10. A computer system as recited in claim 9 , wherein said native programming language is the C or C++ programming language.

11. A computer system as recited in claim 9 , wherein said at least one Java parameter is a Java reference object or a Java primitive data type.

12. A computer system as recited in claim 9 , wherein said set of macros operate to insulate the native method from the internals of said virtual machine.

Assignments (2)
MERGER AND CHANGE OF NAME Recorded Aug 31, 2016
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 039604/0471 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 15, 2001
From: SOKOLOV, STEPAN; WALLMAN, DAVID
To: SUN MICROSYSTEMS, IMC.
Reel/Frame 011816/0594 →
Continuity (1)
Related Publication 20020174261A1 · Nov 21, 2002