J3/04-133 Date: 16 Dec. 2003 To: J3 From: Dan Nagle Subject: Better Description of Memory- SWAP Processor speeds have increased to very much faster rates than memory speeds, compilers have improved to the point where most code sequences are nearly perfectly optimized. Separate compilation confounds "application compilers", pointers and targets complicate aliasing analysis. Therefore, more information regarding aliasing is essential for very high computational rates. The "Better Description of Memory" features attempt to define features which may provide this missing information to compilers. Since several features combine to do so, they are broken into individual papers for consideration. Title: Better Description of Memory- SWAP Submitted By: J3 Status: For Consideration References: Basic Functionality: Reduce copying by defining an atomic swap statement. Rationale: Compilers must generate copy operations user-defined swap operations are encoded. Sometimes, a compiler will be able to do no better, but there are other cases where a compiler can do very much better indeed. Estimated Impact: Compilers must recognize a new statement, and generate code for it. Detailed Specification: Introduce a SWAP statement, as follows: SWAP( A, B) Where a SWAP statement appears, both the following must be allowed: A = B B = A without implying a type conversion. Example: real, allocatable, dimension(:) :: x, y allocate( x( 1000000)) allocate( y( 1000000)) swap( x, y) Note that the compier can simply swap the data structures for x, y, rather than copying 2e6 words. History: