Java 2 SDK for Solaris Developer's Guide

New Features and Enhancements

This chapter describes the new Java 2 SDK for Solaris features and enhancements. If you are developing your application with this release, the advanced feature set of the Java 2 platform provides:

Additionally, Java 2 SDK for Solaris has significantly improved scalability and performance as the result of an enhanced Java Virtual Machine (VM) with:

To help deploy your application with the Java 2 SDK for Solaris production release for the Solaris 8 operating environment, this release provides:

High-Performance Memory System

Java 2 SDK for Solaris includes a highly optimized memory system, which makes memory allocation and garbage collection more efficient. This memory system uses direct pointers and is:

These features increase program performance and reduce disruptive garbage collection pauses in interactive programs.

The following enhancements, part of the high-performance memory system, improve system performance.

Exact Garbage Collection

The Java 2 SDK for Solaris features exact garbage collection. Exact garbage collection increases performance by enabling a wider range of garbage collection techniques than conservative systems allow.

The Java 2 SDK for Solaris uses an efficient generational garbage collector. This efficiency produces significantly better performance for many applications. Generational garbage collection examines a subset of objects allocated for reclamation. The garbage collector selects a subset based on the age of the objects where younger generations of objects are examined more often than older ones. This subsetting works because in Java programs, recently created objects are more likely candidates for collection than older objects. This technique provides the added benefit of shorter pauses for garbage collection, because young-generation collections are usually much shorter than full collections.

To achieve this added performance, the entire system must support exact collection, including user-written native code. Fortunately, the Java Native Interface (JNI) allows an implementation that is compatible with exact collection. Because Java 2 SDK for Solaris provides such an implementation, native code written using the JNI works seamlessly with the Java 2 SDK for Solaris VM.

Direct Pointers

Java 2 SDK for Solaris exact garbage collection uses direct pointers for objects, rather than handles. Using direct pointers decrease memory consumption, speed allocation, and increase system performance by eliminating one level of indirection in accessing objects.

Double-Word Alignment (longs and doubles) to 8-Byte Boundaries in the Heap

Double-word values are now aligned to 8-byte boundaries in the heap. This alignment improves the performance of both native code and JIT-compiled Java code while ensuring correctness of volatile double-word values on SPARC systems. However, if your application allocates and retains many small objects, you might need to increase your heap size(s) slightly, as these objects are allocated in multiples of 8 bytes, increasing memory usage.


Reduced Synchronization Overhead

The following features result in enhanced performance as a result of reduced synchronization overhead for multithreaded applications.

Fast-Sync Monitor Locking/Fast Thread Synchronization

The Java 2 SDK for Solaris uses a new, internal, fast-locking algorithm for more efficient method synchronization. The VM has significantly improved implementations of the Java platform's synchronization primitives. These implementations make concurrent programs more efficient and decrease the impact of the synchronization primitives on single-threaded application performance.

Lock Contention Minimization

The Java 2 SDK for Solaris minimizes lock contention in the VM by using thread-local data structures and finer-grained locking.

The VM core-locking architecture supports better granularity of VM locks. This fine-grained locking minimizes the number of contended paths of thread execution. Fewer contended paths means that one thread's execution is less likely to impede other threads. This results in better multiprocessor (MP) scaling capability. Fine-grained locking also enables the VM to conduct a larger number of concurrent operations.

Thread-Specific Data Access

The Java 2 SDK for Solaris uses a new internal cache mechanism in order to provide faster access to thread-specific data. This is a general performance enhancement used by the VM and each platform-specific JIT to access execution environment data.


Heap Inspection Tool

You can access this diagnostic tool for interactively killed programs from the SIGQUIT handler menu. It will find memory leaks in your programs. A memory leak occurs when a program inadvertently retains objects, preventing the garbage collector from reclaiming the memory. Heap inspection presents a per-class breakdown of the objects in the heap, sorted by total amount of memory consumed. You can then examine reference chains to selected objects to see what is keeping them alive.

Debugging Utility

Java 2 SDK for Solaris features a new debugging process. It involves sending a SIGQUIT signal to a Java process running in the foreground. This signal allows you to perform debugging tasks, such as thread and monitor state dumps and deadlock detection, on that process. See Chapter 5, Using SIGQUIT for Debugging for more information.

Improved JIT Compiler Optimizations

The improved JIT compiler optimizations instructs the Java Virtual Machine to favor ultimate execution speed over the startup time of Java applications. The JIT compiler performs new optimizations for both SPARC and Intel (IA) platforms, including inlining of virtual and non-virtual methods, CSE within extended basic blocks, loop analysis to eliminate array bounds checking, and fast type checks.


Java 2 SDK for Solaris provides inlining, which eliminates the need to inline manually (and risk destroying program modularity). Automatic inlining is restricted to relatively small, non-synchronous methods without flow control.

Mixed-Mode Execution

Java 2 SDK for Solaris includes a new mixed-mode execution feature that can significantly improve performance. Mixed-mode execution occurs when the VM compiles only the performance-critical methods and interprets the rest. This feature reduces compilation overhead, enables programs to start more quickly, and lets the VM spend more time compiling and optimizing where it matters most, enabling better performance.

Mixed-mode execution is the default mode. In mixed mode, the VM divides the methods into two types:

For each type, the JIT compiler determines when compilation occurs. Methods that potentially contain loops are compiled on their first execution. Methods that do not contain loops are compiled on the 15th invocation.

Scalability Improvements

The Java 2 SDK for Solaris improves handling of concurrency primitives and threads, increases the performance of multithreaded (MT) programs, and significantly reduces garbage-collection pause times for programs that use large numbers of threads.

Text-Rendering Performance Improvements

Several graphics optimizations have significantly improved text rendering performance for Java 2 SDK on Solaris platforms without direct graphics Access (DGA) support. These platforms include UltraTM 5, Ultra 10, Solaris running on Intel (IA), and all remote display systems.

Poller Class Demonstration

The new Poller class provides Java applications with the ability to efficiently access the functionality of the C poll(2) routine. The demonstration code with the Java 2 SDK for Solaris is provided with a sample usage server in


The demonstration code shows a means of determining the I/O status of multiple I/O objects with one call.

The JNI C code supporting the Poller class is optimized to take full advantage of Solaris 7 operating environment poll(2) kernel caching. It can be compiled to take advantage of /dev/poll, a faster kernel-polling mechanism available with Solaris 7 system software update 2 and subsequent versions.

See Appendix C, Poller Class Usage for more detailed information about the Poller class.