ISSN 1000-1239 CN 11-1777/TP

Journal of Computer Research and Development ›› 2015, Vol. 52 ›› Issue (1): 141-155.doi: 10.7544/issn1000-1239.2015.20131166

Previous Articles     Next Articles

A Compound Native Object Model Based on the Strategy of Cross-Language Object Migration

Huang Yukun1,3,Chen Rong1,2,Pei Xilong1,Cao Jing2   

  1. 1(Institute of Electronic and Information Engineering, Tongji University, Shanghai 200092); 2(Shanghai Kortide Century Technology, LTD, Shanghai 201203) ; 3(School of Information Technology, Jiangxi University of Finance and Economics, Nanchang 330029)
  • Online:2015-01-01

Abstract: The Java native interface (JNI) mechanism, which is designed to handle the interaction between native code and Java code, is currently widely utilized to develop mobile applications. However, JNI is observed hardly from perfection in two points: on one hand, the overhead of invoking functions of JNI interfaces heavily affects programs’ runtime performance; on the other hand, the complexity of the JNI’s programming specification prevents the integration and reusing of third party native components in Java code. To solve these problems, a new strategy is advised to migrate objects between Java components and native components by injecting necessary information of native objects into high-level objects. Guided by this strategy, a model of compound native objects (CNO) is proposed to integrate a Java object and a native object into a compound object which share same metadata maintained by Java class objects. Therefore the CNO model could literally reduce the overheads for the time saving of data type conversions, and lessen down the programming burden of the bridging code. A prototype of the CNO model is implemented on the basis of the Dalvik virtual machine such that Java could reuse third-party components in a dynamical and efficient way. Experiments show that the CNO model outweighs JNI in better performance of accessing native methods.

Key words: Java native interface (JNI), cross-language, native component, metadata, Dalvik virtual machine

CLC Number: