Download presentation
Presentation is loading. Please wait.
1
Inside the KVM Real-Time Java Team University of Pennsylvania
2
Small footprint VM for resource constrained devices Build a Java VM that would –Be easy to understand and maintain –Be highly portable –Be small without sacrificing features of Java language KVM Design Goals
3
KVM = JVM – advanced performance optimizations Easy to read and port –24,000 LOC –40 ~ 80 KB when loaded –Supports ROMizing (pre-build application) –30 – 80 % of the speed of JDK w/o JIT KVM-CLDC
4
Platforms –Win32 –PalmOS –Solaris –Linux JAR compatibility & dynamic class loading Source code is in 100% ANSI C Compatibility(1)
5
No floating point support No JNI support (not really) Limited error handling New bytecode (pre)verifier Compatibility(2)
6
Memory model GC Interpreter Frames File Loading Verification Security Romizer Features of VM
7
cell CLASS FIELD METHOD OBJECT FRAME Data Structures THREAD MONITOR BYTEARRAY SHORTARRAY POINTERLIST HASHTABLE
8
Saves space for long strings, faster comparisons, etc ClassTable: all classes –Instance/array/raw-classes InternStringTable –Strings used in program source UTFStringTable –Encodes field/class/signature names Hashtables
9
Objects in action Every object is created in Heap
10
Visible to user –GCT_INSTANCE –GCT_OBJECTARRAY –GCT_INSTANCE_CLASS –GCT_ARRAY_CLASS –… Internal object in heap –GCT_FIELDTABLE –GCT_MONITOR –GCT_GLOBAL_ROOTS –GCT_HASHTABLE –… Header Types
11
Memory Layout
12
Global roots(permanent) –Cannot undone –makeGloabalRoot(&globalVariable) Temporary roots(stack discipline) START_TEMPORARY_ROOTS MAKE_TEMPORARY_ROOT(x) END_TEMPORARY_ROOTS Transient roots(non-stack discipline) makeTransientRoot(y) removeTransientRootByValue(y) Roots for GC op
13
mallocBytes() mallocHeapObject(size, type) mallocObject(size, type) callocObject(size, type) instantiate(instance_class) instantiateArray(arrayclass, count) Allocating Objects
14
Original mark-and-sweep Single-space Non-moving, non-incremental Small and simple Slow allocation, long pause, and fragmentation Garbage Collector
15
Interpretor
16
Platform independent multithreading using green thread –Fully deterministic –Active thread kept in a simple linked queue –Every Java thread runs some number of bytecodes and reschedule() –Given execution time based on priority Thread Design
17
Thread & Monitors
18
1.Low-level VM security Bytecode verifier 2.Application-level security (sandbox) Set of supported JNI(sorta) calls closed Security
19
Preverifier and verifier
20
Preverifier (off-line) –Space-intensive processing –Stackmap verification making sure the VM stack consistency –Jmp/return instruction verification –Leaves hints for run-time verifier Verifier –Just check the hints left by the preverifier Cont’
21
Synchronous notification Polling in Java programming language code Polling in the interpreter Suck in an event from the I/O pipe -> deal with it -> next event -> deal with it -> etc Event Handling
22
Files –Machine_md.h –Runtime_,d.c –Main.c Error Handling, memory management Native code handling, Time, Timer 64bit integer calc, big-little endian Class file locations and format Porting Issues
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.