#include <HdrHeap.h>
Data Structures | |
struct | HeapGuard |
Struct to prevent garbage collection on heaps. More... | |
Public Member Functions | |
void | init () |
inkcoreapi void | destroy () |
HdrHeapObjImpl * | allocate_obj (int nbytes, int type) |
void | deallocate_obj (HdrHeapObjImpl *obj) |
char * | allocate_str (int nbytes) |
char * | expand_str (const char *old_str, int old_len, int new_len) |
char * | duplicate_str (const char *str, int nbytes) |
void | free_string (const char *s, int len) |
inkcoreapi int | marshal_length () |
inkcoreapi int | marshal (char *buf, int length) |
int | unmarshal (int buf_length, int obj_type, HdrHeapObjImpl **found_obj, RefCountObj *block_ref) |
int | unmarshal_size () const |
Computes the valid data size of an unmarshalled instance. | |
void | inherit_string_heaps (const HdrHeap *inherit_from) |
int | attach_block (IOBufferBlock *b, const char *use_start) |
void | set_ronly_str_heap_end (int slot, const char *end) |
void | lock_ronly_str_heap (int i) |
void | unlock_ronly_str_heap (int i) |
void | sanity_check_strs () |
bool | check_marshalled (uint32_t buf_length) |
void | dump_heap (int len=-1) |
int | demote_rw_str_heap () |
void | coalesce_str_heaps (int incoming_size=0) |
void | evacuate_from_str_heaps (HdrStrHeap *new_heap) |
size_t | required_space_for_evacuation () |
int | attach_str_heap (char *h_start, int h_len, RefCountObj *h_ref_obj, int *index) |
Data Fields | |
uint32_t | m_magic |
char * | m_free_start |
char * | m_data_start |
uint32_t | m_size |
bool | m_writeable |
HdrHeap * | m_next |
uint32_t | m_free_size |
Ptr< HdrStrHeap > | m_read_write_heap |
StrHeapDesc | m_ronly_heap [HDR_BUF_RONLY_HEAPS] |
int | m_lost_string_space |
Friends | |
class | CoreUtils |
Definition at line 180 of file HdrHeap.h.
HdrHeapObjImpl * HdrHeap::allocate_obj | ( | int | nbytes, | |
int | type | |||
) |
Definition at line 191 of file HdrHeap.cc.
References HDR_MAX_ALLOC_SIZE, HDR_PTR_SIZE, ink_assert, m_free_size, m_free_start, m_next, m_size, m_writeable, new_HdrHeap(), obj_init_header(), obj_is_aligned(), and ROUND.
Referenced by _mime_field_block_copy(), http_hdr_create(), mime_field_create(), mime_hdr_create(), and url_create().
char * HdrHeap::allocate_str | ( | int | nbytes | ) |
Definition at line 243 of file HdrHeap.cc.
References coalesce_str_heaps(), demote_rw_str_heap(), ink_assert, m_lost_string_space, m_read_write_heap, m_writeable, MAX_LOST_STR_SPACE, new_HdrStrHeap(), RETRY, and STR_HEAP_HDR_SIZE.
Referenced by duplicate_str(), HdrHeap_Coalesce(), mime_field_value_append(), mime_field_value_str_from_strlist(), url_string_get(), and url_string_get_ref().
int HdrHeap::attach_block | ( | IOBufferBlock * | b, | |
const char * | use_start | |||
) |
Definition at line 162 of file HdrTSOnly.cc.
References IOBufferBlock::buf(), coalesce_str_heaps(), IOBufferBlock::data, IOBufferBlock::end(), ink_assert, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, StrHeapDesc::m_ref_count_ptr, m_ronly_heap, m_writeable, RETRY, and IOBufferBlock::start().
Referenced by HTTPHdr::parse_req(), and HTTPHdr::parse_resp().
int HdrHeap::attach_str_heap | ( | char * | h_start, | |
int | h_len, | |||
RefCountObj * | h_ref_obj, | |||
int * | index | |||
) | [inline] |
Definition at line 979 of file HdrHeap.cc.
References HDR_BUF_RONLY_HEAPS, ink_assert, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, StrHeapDesc::m_locked, StrHeapDesc::m_ref_count_ptr, and m_ronly_heap.
Referenced by inherit_string_heaps().
bool HdrHeap::check_marshalled | ( | uint32_t | buf_length | ) |
Definition at line 825 of file HdrHeap.cc.
References HDR_BUF_MAGIC_MARSHALED, HDR_HEAP_HDR_SIZE, m_free_size, m_magic, m_ronly_heap, m_size, and m_writeable.
Referenced by HTTPInfo::check_marshalled().
void HdrHeap::coalesce_str_heaps | ( | int | incoming_size = 0 |
) |
Definition at line 366 of file HdrHeap.cc.
References evacuate_from_str_heaps(), ink_assert, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, m_lost_string_space, m_read_write_heap, StrHeapDesc::m_ref_count_ptr, m_ronly_heap, m_writeable, new_HdrStrHeap(), and required_space_for_evacuation().
Referenced by allocate_str(), attach_block(), and inherit_string_heaps().
void HdrHeap::deallocate_obj | ( | HdrHeapObjImpl * | obj | ) |
Definition at line 235 of file HdrHeap.cc.
References ink_assert, HdrHeapObjImpl::m_type, and m_writeable.
Referenced by _mime_field_block_destroy(), and http_hdr_url_set().
int HdrHeap::demote_rw_str_heap | ( | ) |
Definition at line 334 of file HdrHeap.cc.
References StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, Ptr< T >::m_ptr, m_read_write_heap, StrHeapDesc::m_ref_count_ptr, and m_ronly_heap.
Referenced by allocate_str().
void HdrHeap::destroy | ( | ) |
Definition at line 173 of file HdrHeap.cc.
References ats_free(), destroy(), HDR_HEAP_DEFAULT_SIZE, hdrHeapAllocator, m_next, m_read_write_heap, m_ronly_heap, m_size, this_thread(), and THREAD_FREE.
Referenced by HdrHeapSDKHandle::destroy(), destroy(), HdrHeap_Coalesce(), and TSMBufferDestroy().
void HdrHeap::dump_heap | ( | int | len = -1 |
) |
Definition at line 1096 of file HdrHeap.cc.
References content, HeapCheck::end, m_size, and memcpy.
Referenced by unmarshal().
char * HdrHeap::duplicate_str | ( | const char * | str, | |
int | nbytes | |||
) |
Definition at line 317 of file HdrHeap.cc.
References allocate_str(), and memcpy.
Referenced by mime_field_value_set(), mime_parser_parse(), and mime_str_u16_set().
void HdrHeap::evacuate_from_str_heaps | ( | HdrStrHeap * | new_heap | ) |
Definition at line 400 of file HdrHeap.cc.
References HDR_HEAP_OBJ_EMPTY, HDR_HEAP_OBJ_FIELD_BLOCK, HDR_HEAP_OBJ_HTTP_HEADER, HDR_HEAP_OBJ_MIME_HEADER, HDR_HEAP_OBJ_RAW, HDR_HEAP_OBJ_URL, ink_assert, ink_release_assert, m_data_start, m_free_start, HdrHeapObjImpl::m_length, m_next, HdrHeapObjImpl::m_type, and m_writeable.
Referenced by coalesce_str_heaps().
char * HdrHeap::expand_str | ( | const char * | old_str, | |
int | old_len, | |||
int | new_len | |||
) |
Definition at line 303 of file HdrHeap.cc.
References m_read_write_heap.
Referenced by mime_field_value_append().
void HdrHeap::free_string | ( | const char * | s, | |
int | len | |||
) | [inline] |
Definition at line 307 of file HdrHeap.h.
References m_lost_string_space.
Referenced by mime_field_value_set(), mime_hdr_field_delete(), and mime_str_u16_set().
void HdrHeap::inherit_string_heaps | ( | const HdrHeap * | inherit_from | ) |
Definition at line 1016 of file HdrHeap.cc.
References attach_str_heap(), coalesce_str_heaps(), ink_assert, ink_release_assert, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, m_lost_string_space, Ptr< T >::m_ptr, m_read_write_heap, StrHeapDesc::m_ref_count_ptr, m_ronly_heap, m_writeable, MAX_LOST_STR_SPACE, and STR_HEAP_HDR_SIZE.
Referenced by http_hdr_copy_onto(), mime_hdr_copy_onto(), url_copy_onto(), and url_copy_onto_as_server_url().
void HdrHeap::init | ( | void | ) | [inline] |
Definition at line 90 of file HdrHeap.cc.
References ink_assert, m_data_start, m_free_size, m_free_start, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, StrHeapDesc::m_locked, m_lost_string_space, m_magic, m_next, Ptr< T >::m_ptr, m_read_write_heap, StrHeapDesc::m_ref_count_ptr, m_ronly_heap, m_size, and m_writeable.
Referenced by new_HdrHeap().
void HdrHeap::lock_ronly_str_heap | ( | int | i | ) | [inline] |
Definition at line 213 of file HdrHeap.h.
References StrHeapDesc::m_locked, and m_ronly_heap.
Referenced by HTTPHdr::parse_req(), and HTTPHdr::parse_resp().
int HdrHeap::marshal | ( | char * | buf, | |
int | length | |||
) |
Definition at line 618 of file HdrHeap.cc.
References HeapCheck::end, MarshalXlate::end, HDR_HEAP_OBJ_EMPTY, HDR_HEAP_OBJ_FIELD_BLOCK, HDR_HEAP_OBJ_HTTP_HEADER, HDR_HEAP_OBJ_MIME_HEADER, HDR_HEAP_OBJ_RAW, HDR_HEAP_OBJ_URL, HDR_PTR_ALIGNMENT_MASK, HDR_PTR_SIZE, ink_assert, ink_release_assert, m_data_start, m_free_size, m_free_start, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, HdrHeapObjImpl::m_length, m_lost_string_space, m_magic, m_next, Ptr< T >::m_ptr, m_read_write_heap, StrHeapDesc::m_ref_count_ptr, m_ronly_heap, m_size, HdrHeapObjImpl::m_type, m_writeable, memcpy, obj_is_aligned(), MarshalXlate::offset, ROUND, start, and MarshalXlate::start.
Referenced by HTTPInfo::marshal().
int HdrHeap::marshal_length | ( | ) |
Definition at line 552 of file HdrHeap.cc.
References HDR_PTR_SIZE, m_data_start, m_free_start, StrHeapDesc::m_heap_len, m_next, m_read_write_heap, m_ronly_heap, and ROUND.
Referenced by HTTPInfo::marshal_length().
size_t HdrHeap::required_space_for_evacuation | ( | ) |
Definition at line 444 of file HdrHeap.cc.
References HDR_HEAP_OBJ_EMPTY, HDR_HEAP_OBJ_FIELD_BLOCK, HDR_HEAP_OBJ_HTTP_HEADER, HDR_HEAP_OBJ_MIME_HEADER, HDR_HEAP_OBJ_RAW, HDR_HEAP_OBJ_URL, ink_release_assert, m_data_start, m_free_start, HdrHeapObjImpl::m_length, m_next, and HdrHeapObjImpl::m_type.
Referenced by coalesce_str_heaps().
void HdrHeap::sanity_check_strs | ( | ) |
Definition at line 482 of file HdrHeap.cc.
References HeapCheck::end, HDR_HEAP_OBJ_EMPTY, HDR_HEAP_OBJ_FIELD_BLOCK, HDR_HEAP_OBJ_HTTP_HEADER, HDR_HEAP_OBJ_MIME_HEADER, HDR_HEAP_OBJ_RAW, HDR_HEAP_OBJ_URL, ink_release_assert, m_data_start, m_free_start, StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, HdrHeapObjImpl::m_length, m_next, Ptr< T >::m_ptr, m_read_write_heap, m_ronly_heap, HdrHeapObjImpl::m_type, and HeapCheck::start.
void HdrHeap::set_ronly_str_heap_end | ( | int | slot, | |
const char * | end | |||
) |
Definition at line 141 of file HdrTSOnly.cc.
References ink_assert, StrHeapDesc::m_heap_len, and m_ronly_heap.
Referenced by HTTPHdr::parse_req(), and HTTPHdr::parse_resp().
void HdrHeap::unlock_ronly_str_heap | ( | int | i | ) | [inline] |
Definition at line 217 of file HdrHeap.h.
References StrHeapDesc::m_heap_len, StrHeapDesc::m_heap_start, StrHeapDesc::m_locked, StrHeapDesc::m_ref_count_ptr, and m_ronly_heap.
Referenced by HTTPHdr::parse_req(), and HTTPHdr::parse_resp().
int HdrHeap::unmarshal | ( | int | buf_length, | |
int | obj_type, | |||
HdrHeapObjImpl ** | found_obj, | |||
RefCountObj * | block_ref | |||
) |
Definition at line 872 of file HdrHeap.cc.
References dump_heap(), HDR_BUF_MAGIC_MARSHALED, HDR_HEAP_OBJ_EMPTY, HDR_HEAP_OBJ_FIELD_BLOCK, HDR_HEAP_OBJ_HTTP_HEADER, HDR_HEAP_OBJ_MIME_HEADER, HDR_HEAP_OBJ_URL, HDR_PTR_SIZE, ink_assert, ink_release_assert, m_data_start, m_free_size, m_free_start, StrHeapDesc::m_heap_start, HdrHeapObjImpl::m_length, m_magic, Ptr< T >::m_ptr, StrHeapDesc::m_ref_count_ptr, m_ronly_heap, m_size, HdrHeapObjImpl::m_type, m_writeable, obj_is_aligned(), ROUND, and unmarshal_size().
Referenced by HTTPInfo::unmarshal(), and HTTPHdr::unmarshal().
int HdrHeap::unmarshal_size | ( | ) | const [inline] |
Computes the valid data size of an unmarshalled instance.
Callers should round up to HDR_PTR_SIZE to get the actual footprint.
Definition at line 315 of file HdrHeap.h.
References StrHeapDesc::m_heap_len, m_ronly_heap, and m_size.
Referenced by cache_bc::HTTPInfo_v21::copy_and_upgrade_unmarshalled_to_v23(), cache_bc::HTTPInfo_v21::marshalled_length(), and unmarshal().
char* HdrHeap::m_data_start |
Definition at line 248 of file HdrHeap.h.
Referenced by evacuate_from_str_heaps(), init(), load_buffer(), CoreUtils::load_http_hdr(), loop_over_heap_objs(), marshal(), marshal_length(), required_space_for_evacuation(), sanity_check_strs(), and unmarshal().
uint32_t HdrHeap::m_free_size |
Definition at line 263 of file HdrHeap.h.
Referenced by allocate_obj(), check_marshalled(), init(), CoreUtils::load_http_hdr(), marshal(), and unmarshal().
char* HdrHeap::m_free_start |
Definition at line 247 of file HdrHeap.h.
Referenced by allocate_obj(), evacuate_from_str_heaps(), init(), load_buffer(), CoreUtils::load_http_hdr(), loop_over_heap_objs(), marshal(), marshal_length(), required_space_for_evacuation(), sanity_check_strs(), and unmarshal().
Definition at line 303 of file HdrHeap.h.
Referenced by allocate_str(), coalesce_str_heaps(), free_string(), inherit_string_heaps(), init(), marshal(), and HttpTransact::merge_response_header_with_cached_header().
uint32_t HdrHeap::m_magic |
Definition at line 246 of file HdrHeap.h.
Referenced by check_marshalled(), init(), load_buffer(), CoreUtils::load_http_hdr(), loop_over_heap_objs(), marshal(), sdk_sanity_check_mbuffer(), CoreUtils::test_HdrHeap(), and unmarshal().
Definition at line 260 of file HdrHeap.h.
Referenced by allocate_obj(), destroy(), evacuate_from_str_heaps(), HdrHeap_Coalesce(), init(), CoreUtils::load_http_hdr(), marshal(), marshal_length(), required_space_for_evacuation(), and sanity_check_strs().
Definition at line 301 of file HdrHeap.h.
Referenced by allocate_str(), coalesce_str_heaps(), demote_rw_str_heap(), destroy(), expand_str(), HdrHeap_Coalesce(), HdrHeap::HeapGuard::HeapGuard(), inherit_string_heaps(), init(), CoreUtils::load_http_hdr(), marshal(), marshal_length(), and sanity_check_strs().
StrHeapDesc HdrHeap::m_ronly_heap[HDR_BUF_RONLY_HEAPS] |
Definition at line 302 of file HdrHeap.h.
Referenced by attach_block(), attach_str_heap(), check_marshalled(), coalesce_str_heaps(), demote_rw_str_heap(), destroy(), HdrHeap_Coalesce(), HdrHeap::HeapGuard::HeapGuard(), inherit_string_heaps(), init(), load_buffer(), CoreUtils::load_http_hdr(), lock_ronly_str_heap(), marshal(), marshal_length(), sanity_check_strs(), set_ronly_str_heap_end(), unlock_ronly_str_heap(), unmarshal(), and unmarshal_size().
uint32_t HdrHeap::m_size |
Definition at line 249 of file HdrHeap.h.
Referenced by allocate_obj(), check_marshalled(), destroy(), dump_heap(), init(), CoreUtils::load_http_hdr(), loop_over_heap_objs(), marshal(), new_HdrHeap(), unmarshal(), and unmarshal_size().
bool HdrHeap::m_writeable |
Definition at line 251 of file HdrHeap.h.
Referenced by allocate_obj(), allocate_str(), attach_block(), check_marshalled(), coalesce_str_heaps(), deallocate_obj(), evacuate_from_str_heaps(), inherit_string_heaps(), init(), CoreUtils::load_http_hdr(), marshal(), and unmarshal().