lvtn
DESCRIPTION
Thesis's about Java Virtual MachineTRANSCRIPT
1
Chuyển máy ảo Java xuống hệ thống NXP Trimedia
GVHD: TS. ĐINH ĐỨC ANH VŨGVPB: KS. PHẠM QUỐC CƯỜNG
SVTH: HỒ VIỆT LÂM
2
Nội dung
1. Mục tiêu của đề tài 2. Máy ảo Java 3. Truyền dữ liệu giữa lớp C và Java 4. Port CLDC 5. Port MIDP 6. Thống kê và kết luận
3
Hardware
OS
Mục tiêu của đề tài
Java VM
Core JavaLibrary
JSR + MIDP Java Library
MIDP
JSR
MIDlet
Java
Java
Java
C
C
C C
C Java
CC
C
Java
C
Ứng dụng và game Java
Hệ Thống NXP Trimedia
Máy ảo Java
Thư viện Java: java.lang,java.util, java.io
Connected, Limited Device Configuration
(CLDC)
Java Specification Request
Thư viện Java: Graphics, User Interface, Input..Java 2 Micro Edition
(J2ME)
pSOS
Mobile Information Device Profile
4
Nội dung
1. Mục tiêu của đề tài 2. Máy ảo Java 3. Truyền dữ liệu giữa lớp C và Java 4. Port CLDC 5. Port MIDP 6. Thống kê và kết luận
5
Máy ảo Java
Class Loader
Class Files
VM Register
Java Stacks
Java Heap
Method Area
Interpreterreference anew class
loading
GarbageCollector
IP, LP, SP, FP, CP
Jasmin code
Class codeClass data
Constant pool
Instance data
iloadiconstipushiadd…
Instruction PointerStack PointerLocal PointerFrame Pointer
Constant Pool Pointer
PreverificationVerification
6
Nội dung
1. Mục tiêu của đề tài 2. Máy ảo Java 3. Truyền dữ liệu giữa lớp C và Java 4. Port CLDC 5. Port MIDP 6. Thống kê và kết luận
7
Truyền dữ liệu giữa lớp C và Java
Java Code
Jasmin Code
Interpreter
Java Stack
c = a+b;
iload_0iload_1
iaddipush
swicth (ip) {case iload: …
break;case iadd: …
break;case ipush: …
break;…}
ab…
c…
8
Truyền dữ liệu giữa lớp C và Java
method (java)
native executejasmin code
False
native function (C)
Create
executenative function
9
Truyền dữ liệu giữa lớp C và Java
Graphics.drawLine (int x1, int y1, int x2, int y2)
Java_javax_microedition_lcdui_Graphics_drawLine()
const NativeImplementationType javax_microedition_lcdui_Graphics_natives[] = {…
{ "drawLine", NULL, Java_javax_microedition_lcdui_Graphics_drawLine },…}
const ClassNativeImplementationType nativeImplementations[] = {…
{ "javax/microedition/lcdui", "Graphics", javax_microedition_lcdui_Graphics_natives },…}
10
Truyền dữ liệu giữa lớp C và Java
…if (thisMethod->accessFlags & ACC_NATIVE) {
ip += invokerSize; VMSAVE invokeNativeFunction(thisMethod); VMRESTORE TRACE_METHOD_EXIT(thisMethod); goto reschedulePoint; }
…
… CurrentNativeMethod = thisMethod;
native();…
11
Nội dung
1. Mục tiêu của đề tài 2. Máy ảo Java 3. Truyền dữ liệu giữa lớp C và Java 4. Port CLDC 5. Port MIDP 6. Thống kê và kết luận
12
Các vấn đề quan tâm khi port CLDC xuống Trimedia
Class Loading Hỗ trợ 64-bit Hỗ trợ số thực Đồng bộ thời gian Bộ nhớ JavaCodeCompact
13
Nội dung
1. Mục tiêu của đề tài 2. Máy ảo Java 3. Truyền dữ liệu giữa lớp C và Java 4. Port CLDC 5. Port MIDP 6. Thống kê và kết luận
14
Các Module trong MIDP
15
Các vấn đề quan tâm khi port MIDP xuống Trimedia
Cơ chế chạy một MIDlet cơ bản Các hàm về quản lý bộ nhớ Trình quản lý các MIDlet Giao diện người dùng và đồ họa Ảnh PNG Font Bàn phím Âm thanh
16
Nội dung
1. Mục tiêu của đề tài 2. Máy ảo Java 3. Truyền dữ liệu giữa lớp C và Java 4. Port CLDC 5. Port MIDP 6. Thống kê và kết luận
17
Các công việc đã làm được
Class Loading
VerificationTime
Core Language and virtual machine
Core Java Library
ROMizer
Memory allocation
64-bit long
Float support
Thread
Gabage Collector
Basic Midlet Life-Cycle
Graphics/User-Interfacekey
Storage
Sound
MIDlet Management
Không chạy được các class số thực
Chưa hỗ trợ GameCanvasChưa hỗ trợ ảnh tranparentSố lượng font đã port 1/3
Chưa hỗ trợ sự kiện Keyreleased
Chưa hỗ trợ định dạng MIDI
CLDC
MIDP
18
Thống kê và kết luận
CLDC: Chưa hỗ trợ số thực MIDP:
Chưa port networking Chưa port security Chưa port GameCanvas Chưa hỗ trợ MIDI player
19
Thống kê và kết luận
Số lượng hàm native đã port: 105/214
Một mô hình game Java cơ bản Một số MIDlet demo tương ứng để
test các thành phần đã port
20
Demo
21
Tham Khảo
1. Core J2ME Technology & MIDP, by John W.Muchow, ISBN 0130669113.2. CLDC Reference Implementation, Sun Microsystems.3. MIDP Reference Implementation, Sun Microsystems.4. pSOS System Concepts, Integrated Systems, part number 0005433001.