Sun Java Solaris Communities My SDN Account Join SDN
 
Article

What's New in Sun Studio 12 Compilers and Tools

 

What's New summarizes the new features in this release of Sun Studio compilers and tools. More information can be found in the documentation.

Contents:



What's New in the Compilers

A New Way To Specify 32-bit or 64-bit Address Model

 

You no longer need use the -xarch option to specify a 32-bit or 64-bit address model (LP64 versus ILP32). Two new options make it easier:

  • -m32 specifies the ILP32 model: 32-bit ints, longs, and pointer types.
  • -m64 specifies the LP64 model: 32-bit ints, 64-bit longs and pointers types. (Note that -m64 is the default on Linux platforms.)

Deprecated -xarch Flags and Their Replacements Across SPARC and x86
If you are using -xarch=v9 or -xarch=amd64 to specify a 64-bit address model, use just -m64 instead. No -xarch value is required.

  • Use -m64 in place of -xarch=generic64
  • Use -m64 -xarch=native in place of -xarch=native64

Deprecated -xarch Flags and Their Replacements on SPARC Only

  • Use -xarch=sparc in place -xarch=v8plus
  • Use -xarch=sparcvis in place of -xarch=v8plusa
  • Use -xarch=sparcvis2 in place of -xarch=v8plusb
  • Use -xarch=sparc -m64 in place of -xarch=v9
  • Use -xarch=sparcvis -m64 in place of -xarch=v9a
  • Use -xarch=sparcvis2 -m64 in place of -xarch=v9b

Deprecated -xarch Flags and Their Replacements on x86 Only

  • Use -xarch=sse2 -m64 in place of -xarch=amd64.
  • Use -xarch=sse2a -m64 in place of -xarch=amd64a.

Disallowed Combinations and Warnings
The compilers do not allow the combination of a deprecated -xarch value and the new -m32, -m64 options on the command line. For example, specifying -xarch=v9 -m32 is now a fatal error. Specifying -xarch=sparc -xarch=v9 is also a fatal error.

Some older -xarch values do not have 64-bit counterparts. You cannot combine the following -xarch options with -m64 on the command line"

  • SPARC platforms: -xarch=v7, -xarch=v8, -xarch=v8a
  • x86 platforms: -xarch=386, -xarch=pentium_pro, -xarch=pentium_proa, -xarch=sse, -xarch=ssea

If you specify a 32-bit -xarch value followed by -m64, the compiler does not issue a warning. For example -m64 -fast or -fast -m64 are allowed. However, if you specify a 64-bit -xarch value followed by -m32, the compiler issues a warning that -m32 overrides the -xarch value. This situation does not occur using macro options, only when an -xarch option has been explicitly specified.

New x86 Features and Updates

The following are new x86 flags for the -xarch option:

  • -xarch=sse3 specifies that the compiler should generate instructions based on both the SSE3 and SSE2 architectures.
  • -xarch=sse3a specifies that the compiler should generate instructions based on the SSE3, SSE2 and AMD extended architectures as well as the 3DNow extensions.

Changes to -fast
The -fast option on x86 now includes -xregs=frameptr, which means that the compiler can use the frame-pointer register (%ebp on IA32, %rbp on AMD64) as a general purpose register to generate code for all the compilation units. Consequently frame pointers will not be generated in each function or routine.

However, if you want to override this new behavior, specify -xregs=no%frameptr after -fast in the compilation command and the frame-pointer register will not be used as a general purpose register. The following example demonstrates how to override the -fast default for -xregs:

      cc -fast -xregs=no%frameptr foo.c

Static data-race and deadlock-detection with lock_lint
The C compiler option -Zll creates database files (.ll) for use by the lock_lint utility. See lock_lint(1). The -Zll option and the lock_lint utility are now available on x86.

New SPARC Features and Updates

This release of the Sun Studio compilers includes support for the SPARC64 VI and UltraSPARC T2 processors. Use the following new options to specify these processors:

  • -xtarget=sparc64vi
  • -xtarget=ultraT2

You can also specify the following -xchip options to generate code for these processors without setting the -xarch value automatically as happens when you use -xtarget:

  • -xchip=sparc64vi
  • -xchip=ultraT2

New Math and Visual Instruction Set Support in SPARC64 VI

Specify the following new option if you want to use instructions from the SPARC-V9 instruction set including the UltraSPARC extensions, the Visual Instruction Set (VIS) version 1.0, the UltraSPARC-III extensions, the Visual Instruction Set (VIS) version 2.0, and the SPARC64 VI extensions for floating-point multiply-add:

  • -xarch=sparcfmaf
  • -xarch=sparcvis2

You must also specify -m32 or -m64 when you specify -xarch=sparcfmaf to get 32-bit code or 64-bit code respectively. When you specify -xarch=sparcfmaf, the compiler predefines the following new values:

  • -D__FP_FAST_FMA__
  • -D__FP_FAST_FMAF__

Note: You must use -xarch=sparcfmaf in conjunction with the new -fma=fused option detailed below and some optimization level in order for the compiler to find opportunities to use the multiply-add instructions automatically.

New Option for Floating-Point, Fused or Multiply-Add Instructions

Specify the following new option to enable or disable the automatic generation of floating-point, fused, multiply-add instructions:
  • -fma={none,fused}

The none value indicates that the compiler should not generate any floating-point, fused, or multiply-add instructions. The fused value allows the compiler to attempt to find opportunities to improve the performance of the code by using floating-point, fused, or multiply-add instructions.

Linux Support

This release of the Sun Studio compilers supports the Linux OS as follows.

  • SuSE Linux Enterprise Server 9 with Service Pack 3 (or later)
  • Red Hat Enterprise Linux 4
  • Other Linux distributions based on the 2.6 kernel though these are not officially supported

See the release notes for processor and distro version requirements.

The New Thread Analyzer

The following new compiler option causes the compiler to instrument your multi-threaded application for analysis by the new Thread Analyzer. 
  • -xinstrument[=[no%]datarace]

The default is -xinstrument=no%datarace. See tha(1) and the Thread Analyzer User's Guide. The user's guide includes two tutorials, a FAQ and lists of supported APIs.

New Features in the C Compiler

In addition to the new options and features detailed in the rest of this readme, the following new C compiler options are supported in this release:

  • Expanded -D to accept marcos with arguments.
  • A new -errhdr option which limits warnings from header files to a specified group.
  • A new -xnorunpath option prevents the compiler from building a runtime search path for shared libraries into the executible.
  • A new -xMMD option generates makefile dependencies excluding system headers. This is the same functionality as with -xM1, but includes compilation.
  • A new -xMD option generates makefile dependencies. This is the same functionality as with -xM, but includes compilation.
  • A new -xMF filename options allows you to specify a filename for makefile-dependency output.
  • The -xM, -xM1, -xMD, and -xMMD options are mutually exclusive, and only one can be in effect. When you specify -xMD or -xMMD, but do not specify -xMF, the compiler generates an output file for makefile-dependency output whose default filename is derived from the input filename but with the addition of a .d suffix.

    The -xM and -xM1 options behave as usual when you do not specify -xMF. If you do speicyf -xMF, all makefile-dependency output is appended to the specified file. There is no way to specify individual filenames for multiple input files with -xMF on one command line.

  • Support for the #include_next directive

    The C compiler now supports the #include_next directive. The directive does not distinguish between <filename> and "filename" inclusion, nor does it check that the file you specify has the same name as the current file. The compiler looks for the specified file starting with the directory in the search path after the one where the current file which contains the #include_next directive.

  • Additions to the __attributes__ clause

    The always_inline, noinline, pure, const, malloc, and aligned attributes are now supported by the __attributes__ clause.

  • Support for the aligned attribute
    int __attribute__ ((aligned (16))) i = 0;
  • Support for the visibility attribute

    The visibility attribute has been mapped to the linker scoping specifiers of the Sun Studio C compiler as follows:

    The symbol has global linker scoping and is the least restrictive linker scoping. All references to the symbol bind to the definition in the first dynamic module that defines the symbol. This linker scoping is the current linker scoping for extern symbols.

    int __attribute__ ((visibility ("default"))) v5 = 0;
    int __global v6 = 0;

    The symbol has symbolic linker scoping and is more restrictive than global linker scoping. All references to the symbol from within the dynamic module being linked bind to the symbol defined within the module. Outside of the module, the symbol appears as though it were global.

    int __attribute__ ((visibility ("protected"))) v1 = 0; 
    int __symbolic v2 = 0;

    The symbol has hidden linker scoping. Hidden linker scoping is more restrictive than symbolic and global linker scoping. All references within a dynamic module bind to a definition within that module. The symbol will not be visible outside of the module.

    int __attribute__ ((visibility ("internal"))) v3 = 0; 
    int __attribute__ ((visibility ("hidden"))) v4 = 0;
    int __hidden l = 0;
  • Support for value-returning blocks
     #define maxint(a,b) \
    ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  • Support for the typeof operator
     #define max(a,b) \
    ({ __typeof__ (a) _a = (a); \
    __typeof__ (b) _b = (b); \
    _a > _b ? _a : _b; })
  • Support for zero-length arrays
     struct foo {
    int a;
    int flexarray [0];
    int b;
    int c;
    };
  • Support for the __alignof__ operator

    The __alignof__ operator returns the alignment associated with a given type or expression. Its syntax is the same as the syntax of the sizeof operator. The following examples demonstrate how to call __alignof__ and supply an argument:

    __alignof__(float)  /* return 4
    __alignof__(double) /* returns 8

    char foo;
    __alignof__(foo) /* returns 1
    __alignof__(1+1) /* returns 4 (default integer alignment)
    It's an error to ask for the alignment of an incomplete type or of a bit-field.
  • Support for local labels

    The following search-macro example demonstrates a typical use of local labels. The example incorporates statement expressions and the typeof operator. A search for an element of a one dimensional array could be written as follows:

    #define SEARCH(array, value,max) \ 
    ({ \
    __label__ found_it; \
    typeof (value) _value =(value); \
    typeof (*(array)) *_array = (array); \
    typeof (max) _max = (max); \
    typeof (max) i, index; \
    \
    for (i =0; i < max; i++) \
    if (_array[i] == _value) \
    { \
    index= i; \
    goto found_it; \
    } index = -1; \
    found_it: \
    index; \
    })
    Note the use of the local label "found_it". Without the ability to declare a local label (through the __label__ declaration), multiple uses of the macro would result in multiple definitions for "found_it". Note also that local labels can be used in any block, not just within statement expression blocks.

New Features in the C++ Compiler

In addition to the new options and features detailed in the rest of this readme, the following new C++ compiler options are supported in this release:

  • Support for g++ extensions:
    • __typeof__
    • __attribute
    • __alignof__ now accepts expressions
    • long long bitfields, currently by default only on Linux
  • Improved function inlining
    The C++ compiler will now generate some system functions inline at high optimization levels, avoiding calls into system libraries.

  • Support for the following open-source libraries:

  • Standard-conforming lifetime of temporary variables by default
    The compiler no longer requires a command-line option to provide standard-conforming lifetime of temporary variables. This behavior is now the default.

  • Complex expressions in template parameters
    The compiler was previously unable to handle expressions in non-type template arguments in certain cases. For example:

    template<class T, int I, int J>
    T func( T (&arr)[I*J] ) { ... } // I*J is a "complex template expression"
    The compiler can now handle such usage.

  • Improved debugging

    This release of the C++ compiler provides enhanced debugging of OpenMP programs as well as enhanced debugging of optimized code.

  • Debug format now defaults to DWARF
    The C++ compiler now emits debug information in the DWARF format by default. This makes it easier for third-party debuggers and tools to inter-operate with Sun compilers. The DWARF format also makes it easier for Sun Studio to add debugging support for optimized code.


New Features in the Fortran 95 Compiler

  • Support for interval arithmetic on Solaris Intel platform with the -xarch=sse2 -xia options.

  • CAUTION messages issued when using the same symbols that are defined in different modules.This enhancement provides a CAUTION level message when the same symbols defined in different modules are imported by the USE statement. This helps isolating name duplication problems in large applications using third-party modules.

  • Faster compilation time for source files with many constant values.

  • Intrinsic functions called with UNSIGNED arguments improved.
  • Improved backward compatibility with old F77 objects produced by the Sun WorkShop 6 update 2 compiler.


What's New in DBX:

The following features were added or changed in Sun Studio 12 dbx.

  • Support for access checking has been extended to x86 based systems and x64 based systems running the Solaris OS.
  • adb mode is no longer supported.
  • dbx can read separate debug files generated by [g]objcopy.
  • New watch command added to complement the existing display command.
  • Arrow keys are now bound to history and cursor motion in both emacs and vi ksh editing modes.
  • Enhanced support for user-supplied pretty printing functions.
  • New fortran_modules command
  • New +l option for the print command prints only addresses of strings.
  • New dbx environment variable debug_file_directory
  • New dbx environment variable output_no_literal
  • New dbx environment variable event_safety.
  • The default value for dbx environment variable run_savetty has been changed to "off". This setting improves the performance of conditional or counted breakpoints. However, if you are debugging editors, shells or other applications that alter terminal settings, you need to set it manually to "on".
  • New shell variable $exec32
  • Data can be printed and examined and code can be disassembled and examined in the absence of a corefile or before a program is run. This information is extracted from the executable or shared libraries.
  • dbx will now succeed in attaching to a process that is stopped due to SIGSTOP, SIGTSTOP, SIGTTIN or SIGTTOUT. Previously dbx would hang until the user explicitly resumed the process by issuing SIGCONT or foregrounding it.

A few features of dbx are not available for programs compiled with the gcc or g++ compilers, or for programs running on Linux platforms. For more information, see Limitations and Incompatibilities.



What's New in DMAKE:

This section describes the new and changed features for dmake. For details, see the dmake(1) man page.


The following new features were added in this release:

  1. dmake is now integrated in Sun Studio IDE. This means that by default all projects are built using dmake in parallel mode. To change the build mode or change the number of parallel jobs can be done from inside the IDE:

    From the main menu, choose Tools -> Options to open the "Options" dialog
    • In "Options", select the C/C++ icon (left panel) to show the C/C++ options on right panel
    • Click on the "Project Options" tab (right panel) to show the project options, and select "Make Options"
    • Enter "-m parallel -j 24"
    • Press "Ok" button.
    Now all projects will be built in parallel mode up to a maximum of 24 jobs.


The following features were added in previous releases:

  1. The "-x SUN_MAKE_COMPAT_MODE=..." command line option
    gives users three options to specify dmake's behavior
    (compatibility mode):
    SUN_MAKE_COMPAT_MODE=SUN - compatibility with Sun "make"
    (this is the default behavior)
    SUN_MAKE_COMPAT_MODE=POSIX - compatibility with POSIX "make"
    SUN_MAKE_COMPAT_MODE=GNU - compatibility with GNU "make"
    Compatibility with GNU "make" is partially implemented, and
    will be improved in next releases.
  2. The SUN_MAKE_COMPAT_MODE environment variable gives users
    three options to specify dmake's behavior (compatibility mode):
    SUN_MAKE_COMPAT_MODE=POSIX - compatibility with POSIX "make"
    SUN_MAKE_COMPAT_MODE=SUN - compatibility with Sun "make"
    SUN_MAKE_COMPAT_MODE=GNU - compatibility with GNU "make"
    Compatibility with GNU "make" is partially implemented, and
    will be improved in next releases.
  3. UNIX 2003 compliance. dmake and the make utility in the Solaris 10 OS passed the UNIX 2003 conformance tests (XPG5).
  4. dmake now includes support for the Sun Grid Engine on the AMD64 architecture.
  5. System overloading control is now available on the AMD64 architecture.
  6. The DMAKE_OUTPUT_MODE environment variable gives you two format options for the log file, one of which serializes the output of parallel jobs, making the log file more readable.

What's New in the Sun Studio IDE:

The Sun Studio 12 IDE is entirely new and includes many features not included in the Sun Studio 11 IDE, such as:

  • Projects
  • Code completion
  • Code folding
  • Class view
  • Memory browser
  • Registers window
  • Assembler window
  • Runtime checking experiments collected when running (not debugging) your program

For complete documentation of the IDE, see the online help in the IDE and the Sun Studio 12 Quick Start Guide on the Sun Studio developer portal.

Update Notification


The Update Notification feature periodically checks www.sun.com and communicates available changes related to your Sun Studio software, including patches and major software updates.

To view the current contents of the update file from the IDE, choose Help ->  View update information.

To initiate contact with the server and get updated information, choose Help ->  Check now for updates.

If Update Notification is not able to check for updates and your system is on a network with a proxy server, you can set proxy server information by doing the following:

  1. Choose Tools ->  Setup Wizard.
  2. In the wizard, select the Use HTTP Proxy Server checkbox.
  3. Type the proxy host name in the Proxy Server Name field and the port number in the Port field.
  4. Click Finish.

You can also set the proxy server information using the ALL_PROXY environment variable; for example, setenv ALL_PROXY myproxy:8080

Note: You must exit and restart the IDE for the proxy server information to be recognized by the IDE.

To disable Update Notification, set the SUNW_NO_UPDATE_NOTIFY environment variable to any value other than false.

Usage information is communicated during the Update Notification process. This information is used by Sun Microsystems to improve future Sun Studio software releases. This information is anonymous and cannot be associated to any individual or organization.


What's New- The Thread Analyzer:

New in this release of Sun Studio is the Thread Analyzer. The Thread Analyzer is a tool that analyzes the execution of a multi-threaded program and checks for a variety of multi-threaded programming errors such as data races and deadlocks.

The tool can detect errors in code that is written using the POSIX thread API, the Solaris Operating System(R) thread API, OpenMP API, Sun parallel directives, Cray(R) parallel directives, or a mix of these.

Data Races

A data race occurs under the following conditions:

  • Two or more threads in a process concurrently access the same memory location,
  • At least one of the threads is accessing the memory location for writing, and
  • The threads are not using any exclusive locks to control their accesses to that memory.

When these three conditions hold, the order of accesses is non-deterministic. Therefore each run can give different results depending on the order of the accesses. Some data races may be benign (for example, when the memory access is used for a busy-wait), but many data races are either bugs or caused by bugs in the program.

Deadlocks

Deadlock describes a condition where two or more threads are blocked (hang) forever, waiting for each other. Suppose we have a process with two or more threads. A deadlock occurs when the following three conditions hold:

  • Threads already holding locks request new locks,
  • The requests are made concurrently, and
  • Two or more threads form a circular chain where each thread waits for a lock that the next thread in the chain holds.

Here is an example of a deadlock condition:

Thread 1: holds lock A, requests lock B
Thread 2: holds lock B, requests lock A

A deadlock can be of two types: A "potential deadlock" or an "actual deadlock". A potential deadlock is a deadlock that did not occur in a given run, but can occur in different runs of the program depending on the timings of the requests for locks by the threads. An actual deadlock is one that actually occured in a given run of the program. An actual deadlock causes the threads involved to hang, but may or may not cause the whole process to hang.

See the Thread Analyzer User Guide for details.

What's New in the Sun Studio Performance Analyzer:

This section describes the new and changed features in the Performance Analyzer. For details, see the analyzer(1) man page.

  1. Improved Handling of Descendant Processes

    The Analyzer and the er_print utility process an en_desc on|off|reg-exp directive in a .er.rc file. If the directive specifies on, all descendant experiments are read immediately; if the directive specifies off, only the founder experiment is read. If the directive specifies a regular expression, those descendants whose name or lineage match will be read.

  2. New Index Objects Tab and Report

    New tabs are available in the Analyzer to show performance data for threads, cpus, etc. Several new er_print commands are available for index objects.

  3. dbx Profiling on Linux

    Profiling under dbx is now supported on Linux.

  4. Improved Handling of MPI Profiling

    Additional variables specifying process rank for OpenMPI versions of MPI are recognized.

  5. Java Mode Has H5een Replaced

    Java mode has been replaced by View mode. The javamode command is no longer accepted.

  6. Improved OpenMP Support

    The presentation of OpenMP data has been enhanced.

  7. Other Improvements and New Features
    • Improved integration with the Sun Studio IDE.
    • Support for the Sun Studio Thread Analyzer (THA).
    • Improved stack unwind on x86/x64 platforms for both Solaris and Linux.
    • Improved Linux support for: synchronization tracing, MPI tracing with OpenMPI, descentant process support.
    • Improved tracing: interposition only when data is requested gives improved performance when it is not requested.
    • Count data: collect -C {on|static} (SPARC only); requires Cool Tools supplement to Sun Studio 12.
    • Clock-based dataspace profiling.
    • Attach and collect data: collect -P pid

 

What's New in the Sun Studio Performance Library:

This section describes new and changed features for the Sun Studio Sun Performance Library.

For x86-based systems:
  • Libraries are available on 32-bit and 64-bit systems with SuSE Linux Enterprise Server 9 or Redhat Enterprise Linux 4 operating environment.
  • Routines with 64-bit integer parameters are now available. That is, DAXPY() and DAXPY_64() are in all versions of the Sun Performance Library.
  • Serial version of the sparse solver package SuperLU is available and can be called from C drivers or through the existing Fortran-based sparse solver in the Library.
  • At this time, quad-precision routines (dqdoti, dqdota) are not available.
  • Interval BLAS routines are available for Solaris OS and Linux OS on SSE2-enabled and above X86 systems.
For SPARC Processors:
  • BLAS and FFT improvements for the UltraSPARC IV+ and UltraSPARC IV processors were done.
  • Support for SPARC64VI CPUs is available. This version of Sun Performance Library uses the floating point multiply-add instruction to achieve the best performance possible on SPARC64VI CPUs. To link with this library, compile with the -xarch=sparcfmaf or -xtarget=sparc64vi flags.
  • Serial version of the sparse solver package SuperLU is available and can be called from C drivers or through the existing Fortran-based SPSOLVE sparse solver in the Library.

(Last updated December 18, 2007)