Refine aot call_indirect opcode translation (#492)

Re-implement aot call_indirect opcode translation: when calling non-import function, translate it by LLVM call IR to call the function in AOTed code, so as to avoid calling runtime aot_call_indirect API which is much slower. For import function, keep calling aot_call_indirect API due to the possible pointer/string argument conversion.

And add prompt info while app heap is corrupted, change emit_leb to emit_uint32 inter fast-interp to refine footprint.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-01-05 04:05:30 -06:00
committed by GitHub
parent f2a63d8623
commit 788cbf2a19
15 changed files with 529 additions and 191 deletions

View File

@ -109,12 +109,14 @@ gc_migrate(gc_handle_t handle,
char *pool_buf_new, gc_size_t pool_buf_size);
/**
* Destroy lock of heap
* Check whether the heap is corrupted
*
* @param handle the heap handle
* @param handle handle of the heap
*
* @return true if success, false otherwise
*/
void
gc_destroy_lock(gc_handle_t handle);
bool
gc_is_heap_corrupted(gc_handle_t handle);
/**
* Get Heap Stats

View File

@ -204,11 +204,12 @@ gc_migrate(gc_handle_t handle,
return 0;
}
void
gc_destroy_lock(gc_handle_t handle)
bool
gc_is_heap_corrupted(gc_handle_t handle)
{
gc_heap_t *heap = (gc_heap_t *) handle;
os_mutex_destroy(&heap->lock);
gc_heap_t *heap = (gc_heap_t *)handle;
return heap->is_heap_corrupted ? true : false;
}
#if BH_ENABLE_GC_VERIFY != 0

View File

@ -63,10 +63,10 @@ mem_allocator_migrate(mem_allocator_t allocator,
pool_buf_new, pool_buf_size);
}
void
mem_allocator_destroy_lock(mem_allocator_t allocator)
bool
mem_allocator_is_heap_corrupted(mem_allocator_t allocator)
{
gc_destroy_lock((gc_handle_t) allocator);
return gc_is_heap_corrupted((gc_handle_t) allocator);
}
#else /* else of DEFAULT_MEM_ALLOCATOR */
@ -181,19 +181,5 @@ mem_allocator_migrate(mem_allocator_t allocator,
(mem_allocator_tlsf *) allocator_old);
}
int
mem_allocator_init_lock(mem_allocator_t allocator)
{
mem_allocator_tlsf *allocator_tlsf = (mem_allocator_tlsf *)allocator;
return os_mutex_init(&allocator_tlsf->lock);
}
void
mem_allocator_destroy_lock(mem_allocator_t allocator)
{
mem_allocator_tlsf *allocator_tlsf = (mem_allocator_tlsf *)allocator;
os_mutex_destroy(&allocator_tlsf->lock);
}
#endif /* end of DEFAULT_MEM_ALLOCATOR */

View File

@ -42,8 +42,8 @@ int
mem_allocator_migrate(mem_allocator_t allocator,
char *pool_buf_new, uint32 pool_buf_size);
void
mem_allocator_destroy_lock(mem_allocator_t allocator);
bool
mem_allocator_is_heap_corrupted(mem_allocator_t allocator);
#ifdef __cplusplus
}