1 / 29

WTK21 – wtklib\kvem <Of Lime>

WTK21 – wtklibkvem <Of Lime>. HPCC. 프로세스 호출 관계. kvemenvironmentJVM.java KvemenvironmentChildProcess.java KvemKVMBridge.java KvemLime.java. creates. JVM. ChildProcess. J2MEWTK.property 파일 생성 , 정보저장 컴파일 대상파일 실행시킴. runClient of Lime: 해당 Process 리턴 , KVMBridge has:

ckirk
Download Presentation

WTK21 – wtklib\kvem <Of Lime>

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WTK21 – wtklib\kvem<Of Lime> HPCC.

  2. 프로세스 호출 관계 kvem\environment\JVM.java Kvem\environment\ChildProcess.java Kvem\KVMBridge.java Kvem\Lime.java creates JVM ChildProcess J2MEWTK.property파일 생성 , 정보저장 컴파일 대상파일 실행시킴 runClient of Lime: 해당 Process 리턴, KVMBridge has: disconnectLime, runKVM, stopKVM KVMBridge Lime runClient 호출 in runKVM creates

  3. as 분석(in lime.java)

  4. 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); } Runclient() in Lime.java

  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. as3 구성(‘Open Project’  ‘demo’실행) as3 S 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 as2 as

  8. as3 구성 • as3

  9. as2 - 1 as3 S 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 as2 as

  10. as2 - 2 Lime_Trace : 항상 value = 0 COMMAND_PORT : lime.java에서 command_port 설정. 다른 응용 프로그램일 경우, 값이 바뀜. EVENT_PORT : lime.java에서 event_port 설정. 다른 응용 프로그램일 경우, 값이 바뀜.

  11. as - 1 as3 S 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 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 ← ‥‥ ← Main : call 관계 Lime.runClient (wtklib\lime\com\sun\kvem) KVMBridge.runKVM (wtklib\kvem\com\sun\kvem) 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) . . . < Main들끼리 서로 호출! >

  18. PofileConfiguration :Set of Property objects (Trace관련 옵션 포함) Property object: each entry in emulator.poperties initiate initiate EmulatorWrapper : receives args(opt) from prompt Calls to set TracingOptions : invoke profileconfiguration By (method.invoke(profileconfiguration, aobj) ProfileConfiguration에 따라 trace 활성화

  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. file as3 C:\WTK21 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 ‘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. 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 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 wtk21/wtklib/ Emulator. properties

  28. # @(#)ktools.properties 1.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

More Related