Allocating Patch Space for Compiled Expressions
TotalView must either allocate or find space in your program to hold the code that it generates for compiled expressions. Since this patch space is part of your program’s address space, the location, size, and allocation scheme that TotalView uses might conflict with your program. As a result, you may need to change how TotalView allocates this space.
You can choose one of the following patch space allocation schemes:
-
Dynamic patch space allocation: Tells TotalView to dynamically find the space for your expression’s code.
-
Static patch space allocation: Tells TotalView to use a statically allocated area of memory.
On this page:
Allocating Dynamic Patch Space
Dynamic patch space allocation means that TotalView dynamically allocates patch space for code fragments. If you do not specify the size and location for this space, TotalView allocates 1 MB. TotalView creates this space using system calls.
TotalView allocates memory for read, write, and execute access in the addresses like so:
|
Platform |
Address Range |
|
IBM AIX (-q32) |
0xEFF00000 - 0xEFFFFFFF |
|
IBM AIX (-q64) |
0x07f0000000000000 - 0x07ffffffffffffff |
You can allocate dynamic patch space only for the computers listed here.
If the default address range conflicts with your program, or you would like to change the size of the dynamically allocated patch space, you can change the following:
-
Patch space base address by using the -patch_area_base command-line option.
-
Patch space length by using the -patch_area_length command-line option.
Allocating Static Patch Space
TotalView can statically allocate patch space if you add a specially named array to your program. When TotalView needs to use patch space, it uses the space created for this array.
You can include, for example, a 1 MB statically allocated patch space in your program by adding the TVDB_patch_base_address data object in a C module. Because this object must be 8-byte aligned, declare it as an array of doubles; for example:
/* 1 megabyte == size TV expects */
#define PATCH_LEN 0x100000
double TVDB_patch_base_address [PATCH_LEN / sizeof(double)]
If you need to use a static patch space size that differs from the 1 MB default, you must use assembler language. The following shows sample assembler code for IBM AIX-Power:
.csect .data{RW}, 3
.globl TVDB_patch_base_address
.globl TVDB_patch_end_address
TVDB_patch_base_address:
.space PATCH_SIZE TVDB_patch_end_address:
To use the static patch space assembler code:
-
Use an ASCII editor and place the assembler code into a file named tvdb_patch_space.s.
-
Replace the PATCH_SIZE tag with the decimal number of bytes you want. This value must be a multiple of 8.
-
Assemble the file into an object file by using a command such as: