void _jit_function_destroy(jit_function_t func) { if(!func) { return; } if(func->next) { func->next->prev = func->prev; } else { func->context->last_function = func->prev; } if(func->prev) { func->prev->next = func->next; } else { func->context->functions = func->next; } _jit_function_free_builder(func); jit_meta_destroy(&(func->meta)); jit_type_free(func->signature); jit_free(func); }
void _jit_block_free(jit_function_t func) { jit_block_t current = func->builder->first_block; jit_block_t next; while(current != 0) { next = current->next; jit_meta_destroy(&(current->meta)); jit_free(current); current = next; } func->builder->first_block = 0; func->builder->last_block = 0; func->builder->entry = 0; func->builder->current_block = 0; }
void _jit_function_destroy(jit_function_t func) { jit_context_t context; if(!func) { return; } context = func->context; if(func->next) { func->next->prev = func->prev; } else { context->last_function = func->prev; } if(func->prev) { func->prev->next = func->next; } else { context->functions = func->next; } _jit_function_free_builder(func); _jit_varint_free_data(func->bytecode_offset); jit_meta_destroy(&func->meta); jit_type_free(func->signature); _jit_memory_lock(context); #if !defined(JIT_BACKEND_INTERP) && (defined(jit_redirector_size) || defined(jit_indirector_size)) # if defined(jit_redirector_size) _jit_memory_free_trampoline(context, func->redirector); # else _jit_memory_free_trampoline(context, func->indirector); # endif #endif _jit_memory_free_function(context, func); _jit_memory_unlock(context); }