Wednesday Jun 27, 2007

New Article: Prefetching

Prefetching Pragmas and Intrinsics

Diane Meirowitz, Senior Staff Engineer, and Spiros Kalogeropulos, Staff Engineer, June, 2007

Introduction

Explicit data prefetching pragmas and intrinsics for the x86 platform and additional pragmas and intrinscs for the SPARC platform are now available in Sun Studio 12 compilers, released June 2007.

Prefetch instructions can increase the speed of an application substantially by bringing data into cache so that it is available when the processor needs it. This benefits performance because today's processors are so fast that it is difficult to bring data into them quickly enough to keep them busy, even with hardware prefetching and multiple levels of data cache.

The compilers have several options that enable them to generate prefetch instructions automatically: -xprefetch, -xprefetch_level, and -xprefetch_auto_type (described below). The compilers generally do an excellent job of inserting prefetch instructions, and this is the most portable and best way to use prefetch. If finer control of prefetching is desired, prefetch pragmas or intrinsics can be used. Note that the performance benefit due to prefetch instructions is hardware-dependent and prefetches which improve performance on one chip may not have the same effect on a different chip. It is a good idea to study the instruction reference manual for the target hardware before inserting prefetch pragmas or intrinsics. Furthermore, the Sun Studio Performance Analyzer can be used to identify the cache misses of an application.


[Read More]

Friday Jun 22, 2007

C and C++ Technical Articles

There are a lot of useful, short, technical articles on the SDN portal directed at the C and C++ programmer on Solaris. 

This article gives an overview of the C-language extensions (part of the GNU C-implementation) introduced in the Sun Studio 12 C compiler. Although these extensions are not part of the latest ISO C99 standard, they are supported by the popular gcc compilers. (June 13, 2007)
 
Ever wonder what's in a patch? Take a look inside a typical Sun Studio compiler patch that includes updated C++ shared libraries. (November 10, 2006)
 
The Sun C++ compiler ships with two libraries that implement the C++ standard library: libCstd and libstlport. This article discusses the differences between the two libraries and explores the situations in which one library is preferred over the other. (May 17, 2006)
 
Hiding non-interface symbols of a library within the library makes the library more robust and less vulnerable to symbol collisions from outside the library. To get the appropriate linker scoping in a source program, you can now use language extensions built into the Sun Studio C/C++ compilers. (May 17, 2005)
 
The author shows how a simple C++ program fails without language linkage, but can succeed with proper linkage. (This article is on the Solaris portal.) (March 23, 2005)
 
In this test case, the DTrace capability in the Solaris 10 OS is used to identify an error common to C++ applications -- the memory leak. (This article is on the Solaris OS developer portal.) (February 17, 2005)
 
The C++ language provides mechanisms for mixing code that is compiled by compatible C and C++ compilers in the same program. You can experience varying degrees of success as you port such code to different platforms and compilers. This article shows how to solve common problems that arise when you mix C and C++ code, and highlights the areas where you might run into portability issues. (July 25, 2003)
 
This article discusses some of the runtime errors related to memory management and how you can use the garbage collection library, libgc to fix these errors. In most cases, just linking with the library without making any changes to your code will fix the errors. (July 25, 2003)
 
Using the restrict qualifier appropriately in C programs may allow the compiler to produce significantly faster executables. (July 17, 2003)
 
A discussion of the evolution of the C++ Application Binary Interface, and its implications. (March 20,2003)
 
Application software developers can learn to use the latest version of the Solaris OS while supporting previous versions. (January 1, 2002)
 

Wednesday Jun 13, 2007

New Sun Studio Article: C Language Extensions

There's a new article on the Sun Studio SDN portal: 

New Language Extensions in the Sun Studio 12 C Compiler

By Dmitry Mikhailichenko, Sun Microsystems, St Petersburg, Russia, June 2007  

This article gives an overview of the following C-language extensions (part of the GNU C-implementation) introduced in the Sun Studio 12 C compiler. Although these extensions are not part of the latest ISO C99 standard, they are supported by the popular gcc compilers.

  • The typeof keyword which allows references to an arbitrary type
  • Statement expressions that make it possible to specify declarations and statements in expressions
  • Block-scope label names

The article also demonstrates how to use the new C compiler features for creating generic macros on example of linked-list manipulation-routines. Such macros semantically mimic C++ Standard Template Library, support arbitrary data types and provide strict compile-time type-checking.

 ┬╗Read the entire article on the Sun Studio portal

About

Application development on Solaris OS

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today