Download presentation
Presentation is loading. Please wait.
Published byJoan Cunningham Modified over 8 years ago
1
WTK21 – wtklib\kvem HPCC.
2
runClient of Lime: 해당 Process 리턴, KVMBridge has: disconnectLime, runKVM, stopKVM 프로세스 호출 관계 kvem\environment\JVM.java Kvem\environment\ChildProcess.java Kvem\KVMBridge.java Kvem\Lime.java JVM KVMBridgeLime ChildProcess J2MEWTK.property 파일 생성, 정보저장 컴파일 대상파일 실행시킴 creates runClient 호출 in runKVM
3
as 분석 (in lime.java)
4
Runclient() in Lime.java public Process runClient(String s, String as[], String as1[], File file) throws IOException { commandServer = new ServerSocket(0); eventServer = new ServerSocket(0); int i = commandServer.getLocalPort(); int j = eventServer.getLocalPort(); String as2[] = { "LIME_TRACE=" + (debug ? 1 : 0), "COMMAND_PORT=" + i, "EVENT_PORT=" + j, "--" }; int k = as1 != null ? as1.length : 0; String as3[] = new String[1 + k + as2.length + as.length]; as3[0] = s; if(as1 != null) System.arraycopy(as1, 0, as3, 1, k); System.arraycopy(as2, 0, as3, 1 + k, as2.length); System.arraycopy(as, 0, as3, 1 + k + as2.length, as.length); if(debug) { for(int l = 0; l < as3.length; l++) System.out.println("argv[" + l + "] = " + as3[l]); System.out.flush(); } Server server = new Server(); connected = true; (new Thread(server)).start(); String s1 = System.getProperty("kvm.use_library", "false"); if(s1.compareToIgnoreCase("true") == 0) return new FakeProcess(as3); else return Runtime.getRuntime().exec(as3, null, file); }
5
Lime.java Process runClient (String s, String as[], String as1[], File file) { …… Runtime.getRuntime().exec(as3, null, file); }
6
Runtime.exec(String[] cmdarray, String[] envp, File dir) cmdarray : call 하는데, 필요한 argument/ 층 envp : 환경변수 setting ( null 이면, sub_process 에서 상속 받는다. ) file dir : working directory >> return : sub_process manage 위한 process obj
7
C:\WTK21\bin\zayit LIME_TRACE=0 COMMAND_PORT=1137 EVENT_PORT=1138 -- -Dcom.sun.midp.lcdui.eventHandler=com.sun.midp.lcdui.EmulEventHandler -Dcom.sun.midp.lcdui.inputMethodHandler=com.sun.midp.lcdui.DefaultInputMethodHandler -Dcom.sun.midp.io.http.use_chunks=true -Dcom.sun.midp.io.http.force_non_persistent=false -monitormemory -jprof C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\jprof19006.prf -Dsystem.storage_root=DefaultColorPhone -Dmicroedition.locale=ko-KR -Dmicroedition.encoding=MS949 -Dmmapi_enabled=true -domain untrusted -Dsupports.video.capture=false -Daudio.encodings=encoding=pcm -Dvideo.snapshot.encodings=encoding=jpeg&encoding=png -Dsupports.mixing=true -Dsupports.audio.capture=true -Dsupports.recording=true -Dwireless.messaging.sms.smsc=+1234567890 -classpath C:\WTK21\apps\demos\classes;C:\WTK21\apps\demos\res -descriptor C:\WTK21\apps\demos\bin\demos.jad as3 as3 구성 (‘Open Project’ ‘demo’ 실행 ) S S as2 as
8
as3 구성 as3 s 첫번째 argv C:\WTK21\bin\zayit as1 계속해서 null 값이 찍힘. as2 Lime_Trace, COMMAND_PORT, EVENT_PORT 등을 나타냄. as Preference, Settings 에서 enable, disable 해줬던 부분이 parameter 처럼 들어옴.
9
C:\WTK21\bin\zayitLIME_TRACE=0COMMAND_PORT=1137EVENT_PORT=1138-- -Dcom.sun.midp.lcdui.eventHandler=com.sun.midp.lcdui.EmulEventHandler -Dcom.sun.midp.lcdui.inputMethodHandler=com.sun.midp.lcdui.DefaultInputMethodHandler -Dcom.sun.midp.io.http.use_chunks=true -Dcom.sun.midp.io.http.force_non_persistent=false -monitormemory -jprof C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\jprof19006.prf -Dsystem.storage_root=DefaultColorPhone -Dmicroedition.locale=ko-KR -Dmicroedition.encoding=MS949 -Dmmapi_enabled=true -domain untrusted -Dsupports.video.capture=false -Daudio.encodings=encoding=pcm -Dvideo.snapshot.encodings=encoding=jpeg&encoding=png -Dsupports.mixing=true -Dsupports.audio.capture=true -Dsupports.recording=true -Dwireless.messaging.sms.smsc=+1234567890 -classpath C:\WTK21\apps\demos\classes;C:\WTK21\apps\demos\res -descriptor C:\WTK21\apps\demos\bin\demos.jad as3 as2 - 1 S S as2 as
10
as2 - 2 Lime_Trace : 항상 value = 0 COMMAND_PORT : lime.java 에서 command_port 설정. 다른 응용 프로그램일 경우, 값이 바뀜. EVENT_PORT : lime.java 에서 event_port 설정. 다른 응용 프로그램일 경우, 값이 바뀜.
11
C:\WTK21\bin\zayit LIME_TRACE=0 COMMAND_PORT=1137 EVENT_PORT=1138 -- -Dcom.sun.midp.lcdui.eventHandler=com.sun.midp.lcdui.EmulEventHandler -Dcom.sun.midp.lcdui.inputMethodHandler=com.sun.midp.lcdui.DefaultInputMethodHandler -Dcom.sun.midp.io.http.use_chunks=true -Dcom.sun.midp.io.http.force_non_persistent=false -monitormemory -jprof C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\jprof19006.prf -Dsystem.storage_root=DefaultColorPhone -Dmicroedition.locale=ko-KR -Dmicroedition.encoding=MS949 -Dmmapi_enabled=true -domain untrusted -Dsupports.video.capture=false -Daudio.encodings=encoding=pcm -Dvideo.snapshot.encodings=encoding=jpeg&encoding=png -Dsupports.mixing=true -Dsupports.audio.capture=true -Dsupports.recording=true -Dwireless.messaging.sms.smsc=+1234567890 -classpath C:\WTK21\apps\demos\classes;C:\WTK21\apps\demos\res -descriptor C:\WTK21\apps\demos\bin\demos.jad as3 as - 1 S S as2 as
12
as - 2 선택 사항에 따라서 parameter 로 넘어감. : Ktoolbar 의 menu 중에서 Preference, settings 에서 선택하는 것에 따라서 값이 나타남. 예를 들어 … -monitermemory : preference 에서 memorymonitor 를 disable 시키면 없어짐. -Dsupports.mixing=true or -supports.audio.capture=true or Dsupports.recording=true 과 같은 argv : preferences Mmedia optional feature 에 있는 부분을 enable / disable 시켜줌에 따라서 true/ false 값으로 변화.
13
Lime.runClient (wtklib\lime\com\sun\kvem) KVMBridge.runKVM (wtklib\kvem\com\sun\kvem) Lime.runClient ← ‥‥ ← Main : call 관계 KVMBridge.runKVM (wtklib\kvem\com\sun\kvem) MIDP.run (wtklib\kvem\com\sun\kvem\midp) EmulatorInvoker.runEmulatorImpl (wtklib\kenv\com\sun\kvem\environment)
14
Lime.runClient ← ‥‥ ← Main : call 관계 EmulatorInvoker.runEmulatorSameVM (wtklib\kenv\com\sun\kvem\environment) EmulatorInvoker.runEmulator (wtklib\kenv\com\sun\kvem\environment) ProfileEnvironment.KVMThread.runEmulator (wtklib\kenv\com\sun\kvem\environment)
15
Lime.runClient ← ‥‥ ← Main : call 관계 ProfileEnvironment.KVMThread.run (wtklib\kenv\com\sun\kvem\environment) MainWindow.CompilerThread.run (wtklib\ktools\com\sun\kvem\toolbar) MainWindow.MainWindow (wtklib\ktools\com\sun\kvem\toolbar)
16
Lime.runClient ← ‥‥ ← Main : call 관계 EmulatorWrapper.run (wtklib\kenv\com\sun\kvem\environment) EmulatorWrapper.main (wtklib\kenv\com\sun\kvem\environment)
17
Lime.runClient ← ‥‥ ← Main : call 관계 Main.run (wtklib\ktools\com\sun\kvem\toolbar) Main.main (wtklib\ktools\com\sun\kvem\toolbar) Main.main (wtklib\ktools\com\sun\kvem\ktools)...
18
PofileConfiguration :Set of Property objects (Trace 관련 옵션 포함 ) Property object: each entry in emulator.poperties TracingOptions : invoke profileconfiguration By (method.invoke(profileconfiguration, aobj) ProfileConfiguration 에 따라 trace 활성화 EmulatorWrapper : receives args(opt) from prompt initiate Calls to set
19
Lime 데이터 핸들링 Output 스트림 생성, profiler 생성, 기록 서버와 클라이언트 연결 ( 로컬 (?) 네트워 크 )
20
runClient in Lime uses zayit.dll As3 값 : Zayit.exe 외 String s1 = System.getProperty("kvm.use_library", "false"); if(s1.compareToIgnoreCase("true") == 0) return new FakeProcess(as3); else return Runtime.getRuntime().exec(as3, null, file);
21
C:\WTK21\bin\zayit LIME_TRACE=0 COMMAND_PORT=1137 EVENT_PORT=1138 -- -Dcom.sun.midp.lcdui.eventHandler=com.sun.midp.lcdui.EmulEventHandler -Dcom.sun.midp.lcdui.inputMethodHandler=com.sun.midp.lcdui.DefaultInputMethodHandler -Dcom.sun.midp.io.http.use_chunks=true -Dcom.sun.midp.io.http.force_non_persistent=false -monitormemory -jprof C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\jprof19006.prf -Dsystem.storage_root=DefaultColorPhone -Dmicroedition.locale=ko-KR -Dmicroedition.encoding=MS949 -Dmmapi_enabled=true -domain untrusted -Dsupports.video.capture=false -Daudio.encodings=encoding=pcm -Dvideo.snapshot.encodings=encoding=jpeg&encoding=png -Dsupports.mixing=true -Dsupports.audio.capture=true -Dsupports.recording=true -Dwireless.messaging.sms.smsc=+1234567890 -classpath C:\WTK21\apps\demos\classes;C:\WTK21\apps\demos\res -descriptor C:\WTK21\apps\demos\bin\demos.jad as3 C:\WTK21 file ‘Open Project’ 에서 ‘demo’ 실행
22
Zayit.exe Sever program 과 client program 사이의 미들웨어 Dummy 인지 기능이 있는지 아직 알 수 없었음 Emulator 의 실행을 위해 필요한 파일 ( 작은 size 라는 장 점으로 인해 ) Guess 1 - 방화벽을 on 하면 에러,off 하면 컴파일성공, by Java Technology Forums in java.sun.com Guess 2 - 네트웍 관련 (TCP/IP based 추정, 그러나 trace 못함 ) by Java Technology Forums in java.sun.com KVM Strategy for small size
23
Appendix. Configuration file in wtk directory
24
# Properties visible from System.getProperty() microedition.jtwi.version: 1.0 microedition.configuration: CLDC-1.1 microedition.profiles: MIDP-2.0 microedition.locale: en-US microedition.platform: j2me # microedition.encoding: ISO8859_1 microedition.commports: 0,1 # # I18N aliases for common character encodings SHIFT_JIS_InternalEncodingName: SJIS X_SJIS_InternalEncodingName: SJIS # # CLDC implementation parameters # use MIDP protocol implementations javax.microedition.io.Connector.protocolpath: com.sun.kvem.io # java.lang.Character.caseConverter: com.sun.cldc.i18n.uclc.DefaultCaseConverter # com.sun.cldc.i18n.Helper.i18npath: com.sun.cldc.i18n.j2me # microedition.implpath: com.sun.cldc # com.sun.cldc.util.j2me.TimeZoneImpl.timezone: UTC # WMA wireless.messaging.sms.smsc : +12345678900 # MMAPI public properties microedition.media.version: 1.1 supports.audio.capture: true audio.encodings: encoding=pcm streamable.contents: audio/x-wav wtk21/lib/System.config
25
# Visible from com.sun.midp.Configuration.getProperty(key) # # System tunable parameters (system prefix indicates native only access) # system.jam_space:1000000 system.display.double_buffered:true system.display.screen_depth: 8 system.i18n.lang: en system.i18n.encoding: ISO8859_1 # system.display.debug_screen: # system.display.visual_type: TrueColor # system.display.kh_skins: TrueColor # com.sun.midp.io.j2me.comm.buffersize: 256 # com.sun.midp.io.j2me.socket.buffersize: 256 # com.sun.midp.midlet.scheduler: com.sun.midp.midlet.Scheduler # com.sun.midp.lcdui.eventHandler: com.sun.midp.lcdui.DefaultEventHandler # For J2SE # com.sun.midp.lcdui.eventHandler: com.sun.midp.lcdui.AWTEventHandler # com.sun.midp.lcdui.inputHandler: com.sun.midp.lcdui.DefaultInputMethodHandler # com.sun.midp.midletsuite.installer: com.sun.midp.midletsuite.Installer # com.sun.midp.midletsuite.installer: com.sun.midp.midletsuite.SecureInstaller # com.sun.midp.graphicalmanager: com.sun.midp.dev.Manager # com.sun.midp.lcdui.skin: classes/icons/skin.gif #com.sun.midp.io.http.proxy: webcache:8080 #com.sun.midp.io.http.force_non_persistent: false #com.sun.midp.io.http.persistent_connection_linger_time: 60000 #com.sun.midp.io.http.input_buffer_size: 256 #com.sun.midp.io.http.output_buffer_size: 2048 wtk21/lib/internal.config
26
com.sun.midp.io.http.max_persistent_connections: 4 ### # Default values for SMS internal implementation. com.sun.midp.io.j2me.sms.DatagramHost: localhost # # Alternate SMS port for CBS emulation com.sun.midp.io.j2me.sms.CBSPort: 24680 # Sender's phone number com.sun.midp.io.j2me.sms.PhoneNumber=+5551212 # Default SMS Sercice Center address wireless.messaging.sms.smsc: +17815511212 # This file is appended at the end of the MIDP internal.config file. com.sun.midp.io.enable_extra_protocols: true com.sun.midp.io.http.use_chunks: true wtk21/lib/internal.config
27
file.extension: jad heap.size: http.proxyHost: http.proxyPort: http.version: HTTP/1.1 https.proxyHost: https.proxyPort: jammode: kvem.api.exclude: kvem.device: DefaultColorPhone kvem.memory.monitor.enable: true kvem.netmon.autoclose: false kvem.netmon.enable: false kvem.netmon.filter_file_name: netmon_filter.dat kvem.netmon.fixed_font_name: Courier New kvem.netmon.fixed_font_size: 12 kvem.profiler.enable: false kvem.profiler.outfile: kvem.profiler.showsystem: false kvem.trace.all: false kvem.trace.allocation: false kvem.trace.bytecodes: false kvem.trace.calls: false kvem.trace.calls.verbose: false kvem.trace.class: false kvem.trace.class.verbose: false kvem.trace.events: false kvem.trace.exceptions: false kvem.trace.frames: false kvem.trace.gc: false kvem.trace.gc.verbose: false kvem.trace.monitors: false kvem.trace.networking: false kvem.trace.stackchunks: false kvem.trace.stackmaps: false kvem.trace.threading: false kvem.trace.verifier: false mm.control.capture: true mm.control.midi: true mm.control.mixing: true mm.control.record: true mm.control.volume: true mm.format.midi: true mm.format.video: true mm.format.wav: true netspeed.bitpersecond: 1200 netspeed.enableSpeedEmulation: false prng.secure: false screen.graphicsLatency: 0 screen.refresh.mode: screen.refresh.rate: 30 security.domain: untrusted storage.root: storage.size: vmspeed.bytecodespermilli: 10 vmspeed.enableEmulation: false wma.client.phoneNumber: wma.server.deliveryDelayMS: wma.server.firstAssignedPhoneNumber: +5550000 wma.server.percentFragmentLoss: 0 wma.smsc.phoneNumber: +1234567890 wtk21/wtklib/ Emulator. properties
28
# @(#)ktools.properties1.7 03/08/07 kjava.preverifier.command: bin\\preverify.exe kjava.class.path: lib\\midpapi20.zip;lib\\cldcapi10.zip file.extension: jad obfuscator.runner.class.name: com.sun.kvem.ktools.RunPro obfuscator.runner.classpath: wtklib\\ktools.zip obfuscate.script.name: wtk21/wtklib/Windows /ktools.properties
29
KVM strategy, JNI into KVM The KVM design team tried to enable the partitioning of virtual machine capabilities. The team also architected the byte code interpreter and garbage collector to minimize dynamic memory usage, and carefully implemented the virtual machine and libraries to minimize their size (e.g. by rolling Java Native Interface calls into the VM itself). - In KVM Document
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.