Beispiel #1
0
Global_Env::~Global_Env()
{
    GlobalClassLoaderIterator ClIterator;
    ClassLoader *cl = ClIterator.first();
    
    while(cl) {
        ClassLoader* cltmp = cl;
        cl = ClIterator.next();
        delete cltmp;
    }
    ClassLoader::DeleteClassLoaderTable();

    delete TI;
    TI = NULL;

    delete NCAI;
    NCAI = NULL;

    delete m_java_properties;
    m_java_properties = NULL;
    delete m_vm_properties;
    m_vm_properties = NULL;

    nso_clear_lookup_table(nsoTable);
    nsoTable = NULL;

    compile_clear_dynamic_code_list(dcList);
    dcList = NULL;

    // uninitialize critical sections
    delete p_jit_a_method_lock;
    delete p_vtable_patch_lock;
    delete p_handle_lock;
    delete p_method_call_lock;
    delete p_dclist_lock;
    delete p_suspend_lock;

    // Unload jit instances.
    vm_delete_all_jits();

    // Unload all system native libraries.
    natives_cleanup();

    // Unload GC-related resources.
    gc_wrapup();

    delete GlobalCodeMemoryManager;
    GlobalCodeMemoryManager = NULL;
    delete VTableMemoryManager;
    VTableMemoryManager = NULL;
 
    // TODO: Currently, there is only one global thread library instance.
    // It still can be used after VM is destroyed.
    // hythread_lib_destroy(hythread_lib);
 }
Beispiel #2
0
Global_Env::~Global_Env()
{

#ifdef ORDER
#ifdef RECORD_STATIC_IN_FIELD
    finalize_all_field_access_info();
#endif
#endif

    GlobalClassLoaderIterator ClIterator;
    ClassLoader *cl = ClIterator.first();
    
    while(cl) {
        ClassLoader* cltmp = cl;
        cl = ClIterator.next();
        delete cltmp;
    }
    ClassLoader::DeleteClassLoaderTable();

    delete TI;
    TI = NULL;

    delete NCAI;
    NCAI = NULL;

    delete m_java_properties;
    m_java_properties = NULL;
    delete m_vm_properties;
    m_vm_properties = NULL;

    nso_clear_lookup_table(nsoTable);
    nsoTable = NULL;

    compile_clear_dynamic_code_list(dcList);
    dcList = NULL;

    // uninitialize critical sections
    delete p_jit_a_method_lock;
    delete p_vtable_patch_lock;
    delete p_handle_lock;
    delete p_method_call_lock;
    delete p_dclist_lock;
    delete p_suspend_lock;

    // Unload jit instances.
    vm_delete_all_jits();

    // Unload all system native libraries.
    natives_cleanup();

    // Unload GC-related resources.
    gc_wrapup();

#ifdef ORDER_PER_EVA
    dump_method_count();
#endif


#ifdef ORDER
#ifdef ORDER_DEBUG
    printf("[ORDER]: Flush and Close all system call log!!!\n");
#endif
    for (int i = 0 ; i < ORDER_THREAD_NUM ; i ++)
    {
        if (order_system_call[i] != NULL)
        {
            fflush(order_system_call[i]);
            fclose(order_system_call[i]);
            order_system_call[i] = NULL;
        }

        if (systemCallCompile[i] != NULL)
        {
            fflush(systemCallCompile[i]);
            fclose(systemCallCompile[i]);
            systemCallCompile[i] = NULL;
        }

        if(order_system_call_prepare[i] != NULL){
            fflush(order_system_call_prepare[i]);
            fclose(order_system_call_prepare[i]);
            order_system_call_prepare[i] = NULL;
        }

        if(order_system_call_verify[i] != NULL){
            fflush(order_system_call_verify[i]);
            fclose(order_system_call_verify[i]);
            order_system_call_verify[i] = NULL;
        }

        if(order_system_call_in_compile[i] != NULL){
            fflush(order_system_call_in_compile[i]);
            fclose(order_system_call_in_compile[i]);
            order_system_call_in_compile[i] = NULL;
        }

        if(systemCallMemmove[i] != NULL){
            fflush(systemCallMemmove[i]);
            fclose(systemCallMemmove[i]);
            systemCallMemmove[i] = NULL;
        }
		
        if(systemCallWaitFile[i] != NULL){
            fflush(systemCallWaitFile[i]);
            fclose(systemCallWaitFile[i]);
            systemCallWaitFile[i] = NULL;
        }

        if(systemCallTimeFile[i] != NULL){
            fflush(systemCallTimeFile[i]);
            fclose(systemCallTimeFile[i]);
            systemCallTimeFile[i] = NULL;
        }

        if(order_system_call_park[i] != NULL){
            fflush(order_system_call_park[i]);
            fclose(order_system_call_park[i]);
            order_system_call_park[i] = NULL;
        }
    }
#endif

    delete GlobalCodeMemoryManager;
    GlobalCodeMemoryManager = NULL;
    delete VTableMemoryManager;
    VTableMemoryManager = NULL;
 
    // TODO: Currently, there is only one global thread library instance.
    // It still can be used after VM is destroyed.
    // hythread_lib_destroy(hythread_lib);
 }