📄 jvm_mem.c
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2001
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* jvm_mem.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This file implements general memory initializer/finalizer, allocator/deallocator API
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
/*************************************************************************
* Include header files
*************************************************************************/
#include "jal.h"
#include "jvm_internal.h"
/*************************************************************************
* Global Definition
*************************************************************************/
static jvm_malloc_handler jvm_allocator;
static jvm_free_handler jvm_deallocator;
/*************************************************************************
* Function Definition
*************************************************************************/
/*****************************************************************************
* FUNCTION
* jvm_mem_config
* DESCRIPTION
*
* PARAMETERS
* allocator [IN]
* deallocator [IN]
* RETURNS
* void
*****************************************************************************/
void jvm_mem_config(jvm_malloc_handler allocator, jvm_free_handler deallocator)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
jvm_allocator = allocator;
jvm_deallocator = deallocator;
}
/*****************************************************************************
* FUNCTION
* _jvm_malloc
* DESCRIPTION
*
* PARAMETERS
* size [IN]
* filename [?]
* lineno [IN]
* RETURNS
* void
*****************************************************************************/
void *_jvm_malloc(kal_int32 size, char *filename, kal_int32 lineno)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
ASSERT(jvm_allocator);
return (*jvm_allocator) (size, filename, lineno);
}
/*****************************************************************************
* FUNCTION
* _jvm_free
* DESCRIPTION
*
* PARAMETERS
* ptr [?]
* filename [?]
* lineno [IN]
* RETURNS
* void
*****************************************************************************/
void _jvm_free(void *ptr, char *filename, kal_int32 lineno)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
ASSERT(jvm_deallocator);
(*jvm_deallocator) (ptr, filename, lineno);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -