Is that necessary? Outdated things, Android Dalvik efficiency is not high enough, not enough force lattice it?
Yes, but there are always things that we can decide, leadership and project demand is what you should be concerned about, after all, the work to report to the leadership, the project to earn money, but you also have to earn a salary, it is so realistic.
To get down to it, I can complain, but I have to go on with my work.
We must not build the wheels, that's too tiring. or with open source to do our function, after Google found a good open source JVM, phoneme Sun Open source Java virtual machine.
Phoneme Introduction
The phoneme Feature software is an optimized Java ME architecture. Its core is to support multi-tasking MIDP2.1 specification implementation. When phoneme Feature software runs multiple midlet, it uses only one system process, because a Java virtual machine instance can perform several applications and provide independent runtime space. All running applications are independent and look as if each application is executing in its own virtual machine.
phoneme Feature software is available to developers who are related to MIDP or mobile information devices. The following are the content features contained in the phoneme Feature software MR2 version:l High-performance Java ME platform Architecture l supports each functional area (storage , Network and user interface, etc.) l subsystem, directory and portable class library l Minimum specific platform implementation code l multi-tasking capabilities and support for concurrent applications ( MIDlet) l Local application Management apil Local resource Management apil support Texas Instruments P2SAMPLE64-V6 Platform l         CLDC 1.1 (JSR 139) and MIDP 2.1 (JSR 118) Implementation l The following optional package implementations: N wireless Messaging 1.0 (JSR) N &nbsP; mobile Media APIs (JSR 135) n J2me™web Services Support (JSR 172) n security and Trust Services API support (JSR 177) N content Handler API (JSR 211)
N Java Binding for the OpenGL ES API (JSR 239)
This is the feature version. This is optimized for devices with less device resources, but we are under Android and it is smart devices so we choose the advanced version of this version to support smart devices. Let's move it to Android in one step.
First, the source version download
#!/bin/bash
SVN checkout Https://svn.java.net/svn/phoneme~svn/legal Legal--username Guest
For I in abstractions CDC CLDC javacall jpeg jsr120 jsr135 jsr172 jsr177 jsr211 jsr239 jsr280 jump KDP Lime MIDP Midp_abb PCSL pisces preverifier restricted_crypto tools xmlparser;
Do
SVN checkout https://svn.java.net/svn/phoneme~svn/components/$i/trunk $i--username Guest
Done
This is the last updated version, and is the latest version, but it was updated four years ago.
II. Structure Description
1. Javacall API porting Layer: This layer extracts the requirements of the target platform, realizes the function set that must be ported, and is based on the realization of the target platform. The primary migration of Pho-neme advanced is focused on this layer.
2, MIDP/CLC layer: is the core part of embedded Java Virtual machine. Where CDC defines an application programming interface and a base set of functions for a virtual machine for resource-constrained devices, MIDP (Mobile Information device profile, a short-running information equipment Summary) provides a large number of services required by the application environment and applications.
3, PCSL (Portable Common Services Library, portable universal service Libraries) layer: provides the underlying services for CDC, MIDP, and other optional package calls.
4, Abstract layer: is a set of functions, all the extended JSR package through the abstraction layer interface with the MIDP/CDC layer to interact.
5. Extend the JSR package: Provides extended functionality for virtual machines. There are many types of extended JSR packages that can be scaled as needed. such as JSR82 expansion packs that support Bluetooth and Obex (object Exchange), JSR172 packages that support Web services, JSR179 packages that support targeting, JSR229 packages that support online payment functions, and more.
Porting a Java Virtual machine first to identify two things: one is the target CPU, the other is the target OS (operating system). OS porting is simple, migration is focused on the virtual machine itself and the core CLDC library, whereas CPU porting is more complex because the assembler interpreter and the adaptive compiler rely heavily on the target CPU architecture.
Second, compile the configuration
#!/bin/bash
Export cvm_target_tools_prefix=
Export gnu_tools_dir=
Export work_dir= $PWD
Export components_dir= $WORK _dir
Export Java_home=
Export Java_path= $JAVA _home
Export Jdk_home= $JAVA _home
Export path= $JAVA _home: $PATH
Export cvm_javabin= $JAVA _home/bin
Export build_output_dir= $COMPONENTS _dir/output
############################################################
Export Cvm_preload_lib=true
Export javame_legal_dir= $PWD/legal
Export path= $JAVA _home: $PATH
Export Cvm_debug=false
Export Cvm_jit=true
Export Cvm_build_so=true
Export Use_aapcs=true
Export J2me_classlib=foundation
#export Cvm_preload_lib=true
Export tools_dir= $WORK _dir/tools
Export Cvm_build_subdir=true
Export cvm_build_subdir_name=phoneme-advanced
Export PCSL_PLATFORM=LINUX_ARM_GCC
Export Use_midp=true
Export Use_jpeg=true
# Multimedia Subsystem
# Description:mobile Media API
Export jpeg_dir= $COMPONENTS _dir/jpeg
Export android_sysroot=
Export cppflags= "--sysroot= $ANDROID _sysroot"
Export cflags= "--sysroot= $ANDROID _sysroot"
Export cxxflags= "--sysroot= $ANDROID _sysroot"
Export extra_cflags= $CFLAGS
echo "cvm_target_tools_prefix= $CVM _target_tools_prefix" >> cdc/build/linux-arm-generic/gnumakefile
CD Cdc/build/linux-arm-generic
Make-f Gnumakefile bin Verbose_build=true use_verbose_make=true [email protected]
Cvm_target_tools_prefix compiling the Environment directory NDK Directory I'm using android-ndk-r9d.
Java_home for the JDK environment directory
Android_sysroot for the Arch-arm directory under the NDK
Under normal circumstances will encounter some errors, basically is the Android and Linux differences caused by the change it on the line
If everything works, it will be in the Cdc/build/linux-arm-generic. The Build foundation directory contains executable files CVM.
At this point the JVM can only run some test examples at the command line.
BIN/CVM-CP Testclasses.zip Test
That's it for today, and the next one we'll show you how to compile it into libraries on Android and how the port interface is implemented.
If you have questions about this series of articles, you can directly in the public message, the first time to contact the original author to help you patiently answer.
Technicians have their own feelings, deep in which they are not understood, welcome to the personal public platform: the Programmer Interaction Alliance (Coder_online), a developer's home, to tell their story.
JVM Virtual Machine Androidy porting-Compile chapter