Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

heap.h File Reference


Detailed Description

Heap management API.

The two examples of modular development here are the two heap management schemes, heap_simple.c and heap_bimodal.c. This common header file defines the prototypes for both by way of the CONFIG_HEAP_TYPE_xxx symbol definition.

Each heap allocation algorithm will have a section just like those defined here in this file so that these macros will expand to point to the API as implemented by that algoritm. Simply replicate one of the definition sections and change the function names from _simple (et al) to _newalgorithm .

Control

$URL: https://svn.apache.org/path/name/heap.h $ $Id: heap.h 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file heap.h.

Go to the source code of this file.

Bimodal heap model definitions

Expand the HEAP_xxx() macros into the bimidal heap model as implemented by heap_bimodal.c.

#define HEAP_FREE_DATA   heap_free_data_bimodal
#define HEAP_FREE_DATA   heap_free_data_simple
#define HEAP_FREE_METHOD   heap_free_method_bimodal
#define HEAP_FREE_METHOD   heap_free_method_simple
#define HEAP_FREE_STACK   heap_free_stack_bimodal
#define HEAP_FREE_STACK   heap_free_stack_simple
#define HEAP_GET_DATA   heap_get_data_bimodal
#define HEAP_GET_DATA   heap_get_data_simple
#define HEAP_GET_ERROR   heap_get_error_bimodal
#define HEAP_GET_ERROR   heap_get_error_simple
#define HEAP_GET_METHOD   heap_get_method_bimodal
#define HEAP_GET_METHOD   heap_get_method_simple
#define HEAP_GET_STACK   heap_get_stack_bimodal
#define HEAP_GET_STACK   heap_get_stack_simple
#define HEAP_INIT   heap_init_bimodal
#define HEAP_INIT   heap_init_simple
#define HEAP_SHUTDOWN   heap_shutdown_bimodal
#define HEAP_SHUTDOWN   heap_shutdown_simple

Functions

 ARCH_COPYRIGHT_APACHE (heap, h,"$URL: https://svn.apache.org/path/name/heap.h $ $Id: heap.h 0 09/28/2005 dlydick $")
rvoid heap_free_data_simple (rvoid *heap_block)
 Release a previously allocated data block back into the heap for future reallocation.
rvoid heap_free_method_simple (rvoid *heap_block)
 Release a previously allocated method block back into the heap for future reallocation.
rvoid heap_free_stack_simple (rvoid *heap_block)
 Release a previously allocated stack block back into the heap for future reallocation.
rvoidheap_get_data_simple (int size, rboolean clrmem_flag)
 Allocate memory for a data area from heap to caller.
int heap_get_error_simple (rvoid *badptr)
 Allocation failure diagnostic.
rvoidheap_get_method_simple (int size, rboolean clrmem_flag)
 Allocate memory for a method from heap to caller.
rvoidheap_get_stack_simple (int size, rboolean clrmem_flag)
 Allocate memory for a stack area from heap to caller.
rvoid heap_init_simple (rvoid)
rvoid heap_shutdown_simple (rvoid)


Define Documentation

#define HEAP_INIT   heap_init_simple
 

Definition at line 94 of file heap.h.

#define HEAP_SHUTDOWN   heap_shutdown_simple
 

Definition at line 95 of file heap.h.

#define HEAP_GET_METHOD   heap_get_method_simple
 

Definition at line 96 of file heap.h.

Referenced by cfattrib_loadattribute(), and classfile_loadclassdata().

#define HEAP_GET_STACK   heap_get_stack_simple
 

Definition at line 97 of file heap.h.

#define HEAP_GET_DATA   heap_get_data_simple
 

Definition at line 98 of file heap.h.

Referenced by argv_init(), cfmsgs_typemsg(), class_get_num_static_fields(), class_get_static_field_data(), classfile_allocate_primative(), jvmutil_print_errtype_stack(), manifest_get_main(), nts_prchar2utf(), nts_prchar2utf_classname(), thread_init(), unicode_cnv2utf(), and utf_isarray().

#define HEAP_FREE_METHOD   heap_free_method_simple
 

Definition at line 99 of file heap.h.

Referenced by classfile_loadclassdata().

#define HEAP_FREE_STACK   heap_free_stack_simple
 

Definition at line 100 of file heap.h.

Referenced by thread_shutdown().

#define HEAP_FREE_DATA   heap_free_data_simple
 

Definition at line 101 of file heap.h.

Referenced by cfmsgs_typemsg(), class_find_by_cp_entry(), class_static_delete(), jvmutil_print_errtype_stack(), manifest_get_main(), method_find_by_prchar(), and opcode_run().

#define HEAP_GET_ERROR   heap_get_error_simple
 

Definition at line 102 of file heap.h.

#define HEAP_INIT   heap_init_bimodal
 

Definition at line 94 of file heap.h.

#define HEAP_SHUTDOWN   heap_shutdown_bimodal
 

Definition at line 95 of file heap.h.

#define HEAP_GET_METHOD   heap_get_method_bimodal
 

Definition at line 96 of file heap.h.

#define HEAP_GET_STACK   heap_get_stack_bimodal
 

Definition at line 97 of file heap.h.

#define HEAP_GET_DATA   heap_get_data_bimodal
 

Definition at line 98 of file heap.h.

#define HEAP_FREE_METHOD   heap_free_method_bimodal
 

Definition at line 99 of file heap.h.

#define HEAP_FREE_STACK   heap_free_stack_bimodal
 

Definition at line 100 of file heap.h.

#define HEAP_FREE_DATA   heap_free_data_bimodal
 

Definition at line 101 of file heap.h.

#define HEAP_GET_ERROR   heap_get_error_bimodal
 

Definition at line 102 of file heap.h.


Function Documentation

ARCH_COPYRIGHT_APACHE heap  ,
,
"$URL: https://svn.apache.org/path/name/heap.h $ $Id: heap.h 0 09/28/2005 dlydick $" 
 

rvoid heap_init_simple rvoid   ) 
 

rvoid heap_shutdown_simple rvoid   ) 
 

rvoid* heap_get_method_simple int  size,
rboolean  clrmem_flag
 

Allocate memory for a method from heap to caller.

When finished, this pointer should be sent back to heap_free_method_simple() for reallocation.

Note:
This implementation makes no distinction betwen method area heap and any other usage. Other implementations may choose to implement the JVM Spec section 3.5.4 more rigorously.
Parameters:
size Number of bytes to allocate
clrmem_flag Set memory to all zeroes (rtrue) or not (rfalse)
Returns:
(rvoid *) to allocated area. This pointer may be cast to any desired data type. If size of zero bytes is requested, return rnull and let caller croak on SIGSEGV. If no memory is available or some OS system call error happened, throw error, but do not return.
Exceptions:
JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR if no memory is available.
JVMCLASS_JAVA_LANG_INTERNALERROR if other allocation error.

Definition at line 272 of file heap_simple.c.

rvoid* heap_get_stack_simple int  size,
rboolean  clrmem_flag
 

Allocate memory for a stack area from heap to caller.

When finished, this pointer should be sent back to heap_free_stack_simple() for reallocation.

Parameters:
size Number of bytes to allocate
clrmem_flag Set memory to all zeroes (rtrue) or not (rfalse)
Returns:
(rvoid *) to allocated area. This pointer may be cast to any desired data type. If size of zero bytes is requested, return rnull and let caller croak on SIGSEGV. If no memory is available or some OS system call error happened, throw error, but do not return.
Exceptions:
JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR if no memory is available.
JVMCLASS_JAVA_LANG_INTERNALERROR if other allocation error.

Definition at line 314 of file heap_simple.c.

rvoid* heap_get_data_simple int  size,
rboolean  clrmem_flag
 

Allocate memory for a data area from heap to caller.

When finished, this pointer should be sent back to heap_free_data_simple() for reallocation.

Parameters:
size Number of bytes to allocate
clrmem_flag Set memory to all zeroes (rtrue) or not (rfalse)
Returns:
(rvoid *) to allocated area. This pointer may be cast to any desired data type. If size of zero bytes is requested, return rnull and let caller croak on SIGSEGV. If no memory is available or some OS system call error happened, throw error, but do not return.
Exceptions:
JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR if no memory is available.
JVMCLASS_JAVA_LANG_INTERNALERROR if other allocation error.

Definition at line 356 of file heap_simple.c.

rvoid heap_free_method_simple rvoid pheap_block  ) 
 

Release a previously allocated method block back into the heap for future reallocation.

Note:
This implementation makes no distinction betwen method area heap and any other usage. Other implementations may choose to implement the JVM Spec section 3.5.4 more rigorously.
Parameters:
pheap_block An (rvoid *) previously returned by heap_get_method_simple()
Returns:
rvoid

Definition at line 418 of file heap_simple.c.

rvoid heap_free_stack_simple rvoid pheap_block  ) 
 

Release a previously allocated stack block back into the heap for future reallocation.

Parameters:
pheap_block An (rvoid *) previously returned by heap_get_stack_simple()
Returns:
rvoid

Definition at line 439 of file heap_simple.c.

rvoid heap_free_data_simple rvoid pheap_block  ) 
 

Release a previously allocated data block back into the heap for future reallocation.

Parameters:
pheap_block An (rvoid *) previously returned by heap_get_data_simple()
Returns:
rvoid

Definition at line 460 of file heap_simple.c.

int heap_get_error_simple rvoid badptr  ) 
 

Allocation failure diagnostic.

Returns an errno value per "errno.h" if a rnull pointer is passed in, namely from the most recent call to a heap allocation function. It may only be called once before the value is cleared. If a non-null pointer is passed in, ERROR0 is returned and the error status is again cleared.

Parameters:
badptr Return value from heap allocation function.
Returns:
ERROR0 when no error was found or non-null badptr given. heap_last_errno value otherwise.
< Typically found in <errno.h> or <sys/errno.h>

< Typically found in <errno.h> or <sys/errno.h>

< Typically found in <errno.h> or <sys/errno.h>

Definition at line 488 of file heap_simple.c.

References ERROR0, and heap_last_errno.


Generated on Fri Sep 30 19:00:11 2005 by  doxygen 1.4.4