// // Given a class handle cl construct a class handle of the type // representing array of cl. // Class_Handle class_get_array_of_class(Class_Handle cl) { Global_Env *env = VM_Global_State::loader_env; Class *arr_clss = resolve_class_array_of_class(env, cl); assert(arr_clss || exn_raised()); return arr_clss; } // class_get_array_of_class
Class* TypeDesc::load_type_desc() { #ifdef ORDER int class_status = 0; if(vm_order_record){ class_status = clss ? 1 : 0; U_32 tid = hythread_self()->thread_id; if (order_system_call[tid] == NULL) { char name[40]; sprintf(name, "SYSTEM_CALL.%d.log", tid); order_system_call[tid] = fopen64(name, "a+"); } #ifdef ORDER_DEBUG assert(order_system_call[tid] != NULL); fprintf(order_system_call[tid], "[%d] ", 21); #endif fprintf(order_system_call[tid], "%d\n", class_status); if(class_status == 1){ #ifdef ORDER_DEBUG // printf("[TYPE_DESC]: class : %s already loaded, thread id : %d\n", clss->get_name()->bytes, hythread_self()->thread_id); #endif return clss; } } else{ U_32 tid = hythread_self()->thread_id; if (order_system_call[tid] == NULL) { char name[40]; sprintf(name, "SYSTEM_CALL.%d.log", tid); order_system_call[tid] = fopen64(name, "r"); } #ifdef ORDER_DEBUG assert(order_system_call[tid] != NULL); int bit_num; fscanf(order_system_call[tid], "[%d]", &bit_num); assert(bit_num == 21); #endif fscanf(order_system_call[tid], "%d\n", &class_status); if(class_status == 1){ while(!clss){ usleep(1000); #ifdef ORDER_DEBUG printf("[TYPE_DESC]: usleep in TypeDesc::load_type_desc!!\n"); #endif } return clss; } } #else if (clss) return clss; // class already loaded #endif Global_Env* env = VM_Global_State::loader_env; Class* element_clss; switch (get_kind()) { case K_S1: return env->Byte_Class; case K_S2: return env->Short_Class; case K_S4: return env->Int_Class; case K_S8: return env->Long_Class; case K_F4: return env->Float_Class; case K_F8: return env->Double_Class; case K_Boolean: return env->Boolean_Class; case K_Char: return env->Char_Class; case K_Void: return env->Void_Class; case K_Object: assert (loader); assert (name); // FIXME: better to use LoadVerifyAndPrepareClass here - but this results in Recursive resolution collision in StartLoadingClass //c = loader->LoadVerifyAndPrepareClass(env, name); clss = loader->LoadClass(env, name); return clss; case K_Vector: assert (component_type); element_clss = component_type->load_type_desc(); if (!element_clss) return NULL; clss = resolve_class_array_of_class(env, element_clss); return clss; default: // All other types are not Java types, so fail LDIE(73, "Unexpected kind"); return NULL; } }