lscript_alloc.h File Reference

General heap management for scripting system. More...

#include "lscript_byteconvert.h"
#include "lscript_library.h"

Include dependency graph for lscript_alloc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  LLScriptAllocEntry

Functions

void reset_hp_to_safe_spot (const U8 *buffer)
void alloc_entry2bytestream (U8 *buffer, S32 &offset, const LLScriptAllocEntry &entry)
void bytestream2alloc_entry (LLScriptAllocEntry &entry, U8 *buffer, S32 &offset)
BOOL lsa_create_heap (U8 *heap_start, S32 size)
void lsa_fprint_heap (U8 *buffer, FILE *fp)
void lsa_print_heap (U8 *buffer)
S32 lsa_heap_add_data (U8 *buffer, LLScriptLibData *data, S32 heapsize, BOOL b_delete)
S32 lsa_heap_top (U8 *heap_start, S32 maxsize)
void lsa_split_block (U8 *buffer, S32 &offset, S32 size, LLScriptAllocEntry &entry)
void lsa_insert_data (U8 *buffer, S32 &offset, LLScriptLibData *data, LLScriptAllocEntry &entry, S32 heapsize)
S32 lsa_create_data_block (U8 **buffer, LLScriptLibData *data, S32 base_offset)
void lsa_increase_ref_count (U8 *buffer, S32 offset)
void lsa_decrease_ref_count (U8 *buffer, S32 offset)
S32 get_max_heap_size (U8 *buffer)
LLScriptLibDatalsa_get_data (U8 *buffer, S32 &offset, BOOL b_dec_ref)
LLScriptLibDatalsa_get_list_ptr (U8 *buffer, S32 &offset, BOOL b_dec_ref)
S32 lsa_cat_strings (U8 *buffer, S32 offset1, S32 offset2, S32 heapsize)
S32 lsa_cmp_strings (U8 *buffer, S32 offset1, S32 offset2)
S32 lsa_cat_lists (U8 *buffer, S32 offset1, S32 offset2, S32 heapsize)
S32 lsa_cmp_lists (U8 *buffer, S32 offset1, S32 offset2)
S32 lsa_preadd_lists (U8 *buffer, LLScriptLibData *data, S32 offset2, S32 heapsize)
S32 lsa_postadd_lists (U8 *buffer, S32 offset1, LLScriptLibData *data, S32 heapsize)
LLScriptLibDatalsa_bubble_sort (LLScriptLibData *src, S32 stride, S32 ascending)
LLScriptLibDatalsa_randomize (LLScriptLibData *src, S32 stride)

Variables

const S32 MAX_HEAP_SIZE = TOP_OF_MEMORY
const S32 SIZEOF_SCRIPT_ALLOC_ENTRY = 7


Detailed Description

General heap management for scripting system.

LicenseInfo
firstyear=2002&license=viewergpl

Copyright (c) 2002-2007, Linden Research, Inc.

Second Life Viewer Source Code The source code in this file ("Source Code") is provided by Linden Lab to you under the terms of the GNU General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other License"), formally executed by you and Linden Lab. Terms of the GPL can be found in doc/GPL-license.txt in this distribution, or online at http://secondlife.com/developers/opensource/gplv2

There are special exceptions to the terms and conditions of the GPL as it is applied to this Source Code. View the full text of the exception in the file doc/FLOSS-exception.txt in this software distribution, or online at http://secondlife.com/developers/opensource/flossexception

By copying, modifying or distributing this software, you acknowledge that you have read and understood your obligations described above, and agree to abide by those obligations.

ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. $/LicenseInfo$

Definition in file lscript_alloc.h.


Function Documentation

void alloc_entry2bytestream ( U8 buffer,
S32 offset,
const LLScriptAllocEntry entry 
) [inline]

Definition at line 88 of file lscript_alloc.h.

References byte2bytestream(), integer2bytestream(), LSRF_BOUND_CHECK_ERROR, MAX_HEAP_SIZE, LLScriptAllocEntry::mReferenceCount, LLScriptAllocEntry::mSize, LLScriptAllocEntry::mType, s162bytestream(), and set_fault().

Referenced by lsa_create_data_block(), lsa_create_heap(), lsa_decrease_ref_count(), lsa_heap_add_data(), lsa_increase_ref_count(), and lsa_split_block().

void bytestream2alloc_entry ( LLScriptAllocEntry entry,
U8 buffer,
S32 offset 
) [inline]

Definition at line 103 of file lscript_alloc.h.

References bytestream2byte(), bytestream2integer(), bytestream2s16(), LSRF_BOUND_CHECK_ERROR, MAX_HEAP_SIZE, LLScriptAllocEntry::mReferenceCount, LLScriptAllocEntry::mSize, LLScriptAllocEntry::mType, reset_hp_to_safe_spot(), and set_fault().

Referenced by lsa_decrease_ref_count(), lsa_fprint_heap(), lsa_get_data(), lsa_get_list_ptr(), lsa_heap_add_data(), lsa_heap_top(), lsa_increase_ref_count(), and lsa_print_heap().

S32 get_max_heap_size ( U8 buffer  )  [inline]

Definition at line 181 of file lscript_alloc.h.

References get_register(), LREG_HR, and LREG_SP.

Referenced by float_list_operation(), integer_list_operation(), key_list_operation(), list_float_operation(), list_integer_operation(), list_key_operation(), list_list_operation(), list_quaternion_operation(), list_string_operation(), list_vector_operation(), lscript_push_return_variable(), lscript_push_variable(), quaternion_list_operation(), run_cast(), run_pushargs(), run_stacktol(), run_stacktos(), string_list_operation(), string_string_operation(), and vector_list_operation().

LLScriptLibData* lsa_bubble_sort ( LLScriptLibData src,
S32  stride,
S32  ascending 
) [inline]

Definition at line 227 of file lscript_alloc.h.

References LLScriptLibData::getListLength(), i, j, LLScriptLibData::mListp, NULL, s, S32, and TRUE.

S32 lsa_cat_lists ( U8 buffer,
S32  offset1,
S32  offset2,
S32  heapsize 
)

Definition at line 919 of file lscript_library/lscript_alloc.cpp.

References get_register(), LREG_FR, lsa_get_data(), lsa_heap_add_data(), LSRF_HEAP_ERROR, LST_LIST, LLScriptLibData::mListp, LLScriptLibData::mType, NULL, tut::runner, set_fault(), and TRUE.

Referenced by list_list_operation().

S32 lsa_cat_strings ( U8 buffer,
S32  offset1,
S32  offset2,
S32  heapsize 
)

Definition at line 660 of file lscript_library/lscript_alloc.cpp.

References get_register(), LREG_FR, lsa_get_data(), lsa_heap_add_data(), LSRF_HEAP_ERROR, LST_KEY, LST_STRING, LLScriptLibData::mKey, LLScriptLibData::mString, LLScriptLibData::mType, NULL, S32, set_fault(), size, and TRUE.

Referenced by string_string_operation().

S32 lsa_cmp_lists ( U8 buffer,
S32  offset1,
S32  offset2 
)

Definition at line 971 of file lscript_library/lscript_alloc.cpp.

References FALSE, get_register(), LLScriptLibData::getListLength(), LREG_FR, lsa_get_data(), LSRF_HEAP_ERROR, LST_LIST, LLScriptLibData::mType, S32, set_fault(), and TRUE.

Referenced by list_list_operation().

S32 lsa_cmp_strings ( U8 buffer,
S32  offset1,
S32  offset2 
)

Definition at line 728 of file lscript_library/lscript_alloc.cpp.

References get_register(), LREG_FR, lsa_get_data(), LSRF_HEAP_ERROR, LST_KEY, LST_STRING, LLScriptLibData::mKey, LLScriptLibData::mString, LLScriptLibData::mType, NULL, S32, set_fault(), and TRUE.

Referenced by key_key_operation(), key_string_operation(), string_key_operation(), and string_string_operation().

S32 lsa_create_data_block ( U8 **  buffer,
LLScriptLibData data,
S32  base_offset 
)

Definition at line 327 of file lscript_library/lscript_alloc.cpp.

References alloc_entry2bytestream(), byte2bytestream(), char2bytestream(), float2bytestream(), LLScriptLibData::getListLength(), integer2bytestream(), llendl, llerrs, lsa_create_data_block(), LSCRIPTDataSize, LST_FLOATINGPOINT, LST_INTEGER, LST_KEY, LST_LIST, LST_NULL, LST_QUATERNION, LST_STRING, LST_VECTOR, MAX_HEAP_SIZE, LLScriptLibData::mFP, LLScriptLibData::mInteger, LLScriptLibData::mKey, LLScriptLibData::mListp, LLScriptLibData::mQuat, LLScriptAllocEntry::mReferenceCount, LLScriptAllocEntry::mSize, LLScriptLibData::mString, LLScriptAllocEntry::mType, LLScriptLibData::mType, LLScriptLibData::mVec, NULL, quaternion2bytestream(), S32, size, SIZEOF_SCRIPT_ALLOC_ENTRY, and vector2bytestream().

Referenced by lsa_create_data_block(), LLScriptScript::recurse(), LLScriptGlobalVariable::recurse(), LLScriptSAList::recurse(), and LLScriptConstantString::recurse().

BOOL lsa_create_heap ( U8 heap_start,
S32  size 
)

Definition at line 69 of file lscript_library/lscript_alloc.cpp.

References alloc_entry2bytestream(), LST_NULL, S32, and TRUE.

void lsa_decrease_ref_count ( U8 buffer,
S32  offset 
)

Definition at line 486 of file lscript_library/lscript_alloc.cpp.

References alloc_entry2bytestream(), bytestream2alloc_entry(), bytestream2integer(), get_register(), i, LREG_FR, LREG_HP, LREG_HR, lsa_decrease_ref_count(), LSRF_BOUND_CHECK_ERROR, LSRF_HEAP_ERROR, LST_LIST, LST_NULL, LLScriptAllocEntry::mReferenceCount, LLScriptAllocEntry::mType, S32, and set_fault().

Referenced by lsa_decrease_ref_count(), lsa_get_data(), lsa_get_list_ptr(), lscript_pop_variable(), lscript_stacktol_pop_variable(), run_cast(), run_jumpif(), run_jumpnif(), run_loadglp(), run_loadgsp(), run_loadlp(), run_loadsp(), run_popl(), run_pops(), run_print(), run_storegl(), run_storegs(), run_storel(), and run_stores().

void lsa_fprint_heap ( U8 buffer,
FILE *  fp 
)

Definition at line 852 of file lscript_library/lscript_alloc.cpp.

References bytestream2alloc_entry(), bytestream2char(), bytestream2float(), bytestream2integer(), bytestream2quaternion(), bytestream2vector(), get_register(), LREG_HR, LSCRIPTTypeNames, LST_FLOATINGPOINT, LST_INTEGER, LST_KEY, LST_LIST, LST_QUATERNION, LST_STRING, LST_VECTOR, MAX_HEAP_SIZE, LLQuaternion::mQ, LLScriptAllocEntry::mReferenceCount, LLScriptAllocEntry::mSize, LLScriptAllocEntry::mType, LLVector3::mV, S32, VS, VX, VY, and VZ.

Referenced by LLScriptLSOParse::printHeap().

LLScriptLibData* lsa_get_data ( U8 buffer,
S32 offset,
BOOL  b_dec_ref 
)

Definition at line 530 of file lscript_library/lscript_alloc.cpp.

References bytestream2alloc_entry(), bytestream2char(), bytestream2float(), bytestream2integer(), bytestream2quaternion(), bytestream2vector(), LLScriptLibData::checkForMultipleLists(), FALSE, get_register(), gLSAStringRead, i, LREG_FR, LREG_HP, LREG_HR, lsa_decrease_ref_count(), lsa_get_data(), LSRF_BOUND_CHECK_ERROR, LSRF_HEAP_ERROR, LSRF_NESTING_LISTS, LST_FLOATINGPOINT, LST_INTEGER, LST_KEY, LST_LIST, LST_QUATERNION, LST_STRING, LST_VECTOR, LLScriptLibData::mFP, LLScriptLibData::mInteger, LLScriptLibData::mKey, LLScriptLibData::mListp, LLScriptLibData::mQuat, LLScriptLibData::mString, LLScriptAllocEntry::mType, LLScriptLibData::mType, LLScriptLibData::mVec, S32, and set_fault().

Referenced by key_list_operation(), list_key_operation(), list_string_operation(), lsa_cat_lists(), lsa_cat_strings(), lsa_cmp_lists(), lsa_cmp_strings(), lsa_get_data(), lsa_get_list_ptr(), lsa_postadd_lists(), lsa_preadd_lists(), lscript_stacktol_pop_variable(), run_cast(), run_print(), and string_list_operation().

LLScriptLibData* lsa_get_list_ptr ( U8 buffer,
S32 offset,
BOOL  b_dec_ref 
)

Definition at line 610 of file lscript_library/lscript_alloc.cpp.

References base, bytestream2alloc_entry(), bytestream2integer(), FALSE, get_register(), i, LREG_FR, LREG_HP, LREG_HR, lsa_decrease_ref_count(), lsa_get_data(), LSRF_BOUND_CHECK_ERROR, LSRF_HEAP_ERROR, LST_LIST, LLScriptLibData::mListp, LLScriptAllocEntry::mType, NULL, S32, and set_fault().

Referenced by lscript_pop_variable(), run_jumpif(), and run_jumpnif().

S32 lsa_heap_add_data ( U8 buffer,
LLScriptLibData data,
S32  heapsize,
BOOL  b_delete 
)

Definition at line 115 of file lscript_library/lscript_alloc.cpp.

References alloc_entry2bytestream(), bytestream2alloc_entry(), LLScriptLibData::checkForMultipleLists(), get_register(), LLScriptLibData::getListLength(), LREG_FR, LREG_HP, LREG_HR, lsa_insert_data(), lsa_split_block(), LSRF_NESTING_LISTS, LSRF_STACK_HEAP_COLLISION, LST_FLOATINGPOINT, LST_INTEGER, LST_KEY, LST_LIST, LST_QUATERNION, LST_STRING, LST_VECTOR, LLScriptLibData::mKey, LLScriptAllocEntry::mReferenceCount, LLScriptAllocEntry::mSize, LLScriptLibData::mString, LLScriptLibData::mType, LLScriptAllocEntry::mType, reset_hp_to_safe_spot(), S32, set_fault(), set_register(), size, and SIZEOF_SCRIPT_ALLOC_ENTRY.

Referenced by lsa_cat_lists(), lsa_cat_strings(), lsa_insert_data(), lsa_postadd_lists(), lsa_preadd_lists(), lscript_push_return_variable(), lscript_push_variable(), run_cast(), run_pushargs(), run_stacktol(), and run_stacktos().

S32 lsa_heap_top ( U8 heap_start,
S32  maxsize 
)

Definition at line 80 of file lscript_library/lscript_alloc.cpp.

References bytestream2alloc_entry(), LLScriptAllocEntry::mSize, and S32.

void lsa_increase_ref_count ( U8 buffer,
S32  offset 
)

Definition at line 459 of file lscript_library/lscript_alloc.cpp.

References alloc_entry2bytestream(), bytestream2alloc_entry(), get_register(), LREG_FR, LREG_HP, LREG_HR, LSRF_BOUND_CHECK_ERROR, LLScriptAllocEntry::mReferenceCount, S32, and set_fault().

Referenced by run_dupl(), run_dups(), run_pushgl(), run_pushgs(), run_pushl(), run_pushs(), run_storegl(), run_storegs(), run_storel(), and run_stores().

void lsa_insert_data ( U8 buffer,
S32 offset,
LLScriptLibData data,
LLScriptAllocEntry entry,
S32  heapsize 
)

Definition at line 282 of file lscript_library/lscript_alloc.cpp.

References char2bytestream(), FALSE, float2bytestream(), get_register(), LLScriptLibData::getListLength(), integer2bytestream(), LREG_FR, lsa_heap_add_data(), LST_FLOATINGPOINT, LST_INTEGER, LST_KEY, LST_LIST, LST_QUATERNION, LST_STRING, LST_VECTOR, LLScriptLibData::mFP, LLScriptLibData::mInteger, LLScriptLibData::mKey, LLScriptLibData::mListp, LLScriptLibData::mQuat, LLScriptLibData::mString, LLScriptLibData::mType, LLScriptLibData::mVec, quaternion2bytestream(), S32, and vector2bytestream().

Referenced by lsa_heap_add_data().

S32 lsa_postadd_lists ( U8 buffer,
S32  offset1,
LLScriptLibData data,
S32  heapsize 
)

Definition at line 1049 of file lscript_library/lscript_alloc.cpp.

References get_register(), LREG_FR, lsa_get_data(), lsa_heap_add_data(), LSRF_HEAP_ERROR, LST_LIST, LLScriptLibData::mListp, LLScriptLibData::mType, tut::runner, set_fault(), and TRUE.

Referenced by list_float_operation(), list_integer_operation(), list_key_operation(), list_quaternion_operation(), list_string_operation(), and list_vector_operation().

S32 lsa_preadd_lists ( U8 buffer,
LLScriptLibData data,
S32  offset2,
S32  heapsize 
)

Definition at line 1014 of file lscript_library/lscript_alloc.cpp.

References get_register(), LREG_FR, lsa_get_data(), lsa_heap_add_data(), LSRF_HEAP_ERROR, LST_LIST, LLScriptLibData::mListp, LLScriptLibData::mType, tut::runner, set_fault(), and TRUE.

Referenced by float_list_operation(), integer_list_operation(), key_list_operation(), quaternion_list_operation(), string_list_operation(), and vector_list_operation().

void lsa_print_heap ( U8 buffer  ) 

Definition at line 782 of file lscript_library/lscript_alloc.cpp.

Referenced by LLScriptExecute::run().

LLScriptLibData* lsa_randomize ( LLScriptLibData src,
S32  stride 
)

Definition at line 1082 of file lscript_library/lscript_alloc.cpp.

References LLScriptLibData::getListLength(), ll_rand(), LLScriptLibData::mListp, NULL, and S32.

void lsa_split_block ( U8 buffer,
S32 offset,
S32  size,
LLScriptAllocEntry entry 
)

Definition at line 258 of file lscript_library/lscript_alloc.cpp.

References alloc_entry2bytestream(), get_register(), LREG_FR, LLScriptAllocEntry::mSize, S32, and SIZEOF_SCRIPT_ALLOC_ENTRY.

Referenced by lsa_heap_add_data().

void reset_hp_to_safe_spot ( const U8 buffer  ) 

Definition at line 63 of file lscript_library/lscript_alloc.cpp.

Referenced by bytestream2alloc_entry(), lsa_heap_add_data(), and set_fault().


Variable Documentation

const S32 MAX_HEAP_SIZE = TOP_OF_MEMORY

Definition at line 67 of file lscript_alloc.h.

Referenced by alloc_entry2bytestream(), bytestream2alloc_entry(), lsa_create_data_block(), lsa_fprint_heap(), and lsa_print_heap().

const S32 SIZEOF_SCRIPT_ALLOC_ENTRY = 7

Definition at line 86 of file lscript_alloc.h.

Referenced by lsa_create_data_block(), lsa_heap_add_data(), lsa_split_block(), lscript_pop_variable(), lscript_stacktol_pop_variable(), run_cast(), run_jumpif(), run_jumpnif(), and run_print().


Generated on Thu Jul 1 06:10:52 2010 for Second Life Viewer by  doxygen 1.4.7