From bugzilla-daemon at icedtea.classpath.org Sat Aug 1 11:28:15 2009 From: bugzilla-daemon at icedtea.classpath.org (bugzilla-daemon at icedtea.classpath.org) Date: Sat, 01 Aug 2009 18:28:15 +0000 Subject: [Bug 374] New: SIGSEGV while visiting a website on Firefox 3.5, Archlinux 64bit Message-ID: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=374 Summary: SIGSEGV while visiting a website on Firefox 3.5,Archlinux 64bit Product: IcedTea Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: IcedTea AssignedTo: unassigned at icedtea.classpath.org ReportedBy: gary4gar at gmail.com crash I try to visit(http://www.rechargeitnow.com/needRecharge.jsp) with msg "Applet Started" in Status bar on Firefox 3.5. The crash only happens on my system, the site loads normally as it should on my Friend's PC running Windows XP. hs_err_pid5135.log ---------------------------------------------------------------------------- # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f602d101c71, pid=5135, tid=140050025949456 # # JRE version: 6.0-b16 # Java VM: OpenJDK 64-Bit Server VM (14.0-b15 mixed mode linux-amd64 ) # Distribution: Custom build (Thu Jul 2 04:39:46 UTC 2009) # Problematic frame: # C [ld-linux-x86-64.so.2+0x12c71] # # If you would like to submit a bug report, please include # instructions how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x0000000000d79000): JavaThread "Image Fetcher 0" daemon [_thread_in_native, id=5162, stack(0x00007f5feffc2000,0x00007f5ff00c3000)] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00000000000003d4 Registers: RAX=0x00007f602d30bba0, RBX=0x0000000000000000, RCX=0x00007f602c8b7fb0, RDX=0x00007f5ff00c2908 RSP=0x00007f5ff00c0f00, RBP=0x00007f602c8b7fb0, RSI=0x0000000000000000, RDI=0x0000000000000000 R8 =0x0000000000000000, R9 =0x00007f602c8b8090, R10=0x0000000000000000, R11=0x00007f602d101c70 R12=0x0000000000000000, R13=0x00007f5ff00c1108, R14=0x0000000000000000, R15=0x0000000000d79000 RIP=0x00007f602d101c71, EFL=0x0000000000010246, CSGSFS=0x0000000000000033, ERR=0x0000000000000004 TRAPNO=0x000000000000000e Top of Stack: (sp=0x00007f5ff00c0f00) 0x00007f5ff00c0f00: 0000000000000000 00007f602d0fbf66 0x00007f5ff00c0f10: 00007f5ff00c2908 0000000000fda220 0x00007f5ff00c0f20: 0000000000fda228 0000000000fda218 0x00007f5ff00c0f30: 00007f602c8b7fb0 0000000000000000 0x00007f5ff00c0f40: 00007f5ff00c1108 0000000000000000 0x00007f5ff00c0f50: 0000000000d79000 0000000000fda210 0x00007f5ff00c0f60: 792c58364a6e7d8d 0000000000000000 0x00007f5ff00c0f70: 00007f5ff00c1108 0000000000000000 0x00007f5ff00c0f80: 0000000000d79000 7953e138ab2e7d8d 0x00007f5ff00c0f90: 792c5b3fcb987d8d 00000000ffffffff 0x00007f5ff00c0fa0: 00007f5ff00c1150 00007f5feec6a000 0x00007f5ff00c0fb0: 00007f5ff00c10f8 00007f5ff00c1108 0x00007f5ff00c0fc0: 0000000000000000 0000000000d79000 0x00007f5ff00c0fd0: 0000000000208930 00007f602d0fbdac 0x00007f5ff00c0fe0: 00007f5f00000005 0000000000000000 0x00007f5ff00c0ff0: 0000000000d79000 0000000000f281b0 0x00007f5ff00c1000: 00007f602c8b7fb0 0000000000000000 0x00007f5ff00c1010: 00007f5ff00c1108 0000000000000000 0x00007f5ff00c1020: 0000000000d79000 0000000000000000 0x00007f5ff00c1030: 0000000000fda210 00007f602c8b82cc 0x00007f5ff00c1040: 0000000000d791b8 00007f5ff00c1090 0x00007f5ff00c1050: 00007f5ff00c10f8 00007f602c8b7fef 0x00007f5ff00c1060: 0000000000000006 00007f5feec705d8 0x00007f5ff00c1070: 00007f601e242bb0 0000000000d79000 0x00007f5ff00c1080: 00007f601e242bb0 00007f5ff00c1108 0x00007f5ff00c1090: 00007f5ff00c10e8 00007f60279fdf30 0x00007f5ff00c10a0: 0000000000d79000 00007f5ff00c10a8 0x00007f5ff00c10b0: 00007f601e242bb0 00007f5ff00c1108 0x00007f5ff00c10c0: 00007f601e243928 0000000000000000 0x00007f5ff00c10d0: 00007f601e242bb0 0000000000000000 0x00007f5ff00c10e0: 00007f5ff00c1108 00007f5ff00c1150 0x00007f5ff00c10f0: 00007f60279f27fa 00007f601e243870 Instructions: (pc=0x00007f602d101c71) 0x00007f602d101c61: ff ff 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 53 0x00007f602d101c71: f6 87 d4 03 00 00 08 48 89 fb 75 33 44 8b 8f 10 Stack: [0x00007f5feffc2000,0x00007f5ff00c3000], sp=0x00007f5ff00c0f00, free space=1019k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ld-linux-x86-64.so.2+0x12c71] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j sun.awt.image.JPEGImageDecoder.initIDs(Ljava/lang/Class;)V+0 j sun.awt.image.JPEGImageDecoder.()V+22 v ~StubRoutines::call_stub j sun.awt.image.InputStreamImageSource.getDecoder(Ljava/io/InputStream;)Lsun/awt/image/ImageDecoder;+135 j sun.awt.image.ByteArrayImageSource.getDecoder()Lsun/awt/image/ImageDecoder;+29 j sun.awt.image.InputStreamImageSource.doFetch()V+30 j sun.awt.image.ImageFetcher.fetchloop()V+33 j sun.awt.image.ImageFetcher.run()V+5 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x0000000000d79000 JavaThread "Image Fetcher 0" daemon [_thread_in_native, id=5162, stack(0x00007f5feffc2000,0x00007f5ff00c3000)] 0x0000000000fd9800 JavaThread "Thread-8" [_thread_in_vm, id=5161, stack(0x00007f5fef9af000,0x00007f5fefab0000)] 0x0000000000fac800 JavaThread "TimerQueue" daemon [_thread_blocked, id=5160, stack(0x00007f5fef07b000,0x00007f5fef17c000)] 0x0000000001033000 JavaThread "TimerQueue" daemon [_thread_blocked, id=5159, stack(0x00007f5fef7ad000,0x00007f5fef8ae000)] 0x000000000100a800 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=5155, stack(0x00007f5fefb8d000,0x00007f5fefc8e000)] 0x0000000001003800 JavaThread "Thread-5" [_thread_blocked, id=5154, stack(0x00007f5fefc8e000,0x00007f5fefd8f000)] 0x0000000000f91000 JavaThread "AWT-Shutdown" [_thread_blocked, id=5153, stack(0x00007f5fefd8f000,0x00007f5fefe90000)] 0x00000000009bd000 JavaThread "DestroyJavaVM" [_thread_blocked, id=5136, stack(0x00007f602d1d9000,0x00007f602d2da000)] 0x0000000000f85800 JavaThread "Thread-4" [_thread_in_native, id=5152, stack(0x00007f5fefe90000,0x00007f5feff91000)] 0x0000000000d00000 JavaThread "Thread-3" [_thread_blocked, id=5150, stack(0x00007f5ff00c3000,0x00007f5ff01c4000)] 0x0000000000cfe000 JavaThread "Thread-2" [_thread_blocked, id=5149, stack(0x00007f5ff01c4000,0x00007f5ff02c5000)] 0x0000000000ced000 JavaThread "Thread-1" [_thread_blocked, id=5148, stack(0x00007f5ff02c5000,0x00007f5ff03c6000)] 0x0000000000cc2000 JavaThread "AWT-XAWT" daemon [_thread_in_native, id=5147, stack(0x00007f5ff06c7000,0x00007f5ff07c8000)] 0x0000000000b34800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5146, stack(0x00007f5ff0af2000,0x00007f5ff0bf3000)] 0x0000000000a52800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5144, stack(0x00007f5ff2ad3000,0x00007f5ff2bd4000)] 0x0000000000a50000 JavaThread "CompilerThread1" daemon [_thread_blocked, id=5143, stack(0x00007f5ff2bd4000,0x00007f5ff2cd5000)] 0x0000000000a4c000 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5142, stack(0x00007f5ff2cd5000,0x00007f5ff2dd6000)] 0x0000000000a49800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5141, stack(0x00007f5ff2dd6000,0x00007f5ff2ed7000)] 0x0000000000a29800 JavaThread "Finalizer" daemon [_thread_blocked, id=5140, stack(0x00007f5ff301c000,0x00007f5ff311d000)] 0x0000000000a22800 JavaThread "Reference Handler" daemon [_thread_blocked, id=5139, stack(0x00007f5ff311d000,0x00007f5ff321e000)] Other Threads: 0x0000000000a1d000 VMThread [stack: 0x00007f5ff321e000,0x00007f5ff331f000] [id=5138] 0x0000000000a55800 WatcherThread [stack: 0x00007f5ff29d2000,0x00007f5ff2ad3000] [id=5145] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 2368K, used 1689K [0x00007f5ff37e0000, 0x00007f5ff3a70000, 0x00007f60015e0000) eden space 2112K, 67% used [0x00007f5ff37e0000, 0x00007f5ff39466a8, 0x00007f5ff39f0000) from space 256K, 99% used [0x00007f5ff3a30000, 0x00007f5ff3a6fff8, 0x00007f5ff3a70000) to space 256K, 0% used [0x00007f5ff39f0000, 0x00007f5ff39f0000, 0x00007f5ff3a30000) tenured generation total 5312K, used 4015K [0x00007f60015e0000, 0x00007f6001b10000, 0x00007f601d1e0000) the space 5312K, 75% used [0x00007f60015e0000, 0x00007f60019cbe58, 0x00007f60019cc000, 0x00007f6001b10000) compacting perm gen total 21248K, used 16783K [0x00007f601d1e0000, 0x00007f601e6a0000, 0x00007f60279e0000) the space 21248K, 78% used [0x00007f601d1e0000, 0x00007f601e243cf0, 0x00007f601e243e00, 0x00007f601e6a0000) No shared spaces configured. Dynamic libraries: 00400000-00409000 r-xp 00000000 08:02 581665 /usr/lib/jvm/java-1.6.0-openjdk/jre/bin/java 00608000-00609000 rw-p 00008000 08:02 581665 /usr/lib/jvm/java-1.6.0-openjdk/jre/bin/java 009b5000-01068000 rw-p 00000000 00:00 0 [heap] 7f5feec6a000-7f5feec73000 r-xp 00000000 08:02 730131 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libjpeg.so 7f5feec73000-7f5feee72000 ---p 00009000 08:02 730131 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libjpeg.so 7f5feee72000-7f5feee73000 rw-p 00008000 08:02 730131 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libjpeg.so 7f5feee73000-7f5feee7b000 r-xp 00000000 08:02 730143 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libnio.so 7f5feee7b000-7f5fef07a000 ---p 00008000 08:02 730143 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libnio.so 7f5fef07a000-7f5fef07b000 rw-p 00007000 08:02 730143 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libnio.so 7f5fef07b000-7f5fef07e000 ---p 00000000 00:00 0 7f5fef07e000-7f5fef17c000 rwxp 00000000 00:00 0 7f5fef17c000-7f5fef18f000 r-xp 00000000 08:02 704544 /lib/libresolv-2.10.1.so 7f5fef18f000-7f5fef38e000 ---p 00013000 08:02 704544 /lib/libresolv-2.10.1.so 7f5fef38e000-7f5fef38f000 r--p 00012000 08:02 704544 /lib/libresolv-2.10.1.so 7f5fef38f000-7f5fef390000 rw-p 00013000 08:02 704544 /lib/libresolv-2.10.1.so 7f5fef390000-7f5fef392000 rw-p 00000000 00:00 0 7f5fef392000-7f5fef397000 r-xp 00000000 08:02 704547 /lib/libnss_dns-2.10.1.so 7f5fef397000-7f5fef596000 ---p 00005000 08:02 704547 /lib/libnss_dns-2.10.1.so 7f5fef596000-7f5fef597000 r--p 00004000 08:02 704547 /lib/libnss_dns-2.10.1.so 7f5fef597000-7f5fef598000 rw-p 00005000 08:02 704547 /lib/libnss_dns-2.10.1.so 7f5fef598000-7f5fef5ad000 r-xp 00000000 08:02 730144 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libnet.so 7f5fef5ad000-7f5fef7ac000 ---p 00015000 08:02 730144 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libnet.so 7f5fef7ac000-7f5fef7ad000 rw-p 00014000 08:02 730144 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libnet.so 7f5fef7ad000-7f5fef7b0000 ---p 00000000 00:00 0 7f5fef7b0000-7f5fef8ae000 rwxp 00000000 00:00 0 7f5fef8ae000-7f5fef8b1000 rwxp 00000000 00:00 0 7f5fef8b1000-7f5fef9af000 rwxp 00000000 00:00 0 7f5fef9af000-7f5fef9b2000 ---p 00000000 00:00 0 7f5fef9b2000-7f5fefab0000 rwxp 00000000 00:00 0 7f5fefab0000-7f5fefb0c000 r--s 00000000 08:02 1196036 /var/cache/fontconfig/17090aa38d5c6f09fb8c5c354938f1d7-x86-64.cache-2 7f5fefb0c000-7f5fefb68000 r--s 00000000 08:02 1531923 /var/cache/fontconfig/df311e82a1a24c41a75c2c930223552e-x86-64.cache-2 7f5fefb8d000-7f5fefb90000 ---p 00000000 00:00 0 7f5fefb90000-7f5fefc8e000 rwxp 00000000 00:00 0 7f5fefc8e000-7f5fefc91000 ---p 00000000 00:00 0 7f5fefc91000-7f5fefd8f000 rwxp 00000000 00:00 0 7f5fefd8f000-7f5fefd92000 ---p 00000000 00:00 0 7f5fefd92000-7f5fefe90000 rwxp 00000000 00:00 0 7f5fefe90000-7f5fefe93000 ---p 00000000 00:00 0 7f5fefe93000-7f5feff91000 rwxp 00000000 00:00 0 7f5feffc2000-7f5feffc5000 ---p 00000000 00:00 0 7f5feffc5000-7f5ff00c3000 rwxp 00000000 00:00 0 7f5ff00c3000-7f5ff00c6000 ---p 00000000 00:00 0 7f5ff00c6000-7f5ff01c4000 rwxp 00000000 00:00 0 7f5ff01c4000-7f5ff01c7000 ---p 00000000 00:00 0 7f5ff01c7000-7f5ff02c5000 rwxp 00000000 00:00 0 7f5ff02c5000-7f5ff02c8000 ---p 00000000 00:00 0 7f5ff02c8000-7f5ff03c6000 rwxp 00000000 00:00 0 7f5ff03c6000-7f5ff03cb000 r-xp 00000000 08:02 453133 /usr/lib/libXfixes.so.3.1.0 7f5ff03cb000-7f5ff05ca000 ---p 00005000 08:02 453133 /usr/lib/libXfixes.so.3.1.0 7f5ff05ca000-7f5ff05cb000 rw-p 00004000 08:02 453133 /usr/lib/libXfixes.so.3.1.0 7f5ff05cb000-7f5ff05e0000 r--s 00000000 08:02 1531915 /var/cache/fontconfig/8d4af663993b81a124ee82e610bb31f9-x86-64.cache-2 7f5ff05e0000-7f5ff063c000 r--s 00000000 08:02 1196036 /var/cache/fontconfig/17090aa38d5c6f09fb8c5c354938f1d7-x86-64.cache-2 7f5ff063c000-7f5ff0698000 r--s 00000000 08:02 1531923 /var/cache/fontconfig/df311e82a1a24c41a75c2c930223552e-x86-64.cache-2 7f5ff06b2000-7f5ff06c7000 r--s 00000000 08:02 1531915 /var/cache/fontconfig/8d4af663993b81a124ee82e610bb31f9-x86-64.cache-2 7f5ff06c7000-7f5ff06ca000 ---p 00000000 00:00 0 7f5ff06ca000-7f5ff07c8000 rwxp 00000000 00:00 0 7f5ff07c8000-7f5ff07dd000 r--s 00000000 08:02 1531915 /var/cache/fontconfig/8d4af663993b81a124ee82e610bb31f9-x86-64.cache-2 7f5ff07dd000-7f5ff0839000 r--s 00000000 08:02 1196036 /var/cache/fontconfig/17090aa38d5c6f09fb8c5c354938f1d7-x86-64.cache-2 7f5ff0839000-7f5ff0895000 r--s 00000000 08:02 1531923 /var/cache/fontconfig/df311e82a1a24c41a75c2c930223552e-x86-64.cache-2 7f5ff089a000-7f5ff08a3000 r-xp 00000000 08:02 453700 /usr/lib/libXcursor.so.1.0.2 7f5ff08a3000-7f5ff0aa3000 ---p 00009000 08:02 453700 /usr/lib/libXcursor.so.1.0.2 7f5ff0aa3000-7f5ff0aa4000 rw-p 00009000 08:02 453700 /usr/lib/libXcursor.so.1.0.2 7f5ff0aa6000-7f5ff0aae000 r--s 00000000 08:02 1531944 /var/cache/fontconfig/d62e99ef547d1d24cdb1bd22ec1a2976-x86-64.cache-2 7f5ff0aae000-7f5ff0ad0000 r--s 00000000 08:02 1531943 /var/cache/fontconfig/f6b893a7224233d96cb72fd88691c0b4-x86-64.cache-2 7f5ff0ad0000-7f5ff0af2000 r--s 00000000 08:02 1531943 /var/cache/fontconfig/f6b893a7224233d96cb72fd88691c0b4-x86-64.cache-2 7f5ff0af2000-7f5ff0af5000 ---p 00000000 00:00 0 7f5ff0af5000-7f5ff0bf3000 rwxp 00000000 00:00 0 7f5ff0bf3000-7f5ff0c09000 r-xp 00000000 08:02 450637 /usr/lib/libgcc_s.so.1 7f5ff0c09000-7f5ff0e08000 ---p 00016000 08:02 450637 /usr/lib/libgcc_s.so.1 7f5ff0e08000-7f5ff0e09000 rw-p 00015000 08:02 450637 /usr/lib/libgcc_s.so.1 7f5ff0e09000-7f5ff0e9a000 r-xp 00000000 08:02 450973 /usr/lib/libfreetype.so.6.3.20 7f5ff0e9a000-7f5ff109a000 ---p 00091000 08:02 450973 /usr/lib/libfreetype.so.6.3.20 7f5ff109a000-7f5ff10a0000 rw-p 00091000 08:02 450973 /usr/lib/libfreetype.so.6.3.20 7f5ff10a0000-7f5ff10e6000 r-xp 00000000 08:02 730132 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libfontmanager.so 7f5ff10e6000-7f5ff12e6000 ---p 00046000 08:02 730132 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libfontmanager.so 7f5ff12e6000-7f5ff12e9000 rw-p 00046000 08:02 730132 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libfontmanager.so 7f5ff12e9000-7f5ff12fc000 rw-p 00000000 00:00 0 7f5ff12fc000-7f5ff1301000 r-xp 00000000 08:02 453263 /usr/lib/libXdmcp.so.6.0.0 7f5ff1301000-7f5ff1500000 ---p 00005000 08:02 453263 /usr/lib/libXdmcp.so.6.0.0 7f5ff1500000-7f5ff1501000 rw-p 00004000 08:02 453263 /usr/lib/libXdmcp.so.6.0.0 7f5ff1501000-7f5ff151c000 r-xp 00000000 08:02 452676 /usr/lib/libxcb.so.1.1.0 7f5ff151c000-7f5ff171c000 ---p 0001b000 08:02 452676 /usr/lib/libxcb.so.1.1.0 7f5ff171c000-7f5ff171d000 rw-p 0001b000 08:02 452676 /usr/lib/libxcb.so.1.1.0 7f5ff171d000-7f5ff171f000 r-xp 00000000 08:02 452658 /usr/lib/libXau.so.6.0.0 7f5ff171f000-7f5ff191e000 ---p 00002000 08:02 452658 /usr/lib/libXau.so.6.0.0 7f5ff191e000-7f5ff191f000 rw-p 00001000 08:02 452658 /usr/lib/libXau.so.6.0.0 7f5ff191f000-7f5ff1928000 r-xp 00000000 08:02 452701 /usr/lib/libXi.so.6.0.0 7f5ff1928000-7f5ff1b28000 ---p 00009000 08:02 452701 /usr/lib/libXi.so.6.0.0 7f5ff1b28000-7f5ff1b29000 rw-p 00009000 08:02 452701 /usr/lib/libXi.so.6.0.0 7f5ff1b29000-7f5ff1b2e000 r-xp 00000000 08:02 453277 /usr/lib/libXtst.so.6.1.0 7f5ff1b2e000-7f5ff1d2e000 ---p 00005000 08:02 453277 /usr/lib/libXtst.so.6.1.0 7f5ff1d2e000-7f5ff1d2f000 rw-p 00005000 08:02 453277 /usr/lib/libXtst.so.6.1.0 7f5ff1d2f000-7f5ff1d38000 r-xp 00000000 08:02 453697 /usr/lib/libXrender.so.1.3.0 7f5ff1d38000-7f5ff1f37000 ---p 00009000 08:02 453697 /usr/lib/libXrender.so.1.3.0 7f5ff1f37000-7f5ff1f38000 rw-p 00008000 08:02 453697 /usr/lib/libXrender.so.1.3.0 7f5ff1f38000-7f5ff206d000 r-xp 00000000 08:02 451435 /usr/lib/libX11.so.6.2.0 7f5ff206d000-7f5ff226d000 ---p 00135000 08:02 451435 /usr/lib/libX11.so.6.2.0 7f5ff226d000-7f5ff2273000 rw-p 00135000 08:02 451435 /usr/lib/libX11.so.6.2.0 7f5ff2273000-7f5ff2284000 r-xp 00000000 08:02 452698 /usr/lib/libXext.so.6.4.0 7f5ff2284000-7f5ff2484000 ---p 00011000 08:02 452698 /usr/lib/libXext.so.6.4.0 7f5ff2484000-7f5ff2485000 rw-p 00011000 08:02 452698 /usr/lib/libXext.so.6.4.0 7f5ff248f000-7f5ff24b1000 r--s 00000000 08:02 1531943 /var/cache/fontconfig/f6b893a7224233d96cb72fd88691c0b4-x86-64.cache-2 7f5ff24b1000-7f5ff24fd000 r-xp 00000000 08:02 730160 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/xawt/libmawt.so 7f5ff24fd000-7f5ff26fc000 ---p 0004c000 08:02 730160 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/xawt/libmawt.so 7f5ff26fc000-7f5ff2700000 rw-p 0004b000 08:02 730160 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/xawt/libmawt.so 7f5ff2700000-7f5ff2701000 rw-p 00000000 00:00 0 7f5ff2701000-7f5ff27a3000 r-xp 00000000 08:02 730134 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libawt.so 7f5ff27a3000-7f5ff29a2000 ---p 000a2000 08:02 730134 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libawt.so 7f5ff29a2000-7f5ff29ae000 rw-p 000a1000 08:02 730134 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libawt.so 7f5ff29ae000-7f5ff29d2000 rw-p 00000000 00:00 0 7f5ff29d2000-7f5ff29d3000 ---p 00000000 00:00 0 7f5ff29d3000-7f5ff2ad3000 rwxp 00000000 00:00 0 7f5ff2ad3000-7f5ff2ad6000 ---p 00000000 00:00 0 7f5ff2ad6000-7f5ff2bd4000 rwxp 00000000 00:00 0 7f5ff2bd4000-7f5ff2bd7000 ---p 00000000 00:00 0 7f5ff2bd7000-7f5ff2cd5000 rwxp 00000000 00:00 0 7f5ff2cd5000-7f5ff2cd8000 ---p 00000000 00:00 0 7f5ff2cd8000-7f5ff2dd6000 rwxp 00000000 00:00 0 7f5ff2dd6000-7f5ff2dd9000 ---p 00000000 00:00 0 7f5ff2dd9000-7f5ff2ed7000 rwxp 00000000 00:00 0 7f5ff2ed7000-7f5ff301c000 r--p 00000000 08:02 543857 /usr/lib/locale/locale-archive 7f5ff301c000-7f5ff301f000 ---p 00000000 00:00 0 7f5ff301f000-7f5ff311d000 rwxp 00000000 00:00 0 7f5ff311d000-7f5ff3120000 ---p 00000000 00:00 0 7f5ff3120000-7f5ff321e000 rwxp 00000000 00:00 0 7f5ff321e000-7f5ff321f000 ---p 00000000 00:00 0 7f5ff321f000-7f5ff331f000 rwxp 00000000 00:00 0 7f5ff331f000-7f5ff3352000 rw-p 00000000 00:00 0 7f5ff3352000-7f5ff34e2000 r--s 03852000 08:02 581673 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/rt.jar 7f5ff34e2000-7f5ff350a000 rw-p 00000000 00:00 0 7f5ff350a000-7f5ff3515000 rwxp 00000000 00:00 0 7f5ff3515000-7f5ff355f000 rwxp 00000000 00:00 0 7f5ff355f000-7f5ff3562000 rwxp 00000000 00:00 0 7f5ff3562000-7f5ff363e000 rwxp 00000000 00:00 0 7f5ff363e000-7f5ff3640000 rwxp 00000000 00:00 0 7f5ff3640000-7f5ff36ad000 rwxp 00000000 00:00 0 7f5ff36ad000-7f5ff36b0000 rwxp 00000000 00:00 0 7f5ff36b0000-7f5ff378b000 rwxp 00000000 00:00 0 7f5ff378b000-7f5ff3796000 rwxp 00000000 00:00 0 7f5ff3796000-7f5ff37df000 rwxp 00000000 00:00 0 7f5ff37df000-7f5ff3a70000 rwxp 00000000 00:00 0 7f5ff3a70000-7f60015e0000 rwxp 00000000 00:00 0 7f60015e0000-7f6001b10000 rwxp 00000000 00:00 0 7f6001b10000-7f601d1e0000 rwxp 00000000 00:00 0 7f601d1e0000-7f601e6a0000 rwxp 00000000 00:00 0 7f601e6a0000-7f60279e0000 rwxp 00000000 00:00 0 7f60279e6000-7f60279ed000 r--s 00000000 08:02 1531925 /var/cache/fontconfig/a98d8961fa319a64d3cfd8640c79e62d-x86-64.cache-2 7f60279ed000-7f6027c5d000 rwxp 00000000 00:00 0 7f6027c5d000-7f602a9ed000 rwxp 00000000 00:00 0 7f602a9ed000-7f602a9f4000 r-xp 00000000 08:02 730148 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libzip.so 7f602a9f4000-7f602abf3000 ---p 00007000 08:02 730148 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libzip.so 7f602abf3000-7f602abf4000 rw-p 00006000 08:02 730148 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libzip.so 7f602abf4000-7f602abff000 r-xp 00000000 08:02 704549 /lib/libnss_files-2.10.1.so 7f602abff000-7f602adfe000 ---p 0000b000 08:02 704549 /lib/libnss_files-2.10.1.so 7f602adfe000-7f602adff000 r--p 0000a000 08:02 704549 /lib/libnss_files-2.10.1.so 7f602adff000-7f602ae00000 rw-p 0000b000 08:02 704549 /lib/libnss_files-2.10.1.so 7f602ae00000-7f602ae08000 r-xp 00000000 08:02 730165 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/native_threads/libhpi.so 7f602ae08000-7f602b007000 ---p 00008000 08:02 730165 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/native_threads/libhpi.so 7f602b007000-7f602b009000 rw-p 00007000 08:02 730165 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/native_threads/libhpi.so 7f602b009000-7f602b01e000 r-xp 00000000 08:02 704560 /lib/libnsl-2.10.1.so 7f602b01e000-7f602b21d000 ---p 00015000 08:02 704560 /lib/libnsl-2.10.1.so 7f602b21d000-7f602b21e000 r--p 00014000 08:02 704560 /lib/libnsl-2.10.1.so 7f602b21e000-7f602b21f000 rw-p 00015000 08:02 704560 /lib/libnsl-2.10.1.so 7f602b21f000-7f602b221000 rw-p 00000000 00:00 0 7f602b221000-7f602b24d000 r-xp 00000000 08:02 730149 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libjava.so 7f602b24d000-7f602b44d000 ---p 0002c000 08:02 730149 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libjava.so 7f602b44d000-7f602b451000 rw-p 0002c000 08:02 730149 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libjava.so 7f602b451000-7f602b45f000 r-xp 00000000 08:02 730150 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libverify.so 7f602b45f000-7f602b65f000 ---p 0000e000 08:02 730150 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libverify.so 7f602b65f000-7f602b661000 rw-p 0000e000 08:02 730150 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/libverify.so 7f602b661000-7f602b668000 r-xp 00000000 08:02 704550 /lib/librt-2.10.1.so 7f602b668000-7f602b867000 ---p 00007000 08:02 704550 /lib/librt-2.10.1.so 7f602b867000-7f602b868000 r--p 00006000 08:02 704550 /lib/librt-2.10.1.so 7f602b868000-7f602b869000 rw-p 00007000 08:02 704550 /lib/librt-2.10.1.so 7f602b869000-7f602b8ea000 r-xp 00000000 08:02 704528 /lib/libm-2.10.1.so 7f602b8ea000-7f602bae9000 ---p 00081000 08:02 704528 /lib/libm-2.10.1.so 7f602bae9000-7f602baea000 r--p 00080000 08:02 704528 /lib/libm-2.10.1.so 7f602baea000-7f602baeb000 rw-p 00081000 08:02 704528 /lib/libm-2.10.1.so 7f602baeb000-7f602c2a2000 r-xp 00000000 08:02 730162 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/server/libjvm.so 7f602c2a2000-7f602c4a2000 ---p 007b7000 08:02 730162 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/server/libjvm.so 7f602c4a2000-7f602c528000 rw-p 007b7000 08:02 730162 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/server/libjvm.so 7f602c528000-7f602c564000 rw-p 00000000 00:00 0 7f602c564000-7f602c6ad000 r-xp 00000000 08:02 704573 /lib/libc-2.10.1.so 7f602c6ad000-7f602c8ad000 ---p 00149000 08:02 704573 /lib/libc-2.10.1.so 7f602c8ad000-7f602c8b1000 r--p 00149000 08:02 704573 /lib/libc-2.10.1.so 7f602c8b1000-7f602c8b2000 rw-p 0014d000 08:02 704573 /lib/libc-2.10.1.so 7f602c8b2000-7f602c8b7000 rw-p 00000000 00:00 0 7f602c8b7000-7f602c8b9000 r-xp 00000000 08:02 704530 /lib/libdl-2.10.1.so 7f602c8b9000-7f602cab9000 ---p 00002000 08:02 704530 /lib/libdl-2.10.1.so 7f602cab9000-7f602caba000 r--p 00002000 08:02 704530 /lib/libdl-2.10.1.so 7f602caba000-7f602cabb000 rw-p 00003000 08:02 704530 /lib/libdl-2.10.1.so 7f602cabb000-7f602cabf000 r-xp 00000000 08:02 730161 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/jli/libjli.so 7f602cabf000-7f602ccbe000 ---p 00004000 08:02 730161 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/jli/libjli.so 7f602ccbe000-7f602ccbf000 rw-p 00003000 08:02 730161 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/jli/libjli.so 7f602ccbf000-7f602ccd5000 r-xp 00000000 08:02 704539 /lib/libpthread-2.10.1.so 7f602ccd5000-7f602ced4000 ---p 00016000 08:02 704539 /lib/libpthread-2.10.1.so 7f602ced4000-7f602ced5000 r--p 00015000 08:02 704539 /lib/libpthread-2.10.1.so 7f602ced5000-7f602ced6000 rw-p 00016000 08:02 704539 /lib/libpthread-2.10.1.so 7f602ced6000-7f602ceda000 rw-p 00000000 00:00 0 7f602ceda000-7f602ceef000 r-xp 00000000 08:02 451303 /usr/lib/libz.so.1.2.3.3 7f602ceef000-7f602d0ee000 ---p 00015000 08:02 451303 /usr/lib/libz.so.1.2.3.3 7f602d0ee000-7f602d0ef000 rw-p 00014000 08:02 451303 /usr/lib/libz.so.1.2.3.3 7f602d0ef000-7f602d10c000 r-xp 00000000 08:02 704568 /lib/ld-2.10.1.so 7f602d10c000-7f602d10e000 r--s 00008000 08:02 403518 /home/gaurish/.icedteaplugin/cache/http/jdc-cam1.joesdatacenter.com/java/ama/ama.jar 7f602d10e000-7f602d112000 r--s 00079000 08:02 581671 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/jsse.jar 7f602d112000-7f602d119000 r--s 00000000 08:02 1531925 /var/cache/fontconfig/a98d8961fa319a64d3cfd8640c79e62d-x86-64.cache-2 7f602d119000-7f602d123000 rwxp 00000000 00:00 0 7f602d123000-7f602d1d9000 rwxp 00000000 00:00 0 7f602d1d9000-7f602d1dc000 ---p 00000000 00:00 0 7f602d1dc000-7f602d2da000 rwxp 00000000 00:00 0 7f602d2da000-7f602d2dd000 rw-p 00000000 00:00 0 7f602d2de000-7f602d2df000 r--s 00000000 08:02 1531920 /var/cache/fontconfig/cc95ca9c1a5b584cbe1206592da775ec-x86-64.cache-2 7f602d2df000-7f602d2e0000 r--s 00000000 08:02 1531920 /var/cache/fontconfig/cc95ca9c1a5b584cbe1206592da775ec-x86-64.cache-2 7f602d2e0000-7f602d2e8000 r--s 00000000 08:02 1531944 /var/cache/fontconfig/d62e99ef547d1d24cdb1bd22ec1a2976-x86-64.cache-2 7f602d2e8000-7f602d2e9000 r--s 00000000 08:02 1531920 /var/cache/fontconfig/cc95ca9c1a5b584cbe1206592da775ec-x86-64.cache-2 7f602d2e9000-7f602d2f0000 r--s 00000000 08:02 1531925 /var/cache/fontconfig/a98d8961fa319a64d3cfd8640c79e62d-x86-64.cache-2 7f602d2f0000-7f602d2f8000 r--s 00000000 08:02 1531944 /var/cache/fontconfig/d62e99ef547d1d24cdb1bd22ec1a2976-x86-64.cache-2 7f602d2f8000-7f602d2ff000 r--s 000fd000 08:02 581672 /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/resources.jar 7f602d2ff000-7f602d307000 rw-s 00000000 08:02 581757 /tmp/hsperfdata_gaurish/5135 7f602d307000-7f602d308000 rw-p 00000000 00:00 0 7f602d308000-7f602d309000 r--p 00000000 00:00 0 7f602d309000-7f602d30b000 rw-p 00000000 00:00 0 7f602d30b000-7f602d30c000 r--p 0001c000 08:02 704568 /lib/ld-2.10.1.so 7f602d30c000-7f602d30d000 rw-p 0001d000 08:02 704568 /lib/ld-2.10.1.so 7fff72939000-7fff7294c000 rwxp 00000000 00:00 0 [stack] 7fff7294c000-7fff7294e000 rw-p 00000000 00:00 0 7fff72976000-7fff72977000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] VM Arguments: java_command: sun.applet.PluginMain Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/kde/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/opt/qt/bin LD_LIBRARY_PATH=/usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk/jre/../lib/amd64 SHELL=/bin/bash DISPLAY=:0.0 Signal Handlers: SIGSEGV: [libjvm.so+0x66b290], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGBUS: [libjvm.so+0x66b290], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGFPE: [libjvm.so+0x542960], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGPIPE: [libjvm.so+0x542960], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGXFSZ: [libjvm.so+0x542960], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGILL: [libjvm.so+0x542960], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGUSR2: [libjvm.so+0x542100], sa_mask[0]=0x00000000, sa_flags=0x10000004 SIGHUP: [libjvm.so+0x5444c0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGINT: [libjvm.so+0x5444c0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGTERM: [libjvm.so+0x5444c0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGQUIT: [libjvm.so+0x5444c0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 --------------- S Y S T E M --------------- OS:Linux uname:Linux 2.6.30-ARCH #1 SMP PREEMPT Sat Jul 4 02:24:43 CEST 2009 x86_64 libc:glibc 2.10.1 NPTL 2.10.1 rlimit: STACK 8192k, CORE 0k, NPROC 8191, NOFILE 1024, AS infinity load average:0.66 0.38 0.33 CPU:total 1 (1 cores per cpu, 1 threads per core) family 15 model 12 stepping 0, cmov, cx8, fxsr, mmx, sse, sse2, mmxext, 3dnow, 3dnowext Memory: 4k page, physical 1026132k(225624k free), swap 1574360k(1574360k free) vm_info: OpenJDK 64-Bit Server VM (14.0-b15) for linux-amd64 JRE (1.6.0_0-b16), built on Jul 2 2009 04:46:40 by "andyrtr" with gcc 4.4.0 20090526 (prerelease) time: Sun Jul 19 17:00:04 2009 elapsed time: 7 seconds ------------------------------------------------------------------------------- Steps to Reproduce: 1) Try to Open (http://www.rechargeitnow.com/needRecharge.jsp) 2) It would crash and not load 3) Find the cash log in your Home Dir Please tell me a workaround -- Configure bugmail: http://icedtea.classpath.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. From Joe.Darcy at Sun.COM Sat Aug 1 21:38:57 2009 From: Joe.Darcy at Sun.COM (Joseph D. Darcy) Date: Sat, 01 Aug 2009 21:38:57 -0700 Subject: [FOR REVIEW] hs14 merge for OpenJDK6 In-Reply-To: <4A73E58F.9020502@sun.com> References: <17c6771e0907312044q43080f55y3353927a57dca99f@mail.gmail.com> <4A73E58F.9020502@sun.com> Message-ID: <4A751861.2090901@sun.com> Erik Trimble wrote: > Andrew John Hughes wrote: >> Here it is, the mother of all webrevs: >> >> http://cr.openjdk.java.net/~andrew/jdk6-hs14-merge/webrev.01/ >> >> with the patch itself being ~13mb. >> >> This takes OpenJDK6 up to HotSpot 14 build 16 (see >> http://hg.openjdk.java.net/hsx/hsx14/master/), incorporating 553 >> changesets from the hs14 repo. and one merge changeset. >> I'll shortly push this to http://fuseyism.com/hg/hotspot too. >> >> Ok to push? >> > I approve. > I've taken a look too and don't see anything amiss; approved! Thanks, -Joe From bugzilla-daemon at icedtea.classpath.org Mon Aug 3 01:41:23 2009 From: bugzilla-daemon at icedtea.classpath.org (bugzilla-daemon at icedtea.classpath.org) Date: Mon, 03 Aug 2009 08:41:23 +0000 Subject: [Bug 356] keytool doesn't handle SHA384withECDSA signatures Message-ID: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=356 ------- Comment #10 from ankostis at gmail.com 2009-08-03 08:41 ------- (In reply to comment #9) > A couple of questions come to mind about the possibility of generating a NSS > config file (depending on detection of nss library). > First: how would we know whether the local library is built > with ECC support? > It is not afaik a default build option, > Fedora may not be the only distro not building with that option. As listed in #3, i had verified that: * gentoo[1] and * debian/ubuntu[2] build NSS with ECC by default. Also linked this bug to fedora's relevant bug[3] as suggested. [1] http://bugs.gentoo.org/247221 [2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=490826 [3] https://bugzilla.redhat.com/show_bug.cgi?id=492124 -- Configure bugmail: http://icedtea.classpath.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. From gnu_andrew at member.fsf.org Mon Aug 3 03:02:18 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 3 Aug 2009 11:02:18 +0100 Subject: [FOR REVIEW] hs14 merge for OpenJDK6 In-Reply-To: <4A751861.2090901@sun.com> References: <17c6771e0907312044q43080f55y3353927a57dca99f@mail.gmail.com> <4A73E58F.9020502@sun.com> <4A751861.2090901@sun.com> Message-ID: <17c6771e0908030302k123c206br4a7632fbc77ee0b@mail.gmail.com> 2009/8/2 Joseph D. Darcy : > Erik Trimble wrote: >> >> Andrew John Hughes wrote: >>> >>> Here it is, the mother of all webrevs: >>> >>> http://cr.openjdk.java.net/~andrew/jdk6-hs14-merge/webrev.01/ >>> >>> with the patch itself being ~13mb. >>> >>> This takes OpenJDK6 up to HotSpot 14 build 16 (see >>> http://hg.openjdk.java.net/hsx/hsx14/master/), incorporating 553 >>> changesets from the hs14 repo. and one merge changeset. >>> I'll shortly push this to http://fuseyism.com/hg/hotspot too. >>> >>> Ok to push? >>> >> >> I approve. >> > > I've taken a look too and don't see anything amiss; approved! > > Thanks, > > -Joe > Thanks Erik and Joe for the (very quick) approval! Wasn't expecting that over a weekend :) It looks like pushing isn't working too well though: pushing to ssh://andrew at hg.openjdk.java.net/jdk6/jdk6-gate/hotspot searching for changes remote: adding changesets remote: abort: Permission denied: /hg/jdk6/jdk6-gate/hotspot/.hg/store/00changelog.i abort: unexpected response: empty string I've pushed to various trees before (tl, awt, build, icedtea, cvmi) so I'm guessing this might be related to some permission issues following the replacement of hotspot? Any ideas? CCing Mark Reinhold as well as he manages hg. Thanks, -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From gnu_andrew at member.fsf.org Mon Aug 3 04:06:34 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 3 Aug 2009 12:06:34 +0100 Subject: [PATCH FOR APPROVAL]: Bump HotSpot to hs14b16 Message-ID: <17c6771e0908030406ob11cc89p1a1bb12e767ce790@mail.gmail.com> A simple patch to let us use the latest revision of HotSpot 14 for the release; this moves IcedTea6 from hs14b15 to hs14b16. This is the same version as will be available in the OpenJDK6 repositories as soon as I can push it: http://mail.openjdk.java.net/pipermail/jdk6-dev/2009-August/000656.html Ok to push? ChangeLog: 2009-08-03 Andrew John Hughes * hotspot.map: Bump to hs14b16. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 -------------- next part -------------- diff -r 4041898deb5a hotspot.map --- a/hotspot.map Thu Jul 30 22:47:00 2009 +0100 +++ b/hotspot.map Mon Aug 03 12:03:28 2009 +0100 @@ -1,3 +1,2 @@ # version changeset md5sum -default 25a020f13592 dbd7aca5544d1aeebf0eadd45d29d08e - +default 09f7962b8b44 600284e870609a7531163bf2972c573b From mark at klomp.org Mon Aug 3 05:04:59 2009 From: mark at klomp.org (Mark Wielaard) Date: Mon, 03 Aug 2009 14:04:59 +0200 Subject: [PATCH FOR APPROVAL]: Bump HotSpot to hs14b16 In-Reply-To: <17c6771e0908030406ob11cc89p1a1bb12e767ce790@mail.gmail.com> References: <17c6771e0908030406ob11cc89p1a1bb12e767ce790@mail.gmail.com> Message-ID: <1249301099.3344.5.camel@springer.wildebeest.org> Hi Andrew, On Mon, 2009-08-03 at 12:06 +0100, Andrew John Hughes wrote: > Ok to push? > > ChangeLog: > > 2009-08-03 Andrew John Hughes > > * hotspot.map: > Bump to hs14b16. Nice. Please do push. Thanks for all your hard work, and persistence, pushing hotspot for 6 forward. Cheers, Mark From ahughes at redhat.com Mon Aug 3 05:16:12 2009 From: ahughes at redhat.com (Andrew John Hughes) Date: Mon, 03 Aug 2009 12:16:12 +0000 Subject: changeset in /hg/icedtea6: Bump HotSpot to revision 16. Message-ID: changeset 18f23e1e3c37 in /hg/icedtea6 details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=18f23e1e3c37 description: Bump HotSpot to revision 16. 2009-08-03 Andrew John Hughes * hotspot.map: Bump to hs14b16. diffstat: 2 files changed, 6 insertions(+), 2 deletions(-) ChangeLog | 5 +++++ hotspot.map | 3 +-- diffs (20 lines): diff -r 4041898deb5a -r 18f23e1e3c37 ChangeLog --- a/ChangeLog Thu Jul 30 22:47:00 2009 +0100 +++ b/ChangeLog Mon Aug 03 13:18:16 2009 +0100 @@ -1,3 +1,8 @@ 2009-07-30 Andrew John Hughes + + * hotspot.map: + Bump to hs14b16. + 2009-07-30 Andrew John Hughes * Makefile.am: diff -r 4041898deb5a -r 18f23e1e3c37 hotspot.map --- a/hotspot.map Thu Jul 30 22:47:00 2009 +0100 +++ b/hotspot.map Mon Aug 03 13:18:16 2009 +0100 @@ -1,3 +1,2 @@ # version changeset md5sum -default 25a020f13592 dbd7aca5544d1aeebf0eadd45d29d08e - +default 09f7962b8b44 600284e870609a7531163bf2972c573b From gnu_andrew at member.fsf.org Mon Aug 3 05:37:01 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 3 Aug 2009 13:37:01 +0100 Subject: [PATCH FOR APPROVAL]: Bump HotSpot to hs14b16 In-Reply-To: <1249301099.3344.5.camel@springer.wildebeest.org> References: <17c6771e0908030406ob11cc89p1a1bb12e767ce790@mail.gmail.com> <1249301099.3344.5.camel@springer.wildebeest.org> Message-ID: <17c6771e0908030537l4a2fab9chf47f68978cb289ea@mail.gmail.com> 2009/8/3 Mark Wielaard : > Hi Andrew, > > On Mon, 2009-08-03 at 12:06 +0100, Andrew John Hughes wrote: >> Ok to push? >> >> ChangeLog: >> >> 2009-08-03 ?Andrew John Hughes ? >> >> ? ? ? ? * hotspot.map: >> ? ? ? ? Bump to hs14b16. > > Nice. Please do push. Thanks for all your hard work, and persistence, > pushing hotspot for 6 forward. > > Cheers, > > Mark > > Thanks. Committed. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From gnu_andrew at member.fsf.org Mon Aug 3 07:23:09 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 3 Aug 2009 15:23:09 +0100 Subject: New API in JDK7 Message-ID: <17c6771e0908030723t7481b949we4218265f0157d08@mail.gmail.com> I thought this might be of interest to those who want a quick overview of actual API changes in JDK7 so far. With Classpath, we use the japitools developed by Stuart Ballard (http://sab39.netreach.com/Software/Japitools/42/) to compare how well Classpath implements the APIs provided by various versions of the JDK. The same can be done to see 'how well OpenJDK6 implements OpenJDK7' or rather what's changed since JDK6: http://builder.classpath.org/japi/openjdk7-openjdk6.html There's also the inverse: http://builder.classpath.org/japi/openjdk6-openjdk7.html which shows anything missing in OpenJDK7 that was in OpenJDK6 (some xml methods and one Swing method it seems). Currently the results are based on IcedTea builds of b16 of OpenJDK6 and b66 (Milestone 4) of OpenJDK7, and will be updated to new builds as they are released and supported by IcedTea. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From Kelly.Ohair at Sun.COM Mon Aug 3 08:39:40 2009 From: Kelly.Ohair at Sun.COM (Kelly O'Hair) Date: Mon, 03 Aug 2009 08:39:40 -0700 Subject: New API in JDK7 In-Reply-To: <17c6771e0908030723t7481b949we4218265f0157d08@mail.gmail.com> References: <17c6771e0908030723t7481b949we4218265f0157d08@mail.gmail.com> Message-ID: <4A7704BC.8080403@sun.com> Very interesting, thanks for sharing this. -kto Andrew John Hughes wrote: > I thought this might be of interest to those who want a quick overview > of actual API changes in JDK7 so far. With Classpath, we use the > japitools developed by Stuart Ballard > (http://sab39.netreach.com/Software/Japitools/42/) to compare how well > Classpath implements the APIs provided by various versions of the JDK. > The same can be done to see 'how well OpenJDK6 implements OpenJDK7' > or rather what's changed since JDK6: > > http://builder.classpath.org/japi/openjdk7-openjdk6.html > > There's also the inverse: > > http://builder.classpath.org/japi/openjdk6-openjdk7.html > > which shows anything missing in OpenJDK7 that was in OpenJDK6 (some > xml methods and one Swing method it seems). > > Currently the results are based on IcedTea builds of b16 of OpenJDK6 > and b66 (Milestone 4) of OpenJDK7, and will be updated to new builds > as they are released and supported by IcedTea. From martinrb at google.com Mon Aug 3 09:05:21 2009 From: martinrb at google.com (Martin Buchholz) Date: Mon, 3 Aug 2009 09:05:21 -0700 Subject: New API in JDK7 In-Reply-To: <17c6771e0908030723t7481b949we4218265f0157d08@mail.gmail.com> References: <17c6771e0908030723t7481b949we4218265f0157d08@mail.gmail.com> Message-ID: <1ccfd1c10908030905u39588276p851d643677b1bcdc@mail.gmail.com> Interesting. There is a bunch of warnings about java.util.concurrent http://builder.classpath.org/japi/openjdk6-openjdk7.html#err_bad_java_util_concurrent but I don't understand them. There is not supposed to be any difference between jdk6 and jdk7 with these methods. Martin On Mon, Aug 3, 2009 at 07:23, Andrew John Hughes wrote: > I thought this might be of interest to those who want a quick overview > of actual API changes in JDK7 so far. ?With Classpath, we use the > japitools developed by Stuart Ballard > (http://sab39.netreach.com/Software/Japitools/42/) to compare how well > Classpath implements the APIs provided by various versions of the JDK. > ?The same can be done to see 'how well OpenJDK6 implements OpenJDK7' > or rather what's changed since JDK6: > > http://builder.classpath.org/japi/openjdk7-openjdk6.html > > There's also the inverse: > > http://builder.classpath.org/japi/openjdk6-openjdk7.html > > which shows anything missing in OpenJDK7 that was in OpenJDK6 (some > xml methods and one Swing method it seems). > > Currently the results are based on IcedTea builds of b16 of OpenJDK6 > and b66 (Milestone 4) of OpenJDK7, and will be updated to new builds > as they are released and supported by IcedTea. > -- > Andrew :-) > > Free Java Software Engineer > Red Hat, Inc. (http://www.redhat.com) > > Support Free Java! > Contribute to GNU Classpath and the OpenJDK > http://www.gnu.org/software/classpath > http://openjdk.java.net > > PGP Key: 94EFD9D8 (http://subkeys.pgp.net) > Fingerprint: F8EF F1EA 401E 2E60 15FA ?7927 142C 2591 94EF D9D8 > From gnu_andrew at member.fsf.org Mon Aug 3 09:10:20 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 3 Aug 2009 17:10:20 +0100 Subject: New API in JDK7 In-Reply-To: <1ccfd1c10908030905u39588276p851d643677b1bcdc@mail.gmail.com> References: <17c6771e0908030723t7481b949we4218265f0157d08@mail.gmail.com> <1ccfd1c10908030905u39588276p851d643677b1bcdc@mail.gmail.com> Message-ID: <17c6771e0908030910g29ce1a79se7458964aa032954@mail.gmail.com> 2009/8/3 Martin Buchholz : > Interesting. > > There is a bunch of warnings about java.util.concurrent > > http://builder.classpath.org/japi/openjdk6-openjdk7.html#err_bad_java_util_concurrent > > but I don't understand them. > There is not supposed to be any difference between jdk6 and jdk7 > with these methods. > Funnily enough, I was just looking at exactly the same thing! I think those are red herrings; the japi tool seems to be getting confused over the generics in those classes. We get the same errors for GNU Classpath too, yet this is one situation where we all share the same public domain code from Doug. You can safely ignore them. Everything else seems sane and I found it interesting spotting a few minor changes I'd missed such as some of the new constructors, etc. > Martin > > On Mon, Aug 3, 2009 at 07:23, Andrew John > Hughes wrote: >> I thought this might be of interest to those who want a quick overview >> of actual API changes in JDK7 so far. ?With Classpath, we use the >> japitools developed by Stuart Ballard >> (http://sab39.netreach.com/Software/Japitools/42/) to compare how well >> Classpath implements the APIs provided by various versions of the JDK. >> ?The same can be done to see 'how well OpenJDK6 implements OpenJDK7' >> or rather what's changed since JDK6: >> >> http://builder.classpath.org/japi/openjdk7-openjdk6.html >> >> There's also the inverse: >> >> http://builder.classpath.org/japi/openjdk6-openjdk7.html >> >> which shows anything missing in OpenJDK7 that was in OpenJDK6 (some >> xml methods and one Swing method it seems). >> >> Currently the results are based on IcedTea builds of b16 of OpenJDK6 >> and b66 (Milestone 4) of OpenJDK7, and will be updated to new builds >> as they are released and supported by IcedTea. >> -- >> Andrew :-) >> >> Free Java Software Engineer >> Red Hat, Inc. (http://www.redhat.com) >> >> Support Free Java! >> Contribute to GNU Classpath and the OpenJDK >> http://www.gnu.org/software/classpath >> http://openjdk.java.net >> >> PGP Key: 94EFD9D8 (http://subkeys.pgp.net) >> Fingerprint: F8EF F1EA 401E 2E60 15FA ?7927 142C 2591 94EF D9D8 >> > -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From bugzilla-daemon at icedtea.classpath.org Mon Aug 3 09:33:19 2009 From: bugzilla-daemon at icedtea.classpath.org (bugzilla-daemon at icedtea.classpath.org) Date: Mon, 03 Aug 2009 16:33:19 +0000 Subject: [Bug 375] New: IcedTea fails to build using ecj-3.5 Message-ID: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=375 Summary: IcedTea fails to build using ecj-3.5 Product: IcedTea Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: IcedTea AssignedTo: unassigned at icedtea.classpath.org ReportedBy: doko at ubuntu.com forwarded to eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=285466 IcedTea fails to build using ecj-3.5: $ sh call_ecj.sh + ecj -version Eclipse Java Compiler 0.967_R35x, 3.5.1 release, Copyright IBM Corp 2000, 2009. All rights reserved. + ecj -nowarn -g -d lib/hotspot-tools -source 1.5 -sourcepath hotspot-tools:openjdk/jdk/src/share/classes:openjdk/jdk/src/solaris/classes:openjdk/langtools/src/share/classes:openjdk/jaxp/src/share/classes:openjdk/corba/src/share/classes:openjdk/jaxws/src/share/classes:generated:rt -bootclasspath @hotspot-tools-source-files.txt ---------- 1. ERROR in hotspot-tools/com/sun/codemodel/internal/package-info.java (at line 1) /* ^ The type package-info is already defined ---------- ---------- 2. ERROR in hotspot-tools/com/sun/source/tree/package-info.java (at line 1) /* ^ The type package-info is already defined ---------- ---------- 3. ERROR in hotspot-tools/com/sun/source/util/package-info.java (at line 1) /* ^ The type package-info is already defined ---------- ---------- 4. ERROR in hotspot-tools/com/sun/tools/internal/xjc/model/package-info.java (at line 1) /* ^ The type package-info is already defined ---------- ---------- 5. ERROR in hotspot-tools/com/sun/tools/internal/xjc/package-info.java (at line 1) /* ^ The type package-info is already defined ---------- ---------- 6. ERROR in hotspot-tools/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/package-info.java (at line 1) /* ^ The type package-info is already defined ---------- 6 problems (6 errors) -- Configure bugmail: http://icedtea.classpath.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. From doko at ubuntu.com Mon Aug 3 10:31:20 2009 From: doko at ubuntu.com (doko at ubuntu.com) Date: Mon, 03 Aug 2009 17:31:20 +0000 Subject: changeset in /hg/icedtea: Fix llvm header location Message-ID: changeset 9ef90ed6dac9 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9ef90ed6dac9 description: Fix llvm header location 2009-06-23 Matthias Klose * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp: Fix header location. diffstat: 2 files changed, 5 insertions(+), 1 deletion(-) ChangeLog | 4 ++++ ports/hotspot/src/share/vm/shark/llvmHeaders.hpp | 2 +- diffs (23 lines): diff -r b1923df0d722 -r 9ef90ed6dac9 ChangeLog --- a/ChangeLog Tue Jun 23 12:40:50 2009 +0200 +++ b/ChangeLog Tue Jun 23 16:31:22 2009 +0200 @@ -1,3 +1,7 @@ 2009-06-23 Xerxes R??nby + + * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp: Fix header location. + 2009-06-23 Xerxes R??nby PR icedtea/353 diff -r b1923df0d722 -r 9ef90ed6dac9 ports/hotspot/src/share/vm/shark/llvmHeaders.hpp --- a/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Tue Jun 23 12:40:50 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Tue Jun 23 16:31:22 2009 +0200 @@ -36,7 +36,7 @@ #include #include #if SHARK_LLVM_VERSION >= 26 -#include +#include #include #endif #include From gbenson at redhat.com Mon Aug 3 10:31:17 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:17 +0000 Subject: changeset in /hg/icedtea: 2009-06-18 Gary Benson changeset 21f0340f7c98 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=21f0340f7c98 description: 2009-06-18 Gary Benson * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp (SharkTopLevelBlock::improve_virtual_call): Only print cast warnings when run with -XX:+SharkPerformanceWarnings. diffstat: 2 files changed, 15 insertions(+), 9 deletions(-) ChangeLog | 6 +++++ ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | 18 +++++++-------- diffs (41 lines): diff -r 8caa172d8bbc -r 21f0340f7c98 ChangeLog --- a/ChangeLog Thu Jun 18 12:00:59 2009 -0400 +++ b/ChangeLog Thu Jun 18 12:14:25 2009 -0400 @@ -1,3 +1,9 @@ 2009-06-18 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp + (SharkTopLevelBlock::improve_virtual_call): Only print cast + warnings when run with -XX:+SharkPerformanceWarnings. + 2009-06-18 Gary Benson * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp: New file. diff -r 8caa172d8bbc -r 21f0340f7c98 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp --- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Thu Jun 18 12:00:59 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Thu Jun 18 12:14:25 2009 -0400 @@ -902,15 +902,15 @@ ciMethod* SharkTopLevelBlock::improve_vi // types, but I can't even tell which direction it // doesn't like. For now I'm going to block *any* cast. if (monomorphic_target != dest_method) { -#ifndef PRODUCT - tty->print_cr("found monomorphic target, but inhibited cast:"); - tty->print(" dest_method = "); - dest_method->print_short_name(tty); - tty->cr(); - tty->print(" monomorphic_target = "); - monomorphic_target->print_short_name(tty); - tty->cr(); -#endif // !PRODUCT + if (SharkPerformanceWarnings) { + warning("found monomorphic target, but inhibited cast:"); + tty->print(" dest_method = "); + dest_method->print_short_name(tty); + tty->cr(); + tty->print(" monomorphic_target = "); + monomorphic_target->print_short_name(tty); + tty->cr(); + } monomorphic_target = NULL; } } From gbenson at redhat.com Mon Aug 3 10:31:17 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:17 +0000 Subject: changeset in /hg/icedtea: 2009-06-18 Gary Benson changeset 8caa172d8bbc in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8caa172d8bbc description: 2009-06-18 Gary Benson * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp: New file. * ports/hotspot/src/share/vm/shark/sharkInvariants.cpp: Likewise. * ports/hotspot/src/share/vm/shark/sharkFunction.hpp (SharkFunction): Made a subclass of SharkTargetInvariants. (SharkFunction::SharkFunction): Updated constructor. (SharkFunction::_compiler): Removed. (SharkFunction::_flow): Likewise. (SharkFunction::_iter): Likewise. (SharkFunction::_thread): Likewise. (SharkFunction::_max_monitors): Likewise. (SharkFunction::compiler): Likewise. (SharkFunction::flow): Likewise. (SharkFunction::iter): Likewise. (SharkFunction::thread): Likewise. (SharkFunction::max_monitors): Likewise. (SharkFunction::builder): Likewise. (SharkFunction::arg_size): Likewise. (SharkFunction::debug_info): Likewise. (SharkFunction::env): Likewise. (SharkFunction::max_locals): Likewise. (SharkFunction::max_stack): Likewise. (SharkFunction::target): Likewise. * ports/hotspot/src/share/vm/shark/sharkFunction.hpp (SharkFunction::initialize): Updated. * ports/hotspot/src/share/vm/shark/sharkBlock.hpp (SharkBlock): Made a subclass of SharkTargetInvariants. (SharkBlock::SharkBlock): Updated constructors. (SharkBlock::_builder): Removed. (SharkBlock::_target): Likewise. (SharkBlock::_thread): Likewise. (SharkBlock::builder): Likewise. (SharkBlock::target): Likewise. (SharkBlock::thread): Likewise. (SharkBlock::max_locals): Likewise. (SharkBlock::max_stack): Likewise. * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::initial_current_state): Use SharkState::copy. * ports/hotspot/src/share/vm/shark/sharkState.hpp (SharkState): Made a subclass of SharkTargetInvariants. (SharkState::SharkState): Updated constructors. (SharkState::_block): Removed. (SharkState::_function): Likewise. (SharkState::block): Likewise. (SharkState::function): Likewise. (SharkState::builder): Likewise. (SharkState::max_locals): Likewise. (SharkState::max_stack): Likewise. (SharkState::max_monitors): Likewise. (SharkState::pop): Likewise. (SharkState::copy): Updated. (SharkState::decache_for_Java_call): Moved to SharkTopLevelBlock. (SharkState::cache_after_Java_call): Likewise. (SharkState::decache_for_VM_call): Likewise. (SharkState::cache_after_VM_call): Likewise. (SharkState::decache_for_trap): Likewise. (SharkPHIState::_block): New field. (SharkPHIState::block): New method. * ports/hotspot/src/share/vm/shark/sharkState.inline.hpp: Removed. * ports/hotspot/src/share/vm/shark/sharkState.cpp (SharkState::equal_to): Updated. (SharkState::decache_for_Java_call): Moved to SharkTopLevelBlock. (SharkState::cache_after_Java_call): Likewise. (SharkState::decache_for_VM_call): Likewise. (SharkState::cache_after_VM_call): Likewise. (SharkState::decache_for_trap): Likewise. (SharkEntryState::SharkEntryState): Updated. (SharkPHIState::SharkPHIState): Likewise. (SharkPHIState::add_incoming): Likewise. * ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp (SharkStateScanner): Made a subclass of SharkTargetInvariants. (SharkStateScanner::SharkStateScanner): Updated constructor. (SharkStateScanner::start_stack): Updated arguments. (SharkStateScanner::start_locals): Likewise. (SharkStateScanner::stack_integrity_checks): Made non-static. (SharkStateScanner::locals_integrity_checks): Likewise. * ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp (SharkStateScanner::scan): Updated. (SharkStateScanner::locals_integrity_checks): Likewise. * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp (SharkCacherDecacher::builder): Removed. (SharkDecacher::debug_info): Likewise. (SharkDecacher::start_stack): Updated arguments. (SharkDecacher::start_locals): Likewise. * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp (SharkDecacher::start_frame): Updated. (SharkDecacher::start_stack): Likewise.. (SharkDecacher::start_locals): Likewise. (SharkDecacher::end_frame): Likewise. * ports/hotspot/src/share/vm/shark/sharkInliner.hpp (SharkInliner::attempt_inline): Removed thread argument. * ports/hotspot/src/share/vm/shark/sharkInliner.cpp (SharkInlineBlock): Made a subclass of SharkTargetInvariants. (SharkInlineBlock::SharkInlineBlock): Updated constructor. (SharkInlinerHelper::SharkInlinerHelper): Likewise. (SharkInlinerHelper::_thread): Removed. (SharkInlinerHelper::thread): Likewise. (SharkInlinerHelper::do_inline): Updated. (SharkInliner::attempt_inline): Updated. * ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp (SharkIntrinsics): Made a subclass of SharkTargetInvariants. (SharkIntrinsics::inline_intrinsic): Updated arguments. (SharkIntrinsics::SharkIntrinsics): New method. (SharkIntrinsics::_state): New field. (SharkIntrinsics::state): New method. (SharkIntrinsics::do_intrinsic): Likewise. (SharkIntrinsics::do_Math_minmax): Updated arguments. (SharkIntrinsics::do_Math_1to1): Likewise. (SharkIntrinsics::do_Math_2to1): Likewise. (SharkIntrinsics::do_Object_getClass): Likewise. (SharkIntrinsics::do_System_currentTimeMillis): Likewise. (SharkIntrinsics::do_Thread_currentThread): Likewise. (SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise. * ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp (SharkIntrinsics::inline_intrinsic): Updated. (SharkIntrinsics::do_intrinsic): New method. (SharkIntrinsics::do_Math_minmax): Updated. (SharkIntrinsics::do_Math_1to1): Likewise. (SharkIntrinsics::do_Math_2to1): Likewise. (SharkIntrinsics::do_Object_getClass): Likewise. (SharkIntrinsics::do_System_currentTimeMillis): Likewise. (SharkIntrinsics::do_Thread_currentThread): Likewise. (SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise. * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp (SharkTopLevelBlock::SharkTopLevelBlock): Updated constructor. (SharkTopLevelBlock::decache_for_Java_call): Moved from SharkState. (SharkTopLevelBlock::cache_after_Java_call): Likewise. (SharkTopLevelBlock::decache_for_VM_call): Likewise. (SharkTopLevelBlock::cache_after_VM_call): Likewise. (SharkTopLevelBlock::decache_for_trap): Likewise. (SharkTopLevelBlock::call_vm): Updated. * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp (SharkTopLevelBlock::decache_for_Java_call): Moved from SharkState. (SharkTopLevelBlock::cache_after_Java_call): Likewise. (SharkTopLevelBlock::decache_for_VM_call): Likewise. (SharkTopLevelBlock::cache_after_VM_call): Likewise. (SharkTopLevelBlock::decache_for_trap): Likewise. (SharkTopLevelBlock::do_trap): Updated. (SharkTopLevelBlock::improve_virtual_call): Likewise. (SharkTopLevelBlock::do_call): Likewise. (SharkTopLevelBlock::acquire_lock): Likewise. * ports/hotspot/src/share/vm/includeDB_shark: Updated. diffstat: 22 files changed, 717 insertions(+), 522 deletions(-) ChangeLog | 153 ++++++++++ ports/hotspot/src/share/vm/includeDB_shark | 47 ++- ports/hotspot/src/share/vm/shark/sharkBlock.cpp | 2 ports/hotspot/src/share/vm/shark/sharkBlock.hpp | 73 +---- ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp | 14 ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp | 16 - ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 3 ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 28 - ports/hotspot/src/share/vm/shark/sharkFunction.hpp | 87 ------ ports/hotspot/src/share/vm/shark/sharkInliner.cpp | 28 - ports/hotspot/src/share/vm/shark/sharkInliner.hpp | 4 ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp | 214 +++++++-------- ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp | 36 +- ports/hotspot/src/share/vm/shark/sharkInvariants.cpp | 38 ++ ports/hotspot/src/share/vm/shark/sharkInvariants.hpp | 186 +++++++++++++ ports/hotspot/src/share/vm/shark/sharkState.cpp | 87 ------ ports/hotspot/src/share/vm/shark/sharkState.hpp | 77 ++--- ports/hotspot/src/share/vm/shark/sharkState.inline.hpp | 44 --- ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp | 12 ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp | 12 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | 61 +++- ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp | 17 - diffs (truncated from 1991 to 500 lines): diff -r 9c4c94b5f4a2 -r 8caa172d8bbc ChangeLog --- a/ChangeLog Wed Jun 17 14:37:31 2009 +0100 +++ b/ChangeLog Thu Jun 18 12:00:59 2009 -0400 @@ -1,3 +1,156 @@ 2009-06-17 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp: New file. + * ports/hotspot/src/share/vm/shark/sharkInvariants.cpp: Likewise. + + * ports/hotspot/src/share/vm/shark/sharkFunction.hpp + (SharkFunction): Made a subclass of SharkTargetInvariants. + (SharkFunction::SharkFunction): Updated constructor. + (SharkFunction::_compiler): Removed. + (SharkFunction::_flow): Likewise. + (SharkFunction::_iter): Likewise. + (SharkFunction::_thread): Likewise. + (SharkFunction::_max_monitors): Likewise. + (SharkFunction::compiler): Likewise. + (SharkFunction::flow): Likewise. + (SharkFunction::iter): Likewise. + (SharkFunction::thread): Likewise. + (SharkFunction::max_monitors): Likewise. + (SharkFunction::builder): Likewise. + (SharkFunction::arg_size): Likewise. + (SharkFunction::debug_info): Likewise. + (SharkFunction::env): Likewise. + (SharkFunction::max_locals): Likewise. + (SharkFunction::max_stack): Likewise. + (SharkFunction::target): Likewise. + * ports/hotspot/src/share/vm/shark/sharkFunction.hpp + (SharkFunction::initialize): Updated. + + * ports/hotspot/src/share/vm/shark/sharkBlock.hpp + (SharkBlock): Made a subclass of SharkTargetInvariants. + (SharkBlock::SharkBlock): Updated constructors. + (SharkBlock::_builder): Removed. + (SharkBlock::_target): Likewise. + (SharkBlock::_thread): Likewise. + (SharkBlock::builder): Likewise. + (SharkBlock::target): Likewise. + (SharkBlock::thread): Likewise. + (SharkBlock::max_locals): Likewise. + (SharkBlock::max_stack): Likewise. + * ports/hotspot/src/share/vm/shark/sharkBlock.cpp + (SharkBlock::initial_current_state): Use SharkState::copy. + + * ports/hotspot/src/share/vm/shark/sharkState.hpp + (SharkState): Made a subclass of SharkTargetInvariants. + (SharkState::SharkState): Updated constructors. + (SharkState::_block): Removed. + (SharkState::_function): Likewise. + (SharkState::block): Likewise. + (SharkState::function): Likewise. + (SharkState::builder): Likewise. + (SharkState::max_locals): Likewise. + (SharkState::max_stack): Likewise. + (SharkState::max_monitors): Likewise. + (SharkState::pop): Likewise. + (SharkState::copy): Updated. + (SharkState::decache_for_Java_call): Moved to SharkTopLevelBlock. + (SharkState::cache_after_Java_call): Likewise. + (SharkState::decache_for_VM_call): Likewise. + (SharkState::cache_after_VM_call): Likewise. + (SharkState::decache_for_trap): Likewise. + (SharkPHIState::_block): New field. + (SharkPHIState::block): New method. + * ports/hotspot/src/share/vm/shark/sharkState.inline.hpp: Removed. + * ports/hotspot/src/share/vm/shark/sharkState.cpp + (SharkState::equal_to): Updated. + (SharkState::decache_for_Java_call): Moved to SharkTopLevelBlock. + (SharkState::cache_after_Java_call): Likewise. + (SharkState::decache_for_VM_call): Likewise. + (SharkState::cache_after_VM_call): Likewise. + (SharkState::decache_for_trap): Likewise. + (SharkEntryState::SharkEntryState): Updated. + (SharkPHIState::SharkPHIState): Likewise. + (SharkPHIState::add_incoming): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp + (SharkStateScanner): Made a subclass of SharkTargetInvariants. + (SharkStateScanner::SharkStateScanner): Updated constructor. + (SharkStateScanner::start_stack): Updated arguments. + (SharkStateScanner::start_locals): Likewise. + (SharkStateScanner::stack_integrity_checks): Made non-static. + (SharkStateScanner::locals_integrity_checks): Likewise. + * ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp + (SharkStateScanner::scan): Updated. + (SharkStateScanner::locals_integrity_checks): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp + (SharkCacherDecacher::builder): Removed. + (SharkDecacher::debug_info): Likewise. + (SharkDecacher::start_stack): Updated arguments. + (SharkDecacher::start_locals): Likewise. + * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp + (SharkDecacher::start_frame): Updated. + (SharkDecacher::start_stack): Likewise.. + (SharkDecacher::start_locals): Likewise. + (SharkDecacher::end_frame): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkInliner.hpp + (SharkInliner::attempt_inline): Removed thread argument. + * ports/hotspot/src/share/vm/shark/sharkInliner.cpp + (SharkInlineBlock): Made a subclass of SharkTargetInvariants. + (SharkInlineBlock::SharkInlineBlock): Updated constructor. + (SharkInlinerHelper::SharkInlinerHelper): Likewise. + (SharkInlinerHelper::_thread): Removed. + (SharkInlinerHelper::thread): Likewise. + (SharkInlinerHelper::do_inline): Updated. + (SharkInliner::attempt_inline): Updated. + + * ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp + (SharkIntrinsics): Made a subclass of SharkTargetInvariants. + (SharkIntrinsics::inline_intrinsic): Updated arguments. + (SharkIntrinsics::SharkIntrinsics): New method. + (SharkIntrinsics::_state): New field. + (SharkIntrinsics::state): New method. + (SharkIntrinsics::do_intrinsic): Likewise. + (SharkIntrinsics::do_Math_minmax): Updated arguments. + (SharkIntrinsics::do_Math_1to1): Likewise. + (SharkIntrinsics::do_Math_2to1): Likewise. + (SharkIntrinsics::do_Object_getClass): Likewise. + (SharkIntrinsics::do_System_currentTimeMillis): Likewise. + (SharkIntrinsics::do_Thread_currentThread): Likewise. + (SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise. + * ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp + (SharkIntrinsics::inline_intrinsic): Updated. + (SharkIntrinsics::do_intrinsic): New method. + (SharkIntrinsics::do_Math_minmax): Updated. + (SharkIntrinsics::do_Math_1to1): Likewise. + (SharkIntrinsics::do_Math_2to1): Likewise. + (SharkIntrinsics::do_Object_getClass): Likewise. + (SharkIntrinsics::do_System_currentTimeMillis): Likewise. + (SharkIntrinsics::do_Thread_currentThread): Likewise. + (SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp + (SharkTopLevelBlock::SharkTopLevelBlock): Updated constructor. + (SharkTopLevelBlock::decache_for_Java_call): Moved from SharkState. + (SharkTopLevelBlock::cache_after_Java_call): Likewise. + (SharkTopLevelBlock::decache_for_VM_call): Likewise. + (SharkTopLevelBlock::cache_after_VM_call): Likewise. + (SharkTopLevelBlock::decache_for_trap): Likewise. + (SharkTopLevelBlock::call_vm): Updated. + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp + (SharkTopLevelBlock::decache_for_Java_call): Moved from SharkState. + (SharkTopLevelBlock::cache_after_Java_call): Likewise. + (SharkTopLevelBlock::decache_for_VM_call): Likewise. + (SharkTopLevelBlock::cache_after_VM_call): Likewise. + (SharkTopLevelBlock::decache_for_trap): Likewise. + (SharkTopLevelBlock::do_trap): Updated. + (SharkTopLevelBlock::improve_virtual_call): Likewise. + (SharkTopLevelBlock::do_call): Likewise. + (SharkTopLevelBlock::acquire_lock): Likewise. + + * ports/hotspot/src/share/vm/includeDB_shark: Updated. + 2009-06-17 Gary Benson * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp diff -r 9c4c94b5f4a2 -r 8caa172d8bbc ports/hotspot/src/share/vm/includeDB_shark --- a/ports/hotspot/src/share/vm/includeDB_shark Wed Jun 17 14:37:31 2009 +0100 +++ b/ports/hotspot/src/share/vm/includeDB_shark Thu Jun 18 12:00:59 2009 -0400 @@ -50,8 +50,6 @@ ciTypeFlow.hpp compileBroker.cpp sharkCompiler.hpp -disassembler_.cpp sharkEntry.hpp - globals.hpp shark_globals_.hpp globals.cpp shark_globals.hpp @@ -75,7 +73,7 @@ sharkBlock.cpp sharkBlock.cpp sharkBuilder.hpp sharkBlock.cpp sharkConstant.hpp sharkBlock.cpp sharkRuntime.hpp -sharkBlock.cpp sharkState.inline.hpp +sharkBlock.cpp sharkState.hpp sharkBlock.cpp sharkValue.hpp sharkBlock.hpp allocation.hpp @@ -85,6 +83,7 @@ sharkBlock.hpp sharkBlock.hpp llvmHeaders.hpp sharkBlock.hpp sharkBuilder.hpp sharkBlock.hpp sharkConstant.hpp +sharkBlock.hpp sharkInvariants.hpp sharkBlock.hpp sharkState.hpp sharkBlock.hpp sharkValue.hpp @@ -121,7 +120,7 @@ sharkCacheDecache.cpp sharkCacheDecache.cpp sharkBuilder.hpp sharkCacheDecache.cpp sharkCacheDecache.hpp sharkCacheDecache.cpp sharkFunction.hpp -sharkCacheDecache.cpp sharkState.inline.hpp +sharkCacheDecache.cpp sharkState.hpp sharkCacheDecache.hpp ciMethod.hpp sharkCacheDecache.hpp debugInfoRec.hpp @@ -181,7 +180,7 @@ sharkFunction.cpp sharkFunction.cpp sharkBuilder.hpp sharkFunction.cpp sharkEntry.hpp sharkFunction.cpp sharkFunction.hpp -sharkFunction.cpp sharkState.inline.hpp +sharkFunction.cpp sharkState.hpp sharkFunction.cpp sharkTopLevelBlock.hpp sharkFunction.hpp allocation.hpp @@ -191,6 +190,7 @@ sharkFunction.hpp sharkFunction.hpp llvmHeaders.hpp sharkFunction.hpp llvmValue.hpp sharkFunction.hpp sharkBuilder.hpp +sharkFunction.hpp sharkInvariants.hpp sharkInliner.cpp allocation.hpp sharkInliner.cpp bytecodes.hpp @@ -198,29 +198,44 @@ sharkInliner.cpp sharkInliner.cpp ciMethod.hpp sharkInliner.cpp ciStreams.hpp sharkInliner.cpp shark_globals.hpp +sharkInliner.cpp sharkBlock.hpp sharkInliner.cpp sharkConstant.hpp sharkInliner.cpp sharkInliner.hpp sharkInliner.cpp sharkIntrinsics.hpp -sharkInliner.cpp sharkState.inline.hpp +sharkInliner.cpp sharkState.hpp sharkInliner.cpp sharkValue.hpp sharkInliner.hpp allocation.hpp sharkInliner.hpp ciMethod.hpp sharkInliner.hpp llvmHeaders.hpp -sharkInliner.hpp sharkState.inline.hpp +sharkInliner.hpp sharkState.hpp sharkIntrinsics.cpp ciMethod.hpp sharkIntrinsics.cpp llvmHeaders.hpp sharkIntrinsics.cpp shark_globals.hpp sharkIntrinsics.cpp sharkIntrinsics.hpp sharkIntrinsics.cpp sharkRuntime.hpp -sharkIntrinsics.cpp sharkState.inline.hpp +sharkIntrinsics.cpp sharkState.hpp sharkIntrinsics.cpp sharkValue.hpp sharkIntrinsics.hpp allocation.hpp sharkIntrinsics.hpp ciMethod.hpp sharkIntrinsics.hpp llvmHeaders.hpp sharkIntrinsics.hpp sharkState.hpp + +sharkInvariants.cpp sharkInvariants.hpp + +sharkInvariants.hpp allocation.hpp +sharkInvariants.hpp ciEnv.hpp +sharkInvariants.hpp ciMethod.hpp +sharkInvariants.hpp ciInstanceKlass.hpp +sharkInvariants.hpp ciTypeFlow.hpp +sharkInvariants.hpp debugInfoRec.hpp +sharkInvariants.hpp dependencies.hpp +sharkInvariants.hpp llvmHeaders.hpp +sharkInvariants.hpp sharkBuilder.hpp +sharkInvariants.hpp sharkCompiler.hpp +sharkInvariants.hpp sharkMemoryManager.hpp sharkMemoryManager.hpp llvmHeaders.hpp sharkMemoryManager.hpp sharkEntry.hpp @@ -249,7 +264,7 @@ sharkState.cpp sharkState.cpp ciTypeFlow.hpp sharkState.cpp sharkBuilder.hpp sharkState.cpp sharkCacheDecache.hpp -sharkState.cpp sharkState.inline.hpp +sharkState.cpp sharkState.hpp sharkState.cpp sharkTopLevelBlock.hpp sharkState.cpp sharkType.hpp sharkState.cpp sharkValue.hpp @@ -258,19 +273,16 @@ sharkState.hpp sharkState.hpp ciMethod.hpp sharkState.hpp llvmHeaders.hpp sharkState.hpp sharkBuilder.hpp +sharkState.hpp sharkInvariants.hpp sharkState.hpp sharkValue.hpp -sharkState.inline.hpp sharkBlock.hpp -sharkState.inline.hpp sharkBuilder.hpp -sharkState.inline.hpp sharkFunction.hpp -sharkState.inline.hpp sharkState.hpp - -sharkStateScanner.cpp sharkState.inline.hpp +sharkStateScanner.cpp sharkState.hpp sharkStateScanner.cpp sharkStateScanner.hpp sharkStateScanner.hpp allocation.hpp sharkStateScanner.hpp llvmHeaders.hpp sharkStateScanner.hpp sharkFunction.hpp +sharkStateScanner.hpp sharkInvariants.hpp sharkTopLevelBlock.cpp allocation.hpp sharkTopLevelBlock.cpp bytecodes.hpp @@ -283,12 +295,13 @@ sharkTopLevelBlock.cpp sharkTopLevelBlock.cpp llvmHeaders.hpp sharkTopLevelBlock.cpp llvmValue.hpp sharkTopLevelBlock.cpp shark_globals.hpp +sharkTopLevelBlock.cpp sharkCacheDecache.hpp sharkTopLevelBlock.cpp sharkTopLevelBlock.hpp sharkTopLevelBlock.cpp sharkBuilder.hpp sharkTopLevelBlock.cpp sharkConstant.hpp sharkTopLevelBlock.cpp sharkInliner.hpp sharkTopLevelBlock.cpp sharkRuntime.hpp -sharkTopLevelBlock.cpp sharkState.inline.hpp +sharkTopLevelBlock.cpp sharkState.hpp sharkTopLevelBlock.cpp sharkValue.hpp sharkTopLevelBlock.hpp allocation.hpp @@ -300,7 +313,7 @@ sharkTopLevelBlock.hpp sharkTopLevelBlock.hpp sharkBlock.hpp sharkTopLevelBlock.hpp sharkBuilder.hpp sharkTopLevelBlock.hpp sharkFunction.hpp -sharkTopLevelBlock.hpp sharkState.inline.hpp +sharkTopLevelBlock.hpp sharkState.hpp sharkTopLevelBlock.hpp sharkValue.hpp sharkType.cpp arrayOop.hpp diff -r 9c4c94b5f4a2 -r 8caa172d8bbc ports/hotspot/src/share/vm/shark/sharkBlock.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Wed Jun 17 14:37:31 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Thu Jun 18 12:00:59 2009 -0400 @@ -888,7 +888,7 @@ void SharkBlock::parse_bytecode(int star SharkState* SharkBlock::initial_current_state() { - return new SharkState(this, entry_state()); + return entry_state()->copy(); } int SharkBlock::switch_default_dest() diff -r 9c4c94b5f4a2 -r 8caa172d8bbc ports/hotspot/src/share/vm/shark/sharkBlock.hpp --- a/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Wed Jun 17 14:37:31 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Thu Jun 18 12:00:59 2009 -0400 @@ -25,61 +25,32 @@ class SharkState; -class SharkBlock : public ResourceObj { +class SharkBlock : public SharkTargetInvariants { + protected: + SharkBlock(const SharkTargetInvariants* parent) + : SharkTargetInvariants(parent), + _iter(target()), + _current_state(NULL) {} + + SharkBlock(const SharkCompileInvariants* parent, ciMethod* target) + : SharkTargetInvariants(parent, target), + _iter(target), + _current_state(NULL) {} + + private: + ciBytecodeStream _iter; + SharkState* _current_state; + public: - SharkBlock(SharkBuilder* builder, - ciMethod* target, - ciBytecodeStream* iter, - llvm::Value* thread) - : _builder(builder), - _target(target), - _iter(iter), - _current_state(NULL), - _thread(thread) {} - - private: - SharkBuilder* _builder; - ciMethod* _target; - ciBytecodeStream* _iter; - SharkState* _current_state; - llvm::Value* _thread; - - public: - SharkBuilder* builder() const - { - return _builder; - } - ciMethod* target() const - { - return _target; - } - ciBytecodeStream* iter() const - { - return _iter; - } - llvm::Value* thread() const - { - return _thread; - } - - // Target properties - public: - int max_locals() const - { - return target()->max_locals(); - } - int max_stack() const - { - return target()->max_stack(); - } - - // Bytecode stream - public: - Bytecodes::Code bc() const + ciBytecodeStream* iter() + { + return &_iter; + } + Bytecodes::Code bc() { return iter()->cur_bc(); } - int bci() const + int bci() { return iter()->cur_bci(); } diff -r 9c4c94b5f4a2 -r 8caa172d8bbc ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp Wed Jun 17 14:37:31 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp Thu Jun 18 12:00:59 2009 -0400 @@ -34,20 +34,20 @@ void SharkDecacher::start_frame() _pc_offset = builder()->code_buffer()->create_unique_offset(); _oopmap = new OopMap( oopmap_slot_munge(function()->oopmap_frame_size()), - oopmap_slot_munge(function()->arg_size())); + oopmap_slot_munge(arg_size())); debug_info()->add_safepoint(pc_offset(), oopmap()); } -void SharkDecacher::start_stack(int num_slots, int max_slots) +void SharkDecacher::start_stack(int stack_depth) { // Create the array we'll record our stack slots in - _exparray = new GrowableArray(num_slots); + _exparray = new GrowableArray(stack_depth); // Set the stack pointer function()->CreateStoreZeroStackPointer( builder()->CreatePtrToInt( function()->CreateAddressOfFrameEntry( - function()->stack_slots_offset() + max_slots - num_slots), + function()->stack_slots_offset() + max_stack() - stack_depth), SharkType::intptr_type())); } @@ -123,10 +123,10 @@ void SharkDecacher::process_pc_slot(int function()->CreateAddressOfFrameEntry(offset)); } -void SharkDecacher::start_locals(int num_locals) +void SharkDecacher::start_locals() { // Create the array we'll record our local variables in - _locarray = new GrowableArray(num_locals);} + _locarray = new GrowableArray(max_locals());} void SharkDecacher::process_local_slot(int index, SharkValue** addr, @@ -158,7 +158,7 @@ void SharkDecacher::end_frame() // Record the scope debug_info()->describe_scope( pc_offset(), - function()->target(), + target(), bci(), debug_info()->create_scope_values(locarray()), debug_info()->create_scope_values(exparray()), diff -r 9c4c94b5f4a2 -r 8caa172d8bbc ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp --- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp Wed Jun 17 14:37:31 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp Thu Jun 18 12:00:59 2009 -0400 @@ -40,12 +40,6 @@ class SharkCacherDecacher : public Shark SharkCacherDecacher(SharkFunction* function) : SharkStateScanner(function) {} - protected: - SharkBuilder* builder() const - { - return function()->builder(); - } - // Helper protected: static int adjusted_offset(SharkValue* value, int offset) @@ -68,12 +62,6 @@ class SharkDecacher : public SharkCacher int bci() const { return _bci; - } - - private: - DebugInformationRecorder* debug_info() const - { - return function()->debug_info(); } private: @@ -109,7 +97,7 @@ class SharkDecacher : public SharkCacher protected: void start_frame(); From xerxes at zafena.se Mon Aug 3 10:31:19 2009 From: xerxes at zafena.se (Xerxes R?nby) Date: Mon, 03 Aug 2009 17:31:19 +0000 Subject: changeset in /hg/icedtea: PR icedtea/353 Message-ID: changeset b1923df0d722 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=b1923df0d722 description: PR icedtea/353 * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Include llvm/Support/Threading.h and llvm/Target/TargetSelect.h used by llvm_start_multithreaded() and InitializeNativeTarget() when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/llvmValue.hpp (jfloat_constant): Return llvm::Constant* when llvm version are 2.6 or later to handle llvm r73431 API change. (jdouble_constant): Likewise. * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::parse_bytecode): Updated to use CreateFAdd CreateFSub, CreateFMul and CreateFNeg for jfloat and jdouble when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::SharkCompiler): Call InitializeNativeTarget() to link in native target when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Call llvm_start_multithreaded() to initialize llvm mutex guards when llvm version are 2.6 or later. diffstat: 6 files changed, 78 insertions(+) ChangeLog | 22 +++++++++++++ ports/hotspot/src/share/vm/shark/llvmHeaders.hpp | 4 ++ ports/hotspot/src/share/vm/shark/llvmValue.hpp | 8 +++++ ports/hotspot/src/share/vm/shark/sharkBlock.cpp | 32 ++++++++++++++++++++ ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 6 +++ ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 6 +++ diffs (188 lines): diff -r d8dac70fb1fa -r b1923df0d722 ChangeLog --- a/ChangeLog Fri Jun 19 08:48:56 2009 -0400 +++ b/ChangeLog Tue Jun 23 12:40:50 2009 +0200 @@ -1,3 +1,25 @@ 2009-06-19 Gary Benson + + PR icedtea/353 + * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp + Include llvm/Support/Threading.h and llvm/Target/TargetSelect.h + used by llvm_start_multithreaded() and InitializeNativeTarget() + when llvm version are 2.6 or later. + * ports/hotspot/src/share/vm/shark/llvmValue.hpp + (jfloat_constant): Return llvm::Constant* when llvm + version are 2.6 or later to handle llvm r73431 API change. + (jdouble_constant): Likewise. + * ports/hotspot/src/share/vm/shark/sharkBlock.cpp + (SharkBlock::parse_bytecode): Updated to use CreateFAdd + CreateFSub, CreateFMul and CreateFNeg for jfloat and jdouble + when llvm version are 2.6 or later. + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::SharkCompiler): Call InitializeNativeTarget() to + link in native target when llvm version are 2.6 or later. + * ports/hotspot/src/share/vm/shark/sharkFunction.cpp + (SharkFunction::initialize): Call llvm_start_multithreaded() to + initialize llvm mutex guards when llvm version are 2.6 or later. + 2009-06-19 Gary Benson * ports/hotspot/src/share/vm/shark/sharkConstant.cpp diff -r d8dac70fb1fa -r b1923df0d722 ports/hotspot/src/share/vm/shark/llvmHeaders.hpp --- a/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Fri Jun 19 08:48:56 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Tue Jun 23 12:40:50 2009 +0200 @@ -35,6 +35,10 @@ #include #include #include +#if SHARK_LLVM_VERSION >= 26 +#include +#include +#endif #include #include #include diff -r d8dac70fb1fa -r b1923df0d722 ports/hotspot/src/share/vm/shark/llvmValue.hpp --- a/ports/hotspot/src/share/vm/shark/llvmValue.hpp Fri Jun 19 08:48:56 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/llvmValue.hpp Tue Jun 23 12:40:50 2009 +0200 @@ -37,11 +37,19 @@ class LLVMValue : public AllStatic { { return llvm::ConstantInt::get(SharkType::jlong_type(), value, true); } +#if SHARK_LLVM_VERSION >= 26 + static llvm::Constant* jfloat_constant(jfloat value) +#else static llvm::ConstantFP* jfloat_constant(jfloat value) +#endif { return llvm::ConstantFP::get(SharkType::jfloat_type(), value); } +#if SHARK_LLVM_VERSION >= 26 + static llvm::Constant* jdouble_constant(jdouble value) +#else static llvm::ConstantFP* jdouble_constant(jdouble value) +#endif { return llvm::ConstantFP::get(SharkType::jdouble_type(), value); } diff -r d8dac70fb1fa -r b1923df0d722 ports/hotspot/src/share/vm/shark/sharkBlock.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Fri Jun 19 08:48:56 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Tue Jun 23 12:40:50 2009 +0200 @@ -532,19 +532,31 @@ void SharkBlock::parse_bytecode(int star b = pop(); a = pop(); push(SharkValue::create_jfloat( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFAdd(a->jfloat_value(), b->jfloat_value()))); +#else builder()->CreateAdd(a->jfloat_value(), b->jfloat_value()))); +#endif break; case Bytecodes::_fsub: b = pop(); a = pop(); push(SharkValue::create_jfloat( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFSub(a->jfloat_value(), b->jfloat_value()))); +#else builder()->CreateSub(a->jfloat_value(), b->jfloat_value()))); +#endif break; case Bytecodes::_fmul: b = pop(); a = pop(); push(SharkValue::create_jfloat( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFMul(a->jfloat_value(), b->jfloat_value()))); +#else builder()->CreateMul(a->jfloat_value(), b->jfloat_value()))); +#endif break; case Bytecodes::_fdiv: b = pop(); @@ -561,26 +573,42 @@ void SharkBlock::parse_bytecode(int star case Bytecodes::_fneg: a = pop(); push(SharkValue::create_jfloat( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFNeg(a->jfloat_value()))); +#else builder()->CreateNeg(a->jfloat_value()))); +#endif break; case Bytecodes::_dadd: b = pop(); a = pop(); push(SharkValue::create_jdouble( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFAdd(a->jdouble_value(), b->jdouble_value()))); +#else builder()->CreateAdd(a->jdouble_value(), b->jdouble_value()))); +#endif break; case Bytecodes::_dsub: b = pop(); a = pop(); push(SharkValue::create_jdouble( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFSub(a->jdouble_value(), b->jdouble_value()))); +#else builder()->CreateSub(a->jdouble_value(), b->jdouble_value()))); +#endif break; case Bytecodes::_dmul: b = pop(); a = pop(); push(SharkValue::create_jdouble( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFMul(a->jdouble_value(), b->jdouble_value()))); +#else builder()->CreateMul(a->jdouble_value(), b->jdouble_value()))); +#endif break; case Bytecodes::_ddiv: b = pop(); @@ -597,7 +625,11 @@ void SharkBlock::parse_bytecode(int star case Bytecodes::_dneg: a = pop(); push(SharkValue::create_jdouble( +#if SHARK_LLVM_VERSION >= 26 + builder()->CreateFNeg(a->jdouble_value()))); +#else builder()->CreateNeg(a->jdouble_value()))); +#endif break; case Bytecodes::_iinc: diff -r d8dac70fb1fa -r b1923df0d722 ports/hotspot/src/share/vm/shark/sharkCompiler.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 19 08:48:56 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Tue Jun 23 12:40:50 2009 +0200 @@ -38,6 +38,12 @@ SharkCompiler::SharkCompiler() // Create the builder to build our functions _builder = new SharkBuilder(this); + +#if SHARK_LLVM_VERSION >= 26 + // If we have a native target, initialize it to ensure it is linked in and + // usable by the JIT. + InitializeNativeTarget(); +#endif // Create the JIT ModuleProvider *module_provider = new ExistingModuleProvider(module()); diff -r d8dac70fb1fa -r b1923df0d722 ports/hotspot/src/share/vm/shark/sharkFunction.cpp --- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 19 08:48:56 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Tue Jun 23 12:40:50 2009 +0200 @@ -30,6 +30,12 @@ using namespace llvm; void SharkFunction::initialize(const char *name) { + +#if SHARK_LLVM_VERSION >= 26 + // Initialize llvm mutex guards + llvm_start_multithreaded(); +#endif + // Create the function _function = Function::Create( SharkType::entry_point_type(), From gbenson at redhat.com Mon Aug 3 10:31:19 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:19 +0000 Subject: changeset in /hg/icedtea: 2009-06-19 Gary Benson changeset d8dac70fb1fa in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=d8dac70fb1fa description: 2009-06-19 Gary Benson * ports/hotspot/src/share/vm/shark/sharkConstant.cpp (SharkConstant::for_ldc): Set type for object constants. (SharkConstant::SharkConstant): Updated. diffstat: 2 files changed, 18 insertions(+), 2 deletions(-) ChangeLog | 6 ++++++ ports/hotspot/src/share/vm/shark/sharkConstant.cpp | 14 ++++++++++++-- diffs (51 lines): diff -r 3d97a22bbdab -r d8dac70fb1fa ChangeLog --- a/ChangeLog Fri Jun 19 06:03:31 2009 -0400 +++ b/ChangeLog Fri Jun 19 08:48:56 2009 -0400 @@ -1,3 +1,9 @@ 2009-06-19 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkConstant.cpp + (SharkConstant::for_ldc): Set type for object constants. + (SharkConstant::SharkConstant): Updated. + 2009-06-19 Gary Benson * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp diff -r 3d97a22bbdab -r d8dac70fb1fa ports/hotspot/src/share/vm/shark/sharkConstant.cpp --- a/ports/hotspot/src/share/vm/shark/sharkConstant.cpp Fri Jun 19 06:03:31 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkConstant.cpp Fri Jun 19 08:48:56 2009 -0400 @@ -30,7 +30,16 @@ using namespace llvm; SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) { - return new SharkConstant(iter->get_constant(), NULL); + ciConstant constant = iter->get_constant(); + ciType *type = NULL; + if (constant.basic_type() == T_OBJECT) { + ciEnv *env = ciEnv::current(); + if (constant.as_object()->is_klass()) + type = env->Class_klass(); + else + type = env->String_klass(); + } + return new SharkConstant(constant, type); } SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) @@ -97,6 +106,7 @@ SharkConstant::SharkConstant(ciConstant // have yet to be created. We need to spot the unloaded // objects (which differ between ldc* and get*, thanks!) ciObject *object = constant.as_object(); + assert(type != NULL, "shouldn't be"); if (object->is_klass()) { // The constant returned for a klass is the ciKlass // for the entry, but we want the java_mirror. @@ -114,7 +124,7 @@ SharkConstant::SharkConstant(ciConstant _value = NULL; _object = object; - _type = type ? type : ciType::make(T_OBJECT); + _type = type; _is_loaded = true; _is_nonzero = true; _is_two_word = false; From gbenson at redhat.com Mon Aug 3 10:31:16 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:16 +0000 Subject: changeset in /hg/icedtea: 2009-06-17 Gary Benson changeset 9c4c94b5f4a2 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9c4c94b5f4a2 description: 2009-06-17 Gary Benson * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp (SharkCacherDecacher::SharkCacherDecacher): Remove frame cache code. (SharkCacherDecacher::_frame_cache): Removed. (SharkCacherDecacher::frame_cache): Likewise. (SharkDecacher::SharkDecacher): Removed frame cache code. (SharkJavaCallDecacher::SharkJavaCallDecacher): Likewise. (SharkVMCallDecacher::SharkVMCallDecacher): Likewise. (SharkTrapDecacher::SharkTrapDecacher): Likewise. (SharkCacher::SharkCacher): Likewise. (SharkJavaCallCacher::SharkJavaCallCcacher): Likewise. (SharkVMCallCacher::SharkVMCallCacher): Likewise. (SharkFunctionEntryCacher::SharkFunctionEntryCacher): Likewise. * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp (SharkDecacher::write_value_to_frame): Remove frame cache code. (SharkDecacher::read_value_from_frame): Likewise. * ports/hotspot/src/share/vm/shark/sharkState.hpp (SharkState::_frame_cache): Removed. (SharkState::frame_cache): Likewise. * ports/hotspot/src/share/vm/shark/sharkState.cpp (SharkState::SharkState): Remove frame cache code. (SharkState::initialize): Likewise. (SharkState::equal_to): Likewise. (SharkState::merge): Likewise. (SharkState::decache_for_Java_call): Likewise. (SharkState::cache_after_Java_call): Likewise. (SharkState::decache_for_VM_call): Likewise. (SharkState::cache_after_VM_call): Likewise. (SharkState::decache_for_trap): Likewise. (SharkEntryState::SharkEntryState): Likewise. * ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp: Removed. * ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp: Likewise. * ports/hotspot/src/share/vm/includeDB_shark: Updated. diffstat: 8 files changed, 67 insertions(+), 228 deletions(-) ChangeLog | 38 +++++++++ ports/hotspot/src/share/vm/includeDB_shark | 14 --- ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp | 13 --- ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp | 56 ++++--------- ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp | 66 ---------------- ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp | 66 ---------------- ports/hotspot/src/share/vm/shark/sharkState.cpp | 37 +------- ports/hotspot/src/share/vm/shark/sharkState.hpp | 5 - diffs (truncated from 521 to 500 lines): diff -r 0baf35fada62 -r 9c4c94b5f4a2 ChangeLog --- a/ChangeLog Sun Jul 26 20:25:37 2009 +0100 +++ b/ChangeLog Wed Jun 17 14:37:31 2009 +0100 @@ -1,3 +1,41 @@ 2009-07-26 Andrew John Hughes + + * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp + (SharkCacherDecacher::SharkCacherDecacher): Remove frame cache code. + (SharkCacherDecacher::_frame_cache): Removed. + (SharkCacherDecacher::frame_cache): Likewise. + (SharkDecacher::SharkDecacher): Removed frame cache code. + (SharkJavaCallDecacher::SharkJavaCallDecacher): Likewise. + (SharkVMCallDecacher::SharkVMCallDecacher): Likewise. + (SharkTrapDecacher::SharkTrapDecacher): Likewise. + (SharkCacher::SharkCacher): Likewise. + (SharkJavaCallCacher::SharkJavaCallCcacher): Likewise. + (SharkVMCallCacher::SharkVMCallCacher): Likewise. + (SharkFunctionEntryCacher::SharkFunctionEntryCacher): Likewise. + * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp + (SharkDecacher::write_value_to_frame): Remove frame cache code. + (SharkDecacher::read_value_from_frame): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkState.hpp + (SharkState::_frame_cache): Removed. + (SharkState::frame_cache): Likewise. + * ports/hotspot/src/share/vm/shark/sharkState.cpp + (SharkState::SharkState): Remove frame cache code. + (SharkState::initialize): Likewise. + (SharkState::equal_to): Likewise. + (SharkState::merge): Likewise. + (SharkState::decache_for_Java_call): Likewise. + (SharkState::cache_after_Java_call): Likewise. + (SharkState::decache_for_VM_call): Likewise. + (SharkState::cache_after_VM_call): Likewise. + (SharkState::decache_for_trap): Likewise. + (SharkEntryState::SharkEntryState): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp: Removed. + * ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp: Likewise. + + * ports/hotspot/src/share/vm/includeDB_shark: Updated. + 2009-07-26 Andrew John Hughes * Makefile.am: diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/includeDB_shark --- a/ports/hotspot/src/share/vm/includeDB_shark Sun Jul 26 20:25:37 2009 +0100 +++ b/ports/hotspot/src/share/vm/includeDB_shark Wed Jun 17 14:37:31 2009 +0100 @@ -120,14 +120,12 @@ sharkCacheDecache.cpp sharkCacheDecache.cpp llvmValue.hpp sharkCacheDecache.cpp sharkBuilder.hpp sharkCacheDecache.cpp sharkCacheDecache.hpp -sharkCacheDecache.cpp sharkFrameCache.hpp sharkCacheDecache.cpp sharkFunction.hpp sharkCacheDecache.cpp sharkState.inline.hpp sharkCacheDecache.hpp ciMethod.hpp sharkCacheDecache.hpp debugInfoRec.hpp sharkCacheDecache.hpp sharkBuilder.hpp -sharkCacheDecache.hpp sharkFrameCache.hpp sharkCacheDecache.hpp sharkFunction.hpp sharkCacheDecache.hpp sharkStateScanner.hpp @@ -174,15 +172,6 @@ sharkEntry.cpp sharkEntry.hpp llvmHeaders.hpp -sharkFrameCache.cpp allocation.hpp -sharkFrameCache.cpp llvmHeaders.hpp -sharkFrameCache.cpp sharkFrameCache.hpp -sharkFrameCache.cpp sharkFunction.hpp - -sharkFrameCache.hpp allocation.hpp -sharkFrameCache.hpp llvmHeaders.hpp -sharkFrameCache.hpp sharkFunction.hpp - sharkFunction.cpp allocation.hpp sharkFunction.cpp ciTypeFlow.hpp sharkFunction.cpp debug.hpp @@ -260,7 +249,6 @@ sharkState.cpp sharkState.cpp ciTypeFlow.hpp sharkState.cpp sharkBuilder.hpp sharkState.cpp sharkCacheDecache.hpp -sharkState.cpp sharkFrameCache.hpp sharkState.cpp sharkState.inline.hpp sharkState.cpp sharkTopLevelBlock.hpp sharkState.cpp sharkType.hpp @@ -270,11 +258,11 @@ sharkState.hpp sharkState.hpp ciMethod.hpp sharkState.hpp llvmHeaders.hpp sharkState.hpp sharkBuilder.hpp -sharkState.hpp sharkFrameCache.hpp sharkState.hpp sharkValue.hpp sharkState.inline.hpp sharkBlock.hpp sharkState.inline.hpp sharkBuilder.hpp +sharkState.inline.hpp sharkFunction.hpp sharkState.inline.hpp sharkState.hpp sharkStateScanner.cpp sharkState.inline.hpp diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp Sun Jul 26 20:25:37 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp Wed Jun 17 14:37:31 2009 +0100 @@ -225,17 +225,12 @@ void SharkDecacher::write_value_to_frame Value* value, int offset) { - if (frame_cache()->value(offset) != value) { - builder()->CreateStore( - value, - function()->CreateAddressOfFrameEntry(offset, type)); - } + builder()->CreateStore( + value, function()->CreateAddressOfFrameEntry(offset, type)); } Value* SharkCacher::read_value_from_frame(const Type* type, int offset) { - Value *result = builder()->CreateLoad( + return builder()->CreateLoad( function()->CreateAddressOfFrameEntry(offset, type)); - frame_cache()->set_value(offset, result); - return result; -} +} diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp --- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp Sun Jul 26 20:25:37 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp Wed Jun 17 14:37:31 2009 +0100 @@ -37,17 +37,8 @@ class SharkCacherDecacher : public SharkStateScanner { protected: - SharkCacherDecacher(SharkFunction* function, SharkFrameCache* frame_cache) - : SharkStateScanner(function), _frame_cache(frame_cache) {} - - private: - SharkFrameCache* _frame_cache; - - protected: - SharkFrameCache* frame_cache() const - { - return _frame_cache; - } + SharkCacherDecacher(SharkFunction* function) + : SharkStateScanner(function) {} protected: SharkBuilder* builder() const @@ -67,8 +58,8 @@ class SharkCacherDecacher : public Shark class SharkDecacher : public SharkCacherDecacher { protected: - SharkDecacher(SharkFunction* function, SharkFrameCache* frame_cache, int bci) - : SharkCacherDecacher(function, frame_cache), _bci(bci) {} + SharkDecacher(SharkFunction* function, int bci) + : SharkCacherDecacher(function), _bci(bci) {} private: int _bci; @@ -223,11 +214,8 @@ class SharkDecacher : public SharkCacher class SharkJavaCallDecacher : public SharkDecacher { public: - SharkJavaCallDecacher(SharkFunction* function, - SharkFrameCache* frame_cache, - int bci, - ciMethod* callee) - : SharkDecacher(function, frame_cache, bci), _callee(callee) {} + SharkJavaCallDecacher(SharkFunction* function, int bci, ciMethod* callee) + : SharkDecacher(function, bci), _callee(callee) {} private: ciMethod* _callee; @@ -271,10 +259,8 @@ class SharkJavaCallDecacher : public Sha class SharkVMCallDecacher : public SharkDecacher { public: - SharkVMCallDecacher(SharkFunction* function, - SharkFrameCache* frame_cache, - int bci) - : SharkDecacher(function, frame_cache, bci) {} + SharkVMCallDecacher(SharkFunction* function, int bci) + : SharkDecacher(function, bci) {} // Stack slot helpers protected: @@ -309,10 +295,8 @@ class SharkVMCallDecacher : public Shark class SharkTrapDecacher : public SharkDecacher { public: - SharkTrapDecacher(SharkFunction* function, - SharkFrameCache* frame_cache, - int bci) - : SharkDecacher(function, frame_cache, bci) {} + SharkTrapDecacher(SharkFunction* function, int bci) + : SharkDecacher(function, bci) {} // Stack slot helpers protected: @@ -347,8 +331,8 @@ class SharkTrapDecacher : public SharkDe class SharkCacher : public SharkCacherDecacher { protected: - SharkCacher(SharkFunction* function, SharkFrameCache* frame_cache) - : SharkCacherDecacher(function, frame_cache) {} + SharkCacher(SharkFunction* function) + : SharkCacherDecacher(function) {} // Callbacks protected: @@ -377,10 +361,8 @@ class SharkCacher : public SharkCacherDe class SharkJavaCallCacher : public SharkCacher { public: - SharkJavaCallCacher(SharkFunction* function, - SharkFrameCache* frame_cache, - ciMethod* callee) - : SharkCacher(function, frame_cache), _callee(callee) {} + SharkJavaCallCacher(SharkFunction* function, ciMethod* callee) + : SharkCacher(function), _callee(callee) {} private: ciMethod* _callee; @@ -402,8 +384,8 @@ class SharkJavaCallCacher : public Shark class SharkVMCallCacher : public SharkCacher { public: - SharkVMCallCacher(SharkFunction* function, SharkFrameCache* frame_cache) - : SharkCacher(function, frame_cache) {} + SharkVMCallCacher(SharkFunction* function) + : SharkCacher(function) {} // Stack slot helper protected: @@ -415,10 +397,8 @@ class SharkVMCallCacher : public SharkCa class SharkFunctionEntryCacher : public SharkCacher { public: - SharkFunctionEntryCacher(SharkFunction* function, - SharkFrameCache* frame_cache, - llvm::Value* method) - : SharkCacher(function, frame_cache), _method(method) {} + SharkFunctionEntryCacher(SharkFunction* function, llvm::Value* method) + : SharkCacher(function), _method(method) {} private: llvm::Value* _method; diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp --- a/ports/hotspot/src/share/vm/shark/sharkFrameCache.cpp Sun Jul 26 20:25:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2009 Red Hat, Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -#include "incls/_precompiled.incl" -#include "incls/_sharkFrameCache.cpp.incl" - -using namespace llvm; - -SharkFrameCache::SharkFrameCache(SharkFunction *function) - : _frame_size(function->extended_frame_size()) -{ - _values = NEW_RESOURCE_ARRAY(Value*, frame_size()); - memset(_values, 0, frame_size() * sizeof(Value *)); -} - -SharkFrameCache::SharkFrameCache(const SharkFrameCache* cache) - : _frame_size(cache->frame_size()) -{ - _values = NEW_RESOURCE_ARRAY(Value*, frame_size()); - memcpy(_values, cache->_values, frame_size() * sizeof(Value *)); -} - -bool SharkFrameCache::equal_to(SharkFrameCache* other) -{ - if (frame_size() != other->frame_size()) - return false; - - for (int i = 0; i < frame_size(); i++) { - if (value(i) != other->value(i)) - return false; - } - - return true; -} - -void SharkFrameCache::merge(SharkFrameCache* other) -{ - assert(frame_size() == other->frame_size(), "should be"); - - for (int i = 0; i < frame_size(); i++) { - if (value(i) != other->value(i)) - set_value(i, NULL); - } -} diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp --- a/ports/hotspot/src/share/vm/shark/sharkFrameCache.hpp Sun Jul 26 20:25:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2009 Red Hat, Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -class SharkFrameCache : public ResourceObj { - public: - SharkFrameCache(SharkFunction* function); - - protected: - SharkFrameCache(const SharkFrameCache* cache); - - private: - int _frame_size; - llvm::Value** _values; - - private: - int frame_size() const - { - return _frame_size; - } - - public: - llvm::Value* value(int slot) - { - assert(slot >= 0 && slot < frame_size(), "bad index"); - return _values[slot]; - } - void set_value(int slot, llvm::Value* value) - { - assert(slot >= 0 && slot < frame_size(), "bad index"); - _values[slot] = value; - } - - // Comparison - public: - bool equal_to(SharkFrameCache* other); - - // Copy and merge - public: - SharkFrameCache *copy() const - { - return new SharkFrameCache(this); - } - void merge(SharkFrameCache* other); -}; diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/shark/sharkState.cpp --- a/ports/hotspot/src/share/vm/shark/sharkState.cpp Sun Jul 26 20:25:37 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkState.cpp Wed Jun 17 14:37:31 2009 +0100 @@ -33,7 +33,6 @@ SharkState::SharkState(SharkBlock* block _function(function), _method(NULL), _oop_tmp(NULL), - _frame_cache(NULL), _has_safepointed(false) { initialize(NULL); @@ -44,7 +43,6 @@ SharkState::SharkState(SharkBlock* block _function(state->function()), _method(state->method()), _oop_tmp(state->oop_tmp()), - _frame_cache(NULL), _has_safepointed(state->has_safepointed()) { initialize(state); @@ -73,13 +71,7 @@ void SharkState::initialize(const SharkS value = value->clone(); push(value); } - - if (state->frame_cache()) - _frame_cache = state->frame_cache()->copy(); } - else if (function()) { - _frame_cache = new SharkFrameCache(function()); - } set_num_monitors(state ? state->num_monitors() : 0); } @@ -144,19 +136,6 @@ bool SharkState::equal_to(SharkState *ot if (!value->equal_to(other_value)) return false; } - } - - // Frame cache - if (frame_cache() == NULL) { - if (other->frame_cache() != NULL) - return false; - } - else { - if (other->frame_cache() == NULL) - return false; - - if (!frame_cache()->equal_to(other->frame_cache())) - return false; } return true; @@ -218,9 +197,6 @@ void SharkState::merge(SharkState* other } } - // Frame cache - frame_cache()->merge(other->frame_cache()); - // Safepointed status set_has_safepointed(this->has_safepointed() && other->has_safepointed()); } @@ -243,8 +219,7 @@ void SharkState::decache_for_Java_call(c void SharkState::decache_for_Java_call(ciMethod* callee) { assert(function() && method(), "you cannot decache here"); - SharkJavaCallDecacher( - function(), frame_cache(), block()->bci(), callee).scan(this); + SharkJavaCallDecacher(function(), block()->bci(), callee).scan(this); pop(callee->arg_size()); } @@ -269,25 +244,25 @@ void SharkState::cache_after_Java_call(c if (type->is_two_word()) push(NULL); } - SharkJavaCallCacher(function(), frame_cache(), callee).scan(this); + SharkJavaCallCacher(function(), callee).scan(this); } void SharkState::decache_for_VM_call() { assert(function() && method(), "you cannot decache here"); - SharkVMCallDecacher(function(), frame_cache(), block()->bci()).scan(this); + SharkVMCallDecacher(function(), block()->bci()).scan(this); } void SharkState::cache_after_VM_call() { assert(function() && method(), "you cannot cache here"); - SharkVMCallCacher(function(), frame_cache()).scan(this); + SharkVMCallCacher(function()).scan(this); } void SharkState::decache_for_trap() { assert(function() && method(), "you cannot decache here"); - SharkTrapDecacher(function(), frame_cache(), block()->bci()).scan(this); + SharkTrapDecacher(function(), block()->bci()).scan(this); } SharkEntryState::SharkEntryState(SharkTopLevelBlock* block, Value* method) @@ -326,7 +301,7 @@ SharkEntryState::SharkEntryState(SharkTo } set_local(i, value); } - SharkFunctionEntryCacher(function(), frame_cache(), method).scan(this); + SharkFunctionEntryCacher(function(), method).scan(this); } SharkPHIState::SharkPHIState(SharkTopLevelBlock* block) diff -r 0baf35fada62 -r 9c4c94b5f4a2 ports/hotspot/src/share/vm/shark/sharkState.hpp From gbenson at redhat.com Mon Aug 3 10:31:21 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:21 +0000 Subject: changeset in /hg/icedtea: 2009-06-26 Gary Benson changeset 97798e89d452 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=97798e89d452 description: 2009-06-26 Gary Benson * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::SharkCompiler): Moved LLVM multithreading initialization from SharkFunction::initialize. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Moved LLVM multithreading initialization to SharkCompiler::SharkCompiler. diffstat: 3 files changed, 18 insertions(+), 6 deletions(-) ChangeLog | 9 +++++++++ ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 9 +++++++++ ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 6 ------ diffs (51 lines): diff -r b26e1c8bfc51 -r 97798e89d452 ChangeLog --- a/ChangeLog Thu Jun 25 11:40:43 2009 +0100 +++ b/ChangeLog Fri Jun 26 04:51:17 2009 -0400 @@ -1,3 +1,12 @@ 2009-06-25 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::SharkCompiler): Moved LLVM multithreading + initialization from SharkFunction::initialize. + * ports/hotspot/src/share/vm/shark/sharkFunction.cpp + (SharkFunction::initialize): Moved LLVM multithreading + initialization to SharkCompiler::SharkCompiler. + 2009-06-25 Gary Benson * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp diff -r b26e1c8bfc51 -r 97798e89d452 ports/hotspot/src/share/vm/shark/sharkCompiler.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Thu Jun 25 11:40:43 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 26 04:51:17 2009 -0400 @@ -33,6 +33,15 @@ SharkCompiler::SharkCompiler() SharkCompiler::SharkCompiler() : AbstractCompiler() { +#if SHARK_LLVM_VERSION >= 26 + // Make LLVM safe for multithreading. We only make LLVM calls from + // the compiler thread, but if LLVM leaves stubs to be rewritten on + // execution then it's possible for Java threads to be making LLVM + // calls at the same time we are. + if (!llvm_start_multithreaded()) + warning("llvm_start_multithreaded() failed"); +#endif + // Create a module to build our functions into _module = new Module("shark"); diff -r b26e1c8bfc51 -r 97798e89d452 ports/hotspot/src/share/vm/shark/sharkFunction.cpp --- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Thu Jun 25 11:40:43 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 26 04:51:17 2009 -0400 @@ -30,12 +30,6 @@ using namespace llvm; void SharkFunction::initialize(const char *name) { - -#if SHARK_LLVM_VERSION >= 26 - // Initialize llvm mutex guards - llvm_start_multithreaded(); -#endif - // Create the function _function = Function::Create( SharkType::entry_point_type(), From gbenson at redhat.com Mon Aug 3 10:31:21 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:21 +0000 Subject: changeset in /hg/icedtea: 2009-07-03 Gary Benson changeset 93d755a6148a in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=93d755a6148a description: 2009-07-03 Gary Benson * ports/hotspot/src/share/vm/shark/sharkEntry.hpp (SharkEntry::print_statistics): Removed. * ports/hotspot/src/share/vm/shark/sharkEntry.cpp: Removed. * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::compile_method): Save location of native code across the call to ciEnv::register_method (which frees the buffer blob it's in), and inline what was SharkEntry::print_statistics. * ports/hotspot/src/share/vm/includeDB_shark: Updated. diffstat: 5 files changed, 22 insertions(+), 49 deletions(-) ChangeLog | 13 ++++++ ports/hotspot/src/share/vm/includeDB_shark | 2 - ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 15 ++++--- ports/hotspot/src/share/vm/shark/sharkEntry.cpp | 38 -------------------- ports/hotspot/src/share/vm/shark/sharkEntry.hpp | 3 - diffs (119 lines): diff -r 97798e89d452 -r 93d755a6148a ChangeLog --- a/ChangeLog Fri Jun 26 04:51:17 2009 -0400 +++ b/ChangeLog Fri Jul 03 11:52:45 2009 +0100 @@ -1,3 +1,16 @@ 2009-06-26 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkEntry.hpp + (SharkEntry::print_statistics): Removed. + * ports/hotspot/src/share/vm/shark/sharkEntry.cpp: Removed. + + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::compile_method): Save location of native code + across the call to ciEnv::register_method (which frees the buffer + blob it's in), and inline what was SharkEntry::print_statistics. + + * ports/hotspot/src/share/vm/includeDB_shark: Updated. + 2009-06-26 Gary Benson * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp diff -r 97798e89d452 -r 93d755a6148a ports/hotspot/src/share/vm/includeDB_shark --- a/ports/hotspot/src/share/vm/includeDB_shark Fri Jun 26 04:51:17 2009 -0400 +++ b/ports/hotspot/src/share/vm/includeDB_shark Fri Jul 03 11:52:45 2009 +0100 @@ -166,8 +166,6 @@ sharkConstant.hpp sharkConstant.hpp ciStreams.hpp sharkConstant.hpp sharkBuilder.hpp sharkConstant.hpp sharkValue.hpp - -sharkEntry.cpp sharkEntry.hpp sharkEntry.hpp llvmHeaders.hpp diff -r 97798e89d452 -r 93d755a6148a ports/hotspot/src/share/vm/shark/sharkCompiler.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 26 04:51:17 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jul 03 11:52:45 2009 +0100 @@ -166,12 +166,12 @@ void SharkCompiler::compile_method(ciEnv entry->set_entry_point( (ZeroEntry::method_entry_t) execution_engine()->getPointerToFunction(function)); + address code_start = entry->code_start(); + address code_limit = entry->code_limit(); // Register generated code for profiling, etc - if (JvmtiExport::should_post_dynamic_code_generated()) { - JvmtiExport::post_dynamic_code_generated( - name, entry->code_start(), entry->code_limit()); - } + if (JvmtiExport::should_post_dynamic_code_generated()) + JvmtiExport::post_dynamic_code_generated(name, code_start, code_limit); // Install the method into the VM CodeOffsets offsets; @@ -198,8 +198,11 @@ void SharkCompiler::compile_method(ciEnv false); // Print statistics, if requested - if (SharkTraceInstalls) - entry->print_statistics(name); + if (SharkTraceInstalls) { + tty->print_cr( + " [%p-%p): %s (%d bytes code)", + code_start, code_limit, name, code_limit - code_start); + } } const char* SharkCompiler::methodname(const ciMethod* target) diff -r 97798e89d452 -r 93d755a6148a ports/hotspot/src/share/vm/shark/sharkEntry.cpp --- a/ports/hotspot/src/share/vm/shark/sharkEntry.cpp Fri Jun 26 04:51:17 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2008, 2009 Red Hat, Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -#include "incls/_precompiled.incl" -#include "incls/_sharkEntry.cpp.incl" - -#ifndef PRODUCT -void SharkEntry::print_statistics(const char* name) const -{ - address start = code_start(); - address limit = code_limit(); - - tty->print_cr( - " [%p-%p): %s (%d bytes code)", start, limit, name, limit - start); -} -#endif // !PRODUCT diff -r 97798e89d452 -r 93d755a6148a ports/hotspot/src/share/vm/shark/sharkEntry.hpp --- a/ports/hotspot/src/share/vm/shark/sharkEntry.hpp Fri Jun 26 04:51:17 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkEntry.hpp Fri Jul 03 11:52:45 2009 +0100 @@ -43,7 +43,4 @@ class SharkEntry : public ZeroEntry { { _code_limit = code_limit; } - - public: - void print_statistics(const char* name) const PRODUCT_RETURN; }; From gbenson at redhat.com Mon Aug 3 10:31:20 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:20 +0000 Subject: changeset in /hg/icedtea: 2009-06-25 Gary Benson changeset b26e1c8bfc51 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=b26e1c8bfc51 description: 2009-06-25 Gary Benson * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp (SharkRuntime::monitorexit_C): Remove unnecessary lock clear. diffstat: 2 files changed, 5 insertions(+), 5 deletions(-) ChangeLog | 5 +++++ ports/hotspot/src/share/vm/shark/sharkRuntime.cpp | 5 ----- diffs (27 lines): diff -r 9ef90ed6dac9 -r b26e1c8bfc51 ChangeLog --- a/ChangeLog Tue Jun 23 16:31:22 2009 +0200 +++ b/ChangeLog Thu Jun 25 11:40:43 2009 +0100 @@ -1,3 +1,8 @@ 2009-06-23 Matthias Klose + + * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp + (SharkRuntime::monitorexit_C): Remove unnecessary lock clear. + 2009-06-23 Matthias Klose * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp: Fix header location. diff -r 9ef90ed6dac9 -r b26e1c8bfc51 ports/hotspot/src/share/vm/shark/sharkRuntime.cpp --- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Tue Jun 23 16:31:22 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Thu Jun 25 11:40:43 2009 +0100 @@ -290,11 +290,6 @@ JRT_ENTRY(void, SharkRuntime::monitorexi THROW(vmSymbols::java_lang_IllegalMonitorStateException()); } ObjectSynchronizer::slow_exit(object(), lock->lock(), thread); - - // Free entry. This must be done here, since a pending exception - // might be installed on exit. If it is not cleared, the exception - // handling code will try to unlock the monitor again. - lock->set_obj(NULL); } JRT_END From xerxes at zafena.se Mon Aug 3 10:31:23 2009 From: xerxes at zafena.se (Xerxes R?nby) Date: Mon, 03 Aug 2009 17:31:23 +0000 Subject: changeset in /hg/icedtea: 2009-07-14 Xerxes R?nby changeset 022c97ae92d2 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=022c97ae92d2 description: 2009-07-14 Xerxes R?nby * ports/hotspot/src/share/vm/shark/llvmValue.hpp (jfloat_constant): Handle LLVM 2.6 svn r75546 API change. llvm::ConstantFP::get have been moved to llvm::LLVMContext::getConstantFP. (jdouble_constant): Likewise. diffstat: 2 files changed, 16 insertions(+), 2 deletions(-) ChangeLog | 8 ++++++++ ports/hotspot/src/share/vm/shark/llvmValue.hpp | 10 ++++++++-- diffs (47 lines): diff -r 2a3a4c5b35e0 -r 022c97ae92d2 ChangeLog --- a/ChangeLog Thu Jul 09 12:49:11 2009 +0200 +++ b/ChangeLog Tue Jul 14 12:55:48 2009 +0200 @@ -1,3 +1,11 @@ 2009-07-09 Xerxes R??nby + + * ports/hotspot/src/share/vm/shark/llvmValue.hpp + (jfloat_constant): Handle LLVM 2.6 svn r75546 API change. + llvm::ConstantFP::get have been moved to + llvm::LLVMContext::getConstantFP. + (jdouble_constant): Likewise. + 2009-07-09 Xerxes R??nby * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp diff -r 2a3a4c5b35e0 -r 022c97ae92d2 ports/hotspot/src/share/vm/shark/llvmValue.hpp --- a/ports/hotspot/src/share/vm/shark/llvmValue.hpp Thu Jul 09 12:49:11 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/llvmValue.hpp Tue Jul 14 12:55:48 2009 +0200 @@ -39,20 +39,26 @@ class LLVMValue : public AllStatic { } #if SHARK_LLVM_VERSION >= 26 static llvm::Constant* jfloat_constant(jfloat value) + { + return llvm::getGlobalContext().getConstantFP(SharkType::jfloat_type(), value); + } #else static llvm::ConstantFP* jfloat_constant(jfloat value) -#endif { return llvm::ConstantFP::get(SharkType::jfloat_type(), value); } +#endif #if SHARK_LLVM_VERSION >= 26 static llvm::Constant* jdouble_constant(jdouble value) + { + return llvm::getGlobalContext().getConstantFP(SharkType::jdouble_type(), value); + } #else static llvm::ConstantFP* jdouble_constant(jdouble value) -#endif { return llvm::ConstantFP::get(SharkType::jdouble_type(), value); } +#endif static llvm::ConstantPointerNull* null() { return llvm::ConstantPointerNull::get(SharkType::jobject_type()); From xerxes at zafena.se Mon Aug 3 10:31:22 2009 From: xerxes at zafena.se (Xerxes R?nby) Date: Mon, 03 Aug 2009 17:31:22 +0000 Subject: changeset in /hg/icedtea: 2009-07-08 Xerxes R?nby changeset d29fab296cd2 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=d29fab296cd2 description: 2009-07-08 Xerxes R?nby * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp (SharkBuilder::pointer_constant): Pass the LLVMContext returned from getGlobalContext() to the new GlobalVariable constructor when llvm version are 2.6 or later to handle LLVM API change. * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp (SharkBuilder::CreateDump): Likewise. diffstat: 3 files changed, 23 insertions(+), 1 deletion(-) ChangeLog | 9 +++++++++ ports/hotspot/src/share/vm/shark/sharkBuilder.cpp | 6 ++++++ ports/hotspot/src/share/vm/shark/sharkBuilder.hpp | 9 ++++++++- diffs (51 lines): diff -r 225f4d8d7962 -r d29fab296cd2 ChangeLog --- a/ChangeLog Tue Jul 07 10:58:02 2009 +0200 +++ b/ChangeLog Wed Jul 08 11:28:08 2009 +0200 @@ -1,3 +1,12 @@ 2009-07-07 Xerxes R??nby + + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + (SharkBuilder::pointer_constant): Pass the LLVMContext returned + from getGlobalContext() to the new GlobalVariable constructor + when llvm version are 2.6 or later to handle LLVM API change. + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + (SharkBuilder::CreateDump): Likewise. + 2009-07-07 Xerxes R??nby * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp diff -r 225f4d8d7962 -r d29fab296cd2 ports/hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Tue Jul 07 10:58:02 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Wed Jul 08 11:28:08 2009 +0200 @@ -187,6 +187,12 @@ CallInst* SharkBuilder::CreateDump(llvm: Value *name = CreatePtrToInt( CreateStructGEP( new GlobalVariable( +#if SHARK_LLVM_VERSION >= 26 + // LLVM 2.6 requires a LLVMContext during GlobalVariable construction. + // getGlobalConext() returns one that can be used as long as the shark + // compiler are single-threaded. + getGlobalContext(), +#endif const_name->getType(), true, GlobalValue::InternalLinkage, const_name, "dump", module()), diff -r 225f4d8d7962 -r d29fab296cd2 ports/hotspot/src/share/vm/shark/sharkBuilder.hpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Tue Jul 07 10:58:02 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Wed Jul 08 11:28:08 2009 +0200 @@ -174,7 +174,14 @@ class SharkBuilder : public llvm::IRBuil char name[128]; snprintf(name, sizeof name - 1, "pointer_constant_%p", ptr); - GlobalVariable *value = new GlobalVariable(SharkType::intptr_type(), + GlobalVariable *value = new GlobalVariable( +#if SHARK_LLVM_VERSION >= 26 + // LLVM 2.6 requires a LLVMContext during GlobalVariable construction. + // getGlobalConext() returns one that can be used as long as the shark + // compiler are single-threaded. + getGlobalContext(), +#endif + SharkType::intptr_type(), false, GlobalValue::ExternalLinkage, NULL, name, module()); execution_engine()->addGlobalMapping(value, const_cast(ptr)); From xerxes at zafena.se Mon Aug 3 10:31:22 2009 From: xerxes at zafena.se (Xerxes R?nby) Date: Mon, 03 Aug 2009 17:31:22 +0000 Subject: changeset in /hg/icedtea: 2009-07-07 Xerxes R?nby changeset 225f4d8d7962 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=225f4d8d7962 description: 2009-07-07 Xerxes R?nby * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Include llvm/LLVMContext.h used by getGlobalContext() when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::SharkCompiler): Pass the LLVMContext returned from getGlobalContext() to the new Module constructor when llvm version are 2.6 or later to handle LLVM API change. diffstat: 3 files changed, 21 insertions(+) ChangeLog | 10 ++++++++++ ports/hotspot/src/share/vm/shark/llvmHeaders.hpp | 3 +++ ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 8 ++++++++ diffs (49 lines): diff -r 93d755a6148a -r 225f4d8d7962 ChangeLog --- a/ChangeLog Fri Jul 03 11:52:45 2009 +0100 +++ b/ChangeLog Tue Jul 07 10:58:02 2009 +0200 @@ -1,3 +1,13 @@ 2009-07-03 Gary Benson + + * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp + Include llvm/LLVMContext.h used by getGlobalContext() + when llvm version are 2.6 or later. + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::SharkCompiler): Pass the LLVMContext returned + from getGlobalContext() to the new Module constructor + when llvm version are 2.6 or later to handle LLVM API change. + 2009-07-03 Gary Benson * ports/hotspot/src/share/vm/shark/sharkEntry.hpp diff -r 93d755a6148a -r 225f4d8d7962 ports/hotspot/src/share/vm/shark/llvmHeaders.hpp --- a/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Fri Jul 03 11:52:45 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Tue Jul 07 10:58:02 2009 +0200 @@ -32,6 +32,9 @@ #include #include #include +#if SHARK_LLVM_VERSION >= 26 +#include +#endif #include #include #include diff -r 93d755a6148a -r 225f4d8d7962 ports/hotspot/src/share/vm/shark/sharkCompiler.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jul 03 11:52:45 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Tue Jul 07 10:58:02 2009 +0200 @@ -43,7 +43,15 @@ SharkCompiler::SharkCompiler() #endif // Create a module to build our functions into +#if SHARK_LLVM_VERSION >= 26 + // LLVM 2.6 and later requires passing a LLVMContext during module + // creation. The LLVM API getGlobalContext() returns a LLVMContext that + // can be used safely as long as the shark compiler stays single threaded + // and only uses one module. + _module = new Module("shark", getGlobalContext()); +#else _module = new Module("shark"); +#endif // Create the builder to build our functions _builder = new SharkBuilder(this); From gbenson at redhat.com Mon Aug 3 10:31:18 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:18 +0000 Subject: changeset in /hg/icedtea: 2009-06-19 Gary Benson changeset 6690b58a6c66 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=6690b58a6c66 description: 2009-06-19 Gary Benson * ports/hotspot/src/share/vm/shark/sharkEntry.hpp (SharkEntry::_llvm_function): Removed. (SharkEntry::llvm_function): Likewise. (SharkEntry::set_llvm_function): Likewise. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Removed call to set_llvm_function. diffstat: 3 files changed, 11 insertions(+), 13 deletions(-) ChangeLog | 10 ++++++++++ ports/hotspot/src/share/vm/shark/sharkEntry.hpp | 13 +------------ ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 1 - diffs (51 lines): diff -r 21f0340f7c98 -r 6690b58a6c66 ChangeLog --- a/ChangeLog Thu Jun 18 12:14:25 2009 -0400 +++ b/ChangeLog Fri Jun 19 03:59:26 2009 -0400 @@ -1,3 +1,13 @@ 2009-06-18 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkEntry.hpp + (SharkEntry::_llvm_function): Removed. + (SharkEntry::llvm_function): Likewise. + (SharkEntry::set_llvm_function): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkFunction.cpp + (SharkFunction::initialize): Removed call to set_llvm_function. + 2009-06-18 Gary Benson * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp diff -r 21f0340f7c98 -r 6690b58a6c66 ports/hotspot/src/share/vm/shark/sharkEntry.hpp --- a/ports/hotspot/src/share/vm/shark/sharkEntry.hpp Thu Jun 18 12:14:25 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkEntry.hpp Fri Jun 19 03:59:26 2009 -0400 @@ -27,18 +27,7 @@ class SharkEntry : public ZeroEntry { friend class SharkMemoryManager; private: - llvm::Function* _llvm_function; - address _code_limit; - - public: - llvm::Function* llvm_function() const - { - return _llvm_function; - } - void set_llvm_function(llvm::Function* llvm_function) - { - _llvm_function = llvm_function; - } + address _code_limit; public: address code_start() const diff -r 21f0340f7c98 -r 6690b58a6c66 ports/hotspot/src/share/vm/shark/sharkFunction.cpp --- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Thu Jun 18 12:14:25 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 19 03:59:26 2009 -0400 @@ -38,7 +38,6 @@ void SharkFunction::initialize() // Create the function _function = builder()->CreateFunction(name()); - entry->set_llvm_function(function()); memory_manager()->set_entry_for_function(function(), entry); // Get our arguments From gbenson at redhat.com Mon Aug 3 10:31:18 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:18 +0000 Subject: changeset in /hg/icedtea: 2009-06-19 Gary Benson changeset 3d97a22bbdab in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=3d97a22bbdab description: 2009-06-19 Gary Benson * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp (SharkCompiler::compile): Removed. * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::compile_method): Moved all non-IR-emission code from SharkFunction::initialize, and the IR-to-native code from SharkCompiler::compile, here. Also changed all debug options that take a method name to use fnmatch. (SharkCompiler::compile): Removed. * ports/hotspot/src/share/vm/shark/sharkFunction.hpp (SharkFunction::_name): Removed. (SharkFunction::_name): Likewise. (SharkFunction::initialize): Receive name in argument. (SharkFunction::SharkFunction): Updated. (SharkFunction::build): New method. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Receive name in argument, and moved all code not relating to emitting the function's IR to SharkCompiler::compile_method. * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp (SharkBuilder::CreateFunction): Removed. * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp (SharkBuilder::CreateFunction): Likewise. * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp (SharkCompileInvariants::memory_manager): Removed. diffstat: 8 files changed, 94 insertions(+), 91 deletions(-) ChangeLog | 30 +++++++ ports/hotspot/src/share/vm/shark/sharkBuilder.cpp | 10 -- ports/hotspot/src/share/vm/shark/sharkBuilder.hpp | 4 - ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 72 ++++++++++-------- ports/hotspot/src/share/vm/shark/sharkCompiler.hpp | 3 ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 35 +------- ports/hotspot/src/share/vm/shark/sharkFunction.hpp | 27 ++++-- ports/hotspot/src/share/vm/shark/sharkInvariants.hpp | 4 - diffs (306 lines): diff -r 6690b58a6c66 -r 3d97a22bbdab ChangeLog --- a/ChangeLog Fri Jun 19 03:59:26 2009 -0400 +++ b/ChangeLog Fri Jun 19 06:03:31 2009 -0400 @@ -1,3 +1,33 @@ 2009-06-19 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp + (SharkCompiler::compile): Removed. + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::compile_method): Moved all non-IR-emission + code from SharkFunction::initialize, and the IR-to-native + code from SharkCompiler::compile, here. Also changed all + debug options that take a method name to use fnmatch. + (SharkCompiler::compile): Removed. + + * ports/hotspot/src/share/vm/shark/sharkFunction.hpp + (SharkFunction::_name): Removed. + (SharkFunction::_name): Likewise. + (SharkFunction::initialize): Receive name in argument. + (SharkFunction::SharkFunction): Updated. + (SharkFunction::build): New method. + * ports/hotspot/src/share/vm/shark/sharkFunction.cpp + (SharkFunction::initialize): Receive name in argument, + and moved all code not relating to emitting the function's + IR to SharkCompiler::compile_method. + + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + (SharkBuilder::CreateFunction): Removed. + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + (SharkBuilder::CreateFunction): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp + (SharkCompileInvariants::memory_manager): Removed. + 2009-06-19 Gary Benson * ports/hotspot/src/share/vm/shark/sharkEntry.hpp diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Jun 19 06:03:31 2009 -0400 @@ -176,16 +176,6 @@ void SharkBuilder::init_external_functio set_llvm_pow_fn(module()->getOrInsertFunction("llvm.pow.f64", type)); } -Function *SharkBuilder::CreateFunction(const char *name) -{ - Function *function = Function::Create( - SharkType::entry_point_type(), - GlobalVariable::InternalLinkage, - name); - module()->getFunctionList().push_back(function); - return function; -} - CallInst* SharkBuilder::CreateDump(llvm::Value* value) { Constant *const_name; diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkBuilder.hpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -45,10 +45,6 @@ class SharkBuilder : public llvm::IRBuil { return compiler()->execution_engine(); } - - // Function creation - public: - llvm::Function *CreateFunction(const char *name = "func"); // Helpers for creating basic blocks // NB don't use unless SharkFunction::CreateBlock is unavailable diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkCompiler.cpp --- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 19 06:03:31 2009 -0400 @@ -91,7 +91,7 @@ void SharkCompiler::compile_method(ciEnv #endif // !PRODUCT if (SharkOnlyCompile != NULL) { - if (strcmp(SharkOnlyCompile, name)) { + if (fnmatch(SharkOnlyCompile, name, 0)) { env->record_method_not_compilable("does not match SharkOnlyCompile"); return; } @@ -102,8 +102,7 @@ void SharkCompiler::compile_method(ciEnv if (env->failing()) return; if (SharkPrintTypeflowOf != NULL) { - if (!strcmp(SharkPrintTypeflowOf, name) || - !strcmp(SharkPrintTypeflowOf, "*")) + if (!fnmatch(SharkPrintTypeflowOf, name, 0)) flow->print_on(tty); } @@ -119,12 +118,46 @@ void SharkCompiler::compile_method(ciEnv SharkCodeBuffer cb(env->oop_recorder()); builder()->set_code_buffer(&cb); - // Compile the method - SharkFunction function(this, env, flow, name); + // Emit the entry point + SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry)); + + // Build the LLVM IR for the method + Function *function = SharkFunction::build(this, env, flow, name); + if (SharkPrintBitcodeOf != NULL) { + if (!fnmatch(SharkPrintBitcodeOf, name, 0)) + function->dump(); + } // Unhook the code buffer builder()->set_code_buffer(NULL); + // Compile to native code +#ifndef PRODUCT +#ifdef X86 + if (SharkPrintAsmOf != NULL) { + std::vector args; + args.push_back(""); // program name + if (!fnmatch(SharkPrintAsmOf, name, 0)) + args.push_back("-debug-only=x86-emitter"); + else + args.push_back("-debug-only=none"); + args.push_back(0); // terminator + cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]); + } +#endif // X86 +#endif // !PRODUCT + memory_manager()->set_entry_for_function(function, entry); + module()->getFunctionList().push_back(function); + entry->set_entry_point( + (ZeroEntry::method_entry_t) + execution_engine()->getPointerToFunction(function)); + + // Register generated code for profiling, etc + if (JvmtiExport::should_post_dynamic_code_generated()) { + JvmtiExport::post_dynamic_code_generated( + name, entry->code_start(), entry->code_limit()); + } + // Install the method into the VM CodeOffsets offsets; offsets.set_value(CodeOffsets::Deopt, 0); @@ -148,31 +181,10 @@ void SharkCompiler::compile_method(ciEnv env->comp_level(), false, false); -} - - -ZeroEntry::method_entry_t SharkCompiler::compile(const char* name, - Function* function) -{ - // Dump the generated code, if requested -#ifndef PRODUCT -#ifdef X86 - if (SharkPrintAsmOf != NULL) { - std::vector args; - args.push_back(""); // program name - if (!fnmatch(SharkPrintAsmOf, name, 0)) - args.push_back("-debug-only=x86-emitter"); - else - args.push_back("-debug-only=none"); - args.push_back(0); // terminator - cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]); - } -#endif // X86 -#endif // !PRODUCT - - // Compile to native code - return (ZeroEntry::method_entry_t) - execution_engine()->getPointerToFunction(function); + + // Print statistics, if requested + if (SharkTraceInstalls) + entry->print_statistics(name); } const char* SharkCompiler::methodname(const ciMethod* target) diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkCompiler.hpp --- a/ports/hotspot/src/share/vm/shark/sharkCompiler.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -72,9 +72,6 @@ class SharkCompiler : public AbstractCom return _execution_engine; } - public: - ZeroEntry::method_entry_t compile(const char* name, llvm::Function* func); - // Helper private: static const char* methodname(const ciMethod* target); diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkFunction.cpp --- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 19 06:03:31 2009 -0400 @@ -26,19 +26,15 @@ #include "incls/_precompiled.incl" #include "incls/_sharkFunction.cpp.incl" -#include - using namespace llvm; -void SharkFunction::initialize() -{ - // Emit the entry point - SharkEntry *entry = - (SharkEntry *) builder()->code_buffer()->malloc(sizeof(SharkEntry)); - +void SharkFunction::initialize(const char *name) +{ // Create the function - _function = builder()->CreateFunction(name()); - memory_manager()->set_entry_for_function(function(), entry); + _function = Function::Create( + SharkType::entry_point_type(), + GlobalVariable::InternalLinkage, + name); // Get our arguments Function::arg_iterator ai = function()->arg_begin(); @@ -118,25 +114,6 @@ void SharkFunction::initialize() block(i)->emit_IR(); } do_deferred_zero_checks(); - - // Dump the bitcode, if requested - if (SharkPrintBitcodeOf != NULL) { - if (!fnmatch(SharkPrintBitcodeOf, name(), 0)) - function()->dump(); - } - - // Compile to native code - entry->set_entry_point(compiler()->compile(name(), function())); - - // Register generated code for profiling, etc - if (JvmtiExport::should_post_dynamic_code_generated()) { - JvmtiExport::post_dynamic_code_generated( - name(), entry->code_start(), entry->code_limit()); - } - - // Print statistics, if requested - if (SharkTraceInstalls) - entry->print_statistics(name()); } void SharkFunction::CreateInitZeroStack() diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkFunction.hpp --- a/ports/hotspot/src/share/vm/shark/sharkFunction.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -28,26 +28,31 @@ class DeferredZeroCheck; class SharkFunction : public SharkTargetInvariants { public: + static llvm::Function* build(SharkCompiler* compiler, + ciEnv* env, + ciTypeFlow* flow, + const char* name) + { + SharkFunction function(compiler, env, flow, name); + return function.function(); + } + + private: SharkFunction(SharkCompiler* compiler, ciEnv* env, ciTypeFlow* flow, const char* name) - : SharkTargetInvariants(compiler, env, flow), _name(name) { initialize(); } - - private: - void initialize(); - - private: - const char* _name; + : SharkTargetInvariants(compiler, env, flow) { initialize(name); } + + private: + void initialize(const char* name); + + private: llvm::Function* _function; SharkTopLevelBlock** _blocks; GrowableArray _deferred_zero_checks; public: - const char* name() const - { - return _name; - } llvm::Function* function() const { return _function; diff -r 6690b58a6c66 -r 3d97a22bbdab ports/hotspot/src/share/vm/shark/sharkInvariants.hpp --- a/ports/hotspot/src/share/vm/shark/sharkInvariants.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkInvariants.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -93,10 +93,6 @@ class SharkCompileInvariants : public Re { return compiler()->builder(); } - SharkMemoryManager* memory_manager() const - { - return compiler()->memory_manager(); - } DebugInformationRecorder* debug_info() const { return env()->debug_info(); From xerxes at zafena.se Mon Aug 3 10:31:23 2009 From: xerxes at zafena.se (Xerxes R?nby) Date: Mon, 03 Aug 2009 17:31:23 +0000 Subject: changeset in /hg/icedtea: 2009-07-09 Xerxes R?nby changeset 2a3a4c5b35e0 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=2a3a4c5b35e0 description: 2009-07-09 Xerxes R?nby * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp (SharkBuilder::SharkBuilder): Pass the LLVMContext returned from getGlobalContext() to the new IRBuilder constructor when llvm version are 2.6 or later to handle LLVM API change. * ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp: New methods allocateGlobal, setPoisonMemory, dependent on the llvm version. * ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp: Likewise. diffstat: 4 files changed, 31 insertions(+) ChangeLog | 12 ++++++++++++ ports/hotspot/src/share/vm/shark/sharkBuilder.cpp | 7 +++++++ ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp | 10 ++++++++++ ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp | 2 ++ diffs (76 lines): diff -r d29fab296cd2 -r 2a3a4c5b35e0 ChangeLog --- a/ChangeLog Wed Jul 08 11:28:08 2009 +0200 +++ b/ChangeLog Thu Jul 09 12:49:11 2009 +0200 @@ -1,3 +1,15 @@ 2009-07-08 Xerxes R??nby + + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + (SharkBuilder::SharkBuilder): Pass the LLVMContext returned + from getGlobalContext() to the new IRBuilder constructor + when llvm version are 2.6 or later to handle LLVM API change. + * ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp: + New methods allocateGlobal, setPoisonMemory, dependent on the + llvm version. + * ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp: + Likewise. + 2009-07-08 Xerxes R??nby * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp diff -r d29fab296cd2 -r 2a3a4c5b35e0 ports/hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Wed Jul 08 11:28:08 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Thu Jul 09 12:49:11 2009 +0200 @@ -61,7 +61,14 @@ extern "C" { #endif SharkBuilder::SharkBuilder(SharkCompiler* compiler) +#if SHARK_LLVM_VERSION >= 26 + // LLVM 2.6 requires a LLVMContext during IRBuilder construction. + // getGlobalConext() returns one that can be used as long as the shark + // compiler are single-threaded. + : IRBuilder<>(getGlobalContext()), +#else : IRBuilder<>(), +#endif _compiler(compiler) { init_external_functions(); diff -r d29fab296cd2 -r 2a3a4c5b35e0 ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp --- a/ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp Wed Jul 08 11:28:08 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp Thu Jul 09 12:49:11 2009 +0200 @@ -92,6 +92,11 @@ void SharkMemoryManager::deallocateMemFo } #if SHARK_LLVM_VERSION >= 26 +uint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size, unsigned int Alignment) +{ + return mm()->allocateGlobal(Size, Alignment); +} + void* SharkMemoryManager::getDlsymTable() const { return mm()->getDlsymTable(); @@ -100,6 +105,11 @@ void SharkMemoryManager::SetDlsymTable(v void SharkMemoryManager::SetDlsymTable(void *ptr) { mm()->SetDlsymTable(ptr); +} + +void SharkMemoryManager::setPoisonMemory(bool poison) +{ + mm()->setPoisonMemory(poison); } #endif diff -r d29fab296cd2 -r 2a3a4c5b35e0 ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp --- a/ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp Wed Jul 08 11:28:08 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp Thu Jul 09 12:49:11 2009 +0200 @@ -74,6 +74,8 @@ class SharkMemoryManager : public llvm:: #if SHARK_LLVM_VERSION >= 26 void* getDlsymTable() const; void SetDlsymTable(void *ptr); + void setPoisonMemory(bool); + uint8_t* allocateGlobal(uintptr_t, unsigned int); #endif void setMemoryWritable(); void setMemoryExecutable(); From gbenson at redhat.com Mon Aug 3 10:31:25 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:25 +0000 Subject: changeset in /hg/icedtea: 2009-07-30 Gary Benson changeset 9a952e506f16 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9a952e506f16 description: 2009-07-30 Gary Benson * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp: * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp: Moved everything except the actual methods called by JIT-compiled code into SharkBuilder. * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Merged code to create LLVM callable objects for runtime methods from SharkRuntime, and refactored it (and the existing code to create LLVM callable objects for LLVM intrinsics) to create such objects on the fly. * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp (SharkCompiler::_builder): Removed. (SharkCompiler::builder): Likewise. * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp (SharkCompileInvariants::SharkCompileInvariants): Take a new argument, builder, and store it. (SharkCompileInvariants::builder): Updated. (SharkCompileInvariants::code_buffer): New method. (SharkTargetInvariants::SharkTargetInvariants): Take a new argument, builder, and pass it along to SharkCompileInvariants constructor. * ports/hotspot/src/share/vm/shark/sharkFunction.hpp (SharkFunction::build): Take a new argument, builder, and pass it along to SharkFunction consructor. (SharkFunction::SharkFunction): Take a new argument, builder, and pass it along to SharkTargetInvariants consructor. * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::SharkCompiler): Remove builder creation and SharkRuntime initialization. (SharkCompiler::compile_method): Create builder and pass it to SharkFunction::build. * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::parse_bytecode): Updated for new style calls. * ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp (SharkIntrinsics::do_Math_1to1): Likewise. (SharkIntrinsics::do_Math_2to1): Likewise. * ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp (SharkIntrinsics::do_intrinsic): Likewise. (SharkIntrinsics::do_Math_1to1): Likewise. (SharkIntrinsics::do_Math_2to1): Likewise. (SharkIntrinsics::do_System_currentTimeMillis): Likewise. (SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise. * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp (SharkTopLevelBlock::call_vm): Likewise. * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp (SharkTopLevelBlock::zero_check_value): Likewise. (SharkTopLevelBlock::check_bounds): Likewise. (SharkTopLevelBlock::maybe_add_safepoint): Likewise. (SharkTopLevelBlock::do_trap): Likewise. (SharkTopLevelBlock::call_register_finalizer): Likewise. (SharkTopLevelBlock::get_interface_callee): Likewise. (SharkTopLevelBlock::do_new): Likewise. (SharkTopLevelBlock::do_newarray): Likewise. (SharkTopLevelBlock::do_anewarray): Likewise. (SharkTopLevelBlock::do_multianewarray): Likewise. (SharkTopLevelBlock::acquire_lock): Likewise. (SharkTopLevelBlock::release_lock): Likewise. * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp (SharkDecacher::start_frame): Updated for new style codebuffer access. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Likewise. * ports/hotspot/src/share/vm/shark/llvmValue.hpp (LLVMValue::bit_constant): New method. * ports/hotspot/src/share/vm/shark/sharkBlock.hpp (SharkBlock::call_vm_leaf): Removed. * ports/hotspot/src/share/vm/includeDB_shark: Updated. diffstat: 19 files changed, 902 insertions(+), 1060 deletions(-) ChangeLog | 76 + ports/hotspot/src/share/vm/includeDB_shark | 7 ports/hotspot/src/share/vm/shark/llvmValue.hpp | 10 ports/hotspot/src/share/vm/shark/sharkBlock.cpp | 12 ports/hotspot/src/share/vm/shark/sharkBlock.hpp | 7 ports/hotspot/src/share/vm/shark/sharkBuilder.cpp | 779 ++++++++++----- ports/hotspot/src/share/vm/shark/sharkBuilder.hpp | 426 ++------ ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp | 2 ports/hotspot/src/share/vm/shark/sharkCompiler.cpp | 13 ports/hotspot/src/share/vm/shark/sharkCompiler.hpp | 7 ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 2 ports/hotspot/src/share/vm/shark/sharkFunction.hpp | 6 ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp | 28 ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp | 4 ports/hotspot/src/share/vm/shark/sharkInvariants.hpp | 35 ports/hotspot/src/share/vm/shark/sharkRuntime.cpp | 267 ----- ports/hotspot/src/share/vm/shark/sharkRuntime.hpp | 191 --- ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | 54 - ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp | 36 diffs (truncated from 2632 to 500 lines): diff -r 1791126ef6df -r 9a952e506f16 ChangeLog --- a/ChangeLog Fri Jul 17 06:04:59 2009 -0400 +++ b/ChangeLog Thu Jul 30 04:51:32 2009 -0400 @@ -1,3 +1,79 @@ 2009-07-17 Gary Benson + + * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp: + * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp: + Moved everything except the actual methods called by + JIT-compiled code into SharkBuilder. + + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + Merged code to create LLVM callable objects for runtime + methods from SharkRuntime, and refactored it (and the + existing code to create LLVM callable objects for LLVM + intrinsics) to create such objects on the fly. + + * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp + (SharkCompiler::_builder): Removed. + (SharkCompiler::builder): Likewise. + * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp + (SharkCompileInvariants::SharkCompileInvariants): Take a new + argument, builder, and store it. + (SharkCompileInvariants::builder): Updated. + (SharkCompileInvariants::code_buffer): New method. + (SharkTargetInvariants::SharkTargetInvariants): Take a new + argument, builder, and pass it along to SharkCompileInvariants + constructor. + * ports/hotspot/src/share/vm/shark/sharkFunction.hpp + (SharkFunction::build): Take a new argument, builder, and pass + it along to SharkFunction consructor. + (SharkFunction::SharkFunction): Take a new argument, builder, + and pass it along to SharkTargetInvariants consructor. + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::SharkCompiler): Remove builder creation and + SharkRuntime initialization. + (SharkCompiler::compile_method): Create builder and pass it + to SharkFunction::build. + + * ports/hotspot/src/share/vm/shark/sharkBlock.cpp + (SharkBlock::parse_bytecode): Updated for new style calls. + * ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp + (SharkIntrinsics::do_Math_1to1): Likewise. + (SharkIntrinsics::do_Math_2to1): Likewise. + * ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp + (SharkIntrinsics::do_intrinsic): Likewise. + (SharkIntrinsics::do_Math_1to1): Likewise. + (SharkIntrinsics::do_Math_2to1): Likewise. + (SharkIntrinsics::do_System_currentTimeMillis): Likewise. + (SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise. + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp + (SharkTopLevelBlock::call_vm): Likewise. + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp + (SharkTopLevelBlock::zero_check_value): Likewise. + (SharkTopLevelBlock::check_bounds): Likewise. + (SharkTopLevelBlock::maybe_add_safepoint): Likewise. + (SharkTopLevelBlock::do_trap): Likewise. + (SharkTopLevelBlock::call_register_finalizer): Likewise. + (SharkTopLevelBlock::get_interface_callee): Likewise. + (SharkTopLevelBlock::do_new): Likewise. + (SharkTopLevelBlock::do_newarray): Likewise. + (SharkTopLevelBlock::do_anewarray): Likewise. + (SharkTopLevelBlock::do_multianewarray): Likewise. + (SharkTopLevelBlock::acquire_lock): Likewise. + (SharkTopLevelBlock::release_lock): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp + (SharkDecacher::start_frame): Updated for new style codebuffer access. + * ports/hotspot/src/share/vm/shark/sharkFunction.cpp + (SharkFunction::initialize): Likewise. + + * ports/hotspot/src/share/vm/shark/llvmValue.hpp + (LLVMValue::bit_constant): New method. + + * ports/hotspot/src/share/vm/shark/sharkBlock.hpp + (SharkBlock::call_vm_leaf): Removed. + + * ports/hotspot/src/share/vm/includeDB_shark: Updated. + 2009-07-17 Gary Benson * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp diff -r 1791126ef6df -r 9a952e506f16 ports/hotspot/src/share/vm/includeDB_shark --- a/ports/hotspot/src/share/vm/includeDB_shark Fri Jul 17 06:04:59 2009 -0400 +++ b/ports/hotspot/src/share/vm/includeDB_shark Thu Jul 30 04:51:32 2009 -0400 @@ -72,7 +72,6 @@ sharkBlock.cpp sharkBlock.cpp sharkBlock.hpp sharkBlock.cpp sharkBuilder.hpp sharkBlock.cpp sharkConstant.hpp -sharkBlock.cpp sharkRuntime.hpp sharkBlock.cpp sharkState.hpp sharkBlock.cpp sharkValue.hpp @@ -149,7 +148,6 @@ sharkCompiler.cpp sharkCompiler.cpp sharkEntry.hpp sharkCompiler.cpp sharkFunction.hpp sharkCompiler.cpp sharkMemoryManager.hpp -sharkCompiler.cpp sharkRuntime.hpp sharkCompiler.hpp abstractCompiler.hpp sharkCompiler.hpp ciEnv.hpp @@ -212,7 +210,6 @@ sharkIntrinsics.cpp sharkIntrinsics.cpp llvmHeaders.hpp sharkIntrinsics.cpp shark_globals.hpp sharkIntrinsics.cpp sharkIntrinsics.hpp -sharkIntrinsics.cpp sharkRuntime.hpp sharkIntrinsics.cpp sharkState.hpp sharkIntrinsics.cpp sharkValue.hpp @@ -246,15 +243,12 @@ sharkRuntime.cpp sharkRuntime.cpp deoptimization.hpp sharkRuntime.cpp llvmHeaders.hpp sharkRuntime.cpp klassOop.hpp -sharkRuntime.cpp sharkBuilder.hpp sharkRuntime.cpp sharkRuntime.hpp -sharkRuntime.cpp sharkType.hpp sharkRuntime.cpp thread.hpp sharkRuntime.hpp allocation.hpp sharkRuntime.hpp llvmHeaders.hpp sharkRuntime.hpp klassOop.hpp -sharkRuntime.hpp sharkBuilder.hpp sharkRuntime.hpp thread.hpp sharkState.cpp allocation.hpp @@ -298,7 +292,6 @@ sharkTopLevelBlock.cpp sharkTopLevelBlock.cpp sharkBuilder.hpp sharkTopLevelBlock.cpp sharkConstant.hpp sharkTopLevelBlock.cpp sharkInliner.hpp -sharkTopLevelBlock.cpp sharkRuntime.hpp sharkTopLevelBlock.cpp sharkState.hpp sharkTopLevelBlock.cpp sharkValue.hpp diff -r 1791126ef6df -r 9a952e506f16 ports/hotspot/src/share/vm/shark/llvmValue.hpp --- a/ports/hotspot/src/share/vm/shark/llvmValue.hpp Fri Jul 17 06:04:59 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/llvmValue.hpp Thu Jul 30 04:51:32 2009 -0400 @@ -1,6 +1,6 @@ /* * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2008 Red Hat, Inc. + * Copyright 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,6 +77,14 @@ class LLVMValue : public AllStatic { } public: + static llvm::ConstantInt* bit_constant(int value) + { +#if SHARK_LLVM_VERSION >= 26 + return llvm::getGlobalContext().getConstantInt(llvm::Type::Int1Ty, value, false); +#else + return llvm::ConstantInt::get(llvm::Type::Int1Ty, value, false); +#endif + } static llvm::ConstantInt* intptr_constant(intptr_t value) { #if SHARK_LLVM_VERSION >= 26 diff -r 1791126ef6df -r 9a952e506f16 ports/hotspot/src/share/vm/shark/sharkBlock.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Fri Jul 17 06:04:59 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Thu Jul 30 04:51:32 2009 -0400 @@ -694,11 +694,13 @@ void SharkBlock::parse_bytecode(int star case Bytecodes::_f2i: push(SharkValue::create_jint( - call_vm_leaf(SharkRuntime::f2i(), pop()->jfloat_value()), false)); + builder()->CreateCall( + builder()->f2i(), pop()->jfloat_value()), false)); break; case Bytecodes::_f2l: push(SharkValue::create_jlong( - call_vm_leaf(SharkRuntime::f2l(), pop()->jfloat_value()), false)); + builder()->CreateCall( + builder()->f2l(), pop()->jfloat_value()), false)); break; case Bytecodes::_f2d: push(SharkValue::create_jdouble( @@ -708,11 +710,13 @@ void SharkBlock::parse_bytecode(int star case Bytecodes::_d2i: push(SharkValue::create_jint( - call_vm_leaf(SharkRuntime::d2i(), pop()->jdouble_value()), false)); + builder()->CreateCall( + builder()->d2i(), pop()->jdouble_value()), false)); break; case Bytecodes::_d2l: push(SharkValue::create_jlong( - call_vm_leaf(SharkRuntime::d2l(), pop()->jdouble_value()), false)); + builder()->CreateCall( + builder()->d2l(), pop()->jdouble_value()), false)); break; case Bytecodes::_d2f: push(SharkValue::create_jfloat( diff -r 1791126ef6df -r 9a952e506f16 ports/hotspot/src/share/vm/shark/sharkBlock.hpp --- a/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Fri Jul 17 06:04:59 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Thu Jul 30 04:51:32 2009 -0400 @@ -174,13 +174,6 @@ class SharkBlock : public SharkTargetInv protected: virtual void do_zero_check(SharkValue* value); - // Leaf calls - protected: - llvm::CallInst* call_vm_leaf(llvm::Constant* callee, llvm::Value* arg1) - { - return builder()->CreateCall(callee, arg1); - } - // Zero checking protected: void check_null(SharkValue* object) diff -r 1791126ef6df -r 9a952e506f16 ports/hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Jul 17 06:04:59 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Thu Jul 30 04:51:32 2009 -0400 @@ -28,39 +28,7 @@ using namespace llvm; -#ifdef ARM -/* - * ARM lacks atomic operation implementation in LLVM - * http://llvm.org/bugs/show_bug.cgi?id=3877 - * - * These two functions zero_cmpxchg_int_fn and zero_cmpxchg_ptr_fn - * are defined so that they can be inserted into llvm as a workaround to - * make shark reroute all atomic calls back to the implementation in zero. - * The actual insertion are done in SharkBuilder::init_external_functions(). - */ - -extern "C" { - jint zero_cmpxchg_int_fn(volatile jint *ptr, - jint *oldval, - jint *newval) - { - return Atomic::cmpxchg(*newval, - ptr, - *oldval); - } - - intptr_t* zero_cmpxchg_ptr_fn(volatile void* ptr, - intptr_t* oldval, - intptr_t* newval) - { - return (intptr_t *) Atomic::cmpxchg_ptr((void *) newval, - ptr, - (void *) oldval); - } -}; -#endif - -SharkBuilder::SharkBuilder(SharkCompiler* compiler) +SharkBuilder::SharkBuilder(Module* module, SharkCodeBuffer* code_buffer) #if SHARK_LLVM_VERSION >= 26 // LLVM 2.6 requires a LLVMContext during IRBuilder construction. // getGlobalConext() returns one that can be used as long as the shark @@ -68,149 +36,480 @@ SharkBuilder::SharkBuilder(SharkCompiler : IRBuilder<>(getGlobalContext()), #else : IRBuilder<>(), -#endif - _compiler(compiler) -{ - init_external_functions(); -} - -Constant* SharkBuilder::make_function(intptr_t addr, - const FunctionType* sig, - const char* name) -{ - Constant *func = make_pointer(addr, sig); +#endif // SHARK_LLVM_VERSION >= 26 + _module(module), + _code_buffer(code_buffer) +{ +} + +// Helpers for accessing structures +Value* SharkBuilder::CreateAddressOfStructEntry(Value* base, + ByteSize offset, + const Type* type, + const char* name) +{ + return CreateBitCast(CreateStructGEP(base, in_bytes(offset)), type, name); +} + +LoadInst* SharkBuilder::CreateValueOfStructEntry(Value* base, + ByteSize offset, + const Type* type, + const char* name) +{ + return CreateLoad( + CreateAddressOfStructEntry( + base, offset, PointerType::getUnqual(type)), + name); +} + +// Helpers for accessing arrays + +LoadInst* SharkBuilder::CreateArrayLength(Value* arrayoop) +{ + return CreateValueOfStructEntry( + arrayoop, in_ByteSize(arrayOopDesc::length_offset_in_bytes()), + SharkType::jint_type(), "length"); +} + +Value* SharkBuilder::CreateArrayAddress(Value* arrayoop, + const Type* element_type, + int element_bytes, + ByteSize base_offset, + Value* index, + const char* name) +{ + Value* offset = CreateIntCast(index, SharkType::intptr_type(), false); + if (element_bytes != 1) + offset = CreateShl( + offset, + LLVMValue::intptr_constant(exact_log2(element_bytes))); + offset = CreateAdd( + LLVMValue::intptr_constant(in_bytes(base_offset)), offset); + + return CreateIntToPtr( + CreateAdd(CreatePtrToInt(arrayoop, SharkType::intptr_type()), offset), + PointerType::getUnqual(element_type), + name); +} + +Value* SharkBuilder::CreateArrayAddress(Value* arrayoop, + BasicType basic_type, + ByteSize base_offset, + Value* index, + const char* name) +{ + return CreateArrayAddress( + arrayoop, + SharkType::to_arrayType(basic_type), + type2aelembytes(basic_type), + base_offset, index, name); +} + +Value* SharkBuilder::CreateArrayAddress(Value* arrayoop, + BasicType basic_type, + Value* index, + const char* name) +{ + return CreateArrayAddress( + arrayoop, basic_type, + in_ByteSize(arrayOopDesc::base_offset_in_bytes(basic_type)), + index, name); +} + +// Helpers for creating intrinsics and external functions. + +const Type* SharkBuilder::make_type(char type, bool void_ok) +{ + switch (type) { + // Primitive types + case 'c': + return SharkType::jbyte_type(); + case 'i': + return SharkType::jint_type(); + case 'l': + return SharkType::jlong_type(); + case 'x': + return SharkType::intptr_type(); + case 'f': + return SharkType::jfloat_type(); + case 'd': + return SharkType::jdouble_type(); + + // Pointers to primitive types + case 'C': + case 'I': + case 'L': + case 'X': + case 'F': + case 'D': + return PointerType::getUnqual(make_type(tolower(type), false)); + + // VM objects + case 'T': + return SharkType::thread_type(); + case 'M': + return PointerType::getUnqual(SharkType::monitor_type()); + case 'O': + return SharkType::oop_type(); + + // Miscellaneous + case 'v': + assert(void_ok, "should be"); + return Type::VoidTy; + case '1': + return Type::Int1Ty; + + default: + ShouldNotReachHere(); + } +} + +const FunctionType* SharkBuilder::make_ftype(const char* params, + const char* ret) +{ + std::vector param_types; + for (const char* c = params; *c; c++) + param_types.push_back(make_type(*c, false)); + + assert(strlen(ret) == 1, "should be"); + const Type *return_type = make_type(*ret, true); + + return FunctionType::get(return_type, param_types, false); +} + +// Create an object representing an intrinsic or external function by +// referencing the symbol by name. This is the LLVM-style approach, +// but it cannot be used on functions within libjvm.so its symbols +// are not exported. Note that you cannot make this work simply by +// exporting the symbols, as some symbols have the same names as +// symbols in the standard libraries (eg, atan2, fabs) and would +// obscure them were they visible. +Value* SharkBuilder::make_function(const char* name, + const char* params, + const char* ret) +{ + return module()->getOrInsertFunction(name, make_ftype(params, ret)); +} + +// Create an object representing an external function by inlining a +// function pointer in the code. This is not the LLVM way, but it's +// the only way to access functions in libjvm.so and functions like +// __kernel_dmb on ARM which is accessed via an absolute address. +Value* SharkBuilder::make_function(address func, + const char* params, + const char* ret) +{ + return CreateIntToPtr( + LLVMValue::intptr_constant((intptr_t) func), + PointerType::getUnqual(make_ftype(params, ret))); +} + +// VM calls + +Value* SharkBuilder::find_exception_handler() +{ + return make_function( + (address) SharkRuntime::find_exception_handler, "TIi", "i"); +} + +Value* SharkBuilder::monitorenter() +{ + return make_function((address) SharkRuntime::monitorenter, "TM", "v"); +} + +Value* SharkBuilder::monitorexit() +{ + return make_function((address) SharkRuntime::monitorexit, "TM", "v"); +} + +Value* SharkBuilder::new_instance() +{ + return make_function((address) SharkRuntime::new_instance, "Ti", "v"); +} + +Value* SharkBuilder::newarray() +{ + return make_function((address) SharkRuntime::newarray, "Tii", "v"); +} + +Value* SharkBuilder::anewarray() +{ + return make_function((address) SharkRuntime::anewarray, "Tii", "v"); +} + +Value* SharkBuilder::multianewarray() +{ + return make_function((address) SharkRuntime::multianewarray, "TiiI", "v"); +} + +Value* SharkBuilder::register_finalizer() +{ + return make_function((address) SharkRuntime::register_finalizer, "TO", "v"); +} + +Value* SharkBuilder::safepoint() +{ + return make_function((address) SafepointSynchronize::block, "T", "v"); +} + +Value* SharkBuilder::throw_ArrayIndexOutOfBoundsException() +{ + return make_function( + (address) SharkRuntime::throw_ArrayIndexOutOfBoundsException, "TCii", "v"); +} + +Value* SharkBuilder::throw_NullPointerException() +{ + return make_function( + (address) SharkRuntime::throw_NullPointerException, "TCi", "v"); +} + +// High-level non-VM calls From xerxes at zafena.se Mon Aug 3 10:31:23 2009 From: xerxes at zafena.se (Xerxes R?nby) Date: Mon, 03 Aug 2009 17:31:23 +0000 Subject: changeset in /hg/icedtea: 2009-07-15 Xerxes R?nby changeset 10b3039fa024 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=10b3039fa024 description: 2009-07-15 Xerxes R?nby * ports/hotspot/src/share/vm/shark/llvmValue.hpp (jbyte_constant): Handle LLVM 2.6 svn r75703 API change. llvm::ConstantInt::get have been moved to llvm::LLVMContext::getConstantInt. (jint_constant): Likewise. (jlong_constant): Likewise. (intptr_constant): Likewise. * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp (SharkBuilder::CreateMemoryBarrier): Likewise. (SharkBuilder::CreateDump): llvm::ConstantArray::get have been moved to llvm::LLVMContext::getConstantArray. diffstat: 3 files changed, 44 insertions(+) ChangeLog | 14 ++++++++++++++ ports/hotspot/src/share/vm/shark/llvmValue.hpp | 16 ++++++++++++++++ ports/hotspot/src/share/vm/shark/sharkBuilder.cpp | 14 ++++++++++++++ diffs (101 lines): diff -r 022c97ae92d2 -r 10b3039fa024 ChangeLog --- a/ChangeLog Tue Jul 14 12:55:48 2009 +0200 +++ b/ChangeLog Wed Jul 15 12:56:10 2009 +0200 @@ -1,3 +1,17 @@ 2009-07-14 Xerxes R??nby + + * ports/hotspot/src/share/vm/shark/llvmValue.hpp + (jbyte_constant): Handle LLVM 2.6 svn r75703 API change. + llvm::ConstantInt::get have been moved to + llvm::LLVMContext::getConstantInt. + (jint_constant): Likewise. + (jlong_constant): Likewise. + (intptr_constant): Likewise. + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + (SharkBuilder::CreateMemoryBarrier): Likewise. + (SharkBuilder::CreateDump): llvm::ConstantArray::get have been + moved to llvm::LLVMContext::getConstantArray. + 2009-07-14 Xerxes R??nby * ports/hotspot/src/share/vm/shark/llvmValue.hpp diff -r 022c97ae92d2 -r 10b3039fa024 ports/hotspot/src/share/vm/shark/llvmValue.hpp --- a/ports/hotspot/src/share/vm/shark/llvmValue.hpp Tue Jul 14 12:55:48 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/llvmValue.hpp Wed Jul 15 12:56:10 2009 +0200 @@ -27,15 +27,27 @@ class LLVMValue : public AllStatic { public: static llvm::ConstantInt* jbyte_constant(jbyte value) { +#if SHARK_LLVM_VERSION >= 26 + return llvm::getGlobalContext().getConstantInt(SharkType::jbyte_type(), value, true); +#else return llvm::ConstantInt::get(SharkType::jbyte_type(), value, true); +#endif } static llvm::ConstantInt* jint_constant(jint value) { +#if SHARK_LLVM_VERSION >= 26 + return llvm::getGlobalContext().getConstantInt(SharkType::jint_type(), value, true); +#else return llvm::ConstantInt::get(SharkType::jint_type(), value, true); +#endif } static llvm::ConstantInt* jlong_constant(jlong value) { +#if SHARK_LLVM_VERSION >= 26 + return llvm::getGlobalContext().getConstantInt(SharkType::jlong_type(), value, true); +#else return llvm::ConstantInt::get(SharkType::jlong_type(), value, true); +#endif } #if SHARK_LLVM_VERSION >= 26 static llvm::Constant* jfloat_constant(jfloat value) @@ -67,6 +79,10 @@ class LLVMValue : public AllStatic { public: static llvm::ConstantInt* intptr_constant(intptr_t value) { +#if SHARK_LLVM_VERSION >= 26 + return llvm::getGlobalContext().getConstantInt(SharkType::intptr_type(), value, false); +#else return llvm::ConstantInt::get(SharkType::intptr_type(), value, false); +#endif } }; diff -r 022c97ae92d2 -r 10b3039fa024 ports/hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Tue Jul 14 12:55:48 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Wed Jul 15 12:56:10 2009 +0200 @@ -187,9 +187,15 @@ CallInst* SharkBuilder::CreateDump(llvm: { Constant *const_name; if (value->hasName()) +#if SHARK_LLVM_VERSION >= 26 + const_name = getGlobalContext().getConstantArray(value->getName()); + else + const_name = getGlobalContext().getConstantArray("unnamed_value"); +#else const_name = ConstantArray::get(value->getName()); else const_name = ConstantArray::get("unnamed_value"); +#endif Value *name = CreatePtrToInt( CreateStructGEP( @@ -260,10 +266,18 @@ CallInst *SharkBuilder::CreateMemoryBarr CallInst *SharkBuilder::CreateMemoryBarrier(BarrierFlags flags) { Value *args[] = { +#if SHARK_LLVM_VERSION >= 26 + getGlobalContext().getConstantInt(Type::Int1Ty, (flags & BARRIER_LOADLOAD) ? 1 : 0), + getGlobalContext().getConstantInt(Type::Int1Ty, (flags & BARRIER_LOADSTORE) ? 1 : 0), + getGlobalContext().getConstantInt(Type::Int1Ty, (flags & BARRIER_STORELOAD) ? 1 : 0), + getGlobalContext().getConstantInt(Type::Int1Ty, (flags & BARRIER_STORESTORE) ? 1 : 0), + getGlobalContext().getConstantInt(Type::Int1Ty, 0)}; +#else ConstantInt::get(Type::Int1Ty, (flags & BARRIER_LOADLOAD) ? 1 : 0), ConstantInt::get(Type::Int1Ty, (flags & BARRIER_LOADSTORE) ? 1 : 0), ConstantInt::get(Type::Int1Ty, (flags & BARRIER_STORELOAD) ? 1 : 0), ConstantInt::get(Type::Int1Ty, (flags & BARRIER_STORESTORE) ? 1 : 0), ConstantInt::get(Type::Int1Ty, 0)}; +#endif return CreateCall(llvm_memory_barrier_fn(), args, args + 5); } From gbenson at redhat.com Mon Aug 3 10:31:24 2009 From: gbenson at redhat.com (Gary Benson) Date: Mon, 03 Aug 2009 17:31:24 +0000 Subject: changeset in /hg/icedtea: 2009-07-17 Gary Benson changeset 1791126ef6df in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=1791126ef6df description: 2009-07-17 Gary Benson * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp (SharkBuilder::pointer_constant): Conditionalize a hack. diffstat: 2 files changed, 9 insertions(+), 6 deletions(-) ChangeLog | 5 +++++ ports/hotspot/src/share/vm/shark/sharkBuilder.hpp | 10 ++++------ diffs (45 lines): diff -r 10b3039fa024 -r 1791126ef6df ChangeLog --- a/ChangeLog Wed Jul 15 12:56:10 2009 +0200 +++ b/ChangeLog Fri Jul 17 06:04:59 2009 -0400 @@ -1,3 +1,8 @@ 2009-07-15 Xerxes R??nby + + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + (SharkBuilder::pointer_constant): Conditionalize a hack. + 2009-07-15 Xerxes R??nby * ports/hotspot/src/share/vm/shark/llvmValue.hpp diff -r 10b3039fa024 -r 1791126ef6df ports/hotspot/src/share/vm/shark/sharkBuilder.hpp --- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Wed Jul 15 12:56:10 2009 +0200 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri Jul 17 06:04:59 2009 -0400 @@ -156,6 +156,9 @@ class SharkBuilder : public llvm::IRBuil llvm::Constant* pointer_constant(const void *ptr) { +#if SHARK_LLVM_VERSION >= 25 || !defined(AMD64) + return LLVMValue::intptr_constant((intptr_t) ptr); +#else // Create a pointer constant that points at PTR. We do this by // creating a GlobalVariable mapped at PTR. This is a workaround // for http://www.llvm.org/bugs/show_bug.cgi?id=2920 @@ -175,18 +178,13 @@ class SharkBuilder : public llvm::IRBuil snprintf(name, sizeof name - 1, "pointer_constant_%p", ptr); GlobalVariable *value = new GlobalVariable( -#if SHARK_LLVM_VERSION >= 26 - // LLVM 2.6 requires a LLVMContext during GlobalVariable construction. - // getGlobalConext() returns one that can be used as long as the shark - // compiler are single-threaded. - getGlobalContext(), -#endif SharkType::intptr_type(), false, GlobalValue::ExternalLinkage, NULL, name, module()); execution_engine()->addGlobalMapping(value, const_cast(ptr)); return ConstantExpr::getPtrToInt(value, SharkType::intptr_type()); +#endif // SHARK_LLVM_VERSION >= 25 || !AMD64 } // Helper for making pointers From gnu_andrew at member.fsf.org Mon Aug 3 11:03:11 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 3 Aug 2009 19:03:11 +0100 Subject: Shark and IcedTea7 Message-ID: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> I've forwardported the latest IcedTea6 changest to Shark to 7 and pushed them. However, I haven't been able to successfully build with them. The version of LLVM with which I was building was apparently now too old. It seems the latest SVN may be too new: In file included from ../generated/incls/_sharkBuilder.cpp.incl:3, from /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/sharkBuilder.cpp:27: /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::ConstantInt* LLVMValue::jbyte_constant(jbyte)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:31: error: 'class llvm::LLVMContext' has no member named 'getConstantInt' /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::ConstantInt* LLVMValue::jint_constant(jint)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:39: error: 'class llvm::LLVMContext' has no member named 'getConstantInt' /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::ConstantInt* LLVMValue::jlong_constant(jlong)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:47: error: 'class llvm::LLVMContext' has no member named 'getConstantInt' /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::Constant* LLVMValue::jfloat_constant(jfloat)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:55: error: 'class llvm::LLVMContext' has no member named 'getConstantFP' /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::Constant* LLVMValue::jdouble_constant(jdouble)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:66: error: 'class llvm::LLVMContext' has no member named 'getConstantFP' /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::ConstantInt* LLVMValue::bit_constant(int)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:83: error: 'class llvm::LLVMContext' has no member named 'getConstantInt' /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: In static member function 'static llvm::ConstantInt* LLVMValue::intptr_constant(intptr_t)': /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:91: error: 'class llvm::LLVMContext' has no member named 'getConstantInt' make[7]: *** [sharkCompiler.o] Error 1 There was a change to the file containing getConstantInt last Thursday: ------------------------------------------------------------------------ r77583 | evancheng | 2009-07-30 09:44:08 +0100 (Thu, 30 Jul 2009) | 4 lines I've changed the semantics of MERGE_VALUES a bit. It's now allowed to live until scheduling. It's deleted when the scheduler translate DAG nodes to machine instructions. This is currently used by X86 to handle atomic_load_add when the output of the node is not used. I believe there is a better solution. But I find MERGE_VALUES useful for selecting multi-output node when the dead output can be selected as a IMPLICIT_DEF. but this only seems to have altered a comment. Any ideas? I've pushed because I assume that those working with Shark have been successfully building it even if I can't... :) -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From gbenson at redhat.com Tue Aug 4 02:48:53 2009 From: gbenson at redhat.com (Gary Benson) Date: Tue, 4 Aug 2009 10:48:53 +0100 Subject: Shark and IcedTea7 In-Reply-To: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> References: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> Message-ID: <20090804094852.GA3351@redhat.com> Andrew John Hughes wrote: > I've forwardported the latest IcedTea6 changest to Shark to 7 and > pushed them. However, I haven't been able to successfully build > with them. The version of LLVM with which I was building was > apparently now too old. It seems the latest SVN may be too new: Can you build with 2.5? SVN changes too much to guarantee anything. Cheers, Gary -- http://gbenson.net/ From doko at ubuntu.com Tue Aug 4 03:05:12 2009 From: doko at ubuntu.com (Matthias Klose) Date: Tue, 04 Aug 2009 12:05:12 +0200 Subject: Shark and IcedTea7 In-Reply-To: <20090804094852.GA3351@redhat.com> References: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> <20090804094852.GA3351@redhat.com> Message-ID: <4A7807D8.9010108@ubuntu.com> On 04.08.2009 11:48, Gary Benson wrote: > Andrew John Hughes wrote: >> I've forwardported the latest IcedTea6 changest to Shark to 7 and >> pushed them. However, I haven't been able to successfully build >> with them. The version of LLVM with which I was building was >> apparently now too old. It seems the latest SVN may be too new: > > Can you build with 2.5? SVN changes too much to guarantee anything. llvm goes in API freeze in late August. Maybe it's worth to either look at recent changes just before we release IcedTea6 1.6, or allow changes for a 1.6.1 which lets build with llvm 2.6. From gnu_andrew at member.fsf.org Tue Aug 4 03:30:32 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Tue, 4 Aug 2009 11:30:32 +0100 Subject: Shark and IcedTea7 In-Reply-To: <20090804094852.GA3351@redhat.com> References: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> <20090804094852.GA3351@redhat.com> Message-ID: <17c6771e0908040330u6c46e11bi7f1281f8515093c8@mail.gmail.com> 2009/8/4 Gary Benson : > Andrew John Hughes wrote: >> I've forwardported the latest IcedTea6 changest to Shark to 7 and >> pushed them. ?However, I haven't been able to successfully build >> with them. ?The version of LLVM with which I was building was >> apparently now too old. ?It seems the latest SVN may be too new: > > Can you build with 2.5? ?SVN changes too much to guarantee anything. > > Cheers, > Gary > > -- > http://gbenson.net/ > Ok, I'll try that now. Can we document this somewhere in README and/or INSTALL? There is nothing in there about llvm at the moment AFAICS. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From doko at ubuntu.com Tue Aug 4 04:55:09 2009 From: doko at ubuntu.com (Matthias Klose) Date: Tue, 04 Aug 2009 13:55:09 +0200 Subject: Shark and IcedTea7 In-Reply-To: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> References: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> Message-ID: <4A78219D.8000407@ubuntu.com> On 03.08.2009 20:03, Andrew John Hughes wrote: > I've forwardported the latest IcedTea6 changest to Shark to 7 and > pushed them. However, I haven't been able to successfully build with > them. The version of LLVM with which I was building was apparently > now too old. It seems the latest SVN may be too new: > > In file included from ../generated/incls/_sharkBuilder.cpp.incl:3, > from > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/sharkBuilder.cpp:27: > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::ConstantInt* > LLVMValue::jbyte_constant(jbyte)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:31: > error: 'class llvm::LLVMContext' has no member named 'getConstantInt' > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::ConstantInt* > LLVMValue::jint_constant(jint)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:39: > error: 'class llvm::LLVMContext' has no member named 'getConstantInt' > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::ConstantInt* > LLVMValue::jlong_constant(jlong)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:47: > error: 'class llvm::LLVMContext' has no member named 'getConstantInt' > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::Constant* > LLVMValue::jfloat_constant(jfloat)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:55: > error: 'class llvm::LLVMContext' has no member named 'getConstantFP' > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::Constant* > LLVMValue::jdouble_constant(jdouble)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:66: > error: 'class llvm::LLVMContext' has no member named 'getConstantFP' > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::ConstantInt* > LLVMValue::bit_constant(int)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:83: > error: 'class llvm::LLVMContext' has no member named 'getConstantInt' > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: > In static member function 'static llvm::ConstantInt* > LLVMValue::intptr_constant(intptr_t)': > /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:91: > error: 'class llvm::LLVMContext' has no member named 'getConstantInt' > make[7]: *** [sharkCompiler.o] Error 1 > > There was a change to the file containing getConstantInt last Thursday: > > ------------------------------------------------------------------------ > r77583 | evancheng | 2009-07-30 09:44:08 +0100 (Thu, 30 Jul 2009) | 4 lines > > I've changed the semantics of MERGE_VALUES a bit. It's now allowed to > live until scheduling. It's deleted when the scheduler translate DAG > nodes to machine instructions. > > This is currently used by X86 to handle atomic_load_add when the > output of the node is not used. I believe there is a better solution. > But I find MERGE_VALUES useful for selecting multi-output node when > the dead output can be selected as a IMPLICIT_DEF. > > but this only seems to have altered a comment. > > Any ideas? I've pushed because I assume that those working with Shark > have been successfully building it even if I can't... :) please check with the patch attached. It works for me building current IcedTea6. Matthias -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm.diff Url: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20090804/2e893c1a/attachment.ksh From gnu_andrew at member.fsf.org Tue Aug 4 05:46:49 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Tue, 4 Aug 2009 13:46:49 +0100 Subject: Shark and IcedTea7 In-Reply-To: <4A78219D.8000407@ubuntu.com> References: <17c6771e0908031103g49058689m5f91772f57d76be7@mail.gmail.com> <4A78219D.8000407@ubuntu.com> Message-ID: <17c6771e0908040546s1d37fcceofad26e6fa9a27c11@mail.gmail.com> 2009/8/4 Matthias Klose : > On 03.08.2009 20:03, Andrew John Hughes wrote: >> >> I've forwardported the latest IcedTea6 changest to Shark to 7 and >> pushed them. ?However, I haven't been able to successfully build with >> them. ?The version of LLVM with which I was building was apparently >> now too old. ?It seems the latest SVN may be too new: >> >> In file included from ../generated/incls/_sharkBuilder.cpp.incl:3, >> ? ? ? ? ? ? ? ? ?from >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/sharkBuilder.cpp:27: >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::ConstantInt* >> LLVMValue::jbyte_constant(jbyte)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:31: >> error: 'class llvm::LLVMContext' has no member named 'getConstantInt' >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::ConstantInt* >> LLVMValue::jint_constant(jint)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:39: >> error: 'class llvm::LLVMContext' has no member named 'getConstantInt' >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::ConstantInt* >> LLVMValue::jlong_constant(jlong)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:47: >> error: 'class llvm::LLVMContext' has no member named 'getConstantInt' >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::Constant* >> LLVMValue::jfloat_constant(jfloat)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:55: >> error: 'class llvm::LLVMContext' has no member named 'getConstantFP' >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::Constant* >> LLVMValue::jdouble_constant(jdouble)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:66: >> error: 'class llvm::LLVMContext' has no member named 'getConstantFP' >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::ConstantInt* >> LLVMValue::bit_constant(int)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:83: >> error: 'class llvm::LLVMContext' has no member named 'getConstantInt' >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp: >> In static member function 'static llvm::ConstantInt* >> LLVMValue::intptr_constant(intptr_t)': >> >> /mnt/builder/shark7/openjdk-ecj/hotspot/src/share/vm/shark/llvmValue.hpp:91: >> error: 'class llvm::LLVMContext' has no member named 'getConstantInt' >> make[7]: *** [sharkCompiler.o] Error 1 >> >> There was a change to the file containing getConstantInt last Thursday: >> >> ------------------------------------------------------------------------ >> r77583 | evancheng | 2009-07-30 09:44:08 +0100 (Thu, 30 Jul 2009) | 4 >> lines >> >> I've changed the semantics of MERGE_VALUES a bit. It's now allowed to >> live until scheduling. It's deleted when the scheduler translate DAG >> nodes to machine instructions. >> >> This is currently used by X86 to handle atomic_load_add when the >> output of the node is not used. I believe there is a better solution. >> But I find MERGE_VALUES useful for selecting multi-output node when >> the dead output can be selected as a IMPLICIT_DEF. >> >> but this only seems to have altered a comment. >> >> Any ideas? ?I've pushed because I assume that those working with Shark >> have been successfully building it even if I can't... :) > > please check with the patch attached. It works for me building current > IcedTea6. > > ?Matthias > > Managed to do a full build with 2.5. I'll try with this after I've done the plugin forwardporting. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From bugzilla-daemon at icedtea.classpath.org Tue Aug 4 07:13:50 2009 From: bugzilla-daemon at icedtea.classpath.org (bugzilla-daemon at icedtea.classpath.org) Date: Tue, 04 Aug 2009 14:13:50 +0000 Subject: [Bug 374] SIGSEGV while visiting a website on Firefox 3.5, Archlinux 64bit Message-ID: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=374 jon.vanalten at redhat.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from jon.vanalten at redhat.com 2009-08-04 14:13 ------- *** This bug has been marked as a duplicate of bug 367 *** -- Configure bugmail: http://icedtea.classpath.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. From bugzilla-daemon at icedtea.classpath.org Tue Aug 4 07:13:51 2009 From: bugzilla-daemon at icedtea.classpath.org (bugzilla-daemon at icedtea.classpath.org) Date: Tue, 04 Aug 2009 14:13:51 +0000 Subject: [Bug 367] Interactive brokers fails / libjpeg7 related? Message-ID: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=367 jon.vanalten at redhat.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gary4gar at gmail.com ------- Comment #5 from jon.vanalten at redhat.com 2009-08-04 14:13 ------- *** Bug 374 has been marked as a duplicate of this bug. *** -- Configure bugmail: http://icedtea.classpath.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. From dbhole at redhat.com Tue Aug 4 07:39:21 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 4 Aug 2009 10:39:21 -0400 Subject: RFC: Netx - disable desktop shortcuts In-Reply-To: <4A71BC62.9050508@redhat.com> References: <4A71BC62.9050508@redhat.com> Message-ID: <20090804143921.GA3111@redhat.com> * Omair Majid [2009-07-30 11:30]: > Hi, > > I would like to disable the desktop launcher code in Netx as it has some > issues. Thanks to Deepak who originally brought up these problems. > The two major ones are: > > 1. First of all, the desktop launcher Netx creates dont work well with > the alternatives system. They all invoke $CURRENT_JDK_HOME/bin/javaws > instead of /usr/bin/javaws. However changing to /usr/bin/javaws brings > up other problems. /usr/bin/javaws is likely to be some other JDK which > may or may not understand Netx's options that it uses in the launcher. > This could lead to desktop launchers that dont work. /usr/bin/javaws > overwite our shortcut with it's own which would then call, for example, > /usr/java/latest/bin/javaws instead of /usr/bin/javaws. Also note that > Sun's javaws creates a launcher that points to their cache. Netx wont be > able to use that cache. > > Part of this issue can be fixed by using the exact same options as Sun's > javaws to maintain compatibility. However I dont see a simple way to > make a proprietary JRE's javaws invoke /usr/bin/javaws. Or to share the > cache between multiple JDKs. > > 2. These shortcuts dont work offline, even if the application allows it. > The current launchers just point Netx to the original JNLP file, which > wont work if the machine is offline (even if everything has been cached > by Netx). > > The correct fix is to ensure that Netx supports offline mode, uses the > cache and JNLP update mechanism correctly and then make the launcher > point to the cache. This might take some time to implement correctly. > > Because of these major issues, I would like to disable desktop shortcut > support in Netx. > > ChangeLog: > 2009-07-30 Omair Majid > > * rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java > (initialize): Disable creating desktop shortcuts. > > Any comments? > Looks good. Cheers, Deepak > Cheers, > Omair > diff -r 051ca564791d rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java > --- a/rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java Thu Jul 30 04:51:32 2009 -0400 > +++ b/rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java Thu Jul 30 10:51:57 2009 -0400 > @@ -109,7 +109,24 @@ > */ > public void initialize() { > installEnvironment(); > - addMenuAndDesktopEntries(); > + > + /* > + * FIXME: Disable creating desktop entries for now > + * > + * there are some major issues we need to work out before we can enable them > + * 1. Playing nice with the altnatives system > + * - use the system preferred jdk (/usr/bin/javaws) > + * - dont assume what jdk javaws corresponds to > + * - make sure our shortcuts work with the sun jdk and vice versa > + * (may not be possible since sun's javaws creates a launcher that > + * links to /usr/java/${ver}/bin/javaws) > + * - we should use the same options and arguments as sun's javaws > + * 2. Make shortcuts work offline > + * - make the cache updates and replacements work properly > + * - shortcuts should use the cache > + * > + * addMenuAndDesktopEntries(); > + */ > } > > /** From dbhole at redhat.com Tue Aug 4 07:41:40 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 4 Aug 2009 10:41:40 -0400 Subject: RFC: Netx - implement -Xclearcache command line option In-Reply-To: <4A720F4D.8010007@redhat.com> References: <4A720E40.7020406@redhat.com> <4A720F4D.8010007@redhat.com> Message-ID: <20090804144140.GB3111@redhat.com> * Omair Majid [2009-07-30 18:12]: > Omair Majid wrote: >> The attached patch adds the option -Xclearcache to Netx. > > What I really meant was the patch I am going to attach to the next email > I send ;) > > Cheers, > Omair Assuming you have tested this, go ahead and commit. Cheers, Deepak > diff -r 051ca564791d rt/net/sourceforge/jnlp/cache/CacheUtil.java > --- a/rt/net/sourceforge/jnlp/cache/CacheUtil.java Thu Jul 30 04:51:32 2009 -0400 > +++ b/rt/net/sourceforge/jnlp/cache/CacheUtil.java Thu Jul 30 17:01:27 2009 -0400 > @@ -26,6 +26,7 @@ > > import net.sourceforge.jnlp.*; > import net.sourceforge.jnlp.runtime.*; > +import net.sourceforge.jnlp.util.FileUtils; > > /** > * Provides static methods to interact with the cache, download > @@ -128,6 +129,25 @@ > } > > /** > + * Clears the cache by deleting all the Netx cache files > + */ > + public static void clearCache() { > + File cacheDir = new File(JNLPRuntime.getBaseDir() + File.separator + "cache"); > + if (!(cacheDir.isDirectory())) { > + return; > + } > + > + if (JNLPRuntime.isDebug()) { > + System.err.println("Clearing cache directory: " + cacheDir); > + } > + try { > + FileUtils.recursiveDelete(cacheDir); > + } catch (IOException e) { > + throw new RuntimeException(e); > + } > + } > + > + /** > * Returns whether there is a version of the URL contents in the > * cache and it is up to date. This method may not return > * immediately. > diff -r 051ca564791d rt/net/sourceforge/jnlp/resources/Messages.properties > --- a/rt/net/sourceforge/jnlp/resources/Messages.properties Thu Jul 30 04:51:32 2009 -0400 > +++ b/rt/net/sourceforge/jnlp/resources/Messages.properties Thu Jul 30 17:01:27 2009 -0400 > @@ -133,6 +133,7 @@ > BOViewer = Shows the trusted certificate viewer. > BOUmask = Sets the umask for files created by an application. > BXnofork = Do not create another JVM. > +BXclearcache= Clean the JNLP application cache. > BOHelp = Print this message and exit. > > # Cache > diff -r 051ca564791d rt/net/sourceforge/jnlp/runtime/Boot.java > --- a/rt/net/sourceforge/jnlp/runtime/Boot.java Thu Jul 30 04:51:32 2009 -0400 > +++ b/rt/net/sourceforge/jnlp/runtime/Boot.java Thu Jul 30 17:01:27 2009 -0400 > @@ -40,6 +40,7 @@ > import net.sourceforge.jnlp.ParseException; > import net.sourceforge.jnlp.PropertyDesc; > import net.sourceforge.jnlp.ResourcesDesc; > +import net.sourceforge.jnlp.cache.CacheUtil; > import net.sourceforge.jnlp.cache.UpdatePolicy; > import net.sourceforge.jnlp.security.VariableX509TrustManager; > import net.sourceforge.jnlp.security.viewer.CertificateViewer; > @@ -114,6 +115,7 @@ > + " -strict "+R("BOStrict")+"\n" > + " -umask=value "+R("BOUmask")+"\n" > + " -Xnofork "+R("BXnofork")+"\n" > + + " -Xclearcache "+R("BXclearcache")+"\n" > + " -help "+R("BOHelp")+"\n"; > > private static final String doubleArgs = "-basedir -jnlp -arg -param -property -update"; > @@ -202,6 +204,17 @@ > JNLPRuntime.setSecurityEnabled(null == getOption("-nosecurity")); > JNLPRuntime.initialize(true); > > + /* > + * TODO > + * This should have been done with the rest of the argument parsing > + * code. But we need to know what the cache and base directories are, > + * and baseDir is initialized here > + */ > + if (null != getOption("-Xclearcache")) { > + CacheUtil.clearCache(); > + return null; > + } > + > try { > new Launcher().launch(getFile()); > } > diff -r 051ca564791d rt/net/sourceforge/jnlp/util/FileUtils.java > --- a/rt/net/sourceforge/jnlp/util/FileUtils.java Thu Jul 30 04:51:32 2009 -0400 > +++ b/rt/net/sourceforge/jnlp/util/FileUtils.java Thu Jul 30 17:01:27 2009 -0400 > @@ -14,8 +14,12 @@ > // License along with this library; if not, write to the Free Software > // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > > +package net.sourceforge.jnlp.util; > > -package net.sourceforge.jnlp.util; > +import java.io.File; > +import java.io.IOException; > + > +import net.sourceforge.jnlp.runtime.JNLPRuntime; > > /** > * This class contains a few file-related utility functions. > @@ -44,5 +48,36 @@ > String sanitizedName = input.replaceAll("[^a-zA-Z0-9.]", "_"); > return sanitizedName; > } > - > + > + /** > + * Recursively delete everything under a directory. Works on either files or > + * directories > + * > + * @param file the file object representing what to delete. Can be either a > + * file or a directory. Must be within Netx's basedir > + * @throws IOException on an io exception or if trying to delete something > + * outside the basedir > + */ > + public static void recursiveDelete(File file) throws IOException { > + if (JNLPRuntime.isDebug()) { > + System.err.println("Deleting: " + file); > + } > + > + if (!(file.getCanonicalPath().startsWith(JNLPRuntime.getBaseDir().getCanonicalPath()))) { > + throw new IOException("Trying to delete a file outside Netx's basedir: " > + + file.getCanonicalPath()); > + } > + > + if (file.isDirectory()) { > + File[] children = file.listFiles(); > + for (int i = 0; i < children.length; i++) { > + recursiveDelete(children[i]); > + } > + } > + if (!file.delete()) { > + throw new IOException("Unable to delete file: " + file); > + } > + > + } > + > } From omajid at redhat.com Tue Aug 4 08:33:04 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 15:33:04 +0000 Subject: changeset in /hg/icedtea6: Netx: disable destkop shortcuts Message-ID: changeset f5ed1489ddcf in /hg/icedtea6 details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=f5ed1489ddcf description: Netx: disable destkop shortcuts 2009-08-04 Omair Majid * rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java (initialize): Disable creation of desktop shortcuts. diffstat: 2 files changed, 23 insertions(+), 1 deletion(-) ChangeLog | 5 +++ rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java | 19 +++++++++++++- diffs (41 lines): diff -r 18f23e1e3c37 -r f5ed1489ddcf ChangeLog --- a/ChangeLog Mon Aug 03 13:18:16 2009 +0100 +++ b/ChangeLog Tue Aug 04 11:34:49 2009 -0400 @@ -1,3 +1,8 @@ 2009-08-03 Andrew John Hughes + + * rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java + (initialize): Disable creation of desktop shortcuts. + 2009-08-03 Andrew John Hughes * hotspot.map: diff -r 18f23e1e3c37 -r f5ed1489ddcf rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java --- a/rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java Mon Aug 03 13:18:16 2009 +0100 +++ b/rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java Tue Aug 04 11:34:49 2009 -0400 @@ -109,7 +109,24 @@ public class ApplicationInstance { */ public void initialize() { installEnvironment(); - addMenuAndDesktopEntries(); + + /* + * FIXME: Disable creating desktop entries for now + * + * there are some major issues we need to work out before we can enable them + * 1. Playing nice with the altnatives system + * - use the system preferred jdk (/usr/bin/javaws) + * - dont assume what jdk javaws corresponds to + * - make sure our shortcuts work with the sun jdk and vice versa + * (may not be possible since sun's javaws creates a launcher that + * links to /usr/java/${ver}/bin/javaws) + * - we should use the same options and arguments as sun's javaws + * 2. Make shortcuts work offline + * - make the cache updates and replacements work properly + * - shortcuts should use the cache + * + * addMenuAndDesktopEntries(); + */ } /** From omajid at redhat.com Tue Aug 4 08:36:37 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 11:36:37 -0400 Subject: RFC: Netx - disable desktop shortcuts In-Reply-To: <20090804143921.GA3111@redhat.com> References: <4A71BC62.9050508@redhat.com> <20090804143921.GA3111@redhat.com> Message-ID: <4A785585.7090806@redhat.com> Deepak Bhole wrote: > * Omair Majid [2009-07-30 11:30]: >> Hi, >> >> I would like to disable the desktop launcher code in Netx as it has some >> issues. Thanks to Deepak who originally brought up these problems. >> The two major ones are: >> >> 1. First of all, the desktop launcher Netx creates dont work well with >> the alternatives system. They all invoke $CURRENT_JDK_HOME/bin/javaws >> instead of /usr/bin/javaws. However changing to /usr/bin/javaws brings >> up other problems. /usr/bin/javaws is likely to be some other JDK which >> may or may not understand Netx's options that it uses in the launcher. >> This could lead to desktop launchers that dont work. /usr/bin/javaws >> overwite our shortcut with it's own which would then call, for example, >> /usr/java/latest/bin/javaws instead of /usr/bin/javaws. Also note that >> Sun's javaws creates a launcher that points to their cache. Netx wont be >> able to use that cache. >> >> Part of this issue can be fixed by using the exact same options as Sun's >> javaws to maintain compatibility. However I dont see a simple way to >> make a proprietary JRE's javaws invoke /usr/bin/javaws. Or to share the >> cache between multiple JDKs. >> >> 2. These shortcuts dont work offline, even if the application allows it. >> The current launchers just point Netx to the original JNLP file, which >> wont work if the machine is offline (even if everything has been cached >> by Netx). >> >> The correct fix is to ensure that Netx supports offline mode, uses the >> cache and JNLP update mechanism correctly and then make the launcher >> point to the cache. This might take some time to implement correctly. >> >> Because of these major issues, I would like to disable desktop shortcut >> support in Netx. >> >> ChangeLog: >> 2009-07-30 Omair Majid >> >> * rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java >> (initialize): Disable creating desktop shortcuts. >> >> Any comments? >> > > Looks good. > Pushed as changeset f5ed1489ddcf. Cheers, Omair From omajid at redhat.com Tue Aug 4 09:07:28 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:28 +0000 Subject: changeset in /hg/icedtea: 2009-05-22 Omair Majid changeset 9a93570b7b06 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9a93570b7b06 description: 2009-05-22 Omair Majid * netx/net/sourceforge/jnlp/JNLPFile.java (parse): Fix comment to reflect that the element can be either 'java' or 'j2se'. * netx/net/sourceforge/jnlp/JREDesc.java: Fix comment to reflect a 'java' element. New private variable vmArgs to keep track of 'java-vm-args'. (JREDesc): Modify to take in an additional parameter vmArgs and store it in vmArgs. (getVMArgs): New function. Return the value of 'java-vm-args' attribute. * netx/net/sourceforge/jnlp/Parser.java: Fix comments to reflect either a 'java' or 'j2se' element. (getResourceDesc): Treat 'java' element identically to 'j2se' element. (getJRE): Read in the value of the 'java-vm-args' attribute. diffstat: 4 files changed, 36 insertions(+), 8 deletions(-) ChangeLog | 14 ++++++++++++++ netx/net/sourceforge/jnlp/JNLPFile.java | 2 +- netx/net/sourceforge/jnlp/JREDesc.java | 17 +++++++++++++++-- netx/net/sourceforge/jnlp/Parser.java | 11 ++++++----- diffs (137 lines): diff -r 9a952e506f16 -r 9a93570b7b06 ChangeLog --- a/ChangeLog Thu Jul 30 04:51:32 2009 -0400 +++ b/ChangeLog Fri May 22 10:13:16 2009 -0400 @@ -1,3 +1,17 @@ 2009-07-30 Gary Benson + + * netx/net/sourceforge/jnlp/JNLPFile.java (parse): Fix comment to reflect + that the element can be either 'java' or 'j2se'. + * netx/net/sourceforge/jnlp/JREDesc.java: Fix comment to reflect a 'java' + element. New private variable vmArgs to keep track of 'java-vm-args'. + (JREDesc): Modify to take in an additional parameter vmArgs and store it in + vmArgs. + (getVMArgs): New function. Return the value of 'java-vm-args' attribute. + * netx/net/sourceforge/jnlp/Parser.java: Fix comments to reflect either a + 'java' or 'j2se' element. + (getResourceDesc): Treat 'java' element identically to 'j2se' element. + (getJRE): Read in the value of the 'java-vm-args' attribute. + 2009-07-30 Gary Benson * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp: diff -r 9a952e506f16 -r 9a93570b7b06 netx/net/sourceforge/jnlp/JNLPFile.java --- a/netx/net/sourceforge/jnlp/JNLPFile.java Thu Jul 30 04:51:32 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Fri May 22 10:13:16 2009 -0400 @@ -505,7 +505,7 @@ public class JNLPFile { sourceLocation = parser.getFileLocation(); info = parser.getInfo(root); - resources = parser.getResources(root, false); // false == not a j2se resources section + resources = parser.getResources(root, false); // false == not a j2se/java resources section launchType = parser.getLauncher(root); security = parser.getSecurity(root); } diff -r 9a952e506f16 -r 9a93570b7b06 netx/net/sourceforge/jnlp/JREDesc.java --- a/netx/net/sourceforge/jnlp/JREDesc.java Thu Jul 30 04:51:32 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JREDesc.java Fri May 22 10:13:16 2009 -0400 @@ -22,7 +22,7 @@ import java.util.*; import java.util.*; /** - * The J2SE element. + * The J2SE/Java element. * * @author Jon A. Maxwell (JAM) - initial author * @version $Revision: 1.5 $ @@ -41,6 +41,9 @@ public class JREDesc { /** maximum head size */ private long maximumHeapSize; + /** args to pass to the vm */ + private String vmArgs; + /** list of ResourceDesc objects */ private List resources; @@ -55,9 +58,12 @@ public class JREDesc { * @param maximumHeadSize maximum head size * @param resources list of ResourceDesc objects */ - public JREDesc(Version version, URL location, String initialHeapSize, String maximumHeapSize, List resources) { + public JREDesc(Version version, URL location, + String vmArgs, String initialHeapSize, + String maximumHeapSize, List resources) { this.version = version; this.location = location; + this.vmArgs = vmArgs; this.initialHeapSize = heapToLong(initialHeapSize); this.maximumHeapSize = heapToLong(maximumHeapSize); this.resources = resources; @@ -110,6 +116,13 @@ public class JREDesc { } /** + * Returns the additional arguments to pass to the Java VM + */ + public String getVMArgs() { + return vmArgs; + } + + /** * Convert a heap size description string to a long value * indicating the heap min/max size. */ diff -r 9a952e506f16 -r 9a93570b7b06 netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Thu Jul 30 04:51:32 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Fri May 22 10:13:16 2009 -0400 @@ -186,7 +186,7 @@ class Parser { * node (jnlp or j2se). * * @param parent the parent node (either jnlp or j2se) - * @param j2se true if the resources are located under a j2se node + * @param j2se true if the resources are located under a j2se or java node * @throws ParseException if the JNLP file is invalid */ public List getResources(Node parent, boolean j2se) throws ParseException { @@ -208,7 +208,7 @@ class Parser { * Returns the ResourcesDesc element at the specified node. * * @param node the resources node - * @param j2se true if the resources are located under a j2se node + * @param j2se true if the resources are located under a j2se or java node * @throws ParseException if the JNLP file is invalid */ public ResourcesDesc getResourcesDesc(Node node, boolean j2se) throws ParseException { @@ -231,7 +231,7 @@ class Parser { if (!isTrustedEnvironment()) throw new ParseException(R("PUntrustedNative")); - if ("j2se".equals(name)) { + if ("j2se".equals(name) || "java".equals(name)) { if (getChildNode(root, "component-desc") != null) if (strict) throw new ParseException(R("PExtensionHasJ2SE")); @@ -273,12 +273,13 @@ class Parser { /** * Returns the JRE element at the specified node. * - * @param node the j2se node + * @param node the j2se/java node * @throws ParseException if the JNLP file is invalid */ public JREDesc getJRE(Node node) throws ParseException { Version version = getVersion(node, "version", null); URL location = getURL(node, "href", base); + String vmArgs = getAttribute(node, "java-vm-args",null); String initialHeap = getAttribute(node, "initial-heap-size", null); String maxHeap = getAttribute(node, "max-heap-size", null); List resources = getResources(node, true); @@ -286,7 +287,7 @@ class Parser { // require version attribute getRequiredAttribute(node, "version", null); - return new JREDesc(version, location, initialHeap, maxHeap, resources); + return new JREDesc(version, location, vmArgs, initialHeap, maxHeap, resources); } /** From omajid at redhat.com Tue Aug 4 09:07:31 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:31 +0000 Subject: changeset in /hg/icedtea: 2009-06-10 Omair Majid changeset a5edccad3c7c in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=a5edccad3c7c description: 2009-06-10 Omair Majid * netx/net/sourceforge/jnlp/JNLPFile.java (needsNewJVM): New function. Returns true if the JNLP file requires creating a new JVM. (getNewVMArgs): New function. Returns arguments to pass to the new JVM. * netx/net/sourceforge/jnlp/JREDesc.java (getVMArgs): Fix javadoc to reflect that return value can be null. * netx/net/sourceforge/jnlp/Launcher.java (launchExternal): Modify to take in arguments to pass to the JVM and arguments to pass to Netx. Try to use the local file to launch this instance if possible. (launchExternal): Delegate to new launchExternal. (launchExternal): New method. Take in arguments to pass to the JVM and arguments to pass to Netx. Launch Netx with the with the appropriate arguments. (launchApplication): If needed, launch a new JVM and pass along the Netx arguments. * netx/net/sourceforge/jnlp/Parser.java: (getJRE): Call checkVMArgs to check 'java-vm-args' for security. If that fails, assume 'java-vm-args' is null. (checkVMArgs): New method. Check that the vmArgs variable contains safe arguments only. (getValidVMArguments): New method. (getValidStartingVMArguments): New method. * netx/net/sourceforge/jnlp/resources/Messages.properties: Add BXnofork. * netx/net/sourceforge/jnlp/runtime/Boot/java: Add -Xnofork to helpMessage (main): Check for '-Xnofork'. Set initial arguments. * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: Add forksAllowed to store whether creating a new JVM is allowed. Add initialArguments to store the arguments to Netx. (getForksAllowed): New function. Check if creating a new JVM is allowed. (setForksAllowed): New function. Set whether creating a JVM is allowed. (setInitialArguments): New function. Store the arguments passed to Netx. (getInitialArguments): New function. Return the arguments passed to Netx. diffstat: 8 files changed, 326 insertions(+), 41 deletions(-) ChangeLog | 37 ++++ netx/net/sourceforge/jnlp/JNLPFile.java | 63 +++++++- netx/net/sourceforge/jnlp/JREDesc.java | 1 netx/net/sourceforge/jnlp/Launcher.java | 109 ++++++++++---- netx/net/sourceforge/jnlp/Parser.java | 112 +++++++++++++++ netx/net/sourceforge/jnlp/resources/Messages.properties | 1 netx/net/sourceforge/jnlp/runtime/Boot.java | 9 + netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java | 35 ++++ diffs (truncated from 539 to 500 lines): diff -r 649b859ba20d -r a5edccad3c7c ChangeLog --- a/ChangeLog Wed Jun 10 10:53:03 2009 -0400 +++ b/ChangeLog Wed Jun 10 12:00:53 2009 -0400 @@ -1,3 +1,40 @@ 2009-06-10 Omair Majid + + * netx/net/sourceforge/jnlp/JNLPFile.java + (needsNewJVM): New function. Returns true if the JNLP file requires + creating a new JVM. + (getNewVMArgs): New function. Returns arguments to pass to the new JVM. + * netx/net/sourceforge/jnlp/JREDesc.java + (getVMArgs): Fix javadoc to reflect that return value can be null. + * netx/net/sourceforge/jnlp/Launcher.java + (launchExternal): Modify to take in arguments to pass to the JVM and + arguments to pass to Netx. Try to use the local file to launch this + instance if possible. + (launchExternal): Delegate to new launchExternal. + (launchExternal): New method. Take in arguments to pass to the JVM and + arguments to pass to Netx. Launch Netx with the with the appropriate + arguments. + (launchApplication): If needed, launch a new JVM and pass along the Netx + arguments. + * netx/net/sourceforge/jnlp/Parser.java: + (getJRE): Call checkVMArgs to check 'java-vm-args' for security. If that + fails, assume 'java-vm-args' is null. + (checkVMArgs): New method. Check that the vmArgs variable contains safe + arguments only. + (getValidVMArguments): New method. + (getValidStartingVMArguments): New method. + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add BXnofork. + * netx/net/sourceforge/jnlp/runtime/Boot/java: + Add -Xnofork to helpMessage + (main): Check for '-Xnofork'. Set initial arguments. + * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: + Add forksAllowed to store whether creating a new JVM is allowed. Add + initialArguments to store the arguments to Netx. + (getForksAllowed): New function. Check if creating a new JVM is allowed. + (setForksAllowed): New function. Set whether creating a JVM is allowed. + (setInitialArguments): New function. Store the arguments passed to Netx. + (getInitialArguments): New function. Return the arguments passed to Netx. + 2009-06-10 Omair Majid * netx/net/sourceforge/jnlp/services/XBasicService.java diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/JNLPFile.java --- a/netx/net/sourceforge/jnlp/JNLPFile.java Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Wed Jun 10 12:00:53 2009 -0400 @@ -17,12 +17,19 @@ package net.sourceforge.jnlp; -import java.io.*; -import java.net.*; -import java.util.*; - -import net.sourceforge.jnlp.cache.*; -import net.sourceforge.jnlp.runtime.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; + +import net.sourceforge.jnlp.cache.ResourceTracker; +import net.sourceforge.jnlp.cache.UpdatePolicy; +import net.sourceforge.jnlp.runtime.JNLPRuntime; /** * Provides methods to access the information in a Java Network @@ -520,4 +527,48 @@ public class JNLPFile { } } + /** + * + * @return true if the JNLP file specifies things that can only be + * applied on a new vm (eg: different max heap memory) + */ + public boolean needsNewVM() { + + if (getNewVMArgs().size() == 0) { + return false; + } else { + return true; + } + } + + /** + * @return a list of args to pass to the new + * JVM based on this JNLP file + */ + public List getNewVMArgs() { + + List newVMArgs = new LinkedList(); + + JREDesc[] jres = getResources().getJREs(); + for (int jreIndex = 0; jreIndex < jres.length; jreIndex++) { + String initialHeapSize = jres[jreIndex].getInitialHeapSize(); + if (initialHeapSize != null) { + newVMArgs.add("-Xms" + initialHeapSize); + } + + String maxHeapSize = jres[jreIndex].getMaximumHeapSize(); + if (maxHeapSize != null) { + newVMArgs.add("-Xmx" + maxHeapSize); + } + + String vmArgsFromJre = jres[jreIndex].getVMArgs(); + if (vmArgsFromJre != null) { + String[] args = vmArgsFromJre.split(" "); + newVMArgs.addAll(Arrays.asList(args)); + } + } + + return newVMArgs; + } + } diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/JREDesc.java --- a/netx/net/sourceforge/jnlp/JREDesc.java Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JREDesc.java Wed Jun 10 12:00:53 2009 -0400 @@ -121,6 +121,7 @@ public class JREDesc { /** * Returns the additional arguments to pass to the Java VM + * Can be null */ public String getVMArgs() { return vmArgs; diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Wed Jun 10 12:00:53 2009 -0400 @@ -17,16 +17,27 @@ package net.sourceforge.jnlp; -import java.applet.*; +import java.applet.Applet; import java.awt.Container; -import java.io.*; -import java.net.*; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.net.URL; +import java.util.LinkedList; +import java.util.List; import java.util.jar.JarFile; -import java.lang.reflect.*; - -import net.sourceforge.jnlp.cache.*; -import net.sourceforge.jnlp.runtime.*; -import net.sourceforge.jnlp.util.*; + +import net.sourceforge.jnlp.cache.CacheUtil; +import net.sourceforge.jnlp.cache.ResourceTracker; +import net.sourceforge.jnlp.cache.UpdatePolicy; +import net.sourceforge.jnlp.runtime.AppThreadGroup; +import net.sourceforge.jnlp.runtime.AppletInstance; +import net.sourceforge.jnlp.runtime.ApplicationInstance; +import net.sourceforge.jnlp.runtime.JNLPClassLoader; +import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.util.Reflect; /** * Launches JNLPFiles either in the foreground or background.

@@ -238,44 +249,67 @@ public class Launcher { * application's output is sent to the system out and it's * standard input channel is closed. * + * @param vmArgs the arguments to pass to the new JVM. Can be empty but + * must not be null. * @param file the JNLP file to launch + * @param javawsArgs the arguments to pass to the javaws command. Can be + * an empty list but must not be null. * @throws LaunchException if there was an exception */ - public void launchExternal(JNLPFile file) throws LaunchException { - if (file.getSourceLocation() != null) - launchExternal(file.getSourceLocation()); - else if (file.getFileLocation() != null) - launchExternal(file.getFileLocation()); + public void launchExternal(List vmArgs, JNLPFile file, List javawsArgs) throws LaunchException { + List updatedArgs = new LinkedList(javawsArgs); + + if (file.getFileLocation() != null) + updatedArgs.add(file.getFileLocation().toString()); + else if (file.getSourceLocation() != null) + updatedArgs.add(file.getFileLocation().toString()); else launchError(new LaunchException(file, null, R("LSFatal"), R("LCExternalLaunch"), R("LNullLocation"), R("LNullLocationInfo"))); + + launchExternal(vmArgs, updatedArgs); + + } + + /** + * Launches the JNLP file in a new JVM instance. The launched + * application's output is sent to the system out and it's + * standard input channel is closed. + * + * @param url the URL of the JNLP file to launch + * @throws LaunchException if there was an exception + */ + public void launchExternal(URL url) throws LaunchException { + List javawsArgs = new LinkedList(); + javawsArgs.add(url.toString()); + launchExternal(new LinkedList(), javawsArgs); } /** * Launches the JNLP file at the specified location in a new JVM * instance. The launched application's output is sent to the * system out and it's standard input channel is closed. - * - * @param location the URL of the JNLP file to launch + * @param vmArgs the arguments to pass to the jvm + * @param javawsArgs the arguments to pass to javaws (aka Netx) * @throws LaunchException if there was an exception */ - public void launchExternal(URL location) throws LaunchException { - try { - URL cs = Launcher.class.getProtectionDomain().getCodeSource().getLocation(); - if (JNLPRuntime.isDebug()) - System.out.println("netx.jar path: "+cs.getPath()); - - File netxFile = new File(cs.getPath()); - if (!netxFile.exists()) - throw launchError(new LaunchException(null, null, R("LSFatal"), R("LCExternalLaunch"), R("LNetxJarMissing"), R("LNetxJarMissingInfo"))); - - String command[] = { - "javaw", - "-jar", - netxFile.toString(), - "-jnlp", - location.toString(), - "-verbose", - }; + public void launchExternal(List vmArgs, List javawsArgs) throws LaunchException { + try { + + List commands = new LinkedList(); + + String pathToWebstartBinary = System.getProperty("java.home") + + File.separatorChar + + "bin" + + File.separatorChar + + "javaws"; + commands.add(pathToWebstartBinary); + // use -Jargument format to pass arguments to the JVM through the launcher + for (String arg: vmArgs) { + commands.add("-J" + arg); + } + commands.addAll(javawsArgs); + + String[] command = commands.toArray(new String[] {}); Process p = Runtime.getRuntime().exec(command); new StreamEater(p.getErrorStream()).start(); @@ -331,6 +365,15 @@ public class Launcher { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplication"), R("LNotApplicationInfo"))); try { + + if (JNLPRuntime.getForksAllowed() && file.needsNewVM()) { + List netxArguments = new LinkedList(); + netxArguments.add("-Xnofork"); + netxArguments.addAll(JNLPRuntime.getInitialArguments()); + launchExternal(file.getNewVMArgs(), netxArguments); + return null; + } + final int preferredWidth = 500; final int preferredHeight = 400; JNLPSplashScreen splashScreen = null; diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Wed Jun 10 12:00:53 2009 -0400 @@ -281,6 +281,11 @@ class Parser { Version version = getVersion(node, "version", null); URL location = getURL(node, "href", base); String vmArgs = getAttribute(node, "java-vm-args",null); + try { + checkVMArgs(vmArgs); + } catch (IllegalArgumentException argumentException) { + vmArgs = null; + } String initialHeap = getAttribute(node, "initial-heap-size", null); String maxHeap = getAttribute(node, "max-heap-size", null); List resources = getResources(node, true); @@ -290,6 +295,8 @@ class Parser { return new JREDesc(version, location, vmArgs, initialHeap, maxHeap, resources); } + + /** * Returns the JAR element at the specified node. @@ -992,6 +999,111 @@ class Parser { return null; else return new Version(version); + } + + /** + * Check that the VM args are valid and safe + * @param vmArgs a string containing the args + * @throws ParseException if the VM arguments are invalid or dangerous + */ + private void checkVMArgs(String vmArgs) throws IllegalArgumentException { + if (vmArgs == null) { + return; + } + + List validArguments = Arrays.asList(getValidVMArguments()); + List validStartingArguments = Arrays.asList(getValidStartingVMArguments()); + + String[] arguments = vmArgs.split(" "); + boolean argumentIsValid = false; + for (String argument: arguments) { + argumentIsValid = false; + + if (validArguments.contains(argument)) { + argumentIsValid = true; + } else { + for (String validStartingArgument: validStartingArguments) { + if (argument.startsWith(validStartingArgument)) { + argumentIsValid = true; + break; + } + } + } + + if (!argumentIsValid) { + throw new IllegalArgumentException(argument); + } + } + + } + + /** + * Returns an array of valid (ie safe and supported) arguments for the JVM + * + * Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html + */ + private String[] getValidVMArguments() { + return new String[] { + "-d32", /* use a 32-bit data model if available */ + "-client", /* to select the client VM */ + "-server", /* to select the server VM */ + "-verbose", /* enable verbose output */ + "-version", /* print product version and exit */ + "-showversion", /* print product version and continue */ + "-help", /* print this help message */ + "-X", /* print help on non-standard options */ + "-ea", /* enable assertions */ + "-enableassertions", /* enable assertions */ + "-da", /* disable assertions */ + "-disableassertions", /* disable assertions */ + "-esa", /* enable system assertions */ + "-enablesystemassertions", /* enable system assertions */ + "-dsa", /* disable system assertione */ + "-disablesystemassertions", /* disable system assertione */ + "-Xmixed", /* mixed mode execution (default) */ + "-Xint", /* interpreted mode execution only */ + "-Xnoclassgc", /* disable class garbage collection */ + "-Xincgc", /* enable incremental garbage collection */ + "-Xbatch", /* disable background compilation */ + "-Xprof", /* output cpu profiling data */ + "-Xdebug", /* enable remote debugging */ + "-Xfuture", /* enable strictest checks, anticipating future default */ + "-Xrs", /* reduce use of OS signals by Java/VM (see documentation) */ + "-XX:+ForceTimeHighResolution", /* use high resolution timer */ + "-XX:-ForceTimeHighResolution", /* use low resolution (default) */ + }; + } + + /** + * Returns an array containing the starts of valid (ie safe and supported) + * arguments for the JVM + * + * Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html + */ + private String[] getValidStartingVMArguments() { + return new String[] { + "-ea", /* enable assertions for classes */ + "-enableassertions", /* enable assertions for classes */ + "-da", /* disable assertions for classes */ + "-disableassertions", /* disable assertions for classes */ + "-verbose", /* enable verbose output */ + "-Xms", /* set initial Java heap size */ + "-Xmx", /* set maximum Java heap size */ + "-Xss", /* set java thread stack size */ + "-XX:NewRatio", /* set Ratio of new/old gen sizes */ + "-XX:NewSize", /* set initial size of new generation */ + "-XX:MaxNewSize", /* set max size of new generation */ + "-XX:PermSize", /* set initial size of permanent gen */ + "-XX:MaxPermSize", /* set max size of permanent gen */ + "-XX:MaxHeapFreeRatio", /* heap free percentage (default 70) */ + "-XX:MinHeapFreeRatio", /* heap free percentage (default 40) */ + "-XX:UseSerialGC", /* use serial garbage collection */ + "-XX:ThreadStackSize", /* thread stack size (in KB) */ + "-XX:MaxInlineSize", /* set max num of bytecodes to inline */ + "-XX:ReservedCodeCacheSize", /* Reserved code cache size (bytes) */ + "-XX:MaxDirectMemorySize", + + }; } /** diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/resources/Messages.properties --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jun 10 12:00:53 2009 -0400 @@ -130,6 +130,7 @@ BOStrict = Enables strict checking of BOStrict = Enables strict checking of JNLP file format. BOViewer = Shows the trusted certificate viewer. BOUmask = Sets the umask for files created by an application. +BXnofork = Do not create another JVM. BOHelp = Print this message and exit. # Cache diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/runtime/Boot.java --- a/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Jun 10 12:00:53 2009 -0400 @@ -24,6 +24,7 @@ import java.security.AccessController; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.net.ssl.HttpsURLConnection; @@ -116,6 +117,7 @@ public final class Boot implements Privi + " -headless "+R("BOHeadless")+"\n" + " -strict "+R("BOStrict")+"\n" + " -umask=value "+R("BOUmask")+"\n" + + " -Xnofork "+R("BXnofork")+"\n" + " -help "+R("BOHelp")+"\n"; private static final String doubleArgs = "-basedir -jnlp -arg -param -property -update"; @@ -168,6 +170,10 @@ public final class Boot implements Privi if (null != getOption("-noupdate")) JNLPRuntime.setDefaultUpdatePolicy(UpdatePolicy.NEVER); + + if (null != getOption("-Xnofork")) { + JNLPRuntime.setForksAllowed(false); + } // wire in custom authenticator try { @@ -183,12 +189,13 @@ public final class Boot implements Privi e.printStackTrace(); } + JNLPRuntime.setInitialArgments(Arrays.asList(argsIn)); + // do in a privileged action to clear the security context of // the Boot13 class, which doesn't have any privileges in // JRE1.3; JRE1.4 works without Boot13 or this PrivilegedAction. AccessController.doPrivileged(new Boot()); - args = null; // might save a couple bytes... } /** diff -r 649b859ba20d -r a5edccad3c7c netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 10 10:53:03 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 10 12:00:53 2009 -0400 @@ -21,6 +21,7 @@ import java.awt.*; import java.awt.*; import java.text.*; import java.util.*; +import java.util.List; import java.security.*; import javax.jnlp.*; @@ -96,7 +97,14 @@ public class JNLPRuntime { /** set to true if this is a webstart application. */ private static boolean isWebstartApplication; - + + /** set to false to indicate another JVM should not be spawned, even if necessary */ + private static boolean forksAllowed = true; + + /** contains the arguments passed to the jnlp runtime */ + private static List initialArguments; + + /** * Returns whether the JNLP runtime environment has been * initialized. Once initialized, some properties such as the From omajid at redhat.com Tue Aug 4 09:07:30 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:30 +0000 Subject: changeset in /hg/icedtea: 2009-05-29 Omair Majid changeset 0c18ad4aa0cf in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=0c18ad4aa0cf description: 2009-05-29 Omair Majid * netx/net/sourceforge/jnlp/JREDesc.java: Change initialHeapSize and maximumHeapSize to String. (JREDesc): Check and store initialHeapSize and maximumHeapSize. Throw ParseException on error. (getMaximumHeapSize): Return String. (getInitialHeapSize): Likewise. (heapToLong): Renamed to... (checkHeapSize): New method. Check for valid heap size. * netx/net/sourceforge/jnlp/resources/Messages.properties: Add PBadHeapSize to indicate a bad heap size. diffstat: 3 files changed, 55 insertions(+), 11 deletions(-) ChangeLog | 13 +++ netx/net/sourceforge/jnlp/JREDesc.java | 52 +++++++++++---- netx/net/sourceforge/jnlp/resources/Messages.properties | 1 diffs (134 lines): diff -r fa12c4801f74 -r 0c18ad4aa0cf ChangeLog --- a/ChangeLog Mon May 25 13:54:44 2009 -0400 +++ b/ChangeLog Fri May 29 12:13:53 2009 -0400 @@ -1,3 +1,16 @@ 2009-05-25 Omair Majid + + * netx/net/sourceforge/jnlp/JREDesc.java: + Change initialHeapSize and maximumHeapSize to String. + (JREDesc): Check and store initialHeapSize and maximumHeapSize. Throw + ParseException on error. + (getMaximumHeapSize): Return String. + (getInitialHeapSize): Likewise. + (heapToLong): Renamed to... + (checkHeapSize): New method. Check for valid heap size. + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add PBadHeapSize + to indicate a bad heap size. + 2009-05-25 Omair Majid * netx/net/sourceforge/jnlp/resources/Messages.properties: Add diff -r fa12c4801f74 -r 0c18ad4aa0cf netx/net/sourceforge/jnlp/JREDesc.java --- a/netx/net/sourceforge/jnlp/JREDesc.java Mon May 25 13:54:44 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JREDesc.java Fri May 29 12:13:53 2009 -0400 @@ -21,6 +21,8 @@ import java.net.*; import java.net.*; import java.util.*; +import net.sourceforge.jnlp.runtime.JNLPRuntime; + /** * The J2SE/Java element. * @@ -36,10 +38,10 @@ public class JREDesc { private URL location; /** inital heap size */ - private long initialHeapSize; + private String initialHeapSize; /** maximum head size */ - private long maximumHeapSize; + private String maximumHeapSize; /** args to pass to the vm */ private String vmArgs; @@ -60,12 +62,14 @@ public class JREDesc { */ public JREDesc(Version version, URL location, String vmArgs, String initialHeapSize, - String maximumHeapSize, List resources) { + String maximumHeapSize, List resources) throws ParseException { this.version = version; this.location = location; this.vmArgs = vmArgs; - this.initialHeapSize = heapToLong(initialHeapSize); - this.maximumHeapSize = heapToLong(maximumHeapSize); + checkHeapSize(initialHeapSize); + this.initialHeapSize = initialHeapSize; + checkHeapSize(maximumHeapSize); + this.maximumHeapSize = maximumHeapSize; this.resources = resources; } @@ -97,14 +101,14 @@ public class JREDesc { /** * Returns the maximum heap size in bytes. */ - public long getMaximumHeapSize() { + public String getMaximumHeapSize() { return maximumHeapSize; } /** * Returns the initial heap size in bytes. */ - public long getInitialHeapSize() { + public String getInitialHeapSize() { return initialHeapSize; } @@ -123,12 +127,38 @@ public class JREDesc { } /** - * Convert a heap size description string to a long value - * indicating the heap min/max size. + * Check for valid heap size string + * @throws ParseException if heapSize is invalid */ - static private long heapToLong(String heapSize) { + static private void checkHeapSize(String heapSize) throws ParseException { // need to implement for completeness even though not used in netx - return -1; + if (heapSize == null) { + return; + } + + boolean lastCharacterIsDigit = true; + // the last character must be 0-9 or k/K/m/M + char lastChar = Character.toLowerCase(heapSize.charAt(heapSize.length()-1)); + if ((lastChar < '0' || lastChar > '9')) { + lastCharacterIsDigit = false; + if (lastChar != 'k' && lastChar!= 'm' ) { + throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize",new Object[] {heapSize})); + } + } + + int indexOfLastDigit = heapSize.length() - 1; + if (!lastCharacterIsDigit) { + indexOfLastDigit = indexOfLastDigit - 1; + } + + String size = heapSize.substring(0,indexOfLastDigit); + try { + // check that the number is a number! + Integer.valueOf(size); + } catch (NumberFormatException numberFormat) { + throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize", new Object[] {heapSize}), numberFormat); + } + } } diff -r fa12c4801f74 -r 0c18ad4aa0cf netx/net/sourceforge/jnlp/resources/Messages.properties --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Mon May 25 13:54:44 2009 -0400 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Fri May 29 12:13:53 2009 -0400 @@ -88,6 +88,7 @@ PBadNonrelativeUrl=Invalid non-relative PBadNonrelativeUrl=Invalid non-relative URL (node={0}, href={0}). PNeedsAttribute=The {0} element must specify a {1} attribute. PBadXML=Invalid XML document syntax. +PBadHeapSize=Invalid value for heap size ({0}) # Runtime BLaunchAbout=Launching about window... From omajid at redhat.com Tue Aug 4 09:07:30 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:30 +0000 Subject: changeset in /hg/icedtea: 2009-06-09 Omair Majid changeset 6941e22111cc in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=6941e22111cc description: 2009-06-09 Omair Majid * netx/net/sourceforge/jnlp/AssociationDesc.java: New file. (AssociationDesc): New function. Create an association descriptor. (getExtensions): New function. Get the extensions for this association. (getMimeType): New function. Get the mimetype for this association. (checkMimeType): New function. * netx/net/sourceforge/jnlp/InformationDesc.java (getAssociations): New function. Get the associations. (getShortcut): New function. Get the shortcut. (getRelatedContents): New function. Get the related-contents. * netx/net/sourceforge/jnlp/MenuDesc.java: New file. (MenuDesc): New function. (getSubMenu): New function. Get the submenu for this menu descriptor. * netx/net/sourceforge/jnlp/Parser.java (getInformationDesc): Parse "assocation", "shortcut" and "related-content" elements. (getAssociation): New function. Parse the association node to create a AssociationDesc. (getShortcut): New function. Parse the shortcut node to create a ShortcutDesc. (getMenu): New function. Parse a menu node to create a MenuDesc. (getRelatedContent): New function. Parse a related-content node to create a RelatedContentDesc. * netx/net/sourceforge/jnlp/RelatedContentDesc.java (RelatedContentDesc): New function. (setTitle): New function. Set the title of this content. (getTitle): New function. Get the title of this content. (setDescription): New function. Set the description of this content. (getDescription): New function. Get the description of this content. (getLocation): New function. Get the location of this content. (setIconDesc): New function. Set the icon descriptor for this content. (getIcon): Get the icon descriptor for this content. * netx/net/sourceforge/jnlp/ShortcutDesc.java (ShortcutDesc): New function. Initialize requiresOnline and onDesktop. (isOnline): New function. Return true if the shortcut is online only. (onDesktop): New function. Return true if the shortcut should be placed on the desktop. (addMenu): New function. Add a menu descriptor for this shortcut. (getMenu): New function. Return the menu descriptor for this shortcut. * netx/net/sourceforge/jnlp/resources/Messages.properties: Add PTwoDesktops, PTwoMenus, PTwoTitle and PTwoIcons. diffstat: 8 files changed, 445 insertions(+) ChangeLog | 43 +++++ netx/net/sourceforge/jnlp/AssociationDesc.java | 56 +++++++ netx/net/sourceforge/jnlp/InformationDesc.java | 27 +++ netx/net/sourceforge/jnlp/MenuDesc.java | 38 +++++ netx/net/sourceforge/jnlp/Parser.java | 114 +++++++++++++++ netx/net/sourceforge/jnlp/RelatedContentDesc.java | 93 ++++++++++++ netx/net/sourceforge/jnlp/ShortcutDesc.java | 70 +++++++++ netx/net/sourceforge/jnlp/resources/Messages.properties | 4 diffs (truncated from 515 to 500 lines): diff -r 0c18ad4aa0cf -r 6941e22111cc ChangeLog --- a/ChangeLog Fri May 29 12:13:53 2009 -0400 +++ b/ChangeLog Tue Jun 09 14:08:52 2009 -0400 @@ -1,3 +1,46 @@ 2009-05-29 Omair Majid + + * netx/net/sourceforge/jnlp/AssociationDesc.java: New file. + (AssociationDesc): New function. Create an association descriptor. + (getExtensions): New function. Get the extensions for this association. + (getMimeType): New function. Get the mimetype for this association. + (checkMimeType): New function. + * netx/net/sourceforge/jnlp/InformationDesc.java + (getAssociations): New function. Get the associations. + (getShortcut): New function. Get the shortcut. + (getRelatedContents): New function. Get the related-contents. + * netx/net/sourceforge/jnlp/MenuDesc.java: New file. + (MenuDesc): New function. + (getSubMenu): New function. Get the submenu for this menu descriptor. + * netx/net/sourceforge/jnlp/Parser.java + (getInformationDesc): Parse "assocation", "shortcut" and + "related-content" elements. + (getAssociation): New function. Parse the association node to create a + AssociationDesc. + (getShortcut): New function. Parse the shortcut node to create a + ShortcutDesc. + (getMenu): New function. Parse a menu node to create a MenuDesc. + (getRelatedContent): New function. Parse a related-content node to create a + RelatedContentDesc. + * netx/net/sourceforge/jnlp/RelatedContentDesc.java + (RelatedContentDesc): New function. + (setTitle): New function. Set the title of this content. + (getTitle): New function. Get the title of this content. + (setDescription): New function. Set the description of this content. + (getDescription): New function. Get the description of this content. + (getLocation): New function. Get the location of this content. + (setIconDesc): New function. Set the icon descriptor for this content. + (getIcon): Get the icon descriptor for this content. + * netx/net/sourceforge/jnlp/ShortcutDesc.java + (ShortcutDesc): New function. Initialize requiresOnline and onDesktop. + (isOnline): New function. Return true if the shortcut is online only. + (onDesktop): New function. Return true if the shortcut should be placed on + the desktop. + (addMenu): New function. Add a menu descriptor for this shortcut. + (getMenu): New function. Return the menu descriptor for this shortcut. + * netx/net/sourceforge/jnlp/resources/Messages.properties: + Add PTwoDesktops, PTwoMenus, PTwoTitle and PTwoIcons. + 2009-05-29 Omair Majid * netx/net/sourceforge/jnlp/JREDesc.java: diff -r 0c18ad4aa0cf -r 6941e22111cc netx/net/sourceforge/jnlp/AssociationDesc.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/AssociationDesc.java Tue Jun 09 14:08:52 2009 -0400 @@ -0,0 +1,56 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp; + +public final class AssociationDesc { + + /** the extensions this application wants to register with */ + private String[] extensions; + + /** the mime type for the association */ + private String mimeType; + + public AssociationDesc(String mimeType, String[] extensions) throws ParseException { + checkMimeType(mimeType); + this.mimeType = mimeType; + this.extensions = extensions; + } + + /** + * Return the extensions for this association + */ + public String[] getExtensions() { + return extensions; + } + + /** + * Return the mimetype for this association + */ + public String getMimeType() { + return mimeType; + } + + /** + * Check for valid mimeType + * @param mimeType a mime type + * @throws ParseException if mimeType is an invalid MIME type + */ + private void checkMimeType(String mimeType) throws ParseException { + // TODO check that mime type is valid + } + +} diff -r 0c18ad4aa0cf -r 6941e22111cc netx/net/sourceforge/jnlp/InformationDesc.java --- a/netx/net/sourceforge/jnlp/InformationDesc.java Fri May 29 12:13:53 2009 -0400 +++ b/netx/net/sourceforge/jnlp/InformationDesc.java Tue Jun 09 14:08:52 2009 -0400 @@ -1,4 +1,5 @@ // Copyright (C) 2001-2003 Jon A. Maxwell (JAM) +// Copyright (C) 2009 Red Hat, Inc. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -200,6 +201,32 @@ public class InformationDesc { } /** + * Returns the associations specified in the JNLP file + */ + public AssociationDesc[] getAssociations() { + List associations = getItems("association"); + + return (AssociationDesc[]) associations.toArray(new AssociationDesc[associations.size()]); + } + + /** + * Returns the shortcut specified by this JNLP file + */ + public ShortcutDesc getShortcut() { + return (ShortcutDesc) getItem("shortcut"); + } + + /** + * Returns the related-contents specified by this JNLP file + */ + public RelatedContentDesc[] getRelatedContents() { + List relatedContents = getItems("related-content"); + + return (RelatedContentDesc[]) relatedContents.toArray( + new RelatedContentDesc[relatedContents.size()]); + } + + /** * Returns the last item matching the specified key. */ protected Object getItem(Object key) { diff -r 0c18ad4aa0cf -r 6941e22111cc netx/net/sourceforge/jnlp/MenuDesc.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/MenuDesc.java Tue Jun 09 14:08:52 2009 -0400 @@ -0,0 +1,38 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp; + +public class MenuDesc { + + /** the submenu for this menu entry */ + private String subMenu; + + /** + * Create a new menu descriptor + */ + public MenuDesc(String subMenu) { + this.subMenu = subMenu; + } + + /** + * Returns the submenu for this menu entry. + */ + public String getSubMenu() { + return subMenu; + } + +} diff -r 0c18ad4aa0cf -r 6941e22111cc netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Fri May 29 12:13:53 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Tue Jun 09 14:08:52 2009 -0400 @@ -1,4 +1,5 @@ // Copyright (C) 2001-2003 Jon A. Maxwell (JAM) +// Copyright (C) 2009 Red Hat, Inc. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -435,6 +436,15 @@ class Parser { throw new ParseException(R("PSharing")); addInfo(info, child, null, Boolean.TRUE); } + if ("association".equals(name)) { + addInfo(info, child, null, getAssociation(child)); + } + if ("shortcut".equals(name)) { + addInfo(info, child, null, getShortcut(child)); + } + if ("related-content".equals(name)) { + addInfo(info, child, null, getRelatedContent(child)); + } child = child.getNextSibling(); } @@ -643,6 +653,110 @@ class Parser { return new InstallerDesc(main); } + /** + * Returns the association descriptor. + */ + public AssociationDesc getAssociation(Node node) throws ParseException { + String[] extensions = getRequiredAttribute(node, "extensions", null).split(" "); + String mimeType = getRequiredAttribute(node, "mime-type", null); + + return new AssociationDesc(mimeType, extensions); + } + + /** + * Returns the shortcut descriptor. + */ + public ShortcutDesc getShortcut(Node node) throws ParseException { + + String online = getAttribute(node, "online", "true"); + boolean shortcutIsOnline = Boolean.valueOf(online); + + boolean showOnDesktop = false; + MenuDesc menu = null; + + // step through the elements + Node child = node.getFirstChild(); + while (child != null) { + String name = child.getNodeName(); + + if ("desktop".equals(name)) { + if (showOnDesktop && strict) { + throw new ParseException(R("PTwoDesktops")); + } + showOnDesktop = true; + } else if ("menu".equals(name)){ + if (menu != null && strict) { + throw new ParseException(R("PTwoMenus")); + } + menu = getMenu(child); + } + + child = child.getNextSibling(); + } + + ShortcutDesc shortcut = new ShortcutDesc(shortcutIsOnline, showOnDesktop); + if (menu != null) { + shortcut.addMenu(menu); + } + return shortcut; + } + + /** + * Returns the menu descriptor. + */ + public MenuDesc getMenu(Node node) { + String subMenu = getAttribute(node, "submenu", null); + + return new MenuDesc(subMenu); + } + + + /** + * Returns the related-content descriptor. + */ + public RelatedContentDesc getRelatedContent(Node node) throws ParseException { + + getRequiredAttribute(node, "href", null); + URL location = getURL(node, "href", base); + + String title = null; + String description = null; + IconDesc icon = null; + + // step through the elements + Node child = node.getFirstChild(); + while (child != null) { + String name = child.getNodeName(); + + if ("title".equals(name)) { + if (title != null && strict) { + throw new ParseException(R("PTwoTitles")); + } + title = getSpanText(child); + } else if ("description".equals(name)) { + if (description != null && strict) { + throw new ParseException(R("PTwoDescriptions")); + } + description = getSpanText(child); + } else if ("icon".equals(name)) { + if (icon != null && strict) { + throw new ParseException(R("PTwoIcons")); + } + icon = getIcon(child); + } + + child = child.getNextSibling(); + } + + RelatedContentDesc relatedContent = new RelatedContentDesc(location); + relatedContent.setDescription(description); + relatedContent.setIconDesc(icon); + relatedContent.setTitle(title); + + return relatedContent; + + } + // other methods /** diff -r 0c18ad4aa0cf -r 6941e22111cc netx/net/sourceforge/jnlp/RelatedContentDesc.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/RelatedContentDesc.java Tue Jun 09 14:08:52 2009 -0400 @@ -0,0 +1,93 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp; + +import java.net.URL; + +public class RelatedContentDesc { + + /** title of the content */ + private String title = null;; + + /** the description of the content */ + private String description = null; + + /** the location of the content */ + private URL location = null; + + /** the icon for this related content */ + private IconDesc icon = null; + + /** + * Create a related-content descriptor + * @param href the url of the related content + */ + public RelatedContentDesc(URL href) { + this.location = href; + } + + /** + * Set the title of this content + * @param title the title of this content + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Returns the title of this content.. + */ + public String getTitle() { + return title; + } + + /** + * Set the description of this related content + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Returns the description of the related content + */ + public String getDescription() { + return description; + } + + /** + * Returns the location of the related content. Not null + */ + public URL getLocation() { + return location; + } + + /** + * Set the icon for this related content + */ + public void setIconDesc(IconDesc icon) { + this.icon = icon; + } + + /** + * Returns the icon descriptor for the realted content + */ + public IconDesc getIcon() { + return icon; + } + +} diff -r 0c18ad4aa0cf -r 6941e22111cc netx/net/sourceforge/jnlp/ShortcutDesc.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/ShortcutDesc.java Tue Jun 09 14:08:52 2009 -0400 @@ -0,0 +1,70 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp; + +public final class ShortcutDesc { + + /** the application wants to be placed on the desktop */ + private boolean onDesktop = false; + + /** the application needs to be launched online */ + private boolean requiresOnline = true; + + /** the menu descriptor */ + private MenuDesc menu = null; + + /** + * Create a new Shortcut descriptor + * @param requiresOnline whether the shortcut requires connectivity + * @param onDesktop whether the shortcut wants to be placed on the desktop + */ + public ShortcutDesc(boolean requiresOnline, boolean onDesktop) { + this.requiresOnline = requiresOnline; + this.onDesktop = onDesktop; + } + + /** + * Returns whether the shortcut requires being online + */ + public boolean isOnline() { + return requiresOnline; + } + + /** + * Return whether the shortcut should be placed on the desktop + */ + public boolean onDesktop() { + return onDesktop; + } + + /** + * Add a shortcut to the 'start menu' + * (whatever that means on gnome/kde/other ...) + * @param menu if/what menu this shortcut should be added to + */ + public void addMenu(MenuDesc menu) { + this.menu = menu; + } + + /** + * Returns the menu this shortcut should be added to + */ + public MenuDesc getMenu() { + return menu; + } + From omajid at redhat.com Tue Aug 4 09:07:31 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:31 +0000 Subject: changeset in /hg/icedtea: 2009-06-10 Omair Majid changeset 649b859ba20d in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=649b859ba20d description: 2009-06-10 Omair Majid * netx/net/sourceforge/jnlp/services/XBasicService.java (isOffline): Check if the system is offline by retrieving data from a URL. (findFirstURLFromJNLPFile): New function. Obtain a URL from the JNLP file. As a last resort, return an arbitrary known URL. diffstat: 2 files changed, 76 insertions(+), 9 deletions(-) ChangeLog | 7 + netx/net/sourceforge/jnlp/services/XBasicService.java | 78 +++++++++++++++-- diffs (109 lines): diff -r 6941e22111cc -r 649b859ba20d ChangeLog --- a/ChangeLog Tue Jun 09 14:08:52 2009 -0400 +++ b/ChangeLog Wed Jun 10 10:53:03 2009 -0400 @@ -1,3 +1,10 @@ 2009-06-09 Omair Majid + + * netx/net/sourceforge/jnlp/services/XBasicService.java + (isOffline): Check if the system is offline by retrieving data from a URL. + (findFirstURLFromJNLPFile): New function. Obtain a URL from the JNLP file. + As a last resort, return an arbitrary known URL. + 2009-06-09 Omair Majid * netx/net/sourceforge/jnlp/AssociationDesc.java: New file. diff -r 6941e22111cc -r 649b859ba20d netx/net/sourceforge/jnlp/services/XBasicService.java --- a/netx/net/sourceforge/jnlp/services/XBasicService.java Tue Jun 09 14:08:52 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/XBasicService.java Wed Jun 10 10:53:03 2009 -0400 @@ -17,14 +17,21 @@ package net.sourceforge.jnlp.services; -import java.io.*; -import java.net.*; -import javax.jnlp.*; -import javax.swing.*; - -import net.sourceforge.jnlp.*; -import net.sourceforge.jnlp.runtime.*; -import net.sourceforge.jnlp.util.*; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.jnlp.BasicService; +import javax.swing.JOptionPane; +import javax.swing.JPanel; + +import net.sourceforge.jnlp.InformationDesc; +import net.sourceforge.jnlp.JARDesc; +import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.Launcher; +import net.sourceforge.jnlp.runtime.ApplicationInstance; +import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.util.PropertiesFile; /** * The BasicService JNLP service. @@ -81,7 +88,60 @@ class XBasicService implements BasicServ * Return true if the Environment is Offline */ public boolean isOffline() { - return false; + + URL url = findFirstURLFromJNLPFile(); + + try { + url.openConnection().getInputStream().close(); + return false; + } catch (IOException exception) { + return true; + } + } + + /** + * Return the first URL from the jnlp file + * Or a default URL if no url found in JNLP file + */ + private URL findFirstURLFromJNLPFile() { + + ApplicationInstance app = JNLPRuntime.getApplication(); + + if (app != null) { + JNLPFile jnlpFile = app.getJNLPFile(); + + URL sourceURL = jnlpFile.getSourceLocation(); + if (sourceURL != null) { + return sourceURL; + } + + URL codeBaseURL = jnlpFile.getCodeBase(); + if (codeBaseURL != null) { + return codeBaseURL; + } + + InformationDesc informationDesc = jnlpFile.getInformation(); + URL homePage = informationDesc.getHomepage(); + if (homePage != null) { + return homePage; + } + + JARDesc[] jarDescs = jnlpFile.getResources().getJARs(); + for (JARDesc jarDesc: jarDescs) { + return jarDesc.getLocation(); + } + } + + // this section is only reached if the jnlp file has no jars. + // that doesnt seem very likely. + URL arbitraryURL; + try { + arbitraryURL = new URL("http://icedtea.classpath.org"); + } catch (MalformedURLException malformedURL) { + throw new RuntimeException(malformedURL); + } + + return arbitraryURL; } /** From omajid at redhat.com Tue Aug 4 09:07:29 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:29 +0000 Subject: changeset in /hg/icedtea: 2009-05-25 Omair Majid changeset fa12c4801f74 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=fa12c4801f74 description: 2009-05-25 Omair Majid * netx/net/sourceforge/jnlp/resources/Messages.properties: Add RUnexpected to show generic unexpected information. * netx/net/sourceforge/jnlp/runtime/Boot.java (run): Show more information about the fatal exception. diffstat: 3 files changed, 10 insertions(+), 1 deletion(-) ChangeLog | 7 +++++++ netx/net/sourceforge/jnlp/resources/Messages.properties | 1 + netx/net/sourceforge/jnlp/runtime/Boot.java | 3 ++- diffs (38 lines): diff -r 9a93570b7b06 -r fa12c4801f74 ChangeLog --- a/ChangeLog Fri May 22 10:13:16 2009 -0400 +++ b/ChangeLog Mon May 25 13:54:44 2009 -0400 @@ -1,3 +1,10 @@ 2009-05-22 Omair Majid + + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add + RUnexpected to show generic unexpected information. + * netx/net/sourceforge/jnlp/runtime/Boot.java (run): Show more + information about the fatal exception. + 2009-05-22 Omair Majid * netx/net/sourceforge/jnlp/JNLPFile.java (parse): Fix comment to reflect diff -r 9a93570b7b06 -r fa12c4801f74 netx/net/sourceforge/jnlp/resources/Messages.properties --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Fri May 22 10:13:16 2009 -0400 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Mon May 25 13:54:44 2009 -0400 @@ -105,6 +105,7 @@ RCantReplaceSM=Changing the SecurityMana RCantReplaceSM=Changing the SecurityManager is not allowed. RDenyStopped=Stopped applications have no permissions. RExitNoApp=Can not exit the JVM because the current application cannot be determined. +RUnexpected=Unexpected {0} at {1} # Boot options, message should be shorter than this ----------------> BOUsage=javaws [-run-options] diff -r 9a93570b7b06 -r fa12c4801f74 netx/net/sourceforge/jnlp/runtime/Boot.java --- a/netx/net/sourceforge/jnlp/runtime/Boot.java Fri May 22 10:13:16 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Mon May 25 13:54:44 2009 -0400 @@ -209,7 +209,8 @@ public final class Boot implements Privi if (JNLPRuntime.isDebug()) ex.printStackTrace(); - fatalError(ex.getMessage()); + fatalError(JNLPRuntime.getMessage("RUnexpected", + new Object[] {ex.toString(), ex.getStackTrace()[0]} )); } return null; From dbhole at redhat.com Tue Aug 4 09:07:32 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:32 +0000 Subject: changeset in /hg/icedtea: - Fix race conditions related to multi... Message-ID: changeset ee421053683d in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=ee421053683d description: - Fix race conditions related to multi-stage initialization/destruction - Account for port# when implementing security policy based on address - Reduce sleep time during initialization check iterations diffstat: 4 files changed, 168 insertions(+), 32 deletions(-) ChangeLog | 9 + IcedTeaPlugin.cc | 22 ++ netx/net/sourceforge/jnlp/NetxPanel.java | 2 plugin/icedtea/sun/applet/PluginAppletViewer.java | 167 +++++++++++++++++---- diffs (359 lines): diff -r 8754d9d3bc2c -r ee421053683d ChangeLog --- a/ChangeLog Tue Jun 16 10:58:00 2009 -0400 +++ b/ChangeLog Wed Jun 17 14:47:36 2009 -0400 @@ -1,3 +1,12 @@ 2009-06-16 Omair Majid + + * IcedTeaPlugin.cc: Fix race condition that led to segfault. + * plugin/icedtea/sun/applet/PluginAppletViewer.java: Fix a host of race + conditions brought about by the multi stage asynchronous initialization + design. + * netx/net/sourceforge/jnlp/NetxPanel.java: Account for case where handler + may be null due to an error above. + 2009-06-16 Omair Majid * netx/javax/jnlp/SingleInstanceListener.java: New file. diff -r 8754d9d3bc2c -r ee421053683d IcedTeaPlugin.cc --- a/IcedTeaPlugin.cc Tue Jun 16 10:58:00 2009 -0400 +++ b/IcedTeaPlugin.cc Wed Jun 17 14:47:36 2009 -0400 @@ -1065,6 +1065,7 @@ private: gpointer window_handle; guint32 window_width; guint32 window_height; + PRBool is_active; // FIXME: nsCOMPtr. IcedTeaPluginFactory* factory; PRUint32 instance_identifier; @@ -2447,6 +2448,7 @@ IcedTeaPluginInstance::Destroy () nsCString destroyMessage (instanceIdentifierPrefix); destroyMessage += "destroy"; factory->SendMessageToAppletViewer (destroyMessage); + is_active = PR_FALSE; return NS_OK; } @@ -2475,7 +2477,9 @@ IcedTeaPluginInstance::SetWindow (nsPlug long startTime = get_time_in_s(); PRBool timedOut = PR_FALSE; - while (initialized == PR_FALSE && this->fatalErrorOccurred == PR_FALSE) + while (initialized == PR_FALSE && + this->fatalErrorOccurred == PR_FALSE && + this->is_active == PR_FALSE) { PROCESS_PENDING_EVENTS; @@ -2638,7 +2642,9 @@ IcedTeaPluginInstance::GetJavaObject (jo long startTime = get_time_in_s(); PRBool timedOut = PR_FALSE; - while (initialized == PR_FALSE && this->fatalErrorOccurred == PR_FALSE) + while (initialized == PR_FALSE && + this->fatalErrorOccurred == PR_FALSE && + this->is_active == PR_FALSE) { PROCESS_PENDING_EVENTS; @@ -4115,6 +4121,7 @@ IcedTeaPluginInstance::IcedTeaPluginInst liveconnect_window (0), initialized(PR_FALSE), fatalErrorOccurred(PR_FALSE), + is_active(PR_TRUE), instanceIdentifierPrefix ("") { PLUGIN_TRACE_INSTANCE (); @@ -4134,6 +4141,7 @@ IcedTeaPluginInstance::GetWindow () nsresult result; PLUGIN_DEBUG_1ARG ("HERE 22: %d\n", liveconnect_window); + // principalsArray, numPrincipals and securitySupports // are ignored by GetWindow. See: // @@ -4144,6 +4152,16 @@ IcedTeaPluginInstance::GetWindow () if (factory->proxyEnv != NULL) { PLUGIN_DEBUG_2ARG ("HERE 23: %d, %p\n", liveconnect_window, current_thread ()); + + // there is a bad race condition here where if the instance is active, + // this code remains active after destruction.. so double check + if (is_active != PR_TRUE) + { + PLUGIN_DEBUG_1ARG("Plugin %d is no longer active. Bypassing \ + GetWindow request.\n", instance_identifier); + return; + } + result = factory->liveconnect->GetWindow(factory->proxyEnv, this, NULL, 0, NULL, diff -r 8754d9d3bc2c -r ee421053683d netx/net/sourceforge/jnlp/NetxPanel.java --- a/netx/net/sourceforge/jnlp/NetxPanel.java Tue Jun 16 10:58:00 2009 -0400 +++ b/netx/net/sourceforge/jnlp/NetxPanel.java Wed Jun 17 14:47:36 2009 -0400 @@ -144,7 +144,7 @@ public class NetxPanel extends AppletVie } public boolean isAlive() { - return handler.isAlive() && this.appletAlive; + return handler != null && handler.isAlive() && this.appletAlive; } } diff -r 8754d9d3bc2c -r ee421053683d plugin/icedtea/sun/applet/PluginAppletViewer.java --- a/plugin/icedtea/sun/applet/PluginAppletViewer.java Tue Jun 16 10:58:00 2009 -0400 +++ b/plugin/icedtea/sun/applet/PluginAppletViewer.java Wed Jun 17 14:47:36 2009 -0400 @@ -145,6 +145,8 @@ import com.sun.jndi.toolkit.url.UrlUtil; */ private static String defaultSaveFile = "Applet.ser"; + private static enum PAV_INIT_STATUS {PRE_INIT, ACTIVE, INACTIVE}; + /** * The panel in which the applet is being displayed. */ @@ -168,17 +170,23 @@ import com.sun.jndi.toolkit.url.UrlUtil; int identifier; - private static HashMap requests = new HashMap(); + private static HashMap requests = + new HashMap(); // Instance identifier -> PluginAppletViewer object. - private static HashMap applets = new HashMap(); + private static HashMap applets = + new HashMap(); private static PluginStreamHandler streamhandler; private static PluginCallRequestFactory requestFactory; - private static HashMap siteCookies = new HashMap(); - + private static HashMap siteCookies = + new HashMap(); + + private static HashMap status = + new HashMap(); + private double proposedHeightFactor; private double proposedWidthFactor; @@ -312,7 +320,7 @@ import com.sun.jndi.toolkit.url.UrlUtil; Applet a; while ((a = panel.getApplet()) == null && ((NetxPanel) panel).isAlive()) { try { - Thread.sleep(2000); + Thread.sleep(1000); PluginDebug.debug("Waiting for applet to initialize... "); } catch (InterruptedException ie) { ie.printStackTrace(); @@ -328,7 +336,8 @@ import com.sun.jndi.toolkit.url.UrlUtil; PluginDebug.debug("Applet initialized"); // Applet initialized. Find out it's classloader and add it to the list - String codeBase = doc.getProtocol() + "://" + doc.getHost(); + String portComponent = doc.getPort() != -1 ? ":" + doc.getPort() : ""; + String codeBase = doc.getProtocol() + "://" + doc.getHost() + portComponent; if (atts.get("codebase") != null) { try { @@ -373,6 +382,21 @@ import com.sun.jndi.toolkit.url.UrlUtil; // may happen in independent threads synchronized(requests) { + + // Check if we should proceed with init + // (=> no if destroy was called after tag, but before + // handle) + if (status.containsKey(identifier) && + status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) { + + PluginDebug.debug("Inactive flag set. Refusing to initialize instance " + identifier); + requests.remove(identifier); + return; + + } + + status.put(identifier, PAV_INIT_STATUS.PRE_INIT); + PluginParseRequest request = requests.get(identifier); if (request == null) { request = new PluginParseRequest(); @@ -393,6 +417,17 @@ import com.sun.jndi.toolkit.url.UrlUtil; new StringReader(request.tag), new URL(request.documentbase)); requests.remove(identifier); + + // Panel initialization cannot be aborted mid-way. + // Once it is initialized, double check to see if this + // panel needs to stay around.. + if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) { + PluginDebug.debug("Inactive flag set. Destroying applet instance " + identifier); + applets.get(identifier).handleMessage(-1, "destroy"); + } else { + status.put(identifier, PAV_INIT_STATUS.ACTIVE); + } + } else { PluginDebug.debug ("REQUEST HANDLE NOT SET: " + request.handle + ". BYPASSING"); } @@ -400,6 +435,21 @@ import com.sun.jndi.toolkit.url.UrlUtil; } else if (message.startsWith("handle")) { synchronized(requests) { + + // Check if we should proceed with init + // (=> no if destroy was called after handle, but before + // tag) + if (status.containsKey(identifier) && + status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) { + + PluginDebug.debug("Inactive flag set. Refusing to initialize instance " + identifier); + requests.remove(identifier); + return; + + } + + status.put(identifier, PAV_INIT_STATUS.PRE_INIT); + PluginParseRequest request = requests.get(identifier); if (request == null) { request = new PluginParseRequest(); @@ -418,6 +468,17 @@ import com.sun.jndi.toolkit.url.UrlUtil; requests.remove(identifier); PluginDebug.debug ("REQUEST HANDLE, DONE PARSING " + Thread.currentThread()); + + // Panel initialization cannot be aborted mid-way. + // Once it is initialized, double check to see if this + // panel needs to stay around.. + if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) { + PluginDebug.debug("Inactive flag set. Destroying applet instance " + identifier); + applets.get(identifier).handleMessage(-1, "destroy"); + } else { + status.put(identifier, PAV_INIT_STATUS.ACTIVE); + } + } else { PluginDebug.debug ("REQUEST TAG NOT SET: " + request.tag + ". BYPASSING"); } @@ -433,12 +494,57 @@ import com.sun.jndi.toolkit.url.UrlUtil; // Always set the cookie -- even if it is null siteCookies.put(identifier, cookieStr); } else { - PluginDebug.debug ("HANDLING MESSAGE " + message + " instance " + identifier + " " + Thread.currentThread()); + PluginDebug.debug ("Handling message: " + message + " instance " + identifier + " " + Thread.currentThread()); + + // Destroy may be called while initialization is still going + // on. We therefore special case it. + if (!applets.containsKey(identifier) && message.equals("destroy")) { + + // Set the status to inactive right away. Doesn't matter if it + // gets clobbered during init. due to a race. That is what the + // double check below is for. + PluginDebug.debug("Destroy called during initialization. Delaying destruction."); + status.put(identifier, PAV_INIT_STATUS.INACTIVE); + + // We have set the flags. We now lock what stage 1 and 2 + // lock on, and force a synchronous status check+action. + synchronized (requests) { + // re-check (inside lock) if the applet is + // initialized at this point. + if (applets.containsKey(identifier)) { + PluginDebug.debug("Init done. destroying normally."); + applets.get(identifier).handleMessage(reference, message); + } else { + } + } // unlock + + // we're done here + return; + } + + // For messages other than destroy, wait till initialization finishes + while (!applets.containsKey(identifier) && + ( + !status.containsKey(identifier) || + status.get(identifier).equals(PAV_INIT_STATUS.PRE_INIT) + ) + ); + + // don't bother processing further for inactive applets + if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) + return; + applets.get(identifier).handleMessage(reference, message); } } catch (Exception e) { - throw new RuntimeException("Failed to handle message: " + message + " " + - Thread.currentThread(), e); + + // If an exception happened during pre-init, we need to update status + if (status.get(identifier).equals(PAV_INIT_STATUS.PRE_INIT)) + status.put(identifier, PAV_INIT_STATUS.INACTIVE); + + throw new RuntimeException("Failed to handle message: " + + message + " for instance " + identifier + " " + + Thread.currentThread(), e); } } @@ -487,6 +593,7 @@ import com.sun.jndi.toolkit.url.UrlUtil; } } else if (message.startsWith("destroy")) { dispose(); + status.put(identifier, PAV_INIT_STATUS.INACTIVE); } else if (message.startsWith("GetJavaObject")) { // FIXME: how do we determine what security context this // object should belong to? @@ -1291,26 +1398,28 @@ import com.sun.jndi.toolkit.url.UrlUtil; * the last applet. */ void appletClose() { - - // The caller thread is event dispatch thread, so - // spawn a new thread to avoid blocking the event queue - // when calling appletShutdown. - // - final AppletPanel p = panel; - - new Thread(new Runnable() - { - public void run() - { - appletShutdown(p); - appletPanels.removeElement(p); - dispose(); - - if (countApplets() == 0) { - appletSystemExit(); - } - } - }).start(); + + // The caller thread is event dispatch thread, so + // spawn a new thread to avoid blocking the event queue + // when calling appletShutdown. + // + final AppletPanel p = panel; + + new Thread(new Runnable() + { + public void run() + { + appletShutdown(p); + appletPanels.removeElement(p); + dispose(); + + if (countApplets() == 0) { + appletSystemExit(); + } + } + }).start(); + + status.put(identifier, PAV_INIT_STATUS.INACTIVE); } /** From omajid at redhat.com Tue Aug 4 09:07:32 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:32 +0000 Subject: changeset in /hg/icedtea: 2009-06-16 Omair Majid changeset 8754d9d3bc2c in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8754d9d3bc2c description: 2009-06-16 Omair Majid * netx/javax/jnlp/SingleInstanceListener.java: New file. * netx/javax/jnlp/SingleInstanceService.java: New file. diffstat: 3 files changed, 86 insertions(+) ChangeLog | 5 ++ netx/javax/jnlp/SingleInstanceListener.java | 35 ++++++++++++++++++++ netx/javax/jnlp/SingleInstanceService.java | 46 +++++++++++++++++++++++++++ diffs (101 lines): diff -r 5153060e463b -r 8754d9d3bc2c ChangeLog --- a/ChangeLog Tue Jun 16 10:23:45 2009 -0400 +++ b/ChangeLog Tue Jun 16 10:58:00 2009 -0400 @@ -1,3 +1,8 @@ 2009-06-16 Omair Majid + + * netx/javax/jnlp/SingleInstanceListener.java: New file. + * netx/javax/jnlp/SingleInstanceService.java: New file. + 2009-06-16 Omair Majid * netx/net/sourceforge/jnlp/services/ServiceUtil.java: diff -r 5153060e463b -r 8754d9d3bc2c netx/javax/jnlp/SingleInstanceListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/javax/jnlp/SingleInstanceListener.java Tue Jun 16 10:58:00 2009 -0400 @@ -0,0 +1,35 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package javax.jnlp; + +/** + * This interface specifies a listener which is notified whenever a new instance + * of the web start application is launched. + * + */ +public interface SingleInstanceListener { + + /** + * This method is called when a new instance of the application is launched. + * The arguments passed to the new instance are passed into this method. + * + * @param arguments the arguments passed to the new instance of the + * application + */ + void newActivation(String[] arguments); + +} diff -r 5153060e463b -r 8754d9d3bc2c netx/javax/jnlp/SingleInstanceService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/javax/jnlp/SingleInstanceService.java Tue Jun 16 10:58:00 2009 -0400 @@ -0,0 +1,46 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package javax.jnlp; + +/** + * The SingleInstanceService provides a way to ensure that only one instance of + * the application is ever running - singleton behavior at the application + * level. + * + */ +public interface SingleInstanceService { + + /** + * Adds the specified SingleInstanceListener to the notification list. This + * listener is notified when a new instance of the application is started. + * + * + * @param listener the single instance listener to be added. No action is + * performed if it is null. + */ + void addSingleInstanceListener(SingleInstanceListener listener); + + /** + * Removes the specified SingleInstanceListener from the notification list. + * This listener will not be notified if a new instance of the application + * is started. + * + * @param listener the single instance listener to be removed. No action is + * performed if it is null or not in the notification list. + */ + void removeSingleInstanceListener(SingleInstanceListener listener); +} From omajid at redhat.com Tue Aug 4 09:07:33 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:33 +0000 Subject: changeset in /hg/icedtea: 2009-06-17 Omair Majid changeset f04f94067be0 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=f04f94067be0 description: 2009-06-17 Omair Majid * netx/javax/jnlp/ExtendedService.java: New file. * netx/net/sourceforge/jnlp/services/XExtendedService.java: New file. * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: Add ExtendedService to serviceNames. Create a proxy for XExtendedService to provide ExtendedService. diffstat: 4 files changed, 117 insertions(+) ChangeLog | 8 + netx/javax/jnlp/ExtendedService.java | 51 ++++++++++ netx/net/sourceforge/jnlp/services/XExtendedService.java | 56 +++++++++++ netx/net/sourceforge/jnlp/services/XServiceManagerStub.java | 2 diffs (149 lines): diff -r ee421053683d -r f04f94067be0 ChangeLog --- a/ChangeLog Wed Jun 17 14:47:36 2009 -0400 +++ b/ChangeLog Wed Jun 17 15:13:34 2009 -0400 @@ -1,3 +1,11 @@ 2009-06-17 Deepak Bhole + + * * netx/javax/jnlp/ExtendedService.java: New file. + * netx/net/sourceforge/jnlp/services/XExtendedService.java: New file. + * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: Add + ExtendedService to serviceNames. Create a proxy for XExtendedService to + provide ExtendedService. + 2009-06-17 Deepak Bhole * IcedTeaPlugin.cc: Fix race condition that led to segfault. diff -r ee421053683d -r f04f94067be0 netx/javax/jnlp/ExtendedService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/javax/jnlp/ExtendedService.java Wed Jun 17 15:13:34 2009 -0400 @@ -0,0 +1,51 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package javax.jnlp; + +import java.io.File; +import java.io.IOException; + +/** + * This interface provides a way for the JNLP application to open specific files + * in the client's system. It asks permission from the user before opening any + * files. + * + * @author Omair Majid + * + */ +public interface ExtendedService { + + /** + * Open a file on the client' system and return its contents. The user must + * grant permission to the application for this to work. + * + * @param file the file to open + * @return the opened file as a {@link FileContents} object + * @throws IOException on any io problems + */ + FileContents openFile(File file) throws IOException; + + /** + * Opens multiple files on the user's sytem and returns their contents as a + * {@link FileContents} array + * + * @param files the files to open + * @return an array of FileContents objects + * @throws IOException on any io problems + */ + FileContents[] openFiles(File[] files) throws IOException; +} diff -r ee421053683d -r f04f94067be0 netx/net/sourceforge/jnlp/services/XExtendedService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/services/XExtendedService.java Wed Jun 17 15:13:34 2009 -0400 @@ -0,0 +1,56 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp.services; + +import java.io.File; +import java.io.IOException; + +import javax.jnlp.ExtendedService; +import javax.jnlp.FileContents; + +import net.sourceforge.jnlp.security.SecurityWarningDialog; + +/** + * Implementation of ExtendedService + * + * @author Omair Majid + * + */ +public class XExtendedService implements ExtendedService { + + @Override + public FileContents openFile(File file) throws IOException { + + if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE)) { + return (FileContents) ServiceUtil.createPrivilegedProxy(FileContents.class, + new XFileContents(file)); + } else { + return null; + } + + } + + @Override + public FileContents[] openFiles(File[] files) throws IOException { + FileContents[] contents = new FileContents[files.length]; + for (int i = 0; i < files.length; i++) { + contents[i] = openFile(files[i]); + } + return contents; + } + +} diff -r ee421053683d -r f04f94067be0 netx/net/sourceforge/jnlp/services/XServiceManagerStub.java --- a/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java Wed Jun 17 14:47:36 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java Wed Jun 17 15:13:34 2009 -0400 @@ -45,6 +45,7 @@ public class XServiceManagerStub impleme private static String serviceNames[] = { "javax.jnlp.BasicService", // required "javax.jnlp.DownloadService", // required + "javax.jnlp.ExtendedService", "javax.jnlp.ExtensionInstallerService", // required "javax.jnlp.PersistenceService", "javax.jnlp.FileOpenService", @@ -56,6 +57,7 @@ public class XServiceManagerStub impleme private static Object services[] = { ServiceUtil.createPrivilegedProxy(BasicService.class, new XBasicService()), ServiceUtil.createPrivilegedProxy(DownloadService.class, new XDownloadService()), + ServiceUtil.createPrivilegedProxy(ExtendedService.class, new XExtendedService()), ServiceUtil.createPrivilegedProxy(ExtensionInstallerService.class, new XExtensionInstallerService()), ServiceUtil.createPrivilegedProxy(PersistenceService.class, new XPersistenceService()), ServiceUtil.createPrivilegedProxy(FileOpenService.class, new XFileOpenService()), From omajid at redhat.com Tue Aug 4 09:07:34 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:34 +0000 Subject: changeset in /hg/icedtea: 2009-06-24 Omair Majid changeset 0cfbe4d569d9 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=0cfbe4d569d9 description: 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/Launcher.java (launchApplication): Check for any existing single instance. Dont start a second instance. * netx/net/sourceforge/jnlp/resources/Messages.properties: Add RNoLockDir. * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: Added USER, TMP_DIR, and changed LOCKS_DIR. * netx/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java New file. * netx/net/sourceforge/jnlp/services/InstanceExistsException.java: New file. * netx/net/sourceforge/jnlp/services/ServiceUtil.java (getSingleInstanceService): New function. (checkExistingSingleInstance): New function. * netx/net/sourceforge/jnlp/services/SingleInstanceLock.java: New file. * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: Add SingleInstanceService to serviceNames. Create a new instance of XSingleInstanceService as a privileged proxy. * netx/net/sourceforge/jnlp/services/XSingleInstanceService.java: New file. diffstat: 10 files changed, 602 insertions(+), 12 deletions(-) ChangeLog | 19 netx/net/sourceforge/jnlp/Launcher.java | 8 netx/net/sourceforge/jnlp/resources/Messages.properties | 1 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java | 16 netx/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java | 49 ++ netx/net/sourceforge/jnlp/services/InstanceExistsException.java | 35 + netx/net/sourceforge/jnlp/services/ServiceUtil.java | 48 +- netx/net/sourceforge/jnlp/services/SingleInstanceLock.java | 203 ++++++++ netx/net/sourceforge/jnlp/services/XServiceManagerStub.java | 6 netx/net/sourceforge/jnlp/services/XSingleInstanceService.java | 229 ++++++++++ diffs (truncated from 717 to 500 lines): diff -r 4e5e95c066da -r 0cfbe4d569d9 ChangeLog --- a/ChangeLog Wed Jun 24 12:15:33 2009 -0400 +++ b/ChangeLog Wed Jun 24 15:02:45 2009 -0400 @@ -1,3 +1,22 @@ 2009-06-24 Omair Majid + + * netx/net/sourceforge/jnlp/Launcher.java (launchApplication): Check for any + existing single instance. Dont start a second instance. + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add RNoLockDir. + * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: + Added USER, TMP_DIR, and changed LOCKS_DIR. + * netx/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java + New file. + * netx/net/sourceforge/jnlp/services/InstanceExistsException.java: New file. + * netx/net/sourceforge/jnlp/services/ServiceUtil.java + (getSingleInstanceService): New function. + (checkExistingSingleInstance): New function. + * netx/net/sourceforge/jnlp/services/SingleInstanceLock.java: New file. + * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: Add + SingleInstanceService to serviceNames. Create a new instance of + XSingleInstanceService as a privileged proxy. + * netx/net/sourceforge/jnlp/services/XSingleInstanceService.java: New file. + 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/Parser.java: Add 1.5 and 6.0 to diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Wed Jun 24 12:15:33 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Wed Jun 24 15:02:45 2009 -0400 @@ -37,6 +37,8 @@ import net.sourceforge.jnlp.runtime.Appl import net.sourceforge.jnlp.runtime.ApplicationInstance; import net.sourceforge.jnlp.runtime.JNLPClassLoader; import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.services.InstanceExistsException; +import net.sourceforge.jnlp.services.ServiceUtil; import net.sourceforge.jnlp.util.Reflect; /** @@ -365,6 +367,12 @@ public class Launcher { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplication"), R("LNotApplicationInfo"))); try { + + try { + ServiceUtil.checkExistingSingleInstance(file); + } catch (InstanceExistsException e) { + return null; + } if (JNLPRuntime.getForksAllowed() && file.needsNewVM()) { List netxArguments = new LinkedList(); diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/resources/Messages.properties --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jun 24 12:15:33 2009 -0400 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jun 24 15:02:45 2009 -0400 @@ -110,6 +110,7 @@ RCantReplaceSM=Changing the SecurityMana RCantReplaceSM=Changing the SecurityManager is not allowed. RDenyStopped=Stopped applications have no permissions. RExitNoApp=Can not exit the JVM because the current application cannot be determined. +RNoLockDir=Unable to create locks directory ({0}) RUnexpected=Unexpected {0} at {1} # Boot options, message should be shorter than this ----------------> diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 24 12:15:33 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 24 15:02:45 2009 -0400 @@ -104,6 +104,9 @@ public class JNLPRuntime { /** contains the arguments passed to the jnlp runtime */ private static List initialArguments; + /** Username */ + public static final String USER = System.getProperty("user.name"); + /** User's home directory */ public static final String HOME_DIR = System.getProperty("user.home"); @@ -119,12 +122,17 @@ public class JNLPRuntime { /** the ~/.netx/security/trusted.certs file containing trusted certificates */ public static final String CERTIFICATES_FILE = SECURITY_DIR + File.separator + "trusted.certs"; - /** - * the ~/.netx/locks/ directory containing locks for single instance + /** the /tmp/ directory used for temporary files */ + public static final String TMP_DIR = System.getProperty("java.io.tmpdir"); + + /** + * the /tmp/$USER/netx/locks/ directory containing locks for single instance * applications */ - public static final String LOCKS_DIR = NETX_DIR + File.separator + "locks"; - + public static final String LOCKS_DIR = TMP_DIR + File.separator + USER + File.separator + + "netx" + File.separator + "locks"; + + /** the java.home directory */ public static final String JAVA_HOME_DIR = System.getProperty("java.home"); /** the JNLP file to open to display the network-based about window */ diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java Wed Jun 24 15:02:45 2009 -0400 @@ -0,0 +1,49 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp.services; + +import javax.jnlp.SingleInstanceService; + +import net.sourceforge.jnlp.JNLPFile; + +/** + * Extends SingleInstanceService to provide a few additional methods that are + * required to initialize SingleInstanceService and check things. These methods + * are not exposed publicly + * + * @author Omair Majid + * + */ +interface ExtendedSingleInstanceService extends SingleInstanceService { + + /** + * Check if the instance identified by this jnlp file is already running + * + * @param jnlpFile The JNLPFile that specifies the application + * + * @throws InstanceExistsException if an instance of this application + * already exists + * + */ + void checkSingleInstanceRunning(JNLPFile jnlpFile); + + /** + * Start a single instance service based on the current application + */ + void initializeSingleInstance(); + +} diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/services/InstanceExistsException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/services/InstanceExistsException.java Wed Jun 24 15:02:45 2009 -0400 @@ -0,0 +1,35 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp.services; + +/** + * + * This class represents an exception indicating that an application instance + * already exists for this jnlp file + * + * @author Omair Majid + * + */ +public class InstanceExistsException extends RuntimeException { + + private static final long serialVersionUID = 7950552292795498272L; + + public InstanceExistsException(String message) { + super(message); + } + +} diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/services/ServiceUtil.java --- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java Wed Jun 24 12:15:33 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java Wed Jun 24 15:02:45 2009 -0400 @@ -17,12 +17,29 @@ package net.sourceforge.jnlp.services; -import java.lang.reflect.*; -import java.security.*; - -import javax.jnlp.*; - -import net.sourceforge.jnlp.runtime.*; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + +import javax.jnlp.BasicService; +import javax.jnlp.ClipboardService; +import javax.jnlp.DownloadService; +import javax.jnlp.ExtensionInstallerService; +import javax.jnlp.FileOpenService; +import javax.jnlp.FileSaveService; +import javax.jnlp.PersistenceService; +import javax.jnlp.PrintService; +import javax.jnlp.ServiceManager; +import javax.jnlp.SingleInstanceService; +import javax.jnlp.UnavailableServiceException; + +import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.runtime.ApplicationInstance; +import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.security.SecurityWarningDialog; /** @@ -110,6 +127,25 @@ public class ServiceUtil { return (PrintService) getService("javax.jnlp.PrintService"); } + /** + * Returns the SingleInstanceService reference, or null if the service is + * unavailable. + */ + public static SingleInstanceService getSingleInstanceService() { + return (SingleInstanceService) getService("javax.jnlp.SingleInstanceService"); + } + + /** + * Checks that this application (represented by the jnlp) isnt already running + * @param jnlpFile the {@link JNLPFile} that specifies the application + * + * @throws InstanceExistsException if an instance of this application already exists + */ + public static void checkExistingSingleInstance(JNLPFile jnlpFile) { + ExtendedSingleInstanceService esis = (ExtendedSingleInstanceService) getSingleInstanceService(); + esis.checkSingleInstanceRunning(jnlpFile); + } + /** * Returns the service, or null instead of an UnavailableServiceException */ diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/services/SingleInstanceLock.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Wed Jun 24 15:02:45 2009 -0400 @@ -0,0 +1,203 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp.services; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.BindException; +import java.net.ServerSocket; + +import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.runtime.JNLPRuntime; + +/** + * This class represents a Lock for single instance jnlp applications + * + * The lock is per-session, per user. + * + * @author Omair Majid + */ +class SingleInstanceLock { + + JNLPFile jnlpFile; + File lockFile = null; + + public static final int INVALID_PORT = Integer.MIN_VALUE; + + int port = INVALID_PORT; + + /** + * Create an object to manage the instance lock for the specified JNLP file. + * + * @param jnlpFile the jnlpfile to create the lock for + */ + public SingleInstanceLock(JNLPFile jnlpFile) { + this.jnlpFile = jnlpFile; + lockFile = getLockFile(); + + } + + /** + * Create/overwrite the instance lock for the jnlp file. + * + * @param localPort the network port for the lock + * @throws IOException on any io problems + */ + public void createWithPort(int localPort) throws IOException { + + BufferedWriter lockFileWriter = new BufferedWriter(new FileWriter(lockFile, false)); + lockFileWriter.write(String.valueOf(localPort)); + lockFileWriter.newLine(); + lockFileWriter.flush(); + lockFileWriter.close(); + + } + + /** + * Returns true if the lock if valid. That is, the lock exists, and port it + * points to is listening for incoming messages. + */ + public boolean isValid() { + return (exists() && getPort() != INVALID_PORT && !isPortFree(getPort())); + } + + /** + * Returns the port in this lock file. + */ + public int getPort() { + if (!exists()) { + return INVALID_PORT; + } + + try { + parseFile(); + } catch (NumberFormatException e) { + port = INVALID_PORT; + } catch (IOException e) { + port = INVALID_PORT; + } + return port; + + } + + /** + * Returns true if the lock file already exists. + */ + private boolean exists() { + return lockFile.exists(); + } + + /** + * Returns true if the port is free. + */ + private boolean isPortFree(int port) { + try { + ServerSocket socket = new ServerSocket(port); + socket.close(); + return true; + } catch (BindException e) { + return false; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Return a file object that represents the lock file. The lock file itself + * may or may not exist. + */ + private File getLockFile() { + File baseDir = new File(JNLPRuntime.LOCKS_DIR); + + if (!baseDir.isDirectory() && !baseDir.mkdirs()) { + throw new RuntimeException(R("RNoLockDir", baseDir)); + } + String lockFileName = getLockFileName(); + File applicationLockFile = new File(baseDir, lockFileName); + return applicationLockFile; + } + + /** + * Returns the name of the lock file. + */ + private String getLockFileName() { + String initialName = ""; + + if (jnlpFile.getSourceLocation() != null) { + initialName = initialName + jnlpFile.getSourceLocation(); + } else { + initialName = initialName + jnlpFile.getFileLocation(); + } + + if (jnlpFile.getFileVersion() != null) { + initialName = initialName + jnlpFile.getFileVersion().toString(); + } + + initialName = initialName + getCurrentDisplay(); + String encodedName; + + /* + * FIXME + * + * Assuming safe characters are 'a-z','A-Z','0-9', '_', '.' + */ + + encodedName = initialName.replaceAll("[^a-zA-Z0-9.]", "_"); + + return encodedName; + + } + + /** + * Parse the lock file. + * + * @throws NumberFormatException + * @throws IOException + */ + private void parseFile() throws NumberFormatException, IOException { + BufferedReader lockFileReader = new BufferedReader(new FileReader(lockFile)); + int port = Integer.valueOf(lockFileReader.readLine()); + lockFileReader.close(); + this.port = port; + } + + /** + * Returns a string identifying this display. + * + * Implementation note: On systems with X support, this is the DISPLAY + * variable + * + * @return a string that is guaranteed to be not null. + */ + private String getCurrentDisplay() { + String display = System.getenv("DISPLAY"); + return (display == null) ? "" : display; + } + + private static String R(String key) { + return JNLPRuntime.getMessage(key); + } + + private static String R(String key, Object param) { + return JNLPRuntime.getMessage(key, new Object[] { param }); + } + +} diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/services/XServiceManagerStub.java --- a/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java Wed Jun 24 12:15:33 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java Wed Jun 24 15:02:45 2009 -0400 @@ -51,7 +51,8 @@ public class XServiceManagerStub impleme "javax.jnlp.FileOpenService", "javax.jnlp.FileSaveService", "javax.jnlp.ClipboardService", - "javax.jnlp.PrintService" + "javax.jnlp.PrintService", + "javax.jnlp.SingleInstanceService" }; private static Object services[] = { @@ -63,7 +64,8 @@ public class XServiceManagerStub impleme ServiceUtil.createPrivilegedProxy(FileOpenService.class, new XFileOpenService()), ServiceUtil.createPrivilegedProxy(FileSaveService.class, new XFileSaveService()), ServiceUtil.createPrivilegedProxy(ClipboardService.class, new XClipboardService()), - ServiceUtil.createPrivilegedProxy(PrintService.class, new XPrintService()) + ServiceUtil.createPrivilegedProxy(PrintService.class, new XPrintService()), + ServiceUtil.createPrivilegedProxy(ExtendedSingleInstanceService.class, new XSingleInstanceService()) }; diff -r 4e5e95c066da -r 0cfbe4d569d9 netx/net/sourceforge/jnlp/services/XSingleInstanceService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/services/XSingleInstanceService.java Wed Jun 24 15:02:45 2009 -0400 @@ -0,0 +1,229 @@ +// Copyright (C) 2009 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// From omajid at redhat.com Tue Aug 4 09:07:32 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:32 +0000 Subject: changeset in /hg/icedtea: 2009-06-16 Omair Majid changeset 5153060e463b in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=5153060e463b description: 2009-06-16 Omair Majid * netx/net/sourceforge/jnlp/services/ServiceUtil.java: (invoke): Throw the original exception that caused the problem. diffstat: 2 files changed, 24 insertions(+), 6 deletions(-) ChangeLog | 5 +++ netx/net/sourceforge/jnlp/services/ServiceUtil.java | 25 ++++++++++++++----- diffs (47 lines): diff -r a5edccad3c7c -r 5153060e463b ChangeLog --- a/ChangeLog Wed Jun 10 12:00:53 2009 -0400 +++ b/ChangeLog Tue Jun 16 10:23:45 2009 -0400 @@ -1,3 +1,8 @@ 2009-06-10 Omair Majid + + * netx/net/sourceforge/jnlp/services/ServiceUtil.java: + (invoke): Throw the original exception that caused the problem. + 2009-06-10 Omair Majid * netx/net/sourceforge/jnlp/JNLPFile.java diff -r a5edccad3c7c -r 5153060e463b netx/net/sourceforge/jnlp/services/ServiceUtil.java --- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java Wed Jun 10 12:00:53 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java Tue Jun 16 10:23:45 2009 -0400 @@ -159,12 +159,25 @@ public class ServiceUtil { } }; - Object result = AccessController.doPrivileged(invoker); - - if (JNLPRuntime.isDebug()) - System.err.println(" result: "+result); - - return result; + try { + Object result = AccessController.doPrivileged(invoker); + + if (JNLPRuntime.isDebug()) + System.err.println(" result: "+result); + + return result; + } catch (PrivilegedActionException e) { + // Any exceptions thrown by the actual methods are wrapped by a + // InvocationTargetException, which is further wrapped by the + // PrivilegedActionException. Lets unwrap them to make the + // proxy transparent to the callers + if (e.getCause() instanceof InvocationTargetException) { + throw e.getCause().getCause(); + } else { + throw e.getCause(); + } + } + } }; From omajid at redhat.com Tue Aug 4 09:07:34 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:34 +0000 Subject: changeset in /hg/icedtea: 2009-06-24 Omair Majid changeset 4e5e95c066da in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=4e5e95c066da description: 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/Parser.java: Add 1.5 and 6.0 to supportedVersions. diffstat: 2 files changed, 6 insertions(+), 1 deletion(-) ChangeLog | 5 +++++ netx/net/sourceforge/jnlp/Parser.java | 2 +- diffs (24 lines): diff -r 2bf6d173f425 -r 4e5e95c066da ChangeLog --- a/ChangeLog Wed Jun 17 17:10:39 2009 -0400 +++ b/ChangeLog Wed Jun 24 12:15:33 2009 -0400 @@ -1,3 +1,8 @@ 2009-06-17 Omair Majid + + * netx/net/sourceforge/jnlp/Parser.java: Add 1.5 and 6.0 to + supportedVersions. + 2009-06-17 Omair Majid * netx/net/sourceforge/jnlp/runtime/Boot.java: Remove aboutFile. diff -r 2bf6d173f425 -r 4e5e95c066da netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Wed Jun 17 17:10:39 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Wed Jun 24 12:15:33 2009 -0400 @@ -72,7 +72,7 @@ class Parser { /** the supported JNLP file versions */ - private static Version supportedVersions = new Version("1.0"); + private static Version supportedVersions = new Version("1.0 1.5 6.0"); // fix: some descriptors need to use the jnlp file at a later // date and having file ref lets us pass it to their From omajid at redhat.com Tue Aug 4 09:07:33 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:33 +0000 Subject: changeset in /hg/icedtea: 2009-06-17 Omair Majid changeset 2bf6d173f425 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=2bf6d173f425 description: 2009-06-17 Omair Majid * netx/net/sourceforge/jnlp/runtime/Boot.java: Remove aboutFile. (getAboutFile): Get path from JNLPRuntime. (getBaseDir): Fix comments. * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Add HOME_DIR, NETXRC_FILE, NETX_DIR, SECURITY_DIR, CERTIFICATES_FILE, LOCKS_DIR, JAVA_HOME_DIR, and NETX_ABOUT_FILE. (getDefaultBaseDir): Remove calls to loadWindowIcon and isHeadless() because they are unused. Use HOME_DIR and NETX_DIR. Be prepared for existing NETX_DIR. (getProperties): Use NETXRC_FILE instead of hardcoded file name. * netx/net/sourceforge/jnlp/security/SecurityUtil.java Remove homeDir, certDir and certFile. (getTrustedCertsFilename): Use HOME_DIR and CERTIFICATES_FILE. (checkTrustedCertsFile): Find parent directory from certFile. diffstat: 4 files changed, 61 insertions(+), 27 deletions(-) ChangeLog | 19 +++++++- netx/net/sourceforge/jnlp/runtime/Boot.java | 16 ++---- netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java | 42 +++++++++++++----- netx/net/sourceforge/jnlp/security/SecurityUtil.java | 11 ++-- diffs (183 lines): diff -r f04f94067be0 -r 2bf6d173f425 ChangeLog --- a/ChangeLog Wed Jun 17 15:13:34 2009 -0400 +++ b/ChangeLog Wed Jun 17 17:10:39 2009 -0400 @@ -1,6 +1,23 @@ 2009-06-17 Omair Majid - * * netx/javax/jnlp/ExtendedService.java: New file. + * netx/net/sourceforge/jnlp/runtime/Boot.java: Remove aboutFile. + (getAboutFile): Get path from JNLPRuntime. + (getBaseDir): Fix comments. + * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Add HOME_DIR, + NETXRC_FILE, NETX_DIR, SECURITY_DIR, CERTIFICATES_FILE, LOCKS_DIR, + JAVA_HOME_DIR, and NETX_ABOUT_FILE. + (getDefaultBaseDir): Remove calls to loadWindowIcon and isHeadless() + because they are unused. Use HOME_DIR and NETX_DIR. Be prepared for + existing NETX_DIR. + (getProperties): Use NETXRC_FILE instead of hardcoded file name. + * netx/net/sourceforge/jnlp/security/SecurityUtil.java + Remove homeDir, certDir and certFile. + (getTrustedCertsFilename): Use HOME_DIR and CERTIFICATES_FILE. + (checkTrustedCertsFile): Find parent directory from certFile. + +2009-06-17 Omair Majid + + * netx/javax/jnlp/ExtendedService.java: New file. * netx/net/sourceforge/jnlp/services/XExtendedService.java: New file. * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: Add ExtendedService to serviceNames. Create a proxy for XExtendedService to diff -r f04f94067be0 -r 2bf6d173f425 netx/net/sourceforge/jnlp/runtime/Boot.java --- a/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Jun 17 15:13:34 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Wed Jun 17 17:10:39 2009 -0400 @@ -67,10 +67,6 @@ public final class Boot implements Privi private static final String version = "0.5"; - /** the JNLP file to open to display the network-based about window */ - private static final String aboutFile = - System.getProperty("java.home") + "/lib/about.jnlp"; - /** the text to display before launching the about link */ private static final String aboutMessage = "" + "netx v"+version+" - (C)2001-2003 Jon A. Maxwell (jmaxwell at users.sourceforge.net)\n" @@ -234,8 +230,8 @@ public final class Boot implements Privi */ private static String getAboutFile() { - if (new File(aboutFile).exists()) - return aboutFile; + if (new File(JNLPRuntime.NETX_ABOUT_FILE).exists()) + return JNLPRuntime.NETX_ABOUT_FILE; else return null; } @@ -424,9 +420,9 @@ public final class Boot implements Privi /** * Return the base dir. If the base dir parameter is not set - * the value is read from the "${user.home}/.netxrc" file (as - * defined by JNLPRuntime). If that file does not exist, an - * install dialog is displayed to select the base directory. + * the value is read from JNLPRuntime.NETX_ABOUT_FILE file. + * If that file does not exist, an install dialog is displayed + * to select the base directory. */ private static File getBaseDir() { if (getOption("-basedir") != null) { @@ -438,7 +434,7 @@ public final class Boot implements Privi return basedir; } - // check .netxrc, display dialog + // check .netxrc File basedir = JNLPRuntime.getDefaultBaseDir(); if (basedir == null) fatalError(R("BNoBase")); diff -r f04f94067be0 -r 2bf6d173f425 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 17 15:13:34 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed Jun 17 17:10:39 2009 -0400 @@ -104,6 +104,34 @@ public class JNLPRuntime { /** contains the arguments passed to the jnlp runtime */ private static List initialArguments; + /** User's home directory */ + public static final String HOME_DIR = System.getProperty("user.home"); + + /** the ~/.netxrc file containing netx settings */ + public static final String NETXRC_FILE = HOME_DIR + File.separator + ".netxrc"; + + /** the ~/.netx directory containing user-specific data */ + public static final String NETX_DIR = HOME_DIR + File.separator + ".netx"; + + /** the ~/.netx/security directory containing security related information */ + public static final String SECURITY_DIR = NETX_DIR + File.separator + "security"; + + /** the ~/.netx/security/trusted.certs file containing trusted certificates */ + public static final String CERTIFICATES_FILE = SECURITY_DIR + File.separator + "trusted.certs"; + + /** + * the ~/.netx/locks/ directory containing locks for single instance + * applications + */ + public static final String LOCKS_DIR = NETX_DIR + File.separator + "locks"; + + public static final String JAVA_HOME_DIR = System.getProperty("java.home"); + + /** the JNLP file to open to display the network-based about window */ + public static final String NETX_ABOUT_FILE = JAVA_HOME_DIR + File.separator + "lib" + + File.separator + "about.jnlp"; + + /** * Returns whether the JNLP runtime environment has been @@ -279,18 +307,13 @@ public class JNLPRuntime { public static File getDefaultBaseDir() { PropertiesFile props = JNLPRuntime.getProperties(); - loadWindowIcon(); - String baseStr = props.getProperty("basedir"); if (baseStr != null) return new File(baseStr); - if (isHeadless()) - return null; - - String homeDir = System.getProperty("user.home"); - File baseDir = new File(homeDir + "/.netx/"); - if (homeDir == null || !baseDir.mkdir()) + String homeDir = HOME_DIR; + File baseDir = new File(NETX_DIR); + if (homeDir == null || (!baseDir.isDirectory() && !baseDir.mkdir())) return null; props.setProperty("basedir", baseDir.toString()); @@ -332,8 +355,7 @@ public class JNLPRuntime { * properties file. */ public static PropertiesFile getProperties() { - File netxrc = new File(System.getProperty("user.home"), ".netxrc"); - + File netxrc = new File(NETXRC_FILE); return new PropertiesFile(netxrc); } diff -r f04f94067be0 -r 2bf6d173f425 netx/net/sourceforge/jnlp/security/SecurityUtil.java --- a/netx/net/sourceforge/jnlp/security/SecurityUtil.java Wed Jun 17 15:13:34 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/SecurityUtil.java Wed Jun 17 17:10:39 2009 -0400 @@ -42,21 +42,20 @@ import java.io.FileOutputStream; import java.io.FileOutputStream; import java.security.KeyStore; +import net.sourceforge.jnlp.runtime.JNLPRuntime; + public class SecurityUtil { - private static String homeDir = null; - private static final String certDir = "/.netx/security/"; - private static final String certFile = "trusted.certs"; private static final char[] password = "changeit".toCharArray(); public static String getTrustedCertsFilename() throws Exception{ - homeDir = System.getProperty("user.home"); + String homeDir = JNLPRuntime.HOME_DIR; if (homeDir == null) { throw new Exception("Could not access home directory"); } else { - return homeDir + certDir + certFile; + return JNLPRuntime.CERTIFICATES_FILE; } } @@ -90,7 +89,7 @@ public class SecurityUtil { //file does not exist if (!certFile.isFile()) { - File dir = new File(homeDir+certDir); + File dir = certFile.getAbsoluteFile().getParentFile(); boolean madeDir = false; if (!dir.isDirectory()) { madeDir = dir.mkdirs(); From omajid at redhat.com Tue Aug 4 09:07:34 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:34 +0000 Subject: changeset in /hg/icedtea: 2009-06-24 Omair Majid changeset 9528fc8f3555 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9528fc8f3555 description: 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/Launcher.java (createApplication): Fix messages to refer to application instead of applet. diffstat: 2 files changed, 7 insertions(+), 1 deletion(-) ChangeLog | 6 ++++++ netx/net/sourceforge/jnlp/Launcher.java | 2 +- diffs (25 lines): diff -r 0cfbe4d569d9 -r 9528fc8f3555 ChangeLog --- a/ChangeLog Wed Jun 24 15:02:45 2009 -0400 +++ b/ChangeLog Wed Jun 24 15:10:22 2009 -0400 @@ -1,3 +1,9 @@ 2009-06-24 Omair Majid + + * netx/net/sourceforge/jnlp/Launcher.java + (createApplication): Fix messages to refer to application instead of + applet. + 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/Launcher.java (launchApplication): Check for any diff -r 0cfbe4d569d9 -r 9528fc8f3555 netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Wed Jun 24 15:02:45 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Wed Jun 24 15:10:22 2009 -0400 @@ -590,7 +590,7 @@ public class Launcher { return app; } catch (Exception ex) { - throw new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo")); + throw new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplication"), R("LInitApplicationInfo")); } } From omajid at redhat.com Tue Aug 4 09:07:36 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:36 +0000 Subject: changeset in /hg/icedtea: 2009-06-24 Omair Majid changeset dd483ae1e6ca in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=dd483ae1e6ca description: 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/security/CertWarningPane.java (installComponents): Call SecurityUtil.getCN instead of getCN. (getCN): Removed. * netx/net/sourceforge/jnlp/security/CertsInfoPane.java (buildTree): Call SecurityUtil.getCN instead of getCN. (populateTable): Likewise. (getCN): Removed. * netx/net/sourceforge/jnlp/security/SecurityUtil.java (getCN): Follow RFC 2253 partially and understand escaping. (isHexDigit): New function. * netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java (buildTree): Call SecurityUtil.getCN instead of getCN. (populateTable): Likewise. * netx/net/sourceforge/jnlp/tools/KeyTool.java: (doPrintEntry): Call SecurityUtil.getCN instead of getCN. (getCN): Removed. diffstat: 6 files changed, 130 insertions(+), 77 deletions(-) ChangeLog | 19 ++ netx/net/sourceforge/jnlp/security/CertWarningPane.java | 22 -- netx/net/sourceforge/jnlp/security/CertsInfoPane.java | 29 --- netx/net/sourceforge/jnlp/security/SecurityUtil.java | 110 ++++++++++-- netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java | 8 netx/net/sourceforge/jnlp/tools/KeyTool.java | 19 -- diffs (316 lines): diff -r 9528fc8f3555 -r dd483ae1e6ca ChangeLog --- a/ChangeLog Wed Jun 24 15:10:22 2009 -0400 +++ b/ChangeLog Wed Jun 24 16:26:08 2009 -0400 @@ -1,3 +1,22 @@ 2009-06-24 Omair Majid + + * netx/net/sourceforge/jnlp/security/CertWarningPane.java + (installComponents): Call SecurityUtil.getCN instead of getCN. + (getCN): Removed. + * netx/net/sourceforge/jnlp/security/CertsInfoPane.java + (buildTree): Call SecurityUtil.getCN instead of getCN. + (populateTable): Likewise. + (getCN): Removed. + * netx/net/sourceforge/jnlp/security/SecurityUtil.java + (getCN): Follow RFC 2253 partially and understand escaping. + (isHexDigit): New function. + * netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java + (buildTree): Call SecurityUtil.getCN instead of getCN. + (populateTable): Likewise. + * netx/net/sourceforge/jnlp/tools/KeyTool.java: + (doPrintEntry): Call SecurityUtil.getCN instead of getCN. + (getCN): Removed. + 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/Launcher.java diff -r 9528fc8f3555 -r dd483ae1e6ca netx/net/sourceforge/jnlp/security/CertWarningPane.java --- a/netx/net/sourceforge/jnlp/security/CertWarningPane.java Wed Jun 24 15:10:22 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/CertWarningPane.java Wed Jun 24 16:26:08 2009 -0400 @@ -101,7 +101,7 @@ public class CertWarningPane extends Sec try { if ((certVerifier instanceof HttpsCertVerifier) && (c instanceof X509Certificate)) - name = getCN(((X509Certificate)c) + name = SecurityUtil.getCN(((X509Certificate)c) .getSubjectX500Principal().getName()); else if (file instanceof PluginBridge) name = file.getTitle(); @@ -112,7 +112,7 @@ public class CertWarningPane extends Sec try { if (c instanceof X509Certificate) { - publisher = getCN(((X509Certificate)c) + publisher = SecurityUtil.getCN(((X509Certificate)c) .getSubjectX500Principal().getName()); } } catch (Exception e) { @@ -236,24 +236,6 @@ public class CertWarningPane extends Sec return ""+s+""; } - - /** - * Extracts the CN field from a Certificate principal string. - */ - private String getCN(String principal) { - int start = principal.indexOf("CN="); - int end = principal.indexOf(",", start); - - if (end == -1) { - end = principal.length(); - } - - if (start >= 0) - return principal.substring(start+3, end); - else - return principal; - } - private class MoreInfoButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { diff -r 9528fc8f3555 -r dd483ae1e6ca netx/net/sourceforge/jnlp/security/CertsInfoPane.java --- a/netx/net/sourceforge/jnlp/security/CertsInfoPane.java Wed Jun 24 15:10:22 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/CertsInfoPane.java Wed Jun 24 16:26:08 2009 -0400 @@ -91,9 +91,9 @@ public class CertsInfoPane extends Secur X509Certificate firstCert = ((X509Certificate)firstPath.getCertificates().get(0)); String subjectString = - getCN(firstCert.getSubjectX500Principal().getName()); + SecurityUtil.getCN(firstCert.getSubjectX500Principal().getName()); String issuerString = - getCN(firstCert.getIssuerX500Principal().getName()); + SecurityUtil.getCN(firstCert.getIssuerX500Principal().getName()); DefaultMutableTreeNode top = new DefaultMutableTreeNode(subjectString @@ -105,9 +105,9 @@ public class CertsInfoPane extends Secur X509Certificate secondCert = ((X509Certificate)firstPath.getCertificates().get(1)); subjectString = - getCN(secondCert.getSubjectX500Principal().getName()); + SecurityUtil.getCN(secondCert.getSubjectX500Principal().getName()); issuerString = - getCN(secondCert.getIssuerX500Principal().getName()); + SecurityUtil.getCN(secondCert.getIssuerX500Principal().getName()); top.add(new DefaultMutableTreeNode(subjectString + " (" + issuerString + ")")); } @@ -129,8 +129,8 @@ public class CertsInfoPane extends Secur X509Certificate c = (X509Certificate) certs.get(0).getCertificates().get(i); certsData.add(parseCert(c)); - certNames[i] = getCN(c.getSubjectX500Principal().getName()) - + " (" + getCN(c.getIssuerX500Principal().getName()) + ")"; + certNames[i] = SecurityUtil.getCN(c.getSubjectX500Principal().getName()) + + " (" + SecurityUtil.getCN(c.getIssuerX500Principal().getName()) + ")"; } } @@ -235,23 +235,6 @@ public class CertsInfoPane extends Secur } /** - * Extracts the CN field from a Certificate principal string. - */ - protected String getCN(String principal) { - int start = principal.indexOf("CN="); - int end = principal.indexOf(",", start); - - if (end == -1) { - end = principal.length(); - } - - if (start >= 0) - return principal.substring(start+3, end); - else - return principal; - } - - /** * Copies the currently selected certificate to the system Clipboard. */ private class CopyToClipboardHandler implements ActionListener { diff -r 9528fc8f3555 -r dd483ae1e6ca netx/net/sourceforge/jnlp/security/SecurityUtil.java --- a/netx/net/sourceforge/jnlp/security/SecurityUtil.java Wed Jun 24 15:10:22 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/SecurityUtil.java Wed Jun 24 16:26:08 2009 -0400 @@ -63,20 +63,106 @@ public class SecurityUtil { return password; } - public static String getCN(String principal) { + /** + * Extracts the CN field from a Certificate principal string. Or, if it + * can't find that, return the principal unmodified. + * + * This is a simple (and hence 'wrong') version. See + * http://www.ietf.org/rfc/rfc2253.txt for all the gory details. + */ + public static String getCN(String principal) { + + /* + * FIXME Incomplete + * + * This does not implement RFC 2253 completely + * + * Issues: + * - rfc2253 talks about utf8, java uses utf16. + * - theoretically, java should have dealt with all byte encodings + * so we shouldnt even see cases like \FF + * - if the above is wrong, then we need to deal with cases like + * \FF\FF + */ + int start = principal.indexOf("CN="); - int end = principal.indexOf(",", start); - - if (end == -1) { - end = principal.length(); - } - - if (start >= 0) - return principal.substring(start+3, end); - else + if (start == -1) { return principal; - } - + } + + StringBuilder commonName = new StringBuilder(); + + boolean inQuotes = false; + boolean escaped = false; + + /* + * bit 0 = high order bit. bit 1 = low order bit + */ + char[] hexBits = null; + + for (int i = start + 3; i < principal.length(); i++) { + char ch = principal.charAt(i); + switch (ch) { + case '"': + if (escaped) { + commonName.append(ch); + escaped = false; + } else { + inQuotes = !inQuotes; + } + break; + + case '\\': + if (escaped) { + commonName.append(ch); + escaped = false; + } else { + escaped = true; + } + break; + + case ',': + /* fall through */ + case ';': + /* fall through */ + case '+': + if (escaped || inQuotes) { + commonName.append(ch); + if (escaped) { + escaped = false; + } + } else { + return commonName.toString(); + } + break; + + default: + if (escaped && isHexDigit(ch)) { + hexBits = new char[2]; + hexBits[0] = ch; + } else if (hexBits != null) { + if (!isHexDigit(ch)) { + /* error parsing */ + return ""; + } + hexBits[1] = ch; + commonName.append((char) Integer.parseInt(new String(hexBits), 16)); + hexBits = null; + } else { + commonName.append(ch); + } + escaped = false; + } + } + + return commonName.toString(); + + } + + private static boolean isHexDigit(char ch) { + return ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')); + } + /** * Checks the user's home directory to see if the trusted.certs file exists. * If it does not exist, it tries to create an empty keystore. diff -r 9528fc8f3555 -r dd483ae1e6ca netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java --- a/netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java Wed Jun 24 15:10:22 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java Wed Jun 24 16:26:08 2009 -0400 @@ -55,9 +55,9 @@ public class SingleCertInfoPane extends protected void buildTree() { X509Certificate cert = ((SecurityWarningDialog)optionPane).getCert(); String subjectString = - getCN(cert.getSubjectX500Principal().getName()); + SecurityUtil.getCN(cert.getSubjectX500Principal().getName()); String issuerString = - getCN(cert.getIssuerX500Principal().getName()); + SecurityUtil.getCN(cert.getIssuerX500Principal().getName()); DefaultMutableTreeNode top = new DefaultMutableTreeNode(subjectString + " (" + issuerString + ")"); @@ -72,7 +72,7 @@ public class SingleCertInfoPane extends certNames = new String[1]; certsData = new ArrayList(); certsData.add(parseCert(c)); - certNames[0] = getCN(c.getSubjectX500Principal().getName()) - + " (" + getCN(c.getIssuerX500Principal().getName()) + ")"; + certNames[0] = SecurityUtil.getCN(c.getSubjectX500Principal().getName()) + + " (" + SecurityUtil.getCN(c.getIssuerX500Principal().getName()) + ")"; } } diff -r 9528fc8f3555 -r dd483ae1e6ca netx/net/sourceforge/jnlp/tools/KeyTool.java --- a/netx/net/sourceforge/jnlp/tools/KeyTool.java Wed Jun 24 15:10:22 2009 -0400 +++ b/netx/net/sourceforge/jnlp/tools/KeyTool.java Wed Jun 24 16:26:08 2009 -0400 @@ -176,30 +176,13 @@ public class KeyTool { out.println("Alias: " + alias); out.println("Date Created: " + usercerts.getCreationDate(alias)); - out.println("Subject: " + getCN(((X509Certificate)usercerts + out.println("Subject: " + SecurityUtil.getCN(((X509Certificate)usercerts .getCertificate(alias)).getSubjectX500Principal().getName())); out.println("Certificate fingerprint (MD5): " + getCertFingerPrint("MD5", cert)); out.println(); } } - - /** - * Extracts the CN field from a Certificate principal string. - */ - private String getCN(String principal) { - int start = principal.indexOf("CN="); - int end = principal.indexOf(",", start); - - if (end == -1) { - end = principal.length(); - } - - if (start >= 0) - return principal.substring(start+3, end); - else - return principal; - } /** * Gets the requested finger print of the certificate. From omajid at redhat.com Tue Aug 4 09:07:38 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:38 +0000 Subject: changeset in /hg/icedtea: Support pack200/gzip compression in Netx Message-ID: changeset 332a3a4aa5de in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=332a3a4aa5de description: Support pack200/gzip compression in Netx 2009-07-09 Omair Majid * netx/net/sourceforge/jnlp/cache/ResourceTracker.java: (downloadResource): Accept and download content with pack200 or gzip compression and uncompress it on the fly. (initializeResource): Accept content with pack200 or gzip compression. (getVersionedResourceURL): Add javadoc. diffstat: 2 files changed, 105 insertions(+), 13 deletions(-) ChangeLog | 8 + netx/net/sourceforge/jnlp/cache/ResourceTracker.java | 110 +++++++++++++++--- diffs (172 lines): diff -r b92099ea3dbc -r 332a3a4aa5de ChangeLog --- a/ChangeLog Tue Aug 04 14:27:16 2009 +0100 +++ b/ChangeLog Thu Jul 09 17:18:02 2009 -0400 @@ -1,3 +1,11 @@ 2009-07-09 Deepak Bhole + + * netx/net/sourceforge/jnlp/cache/ResourceTracker.java: + (downloadResource): Accept and download content with pack200 or gzip + compression and uncompress it on the fly. + (initializeResource): Accept content with pack200 or gzip compression. + (getVersionedResourceURL): Add javadoc. + 2009-07-09 Deepak Bhole * IcedTeaPlugin.cc: Add support for cookie info requests from applets. diff -r b92099ea3dbc -r 332a3a4aa5de netx/net/sourceforge/jnlp/cache/ResourceTracker.java --- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Tue Aug 04 14:27:16 2009 +0100 +++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Thu Jul 09 17:18:02 2009 -0400 @@ -17,14 +17,30 @@ package net.sourceforge.jnlp.cache; -import java.io.*; -import java.net.*; -import java.util.*; - -import net.sourceforge.jnlp.*; -import net.sourceforge.jnlp.event.*; -import net.sourceforge.jnlp.runtime.*; -import net.sourceforge.jnlp.util.*; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; +import java.util.jar.JarOutputStream; +import java.util.jar.Pack200; +import java.util.jar.Pack200.Unpacker; +import java.util.zip.GZIPInputStream; + +import net.sourceforge.jnlp.Version; +import net.sourceforge.jnlp.event.DownloadEvent; +import net.sourceforge.jnlp.event.DownloadListener; +import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.util.WeakList; /** * This class tracks the downloading of various resources of a @@ -598,7 +614,9 @@ public class ResourceTracker { } /** - * Downloads an resource to a file. + * Downloads a resource to a file, uncompressing it if required + * + * @param resource the resource to download */ private void downloadResource(Resource resource) { resource.fireDownloadEvent(); // fire DOWNLOADING @@ -606,9 +624,34 @@ public class ResourceTracker { try { // create out second in case in does not exist URLConnection con = getVersionedResourceURL(resource).openConnection(); + con.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip"); + + con.connect(); + + /* + * We dont really know what we are downloading. If we ask for + * foo.jar, the server might send us foo.jar.pack.gz or foo.jar.gz + * instead. So we save the file with the appropriate extension + */ + URL downloadLocation = resource.location; + + String contentEncoding = con.getContentEncoding(); + + if (JNLPRuntime.isDebug()) { + System.err.println("Content encoding for " + resource.location + ": " + + contentEncoding); + } + + if (contentEncoding != null) { + if (contentEncoding.equals("gzip")) { + downloadLocation = new URL(downloadLocation.toString() + ".gz"); + } else if (contentEncoding.equals("pack200-gzip")) { + downloadLocation = new URL(downloadLocation.toString() + ".pack.gz"); + } + } InputStream in = new BufferedInputStream(con.getInputStream()); - OutputStream out = CacheUtil.getOutputStream(resource.location, resource.downloadVersion); + OutputStream out = CacheUtil.getOutputStream(downloadLocation, resource.downloadVersion); byte buf[] = new byte[1024]; int rlen; @@ -623,7 +666,45 @@ public class ResourceTracker { // explicitly close the URLConnection. if (con instanceof HttpURLConnection) ((HttpURLConnection)con).disconnect(); - + + /* + * If the file was compressed, uncompress it. + */ + if (contentEncoding != null) { + if (contentEncoding.equals("gzip")) { + GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(CacheUtil + .getCacheFile(downloadLocation, resource.downloadVersion))); + InputStream inputStream = new BufferedInputStream(gzInputStream); + + BufferedOutputStream outputStream = new BufferedOutputStream( + new FileOutputStream(CacheUtil.getCacheFile(resource.location, + resource.downloadVersion))); + + while (-1 != (rlen = inputStream.read(buf))) { + outputStream.write(buf, 0, rlen); + } + + outputStream.close(); + inputStream.close(); + gzInputStream.close(); + + } else if (contentEncoding.equals("pack200-gzip")) { + GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream( + CacheUtil.getCacheFile(downloadLocation, resource.downloadVersion))); + InputStream inputStream = new BufferedInputStream(gzInputStream); + + JarOutputStream outputStream = new JarOutputStream(new FileOutputStream( + CacheUtil.getCacheFile(resource.location, resource.downloadVersion))); + + Unpacker unpacker = Pack200.newUnpacker(); + unpacker.unpack(inputStream, outputStream); + + outputStream.close(); + inputStream.close(); + gzInputStream.close(); + } + } + resource.changeStatus(DOWNLOADING, DOWNLOADED); synchronized(lock) { lock.notifyAll(); // wake up wait's to check for completion @@ -654,6 +735,7 @@ public class ResourceTracker { // connect URLConnection connection = getVersionedResourceURL(resource).openConnection(); // this won't change so should be okay unsynchronized + connection.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip"); int size = connection.getContentLength(); boolean current = CacheUtil.isCurrent(resource.location, resource.requestVersion, connection) && resource.getUpdatePolicy() != UpdatePolicy.FORCE; @@ -698,8 +780,10 @@ public class ResourceTracker { } } - - + /** + * Returns the versioned url for a resource + * @param resource the resource to get the url for + */ private URL getVersionedResourceURL(Resource resource) { String actualLocation = resource.location.getProtocol() + "://" + resource.location.getHost(); From dbhole at redhat.com Tue Aug 4 09:07:39 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:39 +0000 Subject: changeset in /hg/icedtea: Commit changes to the new np plugin. T... Message-ID: changeset 5da2e8e775d5 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=5da2e8e775d5 description: Commit changes to the new np plugin. These changes do a lot of things to list. But most notably, they: - Lay down the scriptability framework. - Implement the new MessageBus architecture that is independent of how messages are passed. - Implement GetWindow and GetMember (partially) as proof of concept for message passing, threading, unicode translation, etc. ChangeLog: * Makefile.am: Update makefile to pick up plugin C++ files from new location. * plugin/icedtea/sun/applet/PluginMessageConsumer.java : Minor typo fix. * plugin/icedteanp/IcedTeaJavaRequestProcessor.cc: New file. Processes requests from JS/C++ side to JavaSide. * plugin/icedteanp/IcedTeaJavaRequestProcessor.h: New file. Header for IcedTeaJavaRequestProcessor.cc. * plugin/icedteanp/IcedTeaNPPlugin.cc: Modified to work with the new MessageBus archtecture for the new plugin. Also, moved from top level directory. * plugin/icedteanp/IcedTeaNPPlugin.h: New file. Header for IcedTeaNPPlugin.cc. * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc: New file. Processes plugin data requests from Java side. * plugin/icedteanp/IcedTeaPluginRequestProcessor.h: new file. Header for IcedTeaPluginRequestProcessor.cc. * plugin/icedteanp/IcedTeaPluginUtils.cc: New file. Utility functions for the rest of the plugin code. * plugin/icedteanp/IcedTeaPluginUtils.h: New file. Header for IcedTeaPluginUtils.cc. * plugin/icedteanp/IcedTeaScriptablePluginObject.cc: New file. Scriptable object that extends NPObject and implements hooks from NPClass. * plugin/icedteanp/IcedTeaScriptablePluginObject.h: New file. Header for IcedTeaScriptablePluginObject.h * plugin/icedtea/sun/applet/PluginMessageConsumer.java: Sync with current plugin. * plugin/icedteanp/sun/applet/PluginAppletSecurityContext.java: Same. * plugin/icedteanp/sun/applet/PluginAppletViewer.java: Same. * plugin/icedteanp/sun/applet/PluginCallRequestFactory.java: Same. * plugin/icedteanp/sun/applet/PluginCookieInfoRequest.java: Same * plugin/icedteanp/sun/applet/PluginCookieStore.java: Same. * plugin/icedteanp/sun/applet/PluginMain.java: Same. * plugin/icedteanp/sun/applet/PluginMessageConsumer.java: Same. * netx/net/sourceforge/jnlp/tools/JarSigner.java: Use JarFile instead of JarInputstream when verifying jars. diffstat: 21 files changed, 4450 insertions(+), 2082 deletions(-) ChangeLog | 38 IcedTeaNPPlugin.cc | 2006 --------- netx/net/sourceforge/jnlp/tools/JarSigner.java | 23 plugin/icedtea/sun/applet/PluginMessageConsumer.java | 2 plugin/icedteanp/IcedTeaJavaRequestProcessor.cc | 195 plugin/icedteanp/IcedTeaJavaRequestProcessor.h | 107 plugin/icedteanp/IcedTeaNPPlugin.cc | 2071 ++++++++++ plugin/icedteanp/IcedTeaNPPlugin.h | 90 plugin/icedteanp/IcedTeaPluginRequestProcessor.cc | 420 ++ plugin/icedteanp/IcedTeaPluginRequestProcessor.h | 108 plugin/icedteanp/IcedTeaPluginUtils.cc | 583 ++ plugin/icedteanp/IcedTeaPluginUtils.h | 244 + plugin/icedteanp/IcedTeaScriptablePluginObject.cc | 113 plugin/icedteanp/IcedTeaScriptablePluginObject.h | 87 plugin/icedteanp/sun/applet/PluginAppletSecurityContext.java | 2 plugin/icedteanp/sun/applet/PluginAppletViewer.java | 238 - plugin/icedteanp/sun/applet/PluginCallRequestFactory.java | 2 plugin/icedteanp/sun/applet/PluginCookieInfoRequest.java | 122 plugin/icedteanp/sun/applet/PluginCookieStore.java | 73 plugin/icedteanp/sun/applet/PluginMain.java | 6 plugin/icedteanp/sun/applet/PluginMessageConsumer.java | 2 diffs (truncated from 6848 to 500 lines): diff -r b190c887feae -r 5da2e8e775d5 ChangeLog --- a/ChangeLog Thu Jul 09 17:29:13 2009 -0400 +++ b/ChangeLog Fri Jul 10 19:02:10 2009 -0400 @@ -1,3 +1,41 @@ 2009-07-09 Omair Majid + + * Makefile.am: Update makefile to pick up plugin C++ files from new + location. + * plugin/icedtea/sun/applet/PluginMessageConsumer.java : Minor typo fix. + * plugin/icedteanp/IcedTeaJavaRequestProcessor.cc: New file. Processes + requests from JS/C++ side to JavaSide. + * plugin/icedteanp/IcedTeaJavaRequestProcessor.h: New file. Header for + IcedTeaJavaRequestProcessor.cc. + * plugin/icedteanp/IcedTeaNPPlugin.cc: Modified to work with the new + MessageBus archtecture for the new plugin. Also, moved from top level + directory. + * plugin/icedteanp/IcedTeaNPPlugin.h: New file. Header for + IcedTeaNPPlugin.cc. + * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc: New file. Processes + plugin data requests from Java side. + * plugin/icedteanp/IcedTeaPluginRequestProcessor.h: new file. Header for + IcedTeaPluginRequestProcessor.cc. + * plugin/icedteanp/IcedTeaPluginUtils.cc: New file. Utility functions for + the rest of the plugin code. + * plugin/icedteanp/IcedTeaPluginUtils.h: New file. Header for + IcedTeaPluginUtils.cc. + * plugin/icedteanp/IcedTeaScriptablePluginObject.cc: New file. Scriptable + object that extends NPObject and implements hooks from NPClass. + * plugin/icedteanp/IcedTeaScriptablePluginObject.h: New file. Header for + IcedTeaScriptablePluginObject.h + * plugin/icedtea/sun/applet/PluginMessageConsumer.java: Sync with current + plugin. + * plugin/icedteanp/sun/applet/PluginAppletSecurityContext.java: Same. + * plugin/icedteanp/sun/applet/PluginAppletViewer.java: Same. + * plugin/icedteanp/sun/applet/PluginCallRequestFactory.java: Same. + * plugin/icedteanp/sun/applet/PluginCookieInfoRequest.java: Same + * plugin/icedteanp/sun/applet/PluginCookieStore.java: Same. + * plugin/icedteanp/sun/applet/PluginMain.java: Same. + * plugin/icedteanp/sun/applet/PluginMessageConsumer.java: Same. + * netx/net/sourceforge/jnlp/tools/JarSigner.java: Use JarFile instead of + JarInputstream when verifying jars. + 2009-07-09 Omair Majid * netx/net/sourceforge/jnlp/Launcher.java diff -r b190c887feae -r 5da2e8e775d5 IcedTeaNPPlugin.cc --- a/IcedTeaNPPlugin.cc Thu Jul 09 17:29:13 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2006 +0,0 @@ -/* gcjwebplugin.cc -- web browser plugin to execute Java applets - Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -// System includes. -#include -#include -#include -#include -#include -#include -#include -#include - -// Netscape plugin API includes. -#include -#include - -// GLib includes. -#include -#include - -// GTK includes. -#include - -// Documentbase retrieval includes. -#include -#include -#include - -// API's into Mozilla -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// Debugging macros. -#define PLUGIN_DEBUG(message) \ - g_print ("GCJ PLUGIN: thread %p: %s\n", g_thread_self (), message) - -#define PLUGIN_DEBUG_TWO(first, second) \ - g_print ("GCJ PLUGIN: thread %p: %s %s\n", g_thread_self (), \ - first, second) - -// Error reporting macros. -#define PLUGIN_ERROR(message) \ - g_printerr ("%s:%d: thread %p: Error: %s\n", __FILE__, __LINE__, \ - g_thread_self (), message) - -#define PLUGIN_ERROR_TWO(first, second) \ - g_printerr ("%s:%d: thread %p: Error: %s: %s\n", __FILE__, __LINE__, \ - g_thread_self (), first, second) - -#define PLUGIN_ERROR_THREE(first, second, third) \ - g_printerr ("%s:%d: thread %p: Error: %s: %s: %s\n", __FILE__, \ - __LINE__, g_thread_self (), first, second, third) - -// Plugin information passed to about:plugins. -#define PLUGIN_NAME "IcedTea NPR Web Browser Plugin (using IcedTea)" -#define PLUGIN_DESC "The " PLUGIN_NAME PLUGIN_VERSION " executes Java applets." -#define PLUGIN_MIME_DESC \ - "application/x-java-vm:class,jar:IcedTea;" \ - "application/x-java-applet:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.1:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.1.1:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.1.2:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.1.3:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.2:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.2.1:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.2.2:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.3:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.3.1:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.4:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.4.1:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.4.2:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.5:class,jar:IcedTea;" \ - "application/x-java-applet;version=1.6:class,jar:IcedTea;" \ - "application/x-java-applet;jpi-version=1.6.0_00:class,jar:IcedTea;" \ - "application/x-java-bean:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.1:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.1.1:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.1.2:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.1.3:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.2:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.2.1:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.2.2:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.3:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.3.1:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.4:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.4.1:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.4.2:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.5:class,jar:IcedTea;" \ - "application/x-java-bean;version=1.6:class,jar:IcedTea;" \ - "application/x-java-bean;jpi-version=1.6.0_00:class,jar:IcedTea;" -#define PLUGIN_URL NS_INLINE_PLUGIN_CONTRACTID_PREFIX NS_JVM_MIME_TYPE -#define PLUGIN_MIME_TYPE "application/x-java-vm" -#define PLUGIN_FILE_EXTS "class,jar,zip" -#define PLUGIN_MIME_COUNT 1 - -#define FAILURE_MESSAGE "gcjwebplugin error: Failed to run %s." \ - " For more detail rerun \"firefox -g\" in a terminal window." - -static int plugin_debug = 1; - -#define PLUGIN_DEBUG_0ARG(str) \ - do \ - { \ - if (plugin_debug) \ - { \ - fprintf(stderr, "GCJ PLUGIN: thread %p: ", g_thread_self ()); \ - fprintf(stderr, str); \ - } \ - } while (0) - -#define PLUGIN_DEBUG_1ARG(str, arg1) \ - do \ - { \ - if (plugin_debug) \ - { \ - fprintf(stderr, "GCJ PLUGIN: thread %p: ", g_thread_self ()); \ - fprintf(stderr, str, arg1); \ - } \ - } while (0) - -#define PLUGIN_DEBUG_2ARG(str, arg1, arg2) \ - do \ - { \ - if (plugin_debug) \ - { \ - fprintf(stderr, "GCJ PLUGIN: thread %p: ", g_thread_self ()); \ - fprintf(stderr, str, arg1, arg2); \ - } \ - } while (0) - -#define PLUGIN_DEBUG_3ARG(str, arg1, arg2, arg3) \ - do \ - { \ - if (plugin_debug) \ - { \ - fprintf(stderr, "GCJ PLUGIN: thread %p: ", g_thread_self ()); \ - fprintf(stderr, str, arg1, arg2, arg3); \ - } \ - } while (0) - -#define PLUGIN_DEBUG_4ARG(str, arg1, arg2, arg3, arg4) \ - do \ - { \ - if (plugin_debug) \ - { \ - fprintf(stderr, "GCJ PLUGIN: thread %p: ", g_thread_self ()); \ - fprintf(stderr, str, arg1, arg2, arg3, arg4); \ - } \ - } while (0) - -// Documentbase retrieval required definition. -static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); - -// Browser function table. -static NPNetscapeFuncs browserFunctions; - -// Data directory for plugin. -static gchar* data_directory = NULL; - -// Fully-qualified appletviewer executable. -static gchar* appletviewer_executable = NULL; - -// Applet viewer input channel (needs to be static because it is used in plugin_in_pipe_callback) -static GIOChannel* in_from_appletviewer = NULL; - -// Applet viewer input pipe name. -gchar* in_pipe_name; - -// Applet viewer input watch source. -gint in_watch_source; - -// Applet viewer output pipe name. -gchar* out_pipe_name; - -// Applet viewer output watch source. -gint out_watch_source; - -// Applet viewer output channel. -GIOChannel* out_to_appletviewer; - -// Tracks jvm status -gboolean jvm_up = FALSE; - -// Keeps track of initialization. NP_Initialize should only be -// called once. -gboolean initialized = false; - -GQuark ITNP_PLUGIN_ERROR = g_quark_from_string("IcedTeaNPPlugin"); - -// GCJPluginData stores all the data associated with a single plugin -// instance. A separate plugin instance is created for each -// tag. For now, each plugin instance spawns its own applet viewer -// process but this may need to change if we find pages containing -// multiple applets that expect to be running in the same VM. -struct GCJPluginData -{ - // A unique identifier for this plugin window. - gchar* instance_string; - // Mutex to protect appletviewer_alive. - GMutex* appletviewer_mutex; - // Back-pointer to the plugin instance to which this data belongs. - // This should not be freed but instead simply set to NULL. - NPP owner; - // The address of the plugin window. This should not be freed but - // instead simply set to NULL. - gpointer window_handle; - // The last plugin window width sent to us by the browser. - guint32 window_width; - // The last plugin window height sent to us by the browser. - guint32 window_height; -}; - -// Documentbase retrieval type-punning union. -typedef union -{ - void** void_field; - nsIPluginTagInfo2** info_field; -} info_union; - -// Static instance helper functions. -// Have the browser allocate a new GCJPluginData structure. -static void plugin_data_new (GCJPluginData** data); -// Retrieve the current document's documentbase. -static gchar* plugin_get_documentbase (NPP instance); -// Notify the user that the appletviewer is not installed correctly. -static void plugin_display_failure_dialog (); -// Callback used to monitor input pipe status. -static gboolean plugin_in_pipe_callback (GIOChannel* source, - GIOCondition condition, - gpointer plugin_data); -// Callback used to monitor output pipe status. -static gboolean plugin_out_pipe_callback (GIOChannel* source, - GIOCondition condition, - gpointer plugin_data); -static NPError plugin_start_appletviewer (GCJPluginData* data); -static gchar* plugin_create_applet_tag (int16 argc, char* argn[], - char* argv[]); -static void plugin_send_message_to_appletviewer (gchar const* message); -static void plugin_stop_appletviewer (); -// Uninitialize GCJPluginData structure -static void plugin_data_destroy (NPP instance); - -NS_IMETHODIMP get_cookie_info(const char* siteAddr, char** cookieString); -void get_proxy_info(const char* siteAddr, char** proxy_scheme, char** proxy_host, char** proxy_port, GError *error); -void decode_url(const gchar* url, gchar** decoded_url); -void consume_message(gchar* message); -void start_jvm_if_needed(); -static void appletviewer_monitor(GPid pid, gint status, gpointer data); - -// Global instance counter. -// Mutex to protect plugin_instance_counter. -static GMutex* plugin_instance_mutex = NULL; -// A global variable for reporting GLib errors. This must be free'd -// and set to NULL after each use. -static GError* channel_error = NULL; - -static GHashTable* instance_to_id_map = g_hash_table_new(NULL, NULL); -static GHashTable* id_to_instance_map = g_hash_table_new(NULL, NULL); -static gint instance_counter = 1; -static GPid appletviewer_pid = -1; -static guint appletviewer_watch_id = -1; - -// Functions prefixed by GCJ_ are instance functions. They are called -// by the browser and operate on instances of GCJPluginData. -// Functions prefixed by plugin_ are static helper functions. -// Functions prefixed by NP_ are factory functions. They are called -// by the browser and provide functionality needed to create plugin -// instances. - -// INSTANCE FUNCTIONS - -// Creates a new gcjwebplugin instance. This function creates a -// GCJPluginData* and stores it in instance->pdata. The following -// GCJPluginData fiels are initialized: instance_string, in_pipe_name, -// in_from_appletviewer, in_watch_source, out_pipe_name, -// out_to_appletviewer, out_watch_source, appletviewer_mutex, owner, -// appletviewer_alive. In addition two pipe files are created. All -// of those fields must be properly destroyed, and the pipes deleted, -// by GCJ_Destroy. If an error occurs during initialization then this -// function will free anything that's been allocated so far, set -// instance->pdata to NULL and return an error code. -NPError -GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode, - int16 argc, char* argn[], char* argv[], - NPSavedData* saved) -{ - PLUGIN_DEBUG ("GCJ_New"); - - NPError np_error = NPERR_NO_ERROR; - GCJPluginData* data = NULL; - - gchar* documentbase = NULL; - gchar* read_message = NULL; - gchar* applet_tag = NULL; - gchar* tag_message = NULL; - gchar* cookie_info = NULL; - - if (!instance) - { - PLUGIN_ERROR ("Browser-provided instance pointer is NULL."); - np_error = NPERR_INVALID_INSTANCE_ERROR; - goto cleanup_done; - } - - // data - plugin_data_new (&data); - if (data == NULL) - { - PLUGIN_ERROR ("Failed to allocate plugin data."); - np_error = NPERR_OUT_OF_MEMORY_ERROR; - goto cleanup_done; - } - - // start the jvm if needed - start_jvm_if_needed(); - - // Initialize data->instance_string. - // - // instance_string should be unique for this process so we use a - // combination of getpid and plugin_instance_counter. - // - // Critical region. Reference and increment plugin_instance_counter - // global. - g_mutex_lock (plugin_instance_mutex); - - // data->instance_string - data->instance_string = g_strdup_printf ("%d", - instance_counter); - - g_mutex_unlock (plugin_instance_mutex); - - // data->appletviewer_mutex - data->appletviewer_mutex = g_mutex_new (); - - g_mutex_lock (data->appletviewer_mutex); - - // Documentbase retrieval. - documentbase = plugin_get_documentbase (instance); - if (!documentbase) - { - PLUGIN_ERROR ("Documentbase retrieval failed." - " Browser not Mozilla-based?"); - goto cleanup_appletviewer_mutex; - } - - // Send applet tag message to appletviewer. - applet_tag = plugin_create_applet_tag (argc, argn, argv); - - tag_message = (gchar*) malloc(strlen(applet_tag)*sizeof(gchar) + 1024); - g_sprintf(tag_message, "instance %d tag %s %s", instance_counter, documentbase, applet_tag); - - //plugin_send_message_to_appletviewer (data, data->instance_string); - plugin_send_message_to_appletviewer (tag_message); - - //send cookie information - char* cookie_string; - if (get_cookie_info(documentbase, &cookie_string) == NS_OK) - { - cookie_info = (gchar*) malloc(sizeof(cookie_string) + 1024); - g_sprintf(cookie_info, "instance %d cookie %s", instance_counter, cookie_string); - } - else - { - cookie_info = (gchar*) malloc(1024); - g_sprintf(cookie_info, "instance %d cookie", instance_counter); - } - - plugin_send_message_to_appletviewer (cookie_info); - - g_mutex_unlock (data->appletviewer_mutex); - - // If initialization succeeded entirely then we store the plugin - // data in the instance structure and return. Otherwise we free the - // data we've allocated so far and set instance->pdata to NULL. - - // Set back-pointer to owner instance. - data->owner = instance; - instance->pdata = data; - goto cleanup_done; - - cleanup_appletviewer_mutex: - g_free (data->appletviewer_mutex); - data->appletviewer_mutex = NULL; - - // cleanup_instance_string: - g_free (data->instance_string); - data->instance_string = NULL; - - // cleanup_data: - // Eliminate back-pointer to plugin instance. - data->owner = NULL; - (*browserFunctions.memfree) (data); - data = NULL; - - // Initialization failed so return a NULL pointer for the browser - // data. - instance->pdata = NULL; - - cleanup_done: - g_free (tag_message); - tag_message = NULL; - g_free (applet_tag); - applet_tag = NULL; - g_free (read_message); From omajid at redhat.com Tue Aug 4 09:07:37 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:37 +0000 Subject: changeset in /hg/icedtea: 2009-07-07 Omair Majid changeset 559f19ce8d7b in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=559f19ce8d7b description: 2009-07-07 Omair Majid * netx/net/sourceforge/jnlp/Parser.java (getExtension): Fix typo in node name. diffstat: 2 files changed, 9 insertions(+), 4 deletions(-) ChangeLog | 5 +++++ netx/net/sourceforge/jnlp/Parser.java | 8 ++++---- diffs (30 lines): diff -r 0a41b2f5f086 -r 559f19ce8d7b ChangeLog --- a/ChangeLog Tue Jul 07 10:12:31 2009 -0400 +++ b/ChangeLog Tue Jul 07 13:44:35 2009 -0400 @@ -1,3 +1,8 @@ 2009-07-07 Omair Majid + + * netx/net/sourceforge/jnlp/Parser.java + (getExtension): Fix typo in node name. + 2009-07-07 Omair Majid * netx/net/sourceforge/jnlp/resources/Messages.properties: Add diff -r 0a41b2f5f086 -r 559f19ce8d7b netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Tue Jul 07 10:12:31 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Tue Jul 07 13:44:35 2009 -0400 @@ -336,10 +336,10 @@ class Parser { Node dload[] = getChildNodes(node, "ext-download"); for (int i=0; i < dload.length; i++) { - boolean lazy = "lazy".equals(getAttribute(node, "download", "eager")); - - ext.addPart(getRequiredAttribute(node, "ext-part", null), - getAttribute(node, "part", null), + boolean lazy = "lazy".equals(getAttribute(dload[i], "download", "eager")); + + ext.addPart(getRequiredAttribute(dload[i], "ext-part", null), + getAttribute(dload[i], "part", null), lazy); } From dbhole at redhat.com Tue Aug 4 09:07:37 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:37 +0000 Subject: changeset in /hg/icedtea: Rewrote cookie support for the plugin ... Message-ID: changeset 544a26bdc6d0 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=544a26bdc6d0 description: Rewrote cookie support for the plugin so that cookies are aquired dynamically from Mozilla for each http/https connection. diffstat: 16 files changed, 127 insertions(+), 108 deletions(-) ChangeLog | 16 ++++ IcedTeaPlugin.cc | 52 ++++++++++--- netx/net/sourceforge/jnlp/ExtensionDesc.java | 16 ---- netx/net/sourceforge/jnlp/JNLPFile.java | 27 ++----- netx/net/sourceforge/jnlp/Launcher.java | 6 - netx/net/sourceforge/jnlp/NetxPanel.java | 5 - netx/net/sourceforge/jnlp/Parser.java | 2 netx/net/sourceforge/jnlp/PluginBridge.java | 3 netx/net/sourceforge/jnlp/cache/CacheUtil.java | 4 - netx/net/sourceforge/jnlp/cache/Resource.java | 17 ---- netx/net/sourceforge/jnlp/cache/ResourceTracker.java | 10 -- netx/net/sourceforge/jnlp/runtime/Boot.java | 2 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | 10 +- plugin/icedtea/sun/applet/PluginAppletViewer.java | 57 +++++++++------ plugin/icedtea/sun/applet/PluginCallRequestFactory.java | 2 plugin/icedtea/sun/applet/PluginMain.java | 6 + diffs (truncated from 645 to 500 lines): diff -r 559f19ce8d7b -r 544a26bdc6d0 ChangeLog --- a/ChangeLog Tue Jul 07 13:44:35 2009 -0400 +++ b/ChangeLog Thu Jul 09 14:42:44 2009 -0400 @@ -1,3 +1,19 @@ 2009-07-07 Omair Majid + + * IcedTeaPlugin.cc: Add suppport for cookie info requests from applets. + * plugin/icedtea/sun/applet/PluginAppletViewer.java: Rework cookie support + to make it dynamic. + * plugin/icedtea/sun/applet/PluginMain.java: Wire in custom cookie store + that dynamically requests cookie information from C++ side. + * netx/net/sourceforge/jnlp/JNLPFile.java: Remove old cookie handling code. + * netx/net/sourceforge/jnlp/Launcher.java: Same. + * netx/net/sourceforge/jnlp/NetxPanel.java: Same. + * netx/net/sourceforge/jnlp/PluginBridge.java: Same. + * netx/net/sourceforge/jnlp/cache/CacheUtil.java: Same. + * netx/net/sourceforge/jnlp/cache/Resource.java: Same. + * netx/net/sourceforge/jnlp/cache/ResourceTracker.java: Same. + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: Same. + 2009-07-07 Omair Majid * netx/net/sourceforge/jnlp/Parser.java diff -r 559f19ce8d7b -r 544a26bdc6d0 IcedTeaPlugin.cc --- a/IcedTeaPlugin.cc Tue Jul 07 13:44:35 2009 -0400 +++ b/IcedTeaPlugin.cc Thu Jul 09 14:42:44 2009 -0400 @@ -1012,6 +1012,7 @@ private: void ProcessMessage(); void ConsumeMsgFromJVM(); nsresult GetProxyInfo(const char* siteAddr, char** proxyScheme, char** proxyHost, char** proxyPort); + nsresult GetCookieInfo(const char* siteAddr, char** cookieString); nsCOMPtr sink; nsCOMPtr transport; nsCOMPtr applet_viewer_process; @@ -1070,7 +1071,6 @@ private: IcedTeaPluginFactory* factory; PRUint32 instance_identifier; nsCString instanceIdentifierPrefix; - nsresult GetCookie(const char* siteAddr, char** cookieString); }; @@ -2380,16 +2380,6 @@ IcedTeaPluginInstance::Initialize (nsIPl encodedAppletTag += tagMessage.get()[i]; } - nsCString cookieInfo(instanceIdentifierPrefix); - cookieInfo += "cookie "; - - char* cookieString; - if (GetCookie(documentbase, &cookieString) == NS_OK) - { - cookieInfo += cookieString; - } - - factory->SendMessageToAppletViewer (cookieInfo); factory->SendMessageToAppletViewer (encodedAppletTag); // Set back-pointer to peer instance. @@ -2760,8 +2750,15 @@ IcedTeaPluginFactory::GetProxyInfo(const return NS_OK; } -NS_IMETHODIMP -IcedTeaPluginInstance::GetCookie(const char* siteAddr, char** cookieString) +/** + * Returns the cookie information for the given url + * + * @param siteAddr The URI to check (must be decoded) + * @return cookieString The cookie string for the given URI + */ + +NS_IMETHODIMP +IcedTeaPluginFactory::GetCookieInfo(const char* siteAddr, char** cookieString) { nsresult rv; @@ -3497,6 +3494,35 @@ IcedTeaPluginFactory::HandleMessage (nsC // free allocated memory delete proxyScheme, proxyHost, proxyPort; + + } else if (command == "PluginCookieInfo") + { + + nsresult rv; + nsCOMPtr net_util = do_GetService(NS_NETUTIL_CONTRACTID, &rv); + + if (!net_util) + printf("Error instantiating NetUtil service.\n"); + + // decode the url + nsDependentCSubstring url; + net_util->UnescapeString(rest, 0, url); + + nsCString cookieInfo("plugin PluginCookieInfo "); + cookieInfo += rest; + cookieInfo += " "; + + char* cookieString; + if (GetCookieInfo(((nsCString) url).get(), &cookieString) == NS_OK) + { + cookieInfo += cookieString; + PLUGIN_DEBUG_2ARG("Cookie for %s is %s\n", ((nsCString) url).get(), cookieString); + } else { + PLUGIN_DEBUG_1ARG("No cookie found for %s\n", ((nsCString) url).get()); + } + + // send back what we found + SendMessageToAppletViewer (cookieInfo); } } diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/ExtensionDesc.java --- a/netx/net/sourceforge/jnlp/ExtensionDesc.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/ExtensionDesc.java Thu Jul 09 14:42:44 2009 -0400 @@ -40,9 +40,6 @@ public class ExtensionDesc { /** the location of the extension JNLP file */ private URL location; - - /** the cookie string sent with resource requests */ - private String cookieStr; /** the JNLPFile the extension refers to */ private JNLPFile file; @@ -61,11 +58,10 @@ public class ExtensionDesc { * @param version the required version of the extention JNLPFile * @param location the location of the extention JNLP file */ - public ExtensionDesc(String name, Version version, URL location, String cookieStr) { + public ExtensionDesc(String name, Version version, URL location) { this.name = name; this.version = version; this.location = location; - this.cookieStr = cookieStr; } /** @@ -125,7 +121,7 @@ public class ExtensionDesc { */ public void resolve() throws ParseException, IOException { if (file == null) { - file = new JNLPFile(location, cookieStr); + file = new JNLPFile(location); if (JNLPRuntime.isDebug()) System.out.println("Resolve: "+file.getInformation().getTitle()); @@ -144,14 +140,6 @@ public class ExtensionDesc { public JNLPFile getJNLPFile() { return file; } - - /** - * Returns the cookie associated with this instance - */ - public String getCookieStr() { - return cookieStr; - } - } diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/JNLPFile.java --- a/netx/net/sourceforge/jnlp/JNLPFile.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Thu Jul 09 14:42:44 2009 -0400 @@ -69,9 +69,6 @@ public class JNLPFile { /** the URL used to resolve relative URLs in the file */ protected URL codeBase; - - /** cookie string to send alongwith resource requests */ - protected String cookieStr; /** file version */ protected Version fileVersion; @@ -127,8 +124,8 @@ public class JNLPFile { * @throws IOException if an IO exception occurred * @throws ParseException if the JNLP file was invalid */ - public JNLPFile(URL location, String cookieStr) throws IOException, ParseException { - this(location, cookieStr, false); // not strict + public JNLPFile(URL location) throws IOException, ParseException { + this(location, false); // not strict } /** @@ -140,8 +137,8 @@ public class JNLPFile { * @throws IOException if an IO exception occurred * @throws ParseException if the JNLP file was invalid */ - public JNLPFile(URL location, String cookieStr, boolean strict) throws IOException, ParseException { - this(location, cookieStr, strict, JNLPRuntime.getDefaultUpdatePolicy()); + public JNLPFile(URL location, boolean strict) throws IOException, ParseException { + this(location, strict, JNLPRuntime.getDefaultUpdatePolicy()); } /** @@ -154,12 +151,11 @@ public class JNLPFile { * @throws IOException if an IO exception occurred * @throws ParseException if the JNLP file was invalid */ - public JNLPFile(URL location, String cookieStr, boolean strict, UpdatePolicy policy) throws IOException, ParseException { - Node root = Parser.getRootNode(openURL(location, cookieStr, policy)); + public JNLPFile(URL location, boolean strict, UpdatePolicy policy) throws IOException, ParseException { + Node root = Parser.getRootNode(openURL(location, policy)); parse(root, strict, location); this.fileLocation = location; - this.cookieStr = cookieStr; } /** @@ -190,13 +186,13 @@ public class JNLPFile { * Open the jnlp file URL from the cache if there, otherwise * download to the cache. Called from constructor. */ - private static InputStream openURL(URL location, String cookieStr, UpdatePolicy policy) throws IOException { + private static InputStream openURL(URL location, UpdatePolicy policy) throws IOException { if (location == null || policy == null) throw new IllegalArgumentException(R("NullParameter")); try { ResourceTracker tracker = new ResourceTracker(false); // no prefetch - tracker.addResource(location, cookieStr, null/*version*/, policy); + tracker.addResource(location, null/*version*/, policy); return tracker.getInputStream(location); } @@ -255,13 +251,6 @@ public class JNLPFile { */ public URL getCodeBase() { return codeBase; - } - - /** - * Returns the cookie string that will be send when resources for this file are requested - */ - public String getCookieStr() { - return cookieStr; } /** diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Thu Jul 09 14:42:44 2009 -0400 @@ -335,10 +335,10 @@ public class Launcher { JNLPFile file = null; try { - file = new JNLPFile(location, null, true, updatePolicy); // strict + file = new JNLPFile(location, true, updatePolicy); // strict } catch (ParseException ex) { - file = new JNLPFile(location, null, false, updatePolicy); + file = new JNLPFile(location, false, updatePolicy); // only here if strict failed but lax did not fail LaunchException lex = @@ -389,7 +389,7 @@ public class Launcher { IconDesc.SPLASH, preferredWidth, preferredHeight); if (splashImageURL != null) { ResourceTracker resourceTracker = new ResourceTracker(true); - resourceTracker.addResource(splashImageURL, "SPLASH", file.getFileVersion(), updatePolicy); + resourceTracker.addResource(splashImageURL, file.getFileVersion(), updatePolicy); splashScreen = new JNLPSplashScreen(resourceTracker, null, null); splashScreen.setSplashImageURL(splashImageURL); if (splashScreen.isSplashScreenValid()) { diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/NetxPanel.java --- a/netx/net/sourceforge/jnlp/NetxPanel.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/NetxPanel.java Thu Jul 09 14:42:44 2009 -0400 @@ -41,7 +41,6 @@ public class NetxPanel extends AppletVie private PluginBridge bridge = null; private boolean exitOnFailure = true; private AppletInstance appInst = null; - private String cookieStr; private boolean appletAlive; public NetxPanel(URL documentURL, Hashtable atts) @@ -50,11 +49,10 @@ public class NetxPanel extends AppletVie } // overloaded constructor, called when initialized via plugin - public NetxPanel(URL documentURL, String cookieStr, Hashtable atts, boolean exitOnFailure) + public NetxPanel(URL documentURL, Hashtable atts, boolean exitOnFailure) { this(documentURL, atts); this.exitOnFailure = exitOnFailure; - this.cookieStr = cookieStr; this.appletAlive = true; } @@ -64,7 +62,6 @@ public class NetxPanel extends AppletVie try { bridge = new PluginBridge(baseURL, - cookieStr, getDocumentBase(), getJarFiles(), getCode(), diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/Parser.java --- a/netx/net/sourceforge/jnlp/Parser.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Parser.java Thu Jul 09 14:42:44 2009 -0400 @@ -332,7 +332,7 @@ class Parser { Version version = getVersion(node, "version", null); URL location = getRequiredURL(node, "href", base); - ExtensionDesc ext = new ExtensionDesc(name, version, location, null); + ExtensionDesc ext = new ExtensionDesc(name, version, location); Node dload[] = getChildNodes(node, "ext-download"); for (int i=0; i < dload.length; i++) { diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/PluginBridge.java --- a/netx/net/sourceforge/jnlp/PluginBridge.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/PluginBridge.java Thu Jul 09 14:42:44 2009 -0400 @@ -43,7 +43,7 @@ public class PluginBridge extends JNLPFi String[] cache_ex_jars = new String[0]; Hashtable atts; - public PluginBridge(URL codebase, String cookieStr, URL documentBase, String jar, String main, + public PluginBridge(URL codebase, URL documentBase, String jar, String main, int width, int height, Hashtable atts) throws Exception { @@ -104,7 +104,6 @@ public class PluginBridge extends JNLPFi else security = null; - this.cookieStr = cookieStr; } public String getTitle() diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/cache/CacheUtil.java --- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java Thu Jul 09 14:42:44 2009 -0400 @@ -75,9 +75,9 @@ public class CacheUtil { * @param version the version, or null * @return either the location in the cache or the original location */ - public static URL getCachedResource(URL location, String cookieStr, Version version, UpdatePolicy policy) { + public static URL getCachedResource(URL location, Version version, UpdatePolicy policy) { ResourceTracker rt = new ResourceTracker(); - rt.addResource(location, cookieStr, version, policy); + rt.addResource(location, version, policy); try { File f = rt.getCacheFile(location); return f.toURL(); diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/cache/Resource.java --- a/netx/net/sourceforge/jnlp/cache/Resource.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/cache/Resource.java Thu Jul 09 14:42:44 2009 -0400 @@ -68,9 +68,6 @@ public class Resource { /** the remote location of the resource */ URL location; - /** cookie string to send with the resource request */ - String cookieStr; - /** the local file downloaded to */ File localFile; @@ -98,20 +95,19 @@ public class Resource { /** * Create a resource. */ - private Resource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) { + private Resource(URL location, UpdatePolicy updatePolicy, Version requestVersion) { this.location = location; this.requestVersion = requestVersion; this.updatePolicy = updatePolicy; - this.cookieStr = cookieStr; } /** * Return a shared Resource object representing the given * location and version. */ - public static Resource getResource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) { + public static Resource getResource(URL location, UpdatePolicy updatePolicy, Version requestVersion) { synchronized (resources) { - Resource resource = new Resource(location, cookieStr, updatePolicy, requestVersion); + Resource resource = new Resource(location, updatePolicy, requestVersion); int index = resources.indexOf(resource); if (index >= 0) { // return existing object @@ -132,13 +128,6 @@ public class Resource { */ public URL getLocation() { return location; - } - - /** - * Returns the cookie string associated with this resource - */ - public String getCookieStr() { - return cookieStr; } /** diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/cache/ResourceTracker.java --- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Thu Jul 09 14:42:44 2009 -0400 @@ -148,11 +148,11 @@ public class ResourceTracker { * @param version the resource version * @param updatePolicy whether to check for updates if already in cache */ - public void addResource(URL location, String cookieStr, Version version, UpdatePolicy updatePolicy) { + public void addResource(URL location, Version version, UpdatePolicy updatePolicy) { if (location == null) throw new IllegalArgumentException("location==null"); - Resource resource = Resource.getResource(location, cookieStr, updatePolicy, version); + Resource resource = Resource.getResource(location, updatePolicy, version); boolean downloaded = false; synchronized (resources) { @@ -606,9 +606,6 @@ public class ResourceTracker { try { // create out second in case in does not exist URLConnection con = getVersionedResourceURL(resource).openConnection(); - - if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0) - con.setRequestProperty("Cookie", resource.getCookieStr()); InputStream in = new BufferedInputStream(con.getInputStream()); OutputStream out = CacheUtil.getOutputStream(resource.location, resource.downloadVersion); @@ -657,9 +654,6 @@ public class ResourceTracker { // connect URLConnection connection = getVersionedResourceURL(resource).openConnection(); // this won't change so should be okay unsynchronized - - if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0) - connection.setRequestProperty("Cookie", resource.getCookieStr()); int size = connection.getContentLength(); boolean current = CacheUtil.isCurrent(resource.location, resource.requestVersion, connection) && resource.getUpdatePolicy() != UpdatePolicy.FORCE; diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/runtime/Boot.java --- a/netx/net/sourceforge/jnlp/runtime/Boot.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Thu Jul 09 14:42:44 2009 -0400 @@ -276,7 +276,7 @@ public final class Boot implements Privi boolean strict = (null != getOption("-strict")); - JNLPFile file = new JNLPFile(url, null, strict); + JNLPFile file = new JNLPFile(url, strict); // add in extra params from command line addProperties(file); diff -r 559f19ce8d7b -r 544a26bdc6d0 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jul 07 13:44:35 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Thu Jul 09 14:42:44 2009 -0400 @@ -234,11 +234,11 @@ public class JNLPClassLoader extends URL * @param location the file's location * @param policy the update policy to use when downloading resources */ - public static JNLPClassLoader getInstance(URL location, String cookieStr, UpdatePolicy policy) throws IOException, ParseException, LaunchException { + public static JNLPClassLoader getInstance(URL location, UpdatePolicy policy) throws IOException, ParseException, LaunchException { JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location); if (loader == null) - loader = getInstance(new JNLPFile(location, cookieStr, false, policy), policy); + loader = getInstance(new JNLPFile(location, false, policy), policy); return loader; } @@ -256,7 +256,7 @@ public class JNLPClassLoader extends URL //if (ext != null) { for (int i=0; i < ext.length; i++) { try { - JNLPClassLoader loader = getInstance(ext[i].getLocation(), ext[i].getCookieStr(), updatePolicy); + JNLPClassLoader loader = getInstance(ext[i].getLocation(), updatePolicy); loaderList.add(loader); } catch (Exception ex) { @@ -314,7 +314,6 @@ public class JNLPClassLoader extends URL initialJars.add(jars[i]); // regardless of part tracker.addResource(jars[i].getLocation(), - file.getCookieStr(), jars[i].getVersion(), jars[i].isCacheable() ? JNLPRuntime.getDefaultUpdatePolicy() : UpdatePolicy.FORCE ); @@ -780,8 +779,7 @@ public class JNLPClassLoader extends URL available.add(desc); - tracker.addResource(desc.getLocation(), - file.getCookieStr(), + tracker.addResource(desc.getLocation(), desc.getVersion(), JNLPRuntime.getDefaultUpdatePolicy() ); diff -r 559f19ce8d7b -r 544a26bdc6d0 plugin/icedtea/sun/applet/PluginAppletViewer.java --- a/plugin/icedtea/sun/applet/PluginAppletViewer.java Tue Jul 07 13:44:35 2009 -0400 +++ b/plugin/icedtea/sun/applet/PluginAppletViewer.java Thu Jul 09 14:42:44 2009 -0400 @@ -84,6 +84,7 @@ import java.io.PrintStream; import java.io.PrintStream; import java.io.Reader; import java.io.StringReader; +import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; From dbhole at redhat.com Tue Aug 4 09:07:37 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:37 +0000 Subject: changeset in /hg/icedtea: Adding new plugin cookie related files. Message-ID: changeset 9af9639e360e in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=9af9639e360e description: Adding new plugin cookie related files. diffstat: 2 files changed, 195 insertions(+) plugin/icedtea/sun/applet/PluginCookieInfoRequest.java | 122 ++++++++++++++++ plugin/icedtea/sun/applet/PluginCookieStore.java | 73 +++++++++ diffs (203 lines): diff -r 544a26bdc6d0 -r 9af9639e360e plugin/icedtea/sun/applet/PluginCookieInfoRequest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/icedtea/sun/applet/PluginCookieInfoRequest.java Thu Jul 09 15:28:30 2009 -0400 @@ -0,0 +1,122 @@ +/* PluginCookieInfoRequest -- Object representing a request for cookie information from the browser + Copyright (C) 2009 Red Hat + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package sun.applet; + +import java.net.HttpCookie; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import com.sun.jndi.toolkit.url.UrlUtil; + +/** + * This class represents a request object for cookie information for a given URI + */ + +public class PluginCookieInfoRequest extends PluginCallRequest { + + List cookieObjects = new ArrayList(); + + public PluginCookieInfoRequest(String message, String returnString) { + super(message, returnString); + } + + public void parseReturn(String cookieInfo) { + + // try to parse the proxy information. If things go wrong, do nothing .. + // this will keep internal = null which forces a direct connection + + PluginDebug.debug ("PluginCookieInfoRequest GOT: " + cookieInfo); + + String encodedURI = cookieInfo.split(" ")[2]; + + // Skip the first 3 components. We are guaranteed 3 components, + // so no index -1 to worry about + cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ')+1); + cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ')+1); + cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ')+1); + + URI siteURI; + try + { + siteURI = new URI(UrlUtil.decode(encodedURI, "UTF-8")); + } catch (Exception e) + { + e.printStackTrace(); + return; + } + + if (cookieInfo != null && cookieInfo.length() > 0) + { + String[] cookies = cookieInfo.split(";"); + + for (int i = 0; i < cookies.length; i++) + { + ArrayList l = new ArrayList(); + + String cookie = cookies[i]; + cookie = cookie.trim(); + String cookieName = cookie.substring(0, cookie.indexOf("=")); + String cookieValue = cookie.substring(cookie.indexOf("=")+1); + + HttpCookie httpCookieObj = new HttpCookie(cookieName, cookieValue); + httpCookieObj.setPath(siteURI.getPath()); + httpCookieObj.setVersion(0); // force v0 + + PluginDebug.debug("Adding cookie info COOKIEN=" + cookieName + " and COOKIEV=" + cookieValue); + cookieObjects.add(httpCookieObj); + } + } + + setDone(true); + } + + /** + * Returns whether the given message is serviceable by this object + * + * @param message The message to service + * @return boolean indicating if message is serviceable + */ + public boolean serviceable(String message) { + return message.startsWith(returnString); + } + + public List getObject() { + return this.cookieObjects; + } +} diff -r 544a26bdc6d0 -r 9af9639e360e plugin/icedtea/sun/applet/PluginCookieStore.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/icedtea/sun/applet/PluginCookieStore.java Thu Jul 09 15:28:30 2009 -0400 @@ -0,0 +1,73 @@ +/* PluginCookieStore -- Storage for cookie information + Copyright (C) 2009 Red Hat + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package sun.applet; + +import java.net.HttpCookie; +import java.net.URI; +import java.util.List; + +import sun.net.www.protocol.http.InMemoryCookieStore; + +public class PluginCookieStore extends InMemoryCookieStore +{ + public List get(URI uri) + { + List cookies; + + // Try to fetch it from the plugin, but if something goes + // wrong, fall back. Don't crash! + try + { + cookies = (List) PluginAppletViewer.requestPluginCookieInfo(uri); + + // If cookies is null, something went wrong. Fall back. + if (cookies == null) throw new NullPointerException("Null cookie"); + + } catch (Exception e) + { + PluginDebug.debug("Unable to fetch cookie information from plugin. " + + "Falling back to default."); + e.printStackTrace(); + cookies = super.get(uri); + } + + PluginDebug.debug("Returning cookies " + cookies + " for site: " + uri); + + return cookies; + } +} From omajid at redhat.com Tue Aug 4 09:07:38 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:38 +0000 Subject: changeset in /hg/icedtea: Netx: Set context classloader for all ... Message-ID: changeset b190c887feae in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=b190c887feae description: Netx: Set context classloader for all threads in an application 2009-07-09 Omair Majid * netx/net/sourceforge/jnlp/Launcher.java (launchApplication): Call setContextClassLoaderForAllThreads. (setContextClassLoaderForAllThreads): New function. diffstat: 2 files changed, 48 insertions(+), 2 deletions(-) ChangeLog | 6 ++++ netx/net/sourceforge/jnlp/Launcher.java | 44 +++++++++++++++++++++++++++++-- diffs (81 lines): diff -r 332a3a4aa5de -r b190c887feae ChangeLog --- a/ChangeLog Thu Jul 09 17:18:02 2009 -0400 +++ b/ChangeLog Thu Jul 09 17:29:13 2009 -0400 @@ -1,3 +1,9 @@ 2009-07-09 Omair Majid + + * netx/net/sourceforge/jnlp/Launcher.java + (launchApplication): Call setContextClassLoaderForAllThreads. + (setContextClassLoaderForAllThreads): New function. + 2009-07-09 Omair Majid * netx/net/sourceforge/jnlp/cache/ResourceTracker.java: diff -r 332a3a4aa5de -r b190c887feae netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Thu Jul 09 17:18:02 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Thu Jul 09 17:29:13 2009 -0400 @@ -23,6 +23,8 @@ import java.io.File; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadMXBean; import java.lang.reflect.Method; import java.net.URL; import java.util.LinkedList; @@ -425,8 +427,7 @@ public class Launcher { Method main = mainClass.getDeclaredMethod("main", new Class[] {String[].class} ); String args[] = file.getApplication().getArguments(); - // required to make some apps work right - Thread.currentThread().setContextClassLoader(app.getClassLoader()); + setContextClassLoaderForAllThreads(app.getClassLoader()); if (splashScreen != null) { if (splashScreen.isSplashScreenValid()) { @@ -445,6 +446,45 @@ public class Launcher { catch (Exception ex) { throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo"))); } + } + + /** + * Set the classloader as the context classloader for all threads. This is + * required to make some applications work. For example, an application that + * provides a custom Swing LnF may ask the swing thread to load resources + * from their JNLP, which would only work if the Swing thread knows about + * the JNLPClassLoader. + * + * @param classLoader the classloader to set as the context classloader + */ + private void setContextClassLoaderForAllThreads(ClassLoader classLoader) { + ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); + ThreadGroup root; + + root = Thread.currentThread().getThreadGroup(); + while (root.getParent() != null) { + root = root.getParent(); + } + + /* be prepared for change in thread size */ + int threadCountGuess = threadBean.getThreadCount(); + Thread[] threads; + do { + threadCountGuess = threadCountGuess * 2; + threads = new Thread[threadCountGuess]; + root.enumerate(threads, true); + } while (threads[threadCountGuess-1] != null); + + + for (Thread thread: threads) { + if (thread != null) { + if (JNLPRuntime.isDebug()) { + System.err.println("Setting " + classLoader + " as the classloader for thread " + thread.getName()); + } + thread.setContextClassLoader(classLoader); + } + } + } /** From omajid at redhat.com Tue Aug 4 09:07:36 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:36 +0000 Subject: changeset in /hg/icedtea: 2009-07-07 Omair Majid changeset 0a41b2f5f086 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=0a41b2f5f086 description: 2009-07-07 Omair Majid * netx/net/sourceforge/jnlp/resources/Messages.properties: Add RNestedJarExtration. * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java (activateJar): Create parent directories for nested jars. diffstat: 3 files changed, 12 insertions(+) ChangeLog | 7 +++++++ netx/net/sourceforge/jnlp/resources/Messages.properties | 1 + netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | 4 ++++ diffs (39 lines): diff -r dd483ae1e6ca -r 0a41b2f5f086 ChangeLog --- a/ChangeLog Wed Jun 24 16:26:08 2009 -0400 +++ b/ChangeLog Tue Jul 07 10:12:31 2009 -0400 @@ -1,3 +1,10 @@ 2009-06-24 Omair Majid + + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add + RNestedJarExtration. + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java + (activateJar): Create parent directories for nested jars. + 2009-06-24 Omair Majid * netx/net/sourceforge/jnlp/security/CertWarningPane.java diff -r dd483ae1e6ca -r 0a41b2f5f086 netx/net/sourceforge/jnlp/resources/Messages.properties --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jun 24 16:26:08 2009 -0400 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Tue Jul 07 10:12:31 2009 -0400 @@ -111,6 +111,7 @@ RDenyStopped=Stopped applications have n RDenyStopped=Stopped applications have no permissions. RExitNoApp=Can not exit the JVM because the current application cannot be determined. RNoLockDir=Unable to create locks directory ({0}) +RNestedJarExtration=Unable to extract nested jar. RUnexpected=Unexpected {0} at {1} # Boot options, message should be shorter than this ----------------> diff -r dd483ae1e6ca -r 0a41b2f5f086 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Wed Jun 24 16:26:08 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Jul 07 10:12:31 2009 -0400 @@ -521,6 +521,10 @@ public class JNLPClassLoader extends URL // with standard classloader methods) String extractedJarLocation = localFile.getParent() + "/" + je.getName(); + File parentDir = new File(extractedJarLocation).getParentFile(); + if (!parentDir.isDirectory() && !parentDir.mkdirs()) { + throw new RuntimeException(R("RNestedJarExtration")); + } FileOutputStream extractedJar = new FileOutputStream(extractedJarLocation); InputStream is = jarFile.getInputStream(je); From ahughes at redhat.com Tue Aug 4 09:07:38 2009 From: ahughes at redhat.com (Andrew John Hughes) Date: Tue, 04 Aug 2009 16:07:38 +0000 Subject: changeset in /hg/icedtea: Correct typo. Message-ID: changeset b92099ea3dbc in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=b92099ea3dbc description: Correct typo. diffstat: 1 file changed, 1 insertion(+), 1 deletion(-) ChangeLog | 2 +- diffs (11 lines): diff -r 9af9639e360e -r b92099ea3dbc ChangeLog --- a/ChangeLog Thu Jul 09 15:28:30 2009 -0400 +++ b/ChangeLog Tue Aug 04 14:27:16 2009 +0100 @@ -1,6 +1,6 @@ 2009-07-09 Deepak Bhole - * IcedTeaPlugin.cc: Add suppport for cookie info requests from applets. + * IcedTeaPlugin.cc: Add support for cookie info requests from applets. * plugin/icedtea/sun/applet/PluginAppletViewer.java: Rework cookie support to make it dynamic. * plugin/icedtea/sun/applet/PluginMain.java: Wire in custom cookie store From ahughes at redhat.com Tue Aug 4 09:07:39 2009 From: ahughes at redhat.com (Andrew John Hughes) Date: Tue, 04 Aug 2009 16:07:39 +0000 Subject: changeset in /hg/icedtea: Deepak's Makefile.am updates. Message-ID: changeset 96a276fcaa9e in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=96a276fcaa9e description: Deepak's Makefile.am updates. 2009-07-10 Deepak Bhole * Makefile.am: Update makefile to pick up plugin C++ files from new location. diffstat: 1 file changed, 21 insertions(+), 4 deletions(-) Makefile.am | 25 +++++++++++++++++++++---- diffs (50 lines): diff -r 5da2e8e775d5 -r 96a276fcaa9e Makefile.am --- a/Makefile.am Fri Jul 10 19:02:10 2009 -0400 +++ b/Makefile.am Tue Aug 04 14:35:37 2009 +0100 @@ -3219,6 +3219,17 @@ if ENABLE_NPPLUGIN # is listed before -l options. See: # http://developer.mozilla.org/en/docs/XPCOM_Glue IcedTeaNPPlugin.o: IcedTeaNPPlugin.cc + +NPPLUGIN_SRC=IcedTeaNPPlugin.cc IcedTeaScriptablePluginObject.cc \ + IcedTeaJavaRequestProcessor.cc IcedTeaPluginRequestProcessor.cc \ + IcedTeaPluginUtils.cc + +NPPLUGIN_OBJECTS=IcedTeaNPPlugin.o IcedTeaScriptablePluginObject.o \ + IcedTeaJavaRequestProcessor.o IcedTeaPluginRequestProcessor.o \ + IcedTeaPluginUtils.o + +IcedTeaNPPlugin_objects: + (cd plugin/icedteanp if [ -e $(abs_top_srcdir)/.hg ] && which $(HG) >/dev/null; then \ revision="-r`(cd $(abs_top_srcdir); $(HG) tip --template '{rev}')`" ; \ fi ; \ @@ -3231,18 +3242,24 @@ IcedTeaNPPlugin.o: IcedTeaNPPlugin.cc $(GLIB_CFLAGS) \ $(GTK_CFLAGS) \ $(MOZILLA_CFLAGS) \ - -fPIC -c -o $@ $< -IcedTeaNPPlugin.so: IcedTeaNPPlugin.o + -fPIC -c $(NPPLUGIN_SRC) + ) + +IcedTeaNPPlugin.so: IcedTeaNPPlugin_objects + (cd plugin/icedteanp $(CXX) $(CXXFLAGS) \ - $< \ + $(NPPLUGIN_OBJECTS) \ $(GLIB_LIBS) \ $(GTK_LIBS) \ $(MOZILLA_LIBS)\ -shared -o $@ + ) clean-IcedTeaNPPlugin: - rm -f IcedTeaNPPlugin.o + (cd plugin/icedteanp + rm -f $(NPPLUGIN_OBJECTS) rm -f IcedTeaNPPlugin.so + ) endif if ENABLE_PLUGIN # IcedTeaPlugin.so. From dbhole at redhat.com Tue Aug 4 09:07:40 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:40 +0000 Subject: changeset in /hg/icedtea: Clean up directory structure of .java ... Message-ID: changeset b9dc9e08ed23 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=b9dc9e08ed23 description: Clean up directory structure of .java files before any significant amount of history gets written. This change does not alter any of the java code, just moves it around to a cleaner location. The only code change is in Makefile.am to adapt to the new location, and another minor change that affects only np plugin build. diffstat: 59 files changed, 7046 insertions(+), 6978 deletions(-) ChangeLog | 68 plugin/icedteanp/java/netscape/javascript/JSException.java | 140 plugin/icedteanp/java/netscape/javascript/JSObject.java | 263 + plugin/icedteanp/java/netscape/javascript/JSProxy.java | 58 plugin/icedteanp/java/netscape/javascript/JSRunnable.java | 72 plugin/icedteanp/java/netscape/javascript/JSUtil.java | 59 plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java | 71 plugin/icedteanp/java/sun/applet/GetMemberPluginCallRequest.java | 76 plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java | 75 plugin/icedteanp/java/sun/applet/JavaConsole.java | 365 + plugin/icedteanp/java/sun/applet/PasswordAuthenticationDialog.java | 241 + plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java | 1307 ++++++ plugin/icedteanp/java/sun/applet/PluginAppletViewer.java | 1988 ++++++++++ plugin/icedteanp/java/sun/applet/PluginCallRequest.java | 85 plugin/icedteanp/java/sun/applet/PluginCallRequestFactory.java | 62 plugin/icedteanp/java/sun/applet/PluginClassLoader.java | 51 plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java | 122 plugin/icedteanp/java/sun/applet/PluginCookieStore.java | 73 plugin/icedteanp/java/sun/applet/PluginDebug.java | 51 plugin/icedteanp/java/sun/applet/PluginException.java | 53 plugin/icedteanp/java/sun/applet/PluginMain.java | 319 + plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java | 119 plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java | 121 plugin/icedteanp/java/sun/applet/PluginObjectStore.java | 132 plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java | 85 plugin/icedteanp/java/sun/applet/PluginProxySelector.java | 195 plugin/icedteanp/java/sun/applet/PluginStreamHandler.java | 479 ++ plugin/icedteanp/java/sun/applet/RequestQueue.java | 77 plugin/icedteanp/java/sun/applet/TestEnv.java | 172 plugin/icedteanp/java/sun/applet/VoidPluginCallRequest.java | 67 plugin/icedteanp/netscape/javascript/JSException.java | 140 plugin/icedteanp/netscape/javascript/JSObject.java | 263 - plugin/icedteanp/netscape/javascript/JSProxy.java | 58 plugin/icedteanp/netscape/javascript/JSRunnable.java | 72 plugin/icedteanp/netscape/javascript/JSUtil.java | 59 plugin/icedteanp/sun/applet/AppletSecurityContextManager.java | 71 plugin/icedteanp/sun/applet/GetMemberPluginCallRequest.java | 76 plugin/icedteanp/sun/applet/GetWindowPluginCallRequest.java | 75 plugin/icedteanp/sun/applet/JavaConsole.java | 365 - plugin/icedteanp/sun/applet/PasswordAuthenticationDialog.java | 241 - plugin/icedteanp/sun/applet/PluginAppletSecurityContext.java | 1307 ------ plugin/icedteanp/sun/applet/PluginAppletViewer.java | 1988 ---------- plugin/icedteanp/sun/applet/PluginCallRequest.java | 85 plugin/icedteanp/sun/applet/PluginCallRequestFactory.java | 62 plugin/icedteanp/sun/applet/PluginClassLoader.java | 51 plugin/icedteanp/sun/applet/PluginCookieInfoRequest.java | 122 plugin/icedteanp/sun/applet/PluginCookieStore.java | 73 plugin/icedteanp/sun/applet/PluginDebug.java | 51 plugin/icedteanp/sun/applet/PluginException.java | 53 plugin/icedteanp/sun/applet/PluginMain.java | 319 - plugin/icedteanp/sun/applet/PluginMessageConsumer.java | 119 plugin/icedteanp/sun/applet/PluginMessageHandlerWorker.java | 121 plugin/icedteanp/sun/applet/PluginObjectStore.java | 132 plugin/icedteanp/sun/applet/PluginProxyInfoRequest.java | 85 plugin/icedteanp/sun/applet/PluginProxySelector.java | 195 plugin/icedteanp/sun/applet/PluginStreamHandler.java | 479 -- plugin/icedteanp/sun/applet/RequestQueue.java | 77 plugin/icedteanp/sun/applet/TestEnv.java | 172 plugin/icedteanp/sun/applet/VoidPluginCallRequest.java | 67 diffs (truncated from 14263 to 500 lines): diff -r bebe7bbde097 -r b9dc9e08ed23 ChangeLog --- a/ChangeLog Mon Jul 13 15:22:34 2009 -0400 +++ b/ChangeLog Tue Jul 14 13:04:20 2009 -0400 @@ -1,3 +1,71 @@ 2009-07-13 Omair Majid + + * Makefile.am: Fix npplugin build. + * plugin/icedteanp/java/netscape/javascript/JSException.java: Moved from + the plugin/icedteanp/netscape/javascript/ hierarchy. + * plugin/icedteanp/java/netscape/javascript/JSObject.java: Same. + * plugin/icedteanp/java/netscape/javascript/JSProxy.java: Same. + * plugin/icedteanp/java/netscape/javascript/JSRunnable.java: Same. + * plugin/icedteanp/java/netscape/javascript/JSUtil.java: Same. + * plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java: + Moved from the plugin/icedteanp/sun/applet hierarchy. + * plugin/icedteanp/java/sun/applet/GetMemberPluginCallRequest.java: Same. + * plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java: Same. + * plugin/icedteanp/java/sun/applet/JavaConsole.java: Same. + * plugin/icedteanp/java/sun/applet/PasswordAuthenticationDialog.java: + Same. + * plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java: Same. + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java: Same. + * plugin/icedteanp/java/sun/applet/PluginCallRequest.java: Same. + * plugin/icedteanp/java/sun/applet/PluginCallRequestFactory.java: Same. + * plugin/icedteanp/java/sun/applet/PluginClassLoader.java: Same. + * plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java: Same. + * plugin/icedteanp/java/sun/applet/PluginCookieStore.java: Same. + * plugin/icedteanp/java/sun/applet/PluginDebug.java: Same. + * plugin/icedteanp/java/sun/applet/PluginException.java: Same. + * plugin/icedteanp/java/sun/applet/PluginMain.java: Same. + * plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java: Same. + * plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java: Same. + * plugin/icedteanp/java/sun/applet/PluginObjectStore.java: Same. + * plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java: Same. + * plugin/icedteanp/java/sun/applet/PluginProxySelector.java: Same. + * plugin/icedteanp/java/sun/applet/PluginStreamHandler.java: Same. + * plugin/icedteanp/java/sun/applet/RequestQueue.java: Same. + * plugin/icedteanp/java/sun/applet/TestEnv.java: Same. + * plugin/icedteanp/java/sun/applet/VoidPluginCallRequest.java: Same. + * plugin/icedteanp/netscape/javascript/JSException.java: Moved to + the plugin/icedteanp/java/netscape/javascript/ heirarchy. + * plugin/icedteanp/netscape/javascript/JSObject.java: Same. + * plugin/icedteanp/netscape/javascript/JSProxy.java: Same. + * plugin/icedteanp/netscape/javascript/JSRunnable.java: Same. + * plugin/icedteanp/netscape/javascript/JSUtil.java: Same. + * plugin/icedteanp/sun/applet/AppletSecurityContextManager.java: Moved to + the plugin/icedteanp/java/sun/applet/ heirarchy. + * plugin/icedteanp/sun/applet/GetMemberPluginCallRequest.java: Same. + * plugin/icedteanp/sun/applet/GetWindowPluginCallRequest.java: Same. + * plugin/icedteanp/sun/applet/JavaConsole.java: Same. + * plugin/icedteanp/sun/applet/PasswordAuthenticationDialog.java: Same. + * plugin/icedteanp/sun/applet/PluginAppletSecurityContext.java: Same. + * plugin/icedteanp/sun/applet/PluginAppletViewer.java: Same. + * plugin/icedteanp/sun/applet/PluginCallRequest.java: Same. + * plugin/icedteanp/sun/applet/PluginCallRequestFactory.java: Same. + * plugin/icedteanp/sun/applet/PluginClassLoader.java: Same. + * plugin/icedteanp/sun/applet/PluginCookieInfoRequest.java: Same. + * plugin/icedteanp/sun/applet/PluginCookieStore.java: Same. + * plugin/icedteanp/sun/applet/PluginDebug.java: Same. + * plugin/icedteanp/sun/applet/PluginException.java: Same. + * plugin/icedteanp/sun/applet/PluginMain.java: Same. + * plugin/icedteanp/sun/applet/PluginMessageConsumer.java: Same. + * plugin/icedteanp/sun/applet/PluginMessageHandlerWorker.java: Same. + * plugin/icedteanp/sun/applet/PluginObjectStore.java: Same. + * plugin/icedteanp/sun/applet/PluginProxyInfoRequest.java: Same. + * plugin/icedteanp/sun/applet/PluginProxySelector.java: Same. + * plugin/icedteanp/sun/applet/PluginStreamHandler.java: Same. + * plugin/icedteanp/sun/applet/RequestQueue.java: Same. + * plugin/icedteanp/sun/applet/TestEnv.java: Same. + * plugin/icedteanp/sun/applet/VoidPluginCallRequest.java: Same. + + 2009-07-13 Omair Majid * netx/net/sourceforge/jnlp/JNLPFile.java diff -r bebe7bbde097 -r b9dc9e08ed23 plugin/icedteanp/java/netscape/javascript/JSException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/icedteanp/java/netscape/javascript/JSException.java Tue Jul 14 13:04:20 2009 -0400 @@ -0,0 +1,140 @@ +/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +package netscape.javascript; + +/** + * JSException is an exception which is thrown when JavaScript code + * returns an error. + */ + +public +class JSException extends RuntimeException { + public static final int EXCEPTION_TYPE_EMPTY = -1; + public static final int EXCEPTION_TYPE_VOID = 0; + public static final int EXCEPTION_TYPE_OBJECT = 1; + public static final int EXCEPTION_TYPE_FUNCTION = 2; + public static final int EXCEPTION_TYPE_STRING = 3; + public static final int EXCEPTION_TYPE_NUMBER = 4; + public static final int EXCEPTION_TYPE_BOOLEAN = 5; + public static final int EXCEPTION_TYPE_ERROR = 6; + + public String filename; + public int lineno; + public String source; + public int tokenIndex; + public int wrappedExceptionType; + public Object wrappedException; + + /** + * Constructs a JSException without a detail message. + * A detail message is a String that describes this particular exception. + * + * @deprecated Not for public use in future versions. + */ + public JSException() { + super(); + filename = "unknown"; + lineno = 0; + source = ""; + tokenIndex = 0; + wrappedExceptionType = EXCEPTION_TYPE_EMPTY; + } + + /** + * Constructs a JSException with a detail message. + * A detail message is a String that describes this particular exception. + * @param s the detail message + * + * @deprecated Not for public use in future versions. + */ + public JSException(String s) { + super(s); + filename = "unknown"; + lineno = 0; + source = ""; + tokenIndex = 0; + wrappedExceptionType = EXCEPTION_TYPE_EMPTY; + } + + /** + * Constructs a JSException with a wrapped JavaScript exception object. + * This constructor needs to be public so that Java users can throw + * exceptions to JS cleanly. + */ + public JSException(int wrappedExceptionType, Object wrappedException) { + super(); + this.wrappedExceptionType = wrappedExceptionType; + this.wrappedException = wrappedException; + } + + /** + * Constructs a JSException with a detail message and all the + * other info that usually comes with a JavaScript error. + * @param s the detail message + * + * @deprecated Not for public use in future versions. + */ + public JSException(String s, String filename, int lineno, + String source, int tokenIndex) { + super(s); + this.filename = filename; + this.lineno = lineno; + this.source = source; + this.tokenIndex = tokenIndex; + wrappedExceptionType = EXCEPTION_TYPE_EMPTY; + } + + /** + * Instance method getWrappedExceptionType returns the int mapping of the + * type of the wrappedException Object. + */ + public int getWrappedExceptionType() { + return wrappedExceptionType; + } + + /** + * Instance method getWrappedException. + */ + public Object getWrappedException() { + return wrappedException; + } + +} + diff -r bebe7bbde097 -r b9dc9e08ed23 plugin/icedteanp/java/netscape/javascript/JSObject.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/icedteanp/java/netscape/javascript/JSObject.java Tue Jul 14 13:04:20 2009 -0400 @@ -0,0 +1,263 @@ +/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* more doc todo: + * threads + * gc + * + * + */ + +package netscape.javascript; + +import java.applet.Applet; + +import sun.applet.PluginAppletViewer; +import sun.applet.PluginDebug; + + + +/** + * JSObject allows Java to manipulate objects that are + * defined in JavaScript. + * Values passed from Java to JavaScript are converted as + * follows:
    + *
  • JSObject is converted to the original JavaScript object + *
  • Any other Java object is converted to a JavaScript wrapper, + * which can be used to access methods and fields of the java object. + * Converting this wrapper to a string will call the toString method + * on the original object, converting to a number will call the + * doubleValue method if possible and fail otherwise. Converting + * to a boolean will try to call the booleanValue method in the + * same way. + *
  • Java arrays are wrapped with a JavaScript object that understands + * array.length and array[index] + *
  • A Java boolean is converted to a JavaScript boolean + *
  • Java byte, char, short, int, long, float, and double are converted + * to JavaScript numbers + *
+ * Values passed from JavaScript to Java are converted as follows:
    + *
  • objects which are wrappers around java objects are unwrapped + *
  • other objects are wrapped with a JSObject + *
  • strings, numbers and booleans are converted to String, Double, + * and Boolean objects respectively + *
+ * This means that all JavaScript values show up as some kind + * of java.lang.Object in Java. In order to make much use of them, + * you will have to cast them to the appropriate subclass of Object, + * e.g. (String) window.getMember("name"); or + * (JSObject) window.getMember("document");. + */ +public final class JSObject { + /* the internal object data */ + private long internal; + + /** + * initialize + */ + private static void initClass() { + PluginDebug.debug ("JSObject.initClass"); + } + + static { + PluginDebug.debug ("JSObject INITIALIZER"); + } + + /** + * it is illegal to construct a JSObject manually + */ + // FIXME: make private! + public JSObject(int jsobj_addr) { + PluginDebug.debug ("JSObject int CONSTRUCTOR"); + internal = jsobj_addr; + } + + public JSObject(long jsobj_addr) { + PluginDebug.debug ("JSObject long CONSTRUCTOR"); + internal = jsobj_addr; + } + + /** + * Retrieves a named member of a JavaScript object. + * Equivalent to "this.name" in JavaScript. + */ + public Object getMember(String name) + { + PluginDebug.debug ("JSObject.getMember " + name); + + Object o = PluginAppletViewer.getMember(internal, name); + PluginDebug.debug ("JSObject.getMember GOT " + o); + return o; + } + + + /** + * Retrieves an indexed member of a JavaScript object. + * Equivalent to "this[index]" in JavaScript. + */ + // public Object getMember(int index) { return getSlot(index); } + public Object getSlot(int index) + { + PluginDebug.debug ("JSObject.getSlot " + index); + + return PluginAppletViewer.getSlot(internal, index); + } + + + /** + * Sets a named member of a JavaScript object. + * Equivalent to "this.name = value" in JavaScript. + */ + public void setMember(String name, Object value) + { + PluginDebug.debug ("JSObject.setMember " + name + " " + value); + + PluginAppletViewer.setMember(internal, name, value); + } + + /** + * Sets an indexed member of a JavaScript object. + * Equivalent to "this[index] = value" in JavaScript. + */ + // public void setMember(int index, Object value) { + // setSlot(index, value); + // } + public void setSlot(int index, Object value) + { + PluginDebug.debug ("JSObject.setSlot " + index + " " + value); + + PluginAppletViewer.setSlot(internal, index, value); + } + + + // TODO: toString, finalize. + + /** + * Removes a named member of a JavaScript object. + */ + public void removeMember(String name) + { + PluginDebug.debug ("JSObject.removeMember " + name); + + PluginAppletViewer.removeMember(internal, name); + } + + + /** + * Calls a JavaScript method. + * Equivalent to "this.methodName(args[0], args[1], ...)" in JavaScript. + */ + public Object call(String methodName, Object args[]) + { + if (args == null) + args = new Object[0]; + + PluginDebug.debug ("JSObject.call " + methodName); + for (int i = 0; i < args.length; i++) + PluginDebug.debug (" " + args[i]); + PluginDebug.debug(""); + return PluginAppletViewer.call(internal, methodName, args); + } + + + /** + * Evaluates a JavaScript expression. The expression is a string + * of JavaScript source code which will be evaluated in the context + * given by "this". + */ + public Object eval(String s) + { + PluginDebug.debug("JSObject.eval " + s); + return PluginAppletViewer.eval(internal, s); + } + + + /** + * Converts a JSObject to a String. + */ + public String toString() + { + PluginDebug.debug("JSObject.toString"); + return PluginAppletViewer.javascriptToString(internal); + } + + + // should use some sort of identifier rather than String + // is "property" the right word? + // native String[] listProperties(); + + + /** + * get a JSObject for the window containing the given applet + */ + public static JSObject getWindow(Applet applet) + { + PluginDebug.debug("JSObject.getWindow"); + // FIXME: handle long case as well. + long internal = 0; + internal = ((PluginAppletViewer) + applet.getAppletContext()).getWindow(); + PluginDebug.debug ("GOT IT: " + internal); + return new JSObject(internal); + } + + + /** + * Finalization decrements the reference count on the corresponding + * JavaScript object. + */ + protected void finalize() + { + PluginDebug.debug("JSObject.finalize "); + PluginAppletViewer.JavaScriptFinalize(internal); + } + + + /** + * Override java.lang.Object.equals() because identity is not preserved + * with instances of JSObject. + */ + public boolean equals(Object obj) + { + PluginDebug.debug("JSObject.equals " + obj); + + return false; + } + +} diff -r bebe7bbde097 -r b9dc9e08ed23 plugin/icedteanp/java/netscape/javascript/JSProxy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/icedteanp/java/netscape/javascript/JSProxy.java Tue Jul 14 13:04:20 2009 -0400 @@ -0,0 +1,58 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * From ahughes at redhat.com Tue Aug 4 09:07:40 2009 From: ahughes at redhat.com (Andrew John Hughes) Date: Tue, 04 Aug 2009 16:07:40 +0000 Subject: changeset in /hg/icedtea: Add Deepak's Makefile.am updates. Message-ID: changeset dbbf4ab50f12 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=dbbf4ab50f12 description: Add Deepak's Makefile.am updates. 2009-07-10 Deepak Bhole * Makefile.am: Fix npplugin build. diffstat: 1 file changed, 16 insertions(+), 15 deletions(-) Makefile.am | 31 ++++++++++++++++--------------- diffs (87 lines): diff -r b9dc9e08ed23 -r dbbf4ab50f12 Makefile.am --- a/Makefile.am Tue Jul 14 13:04:20 2009 -0400 +++ b/Makefile.am Tue Aug 04 14:44:12 2009 +0100 @@ -27,6 +27,7 @@ ICEDTEAPLUGIN_TARGET = IcedTeaNPPlugin.s ICEDTEAPLUGIN_TARGET = IcedTeaNPPlugin.so PLUGIN_PATCH = patches/icedtea-liveconnect.patch LIVECONNECT_DIR = -C lib/rt netscape +NPPLUGIN_DIR=$(abs_top_srcdir)/plugin/icedteanp JNLP_ABOUT_TARGET = extra-lib/about.jar else if ENABLE_PLUGIN @@ -100,7 +101,7 @@ if ENABLE_PLUGIN rm -f IcedTeaPlugin.o IcedTeaPlugin.so endif if ENABLE_NPPLUGIN - rm -f IcedTeaNPPlugin.o IcedTeaNPPlugin.so + rm -f $(NPPLUGIN_DIR)/*.o $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so endif if BUILD_CACAO rm -rf cacao @@ -2303,9 +2304,9 @@ stamps/patch.stamp: stamps/patch-fsg.sta mv stamps/patch.stamp.tmp stamps/patch.stamp if ENABLE_NPPLUGIN - cp -a $(abs_top_srcdir)/plugin/icedteanp/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/ + cp -a $(abs_top_srcdir)/plugin/icedteanp/java/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/ mkdir -p rt - cp -a $(abs_top_srcdir)/plugin/icedteanp/netscape rt/ + cp -a $(abs_top_srcdir)/plugin/icedteanp/java/netscape rt/ else if ENABLE_PLUGIN cp -a $(abs_top_srcdir)/plugin/icedtea/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/ @@ -2679,9 +2680,9 @@ stamps/icedtea.stamp: stamps/bootstrap-d mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/ext mkdir -p $(BUILD_OUTPUT_DIR)/j2re-image/lib/ext if ENABLE_NPPLUGIN - cp -pPRf IcedTeaNPPlugin.so \ + cp -pPRf $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so \ $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR) - cp -pPRf IcedTeaNPPlugin.so \ + cp -pPRf $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so \ $(BUILD_OUTPUT_DIR)/j2re-image/lib/$(INSTALL_ARCH_DIR) endif if ENABLE_PLUGIN @@ -3229,7 +3230,7 @@ NPPLUGIN_OBJECTS=IcedTeaNPPlugin.o IcedT IcedTeaPluginUtils.o IcedTeaNPPlugin_objects: - (cd plugin/icedteanp + cd $(NPPLUGIN_DIR); \ if [ -e $(abs_top_srcdir)/.hg ] && which $(HG) >/dev/null; then \ revision="-r`(cd $(abs_top_srcdir); $(HG) tip --template '{rev}')`" ; \ fi ; \ @@ -3242,24 +3243,24 @@ IcedTeaNPPlugin_objects: $(GLIB_CFLAGS) \ $(GTK_CFLAGS) \ $(MOZILLA_CFLAGS) \ - -fPIC -c $(NPPLUGIN_SRC) - ) + -fPIC -c $(NPPLUGIN_SRC); \ + cd ../ IcedTeaNPPlugin.so: IcedTeaNPPlugin_objects - (cd plugin/icedteanp + cd $(NPPLUGIN_DIR); \ $(CXX) $(CXXFLAGS) \ $(NPPLUGIN_OBJECTS) \ $(GLIB_LIBS) \ $(GTK_LIBS) \ $(MOZILLA_LIBS)\ - -shared -o $@ - ) + -shared -o $@ \ + cd ../ clean-IcedTeaNPPlugin: - (cd plugin/icedteanp - rm -f $(NPPLUGIN_OBJECTS) - rm -f IcedTeaNPPlugin.so - ) + cd $(NPPLUGIN_DIR); \ + rm -f *.o; \ + rm -f IcedTeaNPPlugin.so; \ + cd ../ endif if ENABLE_PLUGIN # IcedTeaPlugin.so. From omajid at redhat.com Tue Aug 4 09:07:39 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:39 +0000 Subject: changeset in /hg/icedtea: Netx: Use version based download proto... Message-ID: changeset bebe7bbde097 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=bebe7bbde097 description: Netx: Use version based download protocol for JNLP files too 2009-07-13 Omair Majid * netx/net/sourceforge/jnlp/JNLPFile.java (JNLPFile): Delegate to the Version-based constructor. (JNLPFile): New constructor. (JNLPFile): Modified to take an additional version argument used in downloading the JNLP file. (openURL): Take an additional version argument and use when downloading the URL. * netx/net/sourceforge/jnlp/Launcher.java (toFile): Use the new JNLPFile constructor. * netx/net/sourceforge/jnlp/cache/Resource.java (Resource): Rearrange argument order. (getResource): Likewise. Fix parameters to constructor. * netx/net/sourceforge/jnlp/cache/ResourceTracker.java (addResource): Fix arguments to Resource.getResource. * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java (getInstance): Take additional version argument and use it when creating a JNLPFile. (initializeExtensions): Use the extension version when requesting a JNLPClassLoader. diffstat: 6 files changed, 59 insertions(+), 19 deletions(-) ChangeLog | 22 ++++++++++ netx/net/sourceforge/jnlp/JNLPFile.java | 35 +++++++++++----- netx/net/sourceforge/jnlp/Launcher.java | 4 - netx/net/sourceforge/jnlp/cache/Resource.java | 6 +- netx/net/sourceforge/jnlp/cache/ResourceTracker.java | 2 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | 9 ++-- diffs (183 lines): diff -r 96a276fcaa9e -r bebe7bbde097 ChangeLog --- a/ChangeLog Tue Aug 04 14:35:37 2009 +0100 +++ b/ChangeLog Mon Jul 13 15:22:34 2009 -0400 @@ -1,3 +1,25 @@ 2009-07-10 Deepak Bhole + + * netx/net/sourceforge/jnlp/JNLPFile.java + (JNLPFile): Delegate to the Version-based constructor. + (JNLPFile): New constructor. + (JNLPFile): Modified to take an additional version argument used in + downloading the JNLP file. + (openURL): Take an additional version argument and use when downloading + the URL. + * netx/net/sourceforge/jnlp/Launcher.java + (toFile): Use the new JNLPFile constructor. + * netx/net/sourceforge/jnlp/cache/Resource.java + (Resource): Rearrange argument order. + (getResource): Likewise. Fix parameters to constructor. + * netx/net/sourceforge/jnlp/cache/ResourceTracker.java + (addResource): Fix arguments to Resource.getResource. + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java + (getInstance): Take additional version argument and use it when creating a + JNLPFile. + (initializeExtensions): Use the extension version when requesting a + JNLPClassLoader. + 2009-07-10 Deepak Bhole * Makefile.am: Update makefile to pick up plugin C++ files from new diff -r 96a276fcaa9e -r bebe7bbde097 netx/net/sourceforge/jnlp/JNLPFile.java --- a/netx/net/sourceforge/jnlp/JNLPFile.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Mon Jul 13 15:22:34 2009 -0400 @@ -138,21 +138,36 @@ public class JNLPFile { * @throws ParseException if the JNLP file was invalid */ public JNLPFile(URL location, boolean strict) throws IOException, ParseException { - this(location, strict, JNLPRuntime.getDefaultUpdatePolicy()); - } - - /** - * Create a JNLPFile from a URL checking for updates using the - * specified policy. + this(location, (Version) null, strict); + } + + /** + * Create a JNLPFile from a URL and a Version checking for updates using + * the default policy. * * @param location the location of the JNLP file + * @param version the version of the JNLP file + * @param strict whether to enforce the spec when + * @throws IOException if an IO exception occurred + * @throws ParseException if the JNLP file was invalid + */ + public JNLPFile(URL location, Version version, boolean strict) throws IOException, ParseException { + this(location, version, strict, JNLPRuntime.getDefaultUpdatePolicy()); + } + + /** + * Create a JNLPFile from a URL and a version, checking for updates + * using the specified policy. + * + * @param location the location of the JNLP file + * @param version the version of the JNLP file * @param strict whether to enforce the spec when * @param policy the update policy * @throws IOException if an IO exception occurred * @throws ParseException if the JNLP file was invalid */ - public JNLPFile(URL location, boolean strict, UpdatePolicy policy) throws IOException, ParseException { - Node root = Parser.getRootNode(openURL(location, policy)); + public JNLPFile(URL location, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException { + Node root = Parser.getRootNode(openURL(location, version, policy)); parse(root, strict, location); this.fileLocation = location; @@ -186,13 +201,13 @@ public class JNLPFile { * Open the jnlp file URL from the cache if there, otherwise * download to the cache. Called from constructor. */ - private static InputStream openURL(URL location, UpdatePolicy policy) throws IOException { + private static InputStream openURL(URL location, Version version, UpdatePolicy policy) throws IOException { if (location == null || policy == null) throw new IllegalArgumentException(R("NullParameter")); try { ResourceTracker tracker = new ResourceTracker(false); // no prefetch - tracker.addResource(location, null/*version*/, policy); + tracker.addResource(location, version , policy); return tracker.getInputStream(location); } diff -r 96a276fcaa9e -r bebe7bbde097 netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/Launcher.java Mon Jul 13 15:22:34 2009 -0400 @@ -337,10 +337,10 @@ public class Launcher { JNLPFile file = null; try { - file = new JNLPFile(location, true, updatePolicy); // strict + file = new JNLPFile(location, (Version) null, true, updatePolicy); // strict } catch (ParseException ex) { - file = new JNLPFile(location, false, updatePolicy); + file = new JNLPFile(location, (Version) null, false, updatePolicy); // only here if strict failed but lax did not fail LaunchException lex = diff -r 96a276fcaa9e -r bebe7bbde097 netx/net/sourceforge/jnlp/cache/Resource.java --- a/netx/net/sourceforge/jnlp/cache/Resource.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/cache/Resource.java Mon Jul 13 15:22:34 2009 -0400 @@ -95,7 +95,7 @@ public class Resource { /** * Create a resource. */ - private Resource(URL location, UpdatePolicy updatePolicy, Version requestVersion) { + private Resource(URL location, Version requestVersion, UpdatePolicy updatePolicy) { this.location = location; this.requestVersion = requestVersion; this.updatePolicy = updatePolicy; @@ -105,9 +105,9 @@ public class Resource { * Return a shared Resource object representing the given * location and version. */ - public static Resource getResource(URL location, UpdatePolicy updatePolicy, Version requestVersion) { + public static Resource getResource(URL location, Version requestVersion, UpdatePolicy updatePolicy) { synchronized (resources) { - Resource resource = new Resource(location, updatePolicy, requestVersion); + Resource resource = new Resource(location, requestVersion, updatePolicy); int index = resources.indexOf(resource); if (index >= 0) { // return existing object diff -r 96a276fcaa9e -r bebe7bbde097 netx/net/sourceforge/jnlp/cache/ResourceTracker.java --- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Mon Jul 13 15:22:34 2009 -0400 @@ -168,7 +168,7 @@ public class ResourceTracker { if (location == null) throw new IllegalArgumentException("location==null"); - Resource resource = Resource.getResource(location, updatePolicy, version); + Resource resource = Resource.getResource(location, version, updatePolicy); boolean downloaded = false; synchronized (resources) { diff -r 96a276fcaa9e -r bebe7bbde097 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Mon Jul 13 15:22:34 2009 -0400 @@ -51,6 +51,7 @@ import net.sourceforge.jnlp.PluginBridge import net.sourceforge.jnlp.PluginBridge; import net.sourceforge.jnlp.ResourcesDesc; import net.sourceforge.jnlp.SecurityDesc; +import net.sourceforge.jnlp.Version; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.ResourceTracker; import net.sourceforge.jnlp.cache.UpdatePolicy; @@ -232,13 +233,15 @@ public class JNLPClassLoader extends URL * location. * * @param location the file's location + * @param version the file's version * @param policy the update policy to use when downloading resources */ - public static JNLPClassLoader getInstance(URL location, UpdatePolicy policy) throws IOException, ParseException, LaunchException { + public static JNLPClassLoader getInstance(URL location, Version version, UpdatePolicy policy) + throws IOException, ParseException, LaunchException { JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location); if (loader == null) - loader = getInstance(new JNLPFile(location, false, policy), policy); + loader = getInstance(new JNLPFile(location, version, false, policy), policy); return loader; } @@ -256,7 +259,7 @@ public class JNLPClassLoader extends URL //if (ext != null) { for (int i=0; i < ext.length; i++) { try { - JNLPClassLoader loader = getInstance(ext[i].getLocation(), updatePolicy); + JNLPClassLoader loader = getInstance(ext[i].getLocation(), ext[i].getVersion(), updatePolicy); loaderList.add(loader); } catch (Exception ex) { From dbhole at redhat.com Tue Aug 4 09:07:41 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:41 +0000 Subject: changeset in /hg/icedtea: Fix date in ChangeLog entry from previ... Message-ID: changeset 358aefef4fb5 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=358aefef4fb5 description: Fix date in ChangeLog entry from previous commit. Bad me for copying+pasting :/ diffstat: 1 file changed, 1 insertion(+), 1 deletion(-) ChangeLog | 2 +- diffs (9 lines): diff -r dbbf4ab50f12 -r 358aefef4fb5 ChangeLog --- a/ChangeLog Tue Aug 04 14:44:12 2009 +0100 +++ b/ChangeLog Tue Jul 14 13:12:50 2009 -0400 @@ -1,4 +1,4 @@ 2009-07-10 Deepak Bhole +2009-07-14 Deepak Bhole * Makefile.am: Fix npplugin build. * plugin/icedteanp/java/netscape/javascript/JSException.java: Moved from From dbhole at redhat.com Tue Aug 4 09:07:41 2009 From: dbhole at redhat.com (Deepak Bhole) Date: Tue, 04 Aug 2009 16:07:41 +0000 Subject: changeset in /hg/icedtea: - Added support for FindClass, GetClas... Message-ID: changeset e808c63fb3a3 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=e808c63fb3a3 description: - Added support for FindClass, GetClassName, GetMethodID, GetToStringValue, NewObject and NewStringUTF. - Split the request wait code in Java processor into a generic function. - Centralized all debug output calls. - ICEDTEAPLUGIN_DEBUG flag now supported. - Dynamic cookie fetching support ported over from current plugin. - Added support for modifying JS objects via SetMember calls. - Message processing model made more robust by using dedicated processing threads, rather than dynamically initialized threads. With this commit, http://www.apl.jhu.edu/~hall/CWP-Sources/CWP-Examples/Chapter19/Everest.html now works. diffstat: 12 files changed, 1577 insertions(+), 552 deletions(-) ChangeLog | 23 plugin/icedteanp/IcedTeaJavaRequestProcessor.cc | 258 ++ plugin/icedteanp/IcedTeaJavaRequestProcessor.h | 34 plugin/icedteanp/IcedTeaNPPlugin.cc | 371 ++-- plugin/icedteanp/IcedTeaNPPlugin.h | 15 plugin/icedteanp/IcedTeaPluginRequestProcessor.cc | 866 ++++++---- plugin/icedteanp/IcedTeaPluginRequestProcessor.h | 47 plugin/icedteanp/IcedTeaPluginUtils.cc | 145 + plugin/icedteanp/IcedTeaPluginUtils.h | 15 plugin/icedteanp/IcedTeaRunnable.cc | 74 plugin/icedteanp/IcedTeaRunnable.h | 102 + plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java | 179 +- diffs (truncated from 3025 to 500 lines): diff -r 358aefef4fb5 -r e808c63fb3a3 ChangeLog --- a/ChangeLog Tue Jul 14 13:12:50 2009 -0400 +++ b/ChangeLog Thu Jul 23 11:39:18 2009 -0400 @@ -1,3 +1,26 @@ 2009-07-14 Deepak Bhole + + * plugin/icedteanp/IcedTeaJavaRequestProcessor.c: Added support for + FindClass, GetClassName, GetMethodID, GetToStringValue, NewObject and + NewStringUTF. Split the request wait code into a generic function. + * plugin/icedteanp/IcedTeaNPPlugin.cc: Centralize debug output calls. Obey + the ICEDTEAPLUGIN_DEBUG flag. Support dynamic cookie fetching. + * plugin/icedteanp/IcedTeaPluginRequestProcessor.c: Update multi-threaded + processing model. Support SetMember. Set up a dedicated message queue + processor (arbitrarily scalable). + * plugin/icedteanp/IcedTeaPluginRequestProcessor.h: Add function and + variable declerations as needed by the .cc file. + * plugin/icedteanp/IcedTeaPluginUtils.cc: Use only long and long long for + memory address translation. Add additional utility methods. + * plugin/icedteanp/IcedTeaPluginUtils.h: Update as needed by the .cc file. + * plugin/icedteanp/IcedTeaRunnable.h: New file. Represents a dispatchable + event, extends nsIRunnable. + * plugin/icedteanp/IcedTeaRunnable.h: New file. Header for + IcedTeaRunnable.cc. + * plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java: Fix + signature handling to remove the need for return type. Add support for + GetToStringValue and GetClassName. + 2009-07-14 Deepak Bhole * Makefile.am: Fix npplugin build. diff -r 358aefef4fb5 -r e808c63fb3a3 plugin/icedteanp/IcedTeaJavaRequestProcessor.cc --- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Tue Jul 14 13:12:50 2009 -0400 +++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Thu Jul 23 11:39:18 2009 -0400 @@ -67,7 +67,8 @@ JavaRequestProcessor::newMessageOnBus(co // Gather the results // GetStringUTFChars - if (message_parts->at(4) == "GetStringUTFChars") + if (message_parts->at(4) == "GetStringUTFChars" || + message_parts->at(4) == "GetToStringValue") { // first item is length, and it is radix 10 int length = strtol(message_parts->at(5).c_str(), NULL, 10); @@ -81,6 +82,31 @@ JavaRequestProcessor::newMessageOnBus(co int length = strtol(message_parts->at(5).c_str(), NULL, 10); IcedTeaPluginUtilities::getUTF16LEString(length, 6 /* start at */, message_parts, result->return_wstring); + result_ready = true; + } else if (message_parts->at(4) == "FindClass") + { + result->return_identifier = atoi(message_parts->at(5).c_str()); + result->return_string->append(message_parts->at(5)); // store it as a string as well, for easy access + result_ready = true; + } else if (message_parts->at(4) == "GetClassName") + { + result->return_identifier = atoi(message_parts->at(5).c_str()); + result->return_string->append(message_parts->at(5)); // store it as a string as well, for easy access + result_ready = true; + } else if (message_parts->at(4) == "GetMethodID") + { + result->return_identifier = atoi(message_parts->at(5).c_str()); + result->return_string->append(message_parts->at(5)); // store it as a string as well, for easy access + result_ready = true; + } else if (message_parts->at(4) == "NewObject") + { + result->return_identifier = atoi(message_parts->at(5).c_str()); + result->return_string->append(message_parts->at(5)); // store it as a string as well, for easy access + result_ready = true; + } else if (message_parts->at(4) == "NewStringUTF") + { + result->return_identifier = atoi(message_parts->at(5).c_str()); + result->return_string->append(message_parts->at(5)); // store it as a string as well, for easy access result_ready = true; } @@ -119,6 +145,8 @@ JavaRequestProcessor::JavaRequestProcess JavaRequestProcessor::~JavaRequestProcessor() { + PLUGIN_DEBUG_0ARG("JavaRequestProcessor::~JavaRequestProcessor\n"); + if (result) { if (result->error_msg) @@ -134,32 +162,12 @@ JavaRequestProcessor::~JavaRequestProces } } -/** - * Given a string id, fetches the actual string from Java side - * - * @param request_data The JavaRequest struct containing request relevant information - * @return A JavaResultData struct containing the result of the request - */ - -JavaResultData* -JavaRequestProcessor::getString(JavaRequest* request_data) -{ - std::string string_id; - std::string* message; - - this->instance = 0; // context is always 0 (needed for java-side backwards compat.) - this->reference = IcedTeaPluginUtilities::getReference(); - - string_id = request_data->data->at(0); - - message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); - - message->append(" GetStringUTFChars "); // get it in UTF8 - message->append(string_id); - +void +JavaRequestProcessor::postAndWaitForResponse(std::string* message) +{ struct timespec t; clock_gettime(CLOCK_REALTIME, &t); - t.tv_sec += 60; // 1 minute timeout + t.tv_sec += REQUESTTIMEOUT; // 1 minute timeout result_ready = false; java_to_plugin_bus->subscribe(this); @@ -174,7 +182,7 @@ JavaRequestProcessor::getString(JavaRequ bool timedout = false; if (!result_ready && (curr_t.tv_sec < t.tv_sec)) - sleep(1); + usleep(2000); else break; @@ -187,9 +195,195 @@ JavaRequestProcessor::getString(JavaRequ } java_to_plugin_bus->unSubscribe(this); - IcedTeaPluginUtilities::releaseReference(); - - delete message; - - return result; -} +} + +/** + * Given an object id, fetches the toString() value from Java + * + * @param object_id The ID of the object + * @return A JavaResultData struct containing the result of the request + */ + +JavaResultData* +JavaRequestProcessor::getToStringValue(std::string object_id) +{ + std::string* message; + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + + message->append(" GetToStringValue "); // get it in UTF8 + message->append(object_id); + + postAndWaitForResponse(message); + + IcedTeaPluginUtilities::releaseReference(); + delete message; + + return result; +} + +/** + * Given a string id, fetches the actual string from Java side + * + * @param string_id The ID of the string + * @return A JavaResultData struct containing the result of the request + */ + +JavaResultData* +JavaRequestProcessor::getString(std::string string_id) +{ + std::string* message; + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + + message->append(" GetStringUTFChars "); // get it in UTF8 + message->append(string_id); + + postAndWaitForResponse(message); + + IcedTeaPluginUtilities::releaseReference(); + delete message; + + return result; +} + +JavaResultData* +JavaRequestProcessor::findClass(std::string name) +{ + std::string* message; + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + + message->append(" FindClass "); + message->append(name); + + postAndWaitForResponse(message); + + delete message; + + return result; +} + +JavaResultData* +JavaRequestProcessor::getClassName(std::string ID) +{ + std::string* message; + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + + message->append(" GetClassName "); + message->append(ID); + + postAndWaitForResponse(message); + + delete message; + + return result; +} + +JavaResultData* +JavaRequestProcessor::getMethodID(std::string objectID, NPIdentifier methodName, + std::vector args) +{ + JavaRequestProcessor* java_request; + std::string* message; + std::string* signature; + + signature = new std::string(); + *signature += "("; + + // FIXME: Need to determine how to extract array types and complex java objects + for (int i=0; i < args.size(); i++) + { + *signature += args[i]; + } + + *signature += ")"; + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + *message += " GetMethodID "; + *message += objectID; + *message += " "; + *message += browser_functions.utf8fromidentifier(methodName); + *message += " "; + *message += *signature; + + postAndWaitForResponse(message); + + IcedTeaPluginUtilities::releaseReference(); + delete signature; + delete message; + + return result; +} + +JavaResultData* +JavaRequestProcessor::newObject(std::string objectID, std::string methodID, + std::vector args) +{ + JavaRequestProcessor* java_request; + std::string* message; + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + *message += " NewObject "; + *message += objectID; + *message += " "; + *message += methodID; + *message += " "; + + for (int i=0; i < args.size(); i++) + { + *message += args[i]; + *message += " "; + } + + postAndWaitForResponse(message); + + IcedTeaPluginUtilities::releaseReference(); + delete message; + + return result; +} + +JavaResultData* +JavaRequestProcessor::newString(std::string str) +{ + JavaRequestProcessor* java_request; + std::string* utf_string = new std::string(); + std::string* message; + + IcedTeaPluginUtilities::convertStringToUTF8(&str, utf_string); + + this->instance = 0; // context is always 0 (needed for java-side backwards compat.) + this->reference = IcedTeaPluginUtilities::getReference(); + + message = IcedTeaPluginUtilities::constructMessagePrefix(0, reference); + message->append(" NewStringUTF "); + message->append(*utf_string); + + postAndWaitForResponse(message); + + IcedTeaPluginUtilities::releaseReference(); + delete utf_string; + delete message; + + return result; +} diff -r 358aefef4fb5 -r e808c63fb3a3 plugin/icedteanp/IcedTeaJavaRequestProcessor.h --- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.h Tue Jul 14 13:12:50 2009 -0400 +++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.h Thu Jul 23 11:39:18 2009 -0400 @@ -45,6 +45,8 @@ exception statement from your version. * #include "IcedTeaNPPlugin.h" #include "IcedTeaPluginUtils.h" + +#define REQUESTTIMEOUT 60 /* * This struct holds data specific to a Java operation requested by the plugin @@ -97,11 +99,41 @@ class JavaRequestProcessor : BusSubscrib bool result_ready; JavaResultData* result; + /* Post message on bus and wait */ + void postAndWaitForResponse(std::string* message); + public: JavaRequestProcessor(); ~JavaRequestProcessor(); virtual bool newMessageOnBus(const char* message); - JavaResultData* getString(JavaRequest* request_data); + + /* Returns the toString() value, given an object identifier */ + JavaResultData* getToStringValue(std::string object_id); + + /* Returns the string, given the identifier */ + JavaResultData* getString(std::string string_id); + + /* Returns the method ID from Java side */ + JavaResultData* getMethodID1(NPObject* obj, NPIdentifier methodName, + std::vector args); + + /* Returns the method id */ + JavaResultData* getMethodID(std::string objectID, NPIdentifier methodName, + std::vector args); + + /* Creates a new object */ + JavaResultData* newObject(std::string objectID, std::string methodID, + std::vector args); + + /* Returns the class ID */ + JavaResultData* findClass(std::string name); + + /* Returns the type class name */ + JavaResultData* getClassName(std::string ID); + + /* Creates a new string in the Java store */ + JavaResultData* newString(std::string str); + }; #endif /* ICEDTEAJAVAREQUESTPROCESSOR_H_ */ diff -r 358aefef4fb5 -r e808c63fb3a3 plugin/icedteanp/IcedTeaNPPlugin.cc --- a/plugin/icedteanp/IcedTeaNPPlugin.cc Tue Jul 14 13:12:50 2009 -0400 +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc Thu Jul 23 11:39:18 2009 -0400 @@ -70,14 +70,6 @@ exception statement from your version. * // Liveconnect extension #include "IcedTeaScriptablePluginObject.h" #include "IcedTeaNPPlugin.h" - -// Debugging macros. -#define PLUGIN_DEBUG(message) \ - g_print ("GCJ PLUGIN: thread %p: %s\n", g_thread_self (), message) - -#define PLUGIN_DEBUG_TWO(first, second) \ - g_print ("GCJ PLUGIN: thread %p: %s %s\n", g_thread_self (), \ - first, second) // Error reporting macros. #define PLUGIN_ERROR(message) \ @@ -180,7 +172,7 @@ NPNetscapeFuncs browser_functions; // Various message buses carrying information to/from Java, and internally MessageBus* plugin_to_java_bus = new MessageBus(); MessageBus* java_to_plugin_bus = new MessageBus(); -MessageBus* internal_bus = new MessageBus(); +//MessageBus* internal_bus = new MessageBus(); // Processor for plugin requests PluginRequestProcessor* plugin_req_proc = new PluginRequestProcessor(); @@ -265,6 +257,8 @@ static GPid appletviewer_pid = -1; static GPid appletviewer_pid = -1; static guint appletviewer_watch_id = -1; +int plugin_debug = getenv ("ICEDTEAPLUGIN_DEBUG") != NULL; + // Functions prefixed by GCJ_ are instance functions. They are called // by the browser and operate on instances of GCJPluginData. // Functions prefixed by plugin_ are static helper functions. @@ -289,7 +283,22 @@ GCJ_New (NPMIMEType pluginType, NPP inst int16 argc, char* argn[], char* argv[], NPSavedData* saved) { - PLUGIN_DEBUG ("GCJ_New"); + PLUGIN_DEBUG_0ARG("GCJ_New\n"); + + static NPObject *window_ptr; + NPIdentifier identifier; + NPVariant member_ptr; + browser_functions.getvalue(instance, NPNVWindowNPObject, &window_ptr); + identifier = browser_functions.getstringidentifier("document"); + printf("Looking for %p %p %p (%s)\n", instance, window_ptr, identifier, "document"); + if (!browser_functions.hasproperty(instance, window_ptr, identifier)) + { + printf("%s not found!\n", "document"); + } + browser_functions.getproperty(instance, window_ptr, identifier, &member_ptr); + + PLUGIN_DEBUG_1ARG("Got variant %p\n", &member_ptr); + NPError np_error = NPERR_NO_ERROR; GCJPluginData* data = NULL; @@ -389,9 +398,6 @@ GCJ_New (NPMIMEType pluginType, NPP inst data->scriptable_plugin_object = npPluginObj; instance->pdata = data; - - java_to_plugin_bus->subscribe(plugin_req_proc); - plugin_to_java_bus->subscribe(java_req_proc); goto cleanup_done; @@ -428,7 +434,7 @@ GCJ_New (NPMIMEType pluginType, NPP inst g_hash_table_insert(id_to_instance_map, GINT_TO_POINTER(instance_counter), instance); instance_counter++; - PLUGIN_DEBUG ("GCJ_New return"); + PLUGIN_DEBUG_0ARG ("GCJ_New return\n"); return np_error; } @@ -475,14 +481,14 @@ void start_jvm_if_needed() // clean up any older pip unlink (in_pipe_name); - PLUGIN_DEBUG_TWO ("GCJ_New: creating input fifo:", in_pipe_name); + PLUGIN_DEBUG_1ARG ("GCJ_New: creating input fifo: %s", in_pipe_name); if (mkfifo (in_pipe_name, 0700) == -1 && errno != EEXIST) { PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno)); np_error = NPERR_GENERIC_ERROR; goto cleanup_in_pipe_name; } - PLUGIN_DEBUG_TWO ("GCJ_New: created input fifo:", in_pipe_name); + PLUGIN_DEBUG_1ARG ("GCJ_New: created input fifo: %s\n", in_pipe_name); // Create plugin-to-appletviewer pipe which we refer to as the // output pipe. @@ -501,14 +507,14 @@ void start_jvm_if_needed() // clean up any older pip unlink (out_pipe_name); - PLUGIN_DEBUG_TWO ("GCJ_New: creating output fifo:", out_pipe_name); + PLUGIN_DEBUG_1ARG ("GCJ_New: creating output fifo: %s\n", out_pipe_name); if (mkfifo (out_pipe_name, 0700) == -1 && errno != EEXIST) { PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno)); np_error = NPERR_GENERIC_ERROR; goto cleanup_out_pipe_name; } - PLUGIN_DEBUG_TWO ("GCJ_New: created output fifo:", out_pipe_name); + PLUGIN_DEBUG_1ARG ("GCJ_New: created output fifo: %s\n", out_pipe_name); // Start a separate appletviewer process for each applet, even if // there are multiple applets in the same page. We may need to From omajid at redhat.com Tue Aug 4 09:07:41 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:41 +0000 Subject: changeset in /hg/icedtea: Netx: prompt the user fewer times for ... Message-ID: changeset 324662e5e611 in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=324662e5e611 description: Netx: prompt the user fewer times for https certificate issues diffstat: 2 files changed, 6 insertions(+), 1 deletion(-) ChangeLog | 5 +++++ netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java | 2 +- diffs (24 lines): diff -r e808c63fb3a3 -r 324662e5e611 ChangeLog --- a/ChangeLog Thu Jul 23 11:39:18 2009 -0400 +++ b/ChangeLog Wed Jul 29 10:48:43 2009 -0400 @@ -1,3 +1,8 @@ 2009-07-23 Deepak Bhole + + * netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java + (checkServerTrusted): Synchronize the function. + 2009-07-23 Deepak Bhole * plugin/icedteanp/IcedTeaJavaRequestProcessor.c: Added support for diff -r e808c63fb3a3 -r 324662e5e611 netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java --- a/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java Thu Jul 23 11:39:18 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java Wed Jul 29 10:48:43 2009 -0400 @@ -143,7 +143,7 @@ public class VariableX509TrustManager im * @param authType The auth type algorithm * @param checkOnly Whether to "check only" i.e. no user prompt, or to prompt for permission */ - public void checkServerTrusted(X509Certificate[] chain, String authType, boolean checkOnly) throws CertificateException { + public synchronized void checkServerTrusted(X509Certificate[] chain, String authType, boolean checkOnly) throws CertificateException { try { checkAllManagers(chain, authType); } catch (CertificateException ce) { From omajid at redhat.com Tue Aug 4 09:07:42 2009 From: omajid at redhat.com (Omair Majid) Date: Tue, 04 Aug 2009 16:07:42 +0000 Subject: changeset in /hg/icedtea: Netx: add support for desktop shortcuts Message-ID: changeset 03e2ef9b5c6b in /hg/icedtea details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=03e2ef9b5c6b description: Netx: add support for desktop shortcuts 2009-07-29 Omair Majid * netx/net/sourceforge/jnlp/IconDesc.java: Add new icon kind SHORTCUT. * netx/net/sourceforge/jnlp/Launcher.java: Move StreamEater class to ... * netx/net/sourceforge/jnlp/StreamEater.java: New file. * netx/net/sourceforge/jnlp/resources/Messages.properties: Add SDesktopShortcut. * netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java (initialize): Call addMenuAndDesktopEntries. (addMenuAndDesktopEntries): New function. * netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java: Add CREATE_DESKTOP_SHORTCUT to AccessType. * netx/net/sourceforge/jnlp/security/AccessWarningPane.java (installComponents): Add a case for CREATE_DESKTOP_SHORTCUT * netx/net/sourceforge/jnlp/services/ServiceUtil.java Remove duplicate enum AccessType. (checkAccess): New function. (checkAccess): Add a new argument app. * netx/net/sourceforge/jnlp/services/SingleInstanceLock.java (getLockFileName): Call FileUtils.sanitizeFileName to sanitize the filename. * netx/net/sourceforge/jnlp/util/FileUtils.java: New file. * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: New file. diffstat: 12 files changed, 386 insertions(+), 45 deletions(-) ChangeLog | 24 + netx/net/sourceforge/jnlp/IconDesc.java | 3 netx/net/sourceforge/jnlp/Launcher.java | 26 - netx/net/sourceforge/jnlp/StreamEater.java | 45 ++ netx/net/sourceforge/jnlp/resources/Messages.properties | 1 netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java | 28 + netx/net/sourceforge/jnlp/security/AccessWarningPane.java | 3 netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java | 1 netx/net/sourceforge/jnlp/services/ServiceUtil.java | 29 + netx/net/sourceforge/jnlp/services/SingleInstanceLock.java | 13 netx/net/sourceforge/jnlp/util/FileUtils.java | 48 ++ netx/net/sourceforge/jnlp/util/XDesktopEntry.java | 210 ++++++++++ diffs (truncated from 553 to 500 lines): diff -r 324662e5e611 -r 03e2ef9b5c6b ChangeLog --- a/ChangeLog Wed Jul 29 10:48:43 2009 -0400 +++ b/ChangeLog Wed Jul 29 10:57:38 2009 -0400 @@ -1,3 +1,27 @@ 2009-07-29 Omair Majid + + * netx/net/sourceforge/jnlp/IconDesc.java: Add new icon kind SHORTCUT. + * netx/net/sourceforge/jnlp/Launcher.java: Move StreamEater class to ... + * netx/net/sourceforge/jnlp/StreamEater.java: New file. + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add + SDesktopShortcut. + * netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java + (initialize): Call addMenuAndDesktopEntries. + (addMenuAndDesktopEntries): New function. + * netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java: Add + CREATE_DESKTOP_SHORTCUT to AccessType. + * netx/net/sourceforge/jnlp/security/AccessWarningPane.java + (installComponents): Add a case for CREATE_DESKTOP_SHORTCUT + * netx/net/sourceforge/jnlp/services/ServiceUtil.java + Remove duplicate enum AccessType. + (checkAccess): New function. + (checkAccess): Add a new argument app. + * netx/net/sourceforge/jnlp/services/SingleInstanceLock.java + (getLockFileName): Call FileUtils.sanitizeFileName to sanitize the + filename. + * netx/net/sourceforge/jnlp/util/FileUtils.java: New file. + * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: New file. + 2009-07-29 Omair Majid * netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/IconDesc.java --- a/netx/net/sourceforge/jnlp/IconDesc.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/IconDesc.java Wed Jul 29 10:57:38 2009 -0400 @@ -43,6 +43,9 @@ public class IconDesc { /** splash icon */ public static final Object SPLASH = "splash"; + + /** destop shortcut icon */ + public static final Object SHORTCUT = "shortcut"; /** the location of the icon */ diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/Launcher.java Wed Jul 29 10:57:38 2009 -0400 @@ -770,32 +770,6 @@ public class Launcher { } }; - /** - * This class reads the output from a launched process and - * writes it to stdout. - */ - private static class StreamEater extends Thread { - private InputStream stream; - - StreamEater(InputStream stream) { - this.stream = new BufferedInputStream(stream); - } - - public void run() { - try { - while (true) { - int c = stream.read(); - if (c == -1) - break; - - System.out.write(c); - } - } - catch (IOException ex) { - } - } - }; - } diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/StreamEater.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/StreamEater.java Wed Jul 29 10:57:38 2009 -0400 @@ -0,0 +1,45 @@ +// Copyright (C) 2001-2003 Jon A. Maxwell (JAM) +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * This class reads the output from a launched process and writes it to stdout. + */ +public class StreamEater extends Thread { + private InputStream stream; + + public StreamEater(InputStream stream) { + this.stream = new BufferedInputStream(stream); + } + + public void run() { + try { + while (true) { + int c = stream.read(); + if (c == -1) + break; + + System.out.write(c); + } + } catch (IOException ex) { + } + } +} diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/resources/Messages.properties --- a/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Wed Jul 29 10:57:38 2009 -0400 @@ -147,6 +147,7 @@ CChooseCacheDir=Cache directory # Security SFileReadAccess=The application has requested read access to a file on the machine. Do you want to allow this action? SFileWriteAccess=The application has requested write access to a file on the machine. Do you want to allow this action? +SDesktopShortcut=The application has requested permission to create a desktop launcher. Do you want to allow this action? SSigUnverified=The application's digital signature cannot be verified. Do you want to run the application? SSigVerified=The application's digital signature has been verified. Do you want to run the application? SSignatureError=The application's digital signature has an error. Do you want to run the application? diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java --- a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Wed Jul 29 10:57:38 2009 -0400 @@ -25,6 +25,8 @@ import javax.swing.event.EventListenerLi import net.sourceforge.jnlp.*; import net.sourceforge.jnlp.event.*; +import net.sourceforge.jnlp.security.SecurityWarningDialog.AccessType; +import net.sourceforge.jnlp.services.ServiceUtil; import net.sourceforge.jnlp.util.*; /** @@ -107,6 +109,32 @@ public class ApplicationInstance { */ public void initialize() { installEnvironment(); + addMenuAndDesktopEntries(); + } + + /** + * Creates menu and desktop entries if required by the jnlp file + */ + + private void addMenuAndDesktopEntries() { + XDesktopEntry entry = new XDesktopEntry(file); + + if (file.getInformation().getShortcut().onDesktop()) { + if (ServiceUtil.checkAccess(this, AccessType.CREATE_DESTKOP_SHORTCUT)) { + entry.createDesktopShortcut(); + } + } + + if (file.getInformation().getShortcut().getMenu() != null) { + /* + * Sun's WebStart implementation doesnt seem to do anything under GNOME + */ + if (JNLPRuntime.isDebug()) { + System.err.println("ApplicationInstance.addMenuAndDesktopEntries():" + + " Adding menu entries NOT IMPLEMENTED"); + } + } + } /** diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/security/AccessWarningPane.java --- a/netx/net/sourceforge/jnlp/security/AccessWarningPane.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java Wed Jul 29 10:57:38 2009 -0400 @@ -121,6 +121,9 @@ public class AccessWarningPane extends S case WRITE_FILE: topLabelText = R("SFileWriteAccess"); break; + case CREATE_DESTKOP_SHORTCUT: + topLabelText = R("SDesktopShortcut"); + break; case CLIPBOARD_READ: topLabelText = R("SClipboardReadAccess"); break; diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java --- a/netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java Wed Jul 29 10:57:38 2009 -0400 @@ -70,6 +70,7 @@ public class SecurityWarningDialog exten public static enum AccessType { READ_FILE, WRITE_FILE, + CREATE_DESTKOP_SHORTCUT, CLIPBOARD_READ, CLIPBOARD_WRITE, PRINTER, diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/services/ServiceUtil.java --- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java Wed Jul 29 10:57:38 2009 -0400 @@ -57,13 +57,6 @@ public class ServiceUtil { } /** - * Types of system access that may need permissions. - */ - public static enum AccessType { - READ_FILE, WRITE_FILE, CLIPBOARD_READ, CLIPBOARD_WRITE, PRINTER - } - - /** * Returns the BasicService reference, or null if the service is * unavailable. */ @@ -227,9 +220,29 @@ public class ServiceUtil { * @return true if the access was granted, false otherwise. */ public static boolean checkAccess(SecurityWarningDialog.AccessType type, + Object... extras) { + return checkAccess(null, type, extras); + } + + /** + * Returns whether the app requesting a service is signed. If the app is + * unsigned, the user is prompted with a dialog asking if the action + * should be allowed. + * @param app the application which is requesting the check. If null, the current + * application is used. + * @param type the type of access being requested + * @param extras extra Strings (usually) that are passed to the dialog for + * message formatting. + * @return true if the access was granted, false otherwise. + */ + public static boolean checkAccess(ApplicationInstance app, + SecurityWarningDialog.AccessType type, Object... extras) { - ApplicationInstance app = JNLPRuntime.getApplication(); + if (app == null) { + app = JNLPRuntime.getApplication(); + } + if (app != null) { if (!app.isSigned()) { final SecurityWarningDialog.AccessType tmpType = type; diff -r 324662e5e611 -r 03e2ef9b5c6b netx/net/sourceforge/jnlp/services/SingleInstanceLock.java --- a/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Wed Jul 29 10:48:43 2009 -0400 +++ b/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Wed Jul 29 10:57:38 2009 -0400 @@ -27,6 +27,7 @@ import java.net.ServerSocket; import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.util.FileUtils; /** * This class represents a Lock for single instance jnlp applications @@ -152,17 +153,7 @@ class SingleInstanceLock { } initialName = initialName + getCurrentDisplay(); - String encodedName; - - /* - * FIXME - * -