Browse Prior Art Database

GETMAIN and FREEMAIN for FORTRAN Programs

IP.com Disclosure Number: IPCOM000075115D
Original Publication Date: 1971-Aug-01
Included in the Prior Art Database: 2005-Feb-24
Document File: 3 page(s) / 43K

Publishing Venue

IBM

Related People

Lewitan, H: AUTHOR

Abstract

The methods described here enable a FORTRAN H compiled program to acquire automatically the exact amount of core storage needed for its arrays, during execution time, and to free selected regions when the storage is no longer needed. It is to be used by programs run under OS, DOS or 44PS, compiled and optimized by the FORTRAN H compiler. The storage obtained is to be used by subroutine subprograms, not main programs.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 64% of the total text.

Page 1 of 3

GETMAIN and FREEMAIN for FORTRAN Programs

The methods described here enable a FORTRAN H compiled program to acquire automatically the exact amount of core storage needed for its arrays, during execution time, and to free selected regions when the storage is no longer needed. It is to be used by programs run under OS, DOS or 44PS, compiled and optimized by the FORTRAN H compiler. The storage obtained is to be used by subroutine subprograms, not main programs.

A main program or subroutine prior to calling a processing subroutine to which an array name is passed on for processing calls on a storage acquiring assembly language subroutine, referred to here as GETMNH. The call parameters of GETMNH are made identical to the call parameters of the processing (called) subroutine. When GETMNH gets control, it acquires the necessary amount of storage for the array from OS and stores the newly acquired array storage address where the processing subroutine expects to find it. For example, following is a call from a main program or subroutine to a processing subroutine named PROC. .

.

.

DIMENSION ARRAY (10, 10000)

.

.

.

CALL PROC (ARRAY, I,J,P,Q, ...). ARRAY, I, and j represent the array and its dimensions I x J. The storage for ARRAY has been reserved by the DIMENSION statement and PROC when given control will operate directly in the space reserved for ARRAY by the calling program. To eliminate the need for the above source time DIMENSION statement the call to PROC has to be preceded by a call to GETMNH as follows: C NO DIMENSION STATEMENT FOR ARRAY

.

.

.

I=LENGTH

CALL GETMNH (ARRAY, I,J,P,Q, ...)

I=...

CALL PROC (ARRAY, I,J,P,Q, ...)

.

.

.

CALL OTHER (ARRAY, I,J,P,Q, ...)

.

.

. .

LENGTH is set equal to the number of bytes of storage needed for array. LENGTH is usually based on an input parameter, read during execution time for

1

Page 2 of 3

the total data length of dimensions I and J of ARRAY. GETMNH uses a GETMAIN macro to obtain storage from the operating system and stores the obtained region address in the parameter list of PROC in place of ARRAY. While the symbolic parameters of PROC and GETMNH must be identical in name, number, and order, GETMNH uses only the first two parameters and ignores the rest. In fact, there are no two parameter lists, one for PROC, and another for GETMNH. The FORTRAN optimizer recognizes that the two parameter lists are identical and forms a single parameter list to be shared by both subroutine calls. It should be pointed out that this core acquisition method takes advantage and is based on precisely this fact that the compiler optimizer produces a single parameter list to be shared by more than one call when the parameter lists are identical. For this reason it is essential that the parameter list of GETMNH be made identical with the parameter list of the called processing subroutine. Calling GETMNH, first of all, locates he proces...