Index: vm/em/src/EBProfileCollector.cpp =================================================================== --- vm/em/src/EBProfileCollector.cpp (revision 639193) +++ vm/em/src/EBProfileCollector.cpp (working copy) @@ -27,6 +27,9 @@ #include "cxxlog.h" #include #include "port_mutex.h" +#include "open/vm_class_loading.h" +#include "open/vm_class_info.h" +#include "open/vm.h" #define LOG_DOMAIN "em" Index: vm/em/src/EdgeProfileCollector.h =================================================================== --- vm/em/src/EdgeProfileCollector.h (revision 639193) +++ vm/em/src/EdgeProfileCollector.h (working copy) @@ -23,7 +23,7 @@ #define _EDGE_PROFILE_COLLECTOR_H_ #include "DrlProfileCollectionFramework.h" -#include "open/vm_util.h" +#include "open/hythread_ext.h" #include #include Index: vm/em/src/NValueProfileCollector.cpp =================================================================== --- vm/em/src/NValueProfileCollector.cpp (revision 639193) +++ vm/em/src/NValueProfileCollector.cpp (working copy) @@ -28,6 +28,8 @@ #include #include "cxxlog.h" #include +#include "open/vm_class_info.h" +#include "open/vm_ee.h" #include "port_threadunsafe.h" #include "port_atomic.h" Index: vm/em/src/EBProfileCollector.h =================================================================== --- vm/em/src/EBProfileCollector.h (revision 639193) +++ vm/em/src/EBProfileCollector.h (working copy) @@ -24,8 +24,8 @@ #include "DrlProfileCollectionFramework.h" -#include "open/vm_util.h" - +#include "open/hythread_ext.h" +#include "platform_lowlevel.h" // for __stdcall #include class EBMethodProfile; Index: vm/em/src/MTable.cpp =================================================================== --- vm/em/src/MTable.cpp (revision 639193) +++ vm/em/src/MTable.cpp (working copy) @@ -22,6 +22,7 @@ #include "MTable.h" #include #include +#include "open/vm_class_info.h" #include "jit_import.h" MTable::~MTable() { Index: vm/em/src/DrlEMImpl.cpp =================================================================== --- vm/em/src/DrlEMImpl.cpp (revision 639193) +++ vm/em/src/DrlEMImpl.cpp (working copy) @@ -24,7 +24,9 @@ #include "EdgeProfileCollector.h" #include "NValueProfileCollector.h" -#include "jit_import.h" +#include "open/vm_class_info.h" +#include "open/vm_ee.h" +#include "open/ee_em_intf.h" #include "em_intf.h" #include "open/vm.h" #include "ini.h" @@ -192,9 +194,9 @@ std::string path = origPath; if (path.find('/') == path.npos && path.find('\\') == path.npos ) { - char* c_string_tmp_value = get_property(O_A_H_VM_VMDIR, JAVA_PROPERTIES); + char* c_string_tmp_value = vm_properties_get_value(O_A_H_VM_VMDIR, JAVA_PROPERTIES); std::string dir = c_string_tmp_value == NULL ? "" : c_string_tmp_value; - destroy_property_value(c_string_tmp_value); + vm_properties_destroy_value(c_string_tmp_value); if (libPrefix.length() > 0 && !startsWith(path, libPrefix)) { path = libPrefix + path; } @@ -277,15 +279,15 @@ } else if (startsWith(line, "-D") && (idx = line.find('=')) != std::string::npos) { std::string name = line.substr(2, idx-2); std::string value = line.substr(idx+1); - if (!is_property_set(name.c_str(), JAVA_PROPERTIES)) { - set_property(name.c_str(), value.c_str(), JAVA_PROPERTIES); + if (!vm_property_is_set(name.c_str(), JAVA_PROPERTIES)) { + vm_property_set(name.c_str(), value.c_str(), JAVA_PROPERTIES); } continue; } else if (startsWith(line, "-XD") && (idx = line.find('=')) != std::string::npos) { std::string name = line.substr(3, idx-3); std::string value = line.substr(idx+1); - if (!is_property_set(name.c_str(),VM_PROPERTIES)) { - set_property(name.c_str(), value.c_str(), VM_PROPERTIES); + if (!vm_property_is_set(name.c_str(),VM_PROPERTIES)) { + vm_property_set(name.c_str(), value.c_str(), VM_PROPERTIES); } continue; } else if (startsWith(line, "-XX:") && line.length() >= 5) { @@ -308,8 +310,8 @@ } } - if (!is_property_set(name.c_str(),VM_PROPERTIES)) { - set_property(name.c_str(), value.c_str(), VM_PROPERTIES); + if (!vm_property_is_set(name.c_str(),VM_PROPERTIES)) { + vm_property_set(name.c_str(), value.c_str(), VM_PROPERTIES); } continue; } @@ -325,12 +327,12 @@ } std::string DrlEMImpl::readConfiguration() { - char* c_string_tmp_value = get_property("em.properties", VM_PROPERTIES); + char* c_string_tmp_value = vm_properties_get_value("em.properties", VM_PROPERTIES); std::string configFileName = c_string_tmp_value == NULL ? "" : c_string_tmp_value; - destroy_property_value(c_string_tmp_value); + vm_properties_destroy_value(c_string_tmp_value); if (configFileName.empty()) { - bool jitTiMode = get_boolean_property("vm.jvmti.enabled", FALSE, VM_PROPERTIES); - bool interpreterMode = get_boolean_property("vm.use_interpreter", FALSE, VM_PROPERTIES); + bool jitTiMode = vm_property_get_bool("vm.jvmti.enabled", FALSE, VM_PROPERTIES); + bool interpreterMode = vm_property_get_bool("vm.use_interpreter", FALSE, VM_PROPERTIES); configFileName = interpreterMode ? "interpreter" : (jitTiMode ? "ti" : "client"); } if (!endsWith(configFileName, EM_CONFIG_EXT)) { @@ -338,9 +340,9 @@ } if (configFileName.find('/') == configFileName.npos && configFileName.find('\\') == configFileName.npos ) { - c_string_tmp_value = get_property(O_A_H_VM_VMDIR, JAVA_PROPERTIES); + c_string_tmp_value = vm_properties_get_value(O_A_H_VM_VMDIR, JAVA_PROPERTIES); std::string defaultConfigDir = c_string_tmp_value == NULL ? "" : c_string_tmp_value; - destroy_property_value(c_string_tmp_value); + vm_properties_destroy_value(c_string_tmp_value); configFileName = defaultConfigDir + "/" + configFileName; } @@ -378,7 +380,7 @@ void (*_init)(JIT_Handle, const char*, vm_adaptor_t) = (void (*)(JIT_Handle, const char*, vm_adaptor_t)) fn; - _init(step.jit, step.jitName.c_str(), get_vm_interface); + _init(step.jit, step.jitName.c_str(), vm_get_interface); bool pcEnabled = false; if (apr_dso_sym(&fn, libHandle, "JIT_set_profile_access_interface") == APR_SUCCESS) { @@ -404,13 +406,13 @@ std::string DrlEMImpl::getJITLibFromCmdLine(const std::string& jitName) const { std::string propName = std::string("em.")+jitName+".jitPath"; - char* c_string_tmp_value = get_property(propName.c_str(), VM_PROPERTIES); + char* c_string_tmp_value = vm_properties_get_value(propName.c_str(), VM_PROPERTIES); std::string jitLib = c_string_tmp_value == NULL ? "" : c_string_tmp_value; - destroy_property_value(c_string_tmp_value); + vm_properties_destroy_value(c_string_tmp_value); if (jitLib.empty()) { - c_string_tmp_value = get_property("em.jitPath", VM_PROPERTIES); + c_string_tmp_value = vm_properties_get_value("em.jitPath", VM_PROPERTIES); jitLib = c_string_tmp_value == NULL ? "" : c_string_tmp_value; - destroy_property_value(c_string_tmp_value); + vm_properties_destroy_value(c_string_tmp_value); } return jitLib; } Index: vm/em/src/DrlEMImpl.h =================================================================== --- vm/em/src/DrlEMImpl.h (revision 639193) +++ vm/em/src/DrlEMImpl.h (working copy) @@ -26,7 +26,8 @@ #include "DrlProfileCollectionFramework.h" #include "method_lookup.h" #include "open/em.h" -#include "open/vm_util.h" +#include "jni.h" +#include "open/hythread_ext.h" #include "open/em_profile_access.h" #include Index: vm/em/src/EdgeProfileCollector.cpp =================================================================== --- vm/em/src/EdgeProfileCollector.cpp (revision 639193) +++ vm/em/src/EdgeProfileCollector.cpp (working copy) @@ -26,6 +26,9 @@ #include "cxxlog.h" #include #include "port_mutex.h" +#include "open/vm_class_loading.h" +#include "open/vm_class_info.h" +#include "open/vm.h" #define LOG_DOMAIN "em" Index: vm/gc_gen/src/jni/java_support.cpp =================================================================== --- vm/gc_gen/src/jni/java_support.cpp (revision 639193) +++ vm/gc_gen/src/jni/java_support.cpp (working copy) @@ -21,7 +21,8 @@ #include #include -#include "jit_intf.h" +#include "open/vm_class_info.h" +#include "open/vm.h" #include "java_support.h" Class_Handle GCHelper_clss; Index: vm/gc_gen/src/common/gc_for_vm.cpp =================================================================== --- vm/gc_gen/src/common/gc_for_vm.cpp (revision 639193) +++ vm/gc_gen/src/common/gc_for_vm.cpp (working copy) @@ -57,7 +57,7 @@ static void init_gc_helpers() { - set_property("vm.component.classpath.gc_gen", "gc_gen.jar", VM_PROPERTIES); + vm_property_set("vm.component.classpath.gc_gen", "gc_gen.jar", VM_PROPERTIES); vm_helper_register_magic_helper(VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE, "org/apache/harmony/drlvm/gc_gen/GCHelper", "alloc"); vm_helper_register_magic_helper(VM_RT_NEW_VECTOR_USING_VTABLE, "org/apache/harmony/drlvm/gc_gen/GCHelper", "allocArray"); vm_helper_register_magic_helper(VM_RT_GC_HEAP_WRITE_REF, "org/apache/harmony/drlvm/gc_gen/GCHelper", "write_barrier_slot_rem"); @@ -84,8 +84,8 @@ /* VT pointer compression is a compile-time option, reference compression and vtable compression are orthogonal */ #ifdef COMPRESS_VTABLE - assert(vm_vtable_pointers_are_compressed()); - vtable_base = vm_get_vtable_base(); + assert(vm_is_vtable_compressed()); + vtable_base = (POINTER_SIZE_INT)vm_get_vtable_base_address(); #endif gc_tls_init(); Index: vm/gc_gen/src/common/gc_options.cpp =================================================================== --- vm/gc_gen/src/common/gc_options.cpp (revision 639193) +++ vm/gc_gen/src/common/gc_options.cpp (working copy) @@ -87,15 +87,15 @@ return gc; } -static int get_int_property(const char *property_name) +static int vm_property_get_int(const char *property_name) { assert(property_name); - char *value = get_property(property_name, VM_PROPERTIES); + char *value = vm_properties_get_value(property_name, VM_PROPERTIES); int return_value; if (NULL != value) { return_value = atoi(value); - destroy_property_value(value); + vm_properties_destroy_value(value); }else{ DIE2("gc.base","Warning: property value "<generate_barrier = gc_is_gen_mode(); - if (is_property_set("gc.generate_barrier", VM_PROPERTIES) == 1) { - Boolean generate_barrier = get_boolean_property("gc.generate_barrier"); + if (vm_property_is_set("gc.generate_barrier", VM_PROPERTIES) == 1) { + Boolean generate_barrier = vm_property_get_bool("gc.generate_barrier"); gc->generate_barrier = (generate_barrier || gc->generate_barrier); } @@ -233,8 +233,8 @@ POINTER_SIZE_INT max_heap_size = HEAP_SIZE_DEFAULT; POINTER_SIZE_INT min_heap_size = min_heap_size_bytes; - if (is_property_set("gc.mx", VM_PROPERTIES) == 1) { - max_heap_size = get_size_property("gc.mx"); + if (vm_property_is_set("gc.mx", VM_PROPERTIES) == 1) { + max_heap_size = vm_property_get_size("gc.mx"); if (max_heap_size < min_heap_size){ max_heap_size = min_heap_size; @@ -252,8 +252,8 @@ } } - if (is_property_set("gc.ms", VM_PROPERTIES) == 1) { - min_heap_size = get_size_property("gc.ms"); + if (vm_property_is_set("gc.ms", VM_PROPERTIES) == 1) { + min_heap_size = vm_property_get_size("gc.ms"); if (min_heap_size < min_heap_size_bytes){ min_heap_size = min_heap_size_bytes; WARN2("gc.base","Warning: Min heap size you set is too small, reset to "<generate_barrier = TRUE; } - if (is_property_set("gc.heap_iteration", VM_PROPERTIES) == 1) { - JVMTI_HEAP_ITERATION = get_boolean_property("gc.heap_iteration"); + if (vm_property_is_set("gc.heap_iteration", VM_PROPERTIES) == 1) { + JVMTI_HEAP_ITERATION = vm_property_get_bool("gc.heap_iteration"); } - if (is_property_set("gc.ignore_vtable_tracing", VM_PROPERTIES) == 1) { - IGNORE_VTABLE_TRACING = get_boolean_property("gc.ignore_vtable_tracing"); + if (vm_property_is_set("gc.ignore_vtable_tracing", VM_PROPERTIES) == 1) { + IGNORE_VTABLE_TRACING = vm_property_get_bool("gc.ignore_vtable_tracing"); } - if (is_property_set("gc.use_large_page", VM_PROPERTIES) == 1){ - char* value = get_property("gc.use_large_page", VM_PROPERTIES); + if (vm_property_is_set("gc.use_large_page", VM_PROPERTIES) == 1){ + char* value = vm_properties_get_value("gc.use_large_page", VM_PROPERTIES); large_page_hint = strdup(value); - destroy_property_value(value); + vm_properties_destroy_value(value); } - if (is_property_set("gc.concurrent_gc", VM_PROPERTIES) == 1){ - Boolean use_all_concurrent_phase= get_boolean_property("gc.concurrent_gc"); + if (vm_property_is_set("gc.concurrent_gc", VM_PROPERTIES) == 1){ + Boolean use_all_concurrent_phase= vm_property_get_bool("gc.concurrent_gc"); if(use_all_concurrent_phase){ USE_CONCURRENT_ENUMERATION = TRUE; USE_CONCURRENT_MARK = TRUE; @@ -349,24 +349,24 @@ } } - if (is_property_set("gc.concurrent_enumeration", VM_PROPERTIES) == 1){ - USE_CONCURRENT_ENUMERATION= get_boolean_property("gc.concurrent_enumeration"); + if (vm_property_is_set("gc.concurrent_enumeration", VM_PROPERTIES) == 1){ + USE_CONCURRENT_ENUMERATION= vm_property_get_bool("gc.concurrent_enumeration"); if(USE_CONCURRENT_ENUMERATION){ USE_CONCURRENT_GC = TRUE; gc->generate_barrier = TRUE; } } - if (is_property_set("gc.concurrent_mark", VM_PROPERTIES) == 1){ - USE_CONCURRENT_MARK= get_boolean_property("gc.concurrent_mark"); + if (vm_property_is_set("gc.concurrent_mark", VM_PROPERTIES) == 1){ + USE_CONCURRENT_MARK= vm_property_get_bool("gc.concurrent_mark"); if(USE_CONCURRENT_MARK){ USE_CONCURRENT_GC = TRUE; gc->generate_barrier = TRUE; } } - if (is_property_set("gc.concurrent_sweep", VM_PROPERTIES) == 1){ - USE_CONCURRENT_SWEEP= get_boolean_property("gc.concurrent_sweep"); + if (vm_property_is_set("gc.concurrent_sweep", VM_PROPERTIES) == 1){ + USE_CONCURRENT_SWEEP= vm_property_get_bool("gc.concurrent_sweep"); if(USE_CONCURRENT_SWEEP){ USE_CONCURRENT_GC = TRUE; } @@ -374,39 +374,39 @@ char* concurrent_algo = NULL; - if (is_property_set("gc.concurrent_algorithm", VM_PROPERTIES) == 1) { - concurrent_algo = get_property("gc.concurrent_algorithm", VM_PROPERTIES); + if (vm_property_is_set("gc.concurrent_algorithm", VM_PROPERTIES) == 1) { + concurrent_algo = vm_properties_get_value("gc.concurrent_algorithm", VM_PROPERTIES); } gc_decide_concurrent_algorithm(concurrent_algo); #if defined(ALLOC_ZEROING) && defined(ALLOC_PREFETCH) - if(is_property_set("gc.prefetch",VM_PROPERTIES) ==1) { - PREFETCH_ENABLED = get_boolean_property("gc.prefetch"); + if(vm_property_is_set("gc.prefetch",VM_PROPERTIES) ==1) { + PREFETCH_ENABLED = vm_property_get_bool("gc.prefetch"); } - if(is_property_set("gc.prefetch_distance",VM_PROPERTIES)==1) { - PREFETCH_DISTANCE = get_size_property("gc.prefetch_distance"); + if(vm_property_is_set("gc.prefetch_distance",VM_PROPERTIES)==1) { + PREFETCH_DISTANCE = vm_property_get_size("gc.prefetch_distance"); if(!PREFETCH_ENABLED) { WARN2("gc.prefetch_distance","Warning: Prefetch distance set with Prefetch disabled!"); } } - if(is_property_set("gc.prefetch_stride",VM_PROPERTIES)==1) { - PREFETCH_STRIDE = get_size_property("gc.prefetch_stride"); + if(vm_property_is_set("gc.prefetch_stride",VM_PROPERTIES)==1) { + PREFETCH_STRIDE = vm_property_get_size("gc.prefetch_stride"); if(!PREFETCH_ENABLED) { WARN2("gc.prefetch_stride","Warning: Prefetch stride set with Prefetch disabled!"); } } - if(is_property_set("gc.zeroing_size",VM_PROPERTIES)==1) { - ZEROING_SIZE = get_size_property("gc.zeroing_size"); + if(vm_property_is_set("gc.zeroing_size",VM_PROPERTIES)==1) { + ZEROING_SIZE = vm_property_get_size("gc.zeroing_size"); } #endif #ifdef PREFETCH_SUPPORTED - if(is_property_set("gc.mark_prefetch",VM_PROPERTIES) ==1) { - mark_prefetch = get_boolean_property("gc.mark_prefetch"); + if(vm_property_is_set("gc.mark_prefetch",VM_PROPERTIES) ==1) { + mark_prefetch = vm_property_get_bool("gc.mark_prefetch"); } #endif Index: vm/gc_gen/src/common/gc_for_class.cpp =================================================================== --- vm/gc_gen/src/common/gc_for_class.cpp (revision 639193) +++ vm/gc_gen/src/common/gc_for_class.cpp (working copy) @@ -21,6 +21,7 @@ #include "gc_common.h" #include "../finalizer_weakref/finalizer_weakref.h" +#include "open/vm_class_info.h" /* Setter functions for the gc class property field. */ void gc_set_prop_alignment_mask (GC_VTable_Info *gcvt, unsigned int the_mask) @@ -175,7 +176,7 @@ WeakReferenceType type = class_is_reference(ch); gc_set_prop_reference(gcvt, type); - unsigned int size = class_get_boxed_data_size(ch); + unsigned int size = class_get_object_size(ch); gcvt->gc_allocated_size = size; gcvt->gc_class_name = class_get_name(ch); Index: vm/include/jit_intf.h =================================================================== --- vm/include/jit_intf.h (revision 639193) +++ vm/include/jit_intf.h (working copy) @@ -1,192 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _JIT_INTF_H_ -#define _JIT_INTF_H_ - - -#include "open/types.h" -#include "open/vm.h" -#include "jit_export.h" -#include "jit_import.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -//////////////// begin C interface -// -// calls from Compiler to VM -// -//----------------------------------------------------------------------------- -// Constant pool resolution -//----------------------------------------------------------------------------- -// -// The following byte codes reference constant pool entries: -// -// field -// getstatic static field -// putstatic static field -// getfield non-static field -// putfield non-static field -// -// method -// invokevirtual virtual method -// invokespecial special method -// invokestatic static method -// invokeinterface interface method -// -// class -// new class -// anewarray class -// checkcast class -// instanceof class -// multianewarray class -// - -// -// For the method invocation byte codes, certain linkage exceptions are thrown -// at run-time: -// -// (1) invocation of a native methods throws the UnsatisfiedLinkError if the -// code that implements the method cannot be loaded or linked. -// (2) invocation of an interface method throws -// - IncompatibleClassChangeError if the object does not implement -// the called method, or the method is implemented as static -// - IllegalAccessError if the implemented method is not public -// - AbstractMethodError if the implemented method is abstract -// - -VMEXPORT Field_Handle -resolve_field(Compile_Handle h, Class_Handle c, unsigned index); - -// -// resolve constant pool reference to a virtual method -// used for invokevirtual and invoke special. -// -// DEPRECATED -// -VMEXPORT Method_Handle -resolve_nonstatic_method(Compile_Handle h, Class_Handle c, unsigned index); - -// -// resolve constant pool reference to a virtual method -// used for invokespecial -// -VMEXPORT Method_Handle -resolve_special_method(Compile_Handle h, Class_Handle c, unsigned index); - -// -// resolve constant pool reference to a class -// used for -// (1) new -// - InstantiationError exception if resolved class is abstract -// (2) anewarray -// (3) multianewarray -// -// resolve_class_new is used for resolving references to class entries by the -// the new byte code. -// -VMEXPORT Class_Handle -resolve_class_new(Compile_Handle h, Class_Handle c, unsigned index); - -// -// resolve_class is used by all the other byte codes that reference classes, -// as well as exception handlers. -// -VMEXPORT Class_Handle -resolve_class(Compile_Handle h, Class_Handle c, unsigned index); - -// -// Field -// -VMEXPORT Boolean field_is_public(Field_Handle f); -VMEXPORT Boolean field_is_injected(Field_Handle f); -VMEXPORT Boolean method_is_public(Method_Handle m); -VMEXPORT unsigned method_get_max_locals(Method_Handle m); -VMEXPORT Boolean method_is_fake(Method_Handle m); - - -VMEXPORT Method_Side_Effects method_get_side_effects(Method_Handle m); -VMEXPORT void method_set_side_effects(Method_Handle m, Method_Side_Effects mse); - - -VMEXPORT Class_Handle method_get_return_type_class(Method_Handle m); - - -VMEXPORT Boolean method_has_annotation(Method_Handle target, Class_Handle antn_type); - - -VMEXPORT unsigned class_number_fields(Class_Handle ch); -VMEXPORT Field_Handle class_get_field(Class_Handle ch, unsigned idx); -VMEXPORT int class_get_super_offset(); - -VMEXPORT Field_Handle class_get_field_by_name(Class_Handle ch, const char* name); -VMEXPORT Method_Handle class_get_method_by_name(Class_Handle ch, const char* name); - -VMEXPORT int class_get_depth(Class_Handle cl); -VMEXPORT const char *class_get_source_file_name(Class_Handle cl); - -VMEXPORT ClassLoaderHandle class_get_class_loader(Class_Handle c); - -VMEXPORT Class_Handle -class_load_class_by_name(const char *name, - Class_Handle c); - -VMEXPORT Class_Handle -class_load_class_by_descriptor(const char *descr, - Class_Handle c); - -VMEXPORT Method_Handle -class_lookup_method_recursively(Class_Handle clss, - const char *name, - const char *descr); - -// This function is for native library support -// It takes a class name with .s not /s. -VMEXPORT Class_Handle class_find_loaded(ClassLoaderHandle, const char*); - -// This function is for native library support -// It takes a class name with .s not /s. -VMEXPORT Class_Handle class_find_class_from_loader(ClassLoaderHandle, const char*, Boolean init); - - - -/** - * Adds information about inlined method. - * @param[in] method - method which is inlined - * @param[in] codeSize - size of inlined code block - * @param[in] codeAddr - size of inlined code block - * @param[in] mapLength - number of AddrLocation elements in addrLocationMap - * @param[in] addrLocationMap - native addresses to bytecode locations - * correspondence table - * @param[in] compileInfo - VM specific information. - * @param[in] outer_method - target method to which inlining was made - */ -DECLARE_OPEN(void, compiled_method_load, (Method_Handle method, U_32 codeSize, - void* codeAddr, U_32 mapLength, - AddrLocation* addrLocationMap, - void* compileInfo, Method_Handle outer_method)); - -//////////////// end C interface - -#ifdef __cplusplus -} -#endif - -#endif Index: vm/include/open/vm_method_access.h =================================================================== --- vm/include/open/vm_method_access.h (revision 639193) +++ vm/include/open/vm_method_access.h (working copy) @@ -327,7 +327,7 @@ * @return The method handle for an accessible method overriding method; otherwise, FALSE. */ Open_Method_Handle -method_find_overridden_method(Open_Class_Handle klass, +class_get_overridden_method(Open_Class_Handle klass, Open_Method_Handle method); /** @@ -546,7 +546,7 @@ * @return The offset from the start of the vtable to the entry for the method, in bytes. */ unsigned -method_get_offset(Open_Method_Handle method); +method_get_vtable_offset(Open_Method_Handle method); /** * Gets the address of the code pointer for the given method. Index: vm/include/open/types.h =================================================================== --- vm/include/open/types.h (revision 639193) +++ vm/include/open/types.h (working copy) @@ -88,7 +88,7 @@ /** * Used for opaques accesses to managed arrays. This handle points * to an array in the managed heap, so handling must be careful to account - * for the possiblity of a moving GC. + * for the possibility of a moving GC. */ typedef void *Vector_Handle; @@ -96,11 +96,4 @@ typedef void *GC_Enumeration_Handle; -//tmp location -typedef enum { - VM_PROPERTIES = 0, - JAVA_PROPERTIES = 1 - } PropertyTable; - - #endif //!_VM_TYPES_H_ Index: vm/include/open/vm_field_access.h =================================================================== --- vm/include/open/vm_field_access.h (revision 639193) +++ vm/include/open/vm_field_access.h (working copy) @@ -87,7 +87,7 @@ * * @return Type information. * - * @note Replaces field_get_type_info_of_field_value. + * @note Replaces field_get_type_info. */ Open_Type_Info_Handle field_get_type_info_of_field_type(Open_Field_Handle field); Index: vm/include/open/rt_helpers.h =================================================================== --- vm/include/open/rt_helpers.h (revision 639193) +++ vm/include/open/rt_helpers.h (working copy) @@ -50,7 +50,7 @@ * * Like VM_RT_NEW_VECTOR_USING_VTABLE, allocates a new object of * a class, but also takes a size argument. The size can be obtained using - * class_get_boxed_data_size(Class_Handle). + * class_get_object_size(Class_Handle). * This function should be used for classes which inherit the finalize method * of java.lang.Object. */ Index: vm/include/open/vm_class_info.h =================================================================== --- vm/include/open/vm_class_info.h (revision 639193) +++ vm/include/open/vm_class_info.h (working copy) @@ -109,6 +109,92 @@ DECLARE_OPEN(const char *, class_cp_get_method_descriptor, (Class_Handle cl, U_16 index)); DECLARE_OPEN(const char *, class_cp_get_field_descriptor, (Class_Handle cl, U_16 index)); +/** +* Class ch is a subclass of method_get_class(mh). +* The function returns a method handle for an accessible method overriding +* mh in ch or in its closest superclass that overrides +* mh. +* Class ch must be a class not an interface. +*/ +DECLARE_OPEN(Method_Handle, class_get_overridden_method, (Class_Handle ch, Method_Handle mh)); + +DECLARE_OPEN(Method_Handle, class_lookup_method_recursively, + (Class_Handle clss, + const char *name, + const char *descr)); + +DECLARE_OPEN(U_16, class_number_fields, (Class_Handle ch)); +DECLARE_OPEN(Field_Handle, class_get_field, (Class_Handle ch, U_16 idx)); + +DECLARE_OPEN(Field_Handle, class_get_field_by_name, (Class_Handle ch, const char* name)); +DECLARE_OPEN(Method_Handle, class_get_method_by_name, (Class_Handle ch, const char* name)); + +DECLARE_OPEN(const char *, class_get_source_file_name, (Class_Handle cl)); + +/** +* @return The name of the class. +*/ +DECLARE_OPEN(const char *, class_get_name, (Class_Handle ch)); + +/** +* @return The name of the package containing the class. +*/ +DECLARE_OPEN(const char *, class_get_package_name, (Class_Handle ch)); + +/** +* The super class of the current class. +* @return NULL for the system object class, i.e. +* class_get_super_class(vm_get_java_lang_object_class()) == NULL +*/ +DECLARE_OPEN(Class_Handle, class_get_super_class, (Class_Handle ch)); + +/** +* @return TRUE if class s is assignment +* compatible with class t. +*/ +DECLARE_OPEN(BOOLEAN, class_is_instanceof, (Class_Handle s, Class_Handle t)); + +/** +* @return TRUE if the class is already fully initialized. +*/ +DECLARE_OPEN(BOOLEAN, class_is_initialized, (Class_Handle ch)); + +/** +* @return TRUE if the class represents an enum. +* For Java 1.4 always returns FALSE. +*/ +DECLARE_OPEN(BOOLEAN, class_is_enum, (Class_Handle ch)); + +/** +* @return TRUE if the class represents a primitive type (int, float, etc.) +*/ +DECLARE_OPEN(BOOLEAN, class_is_primitive, (Class_Handle ch)); + +/** +* @return TRUE is the class is an array. +*/ +DECLARE_OPEN(BOOLEAN, class_is_array, (Class_Handle ch)); + +/** +* @return TRUE if this is an array of primitives. +*/ +DECLARE_OPEN(BOOLEAN, class_is_non_ref_array, (Class_Handle ch)); + +DECLARE_OPEN(BOOLEAN, class_is_final, (Class_Handle ch)); +DECLARE_OPEN(BOOLEAN, class_is_abstract, (Class_Handle ch)); +DECLARE_OPEN(BOOLEAN, class_is_interface, (Class_Handle ch)); + +/** +* @return TRUE if the class is likely to be used as an exception object. +* This is a hint only. If the result is FALSE, the class may still +* be used for exceptions but it is less likely. +*/ +DECLARE_OPEN(BOOLEAN, class_is_throwable, (Class_Handle ch)); +/** +* @return TRUE if the class has a non-trivial finalizer. +*/ +DECLARE_OPEN(BOOLEAN, class_is_finalizable, (Class_Handle ch)); + #ifdef __cplusplus } #endif Index: vm/include/open/vm_class_manipulation.h =================================================================== --- vm/include/open/vm_class_manipulation.h (revision 639193) +++ vm/include/open/vm_class_manipulation.h (working copy) @@ -214,7 +214,7 @@ * * @return The size of an instance in the heap. * - * @note Replaces class_get_boxed_data_size function. + * @note Replaces class_get_object_size function. */ unsigned class_get_instance_size(Open_Class_Handle klass); @@ -376,7 +376,7 @@ * as an exception object; otherwise, FALSE. */ Boolean -class_hint_is_exceptiontype(Open_Class_Handle klass); +class_is_throwable(Open_Class_Handle klass); /** * Checks whether the class represents an enumerator. Index: vm/include/open/vm_ee.h =================================================================== --- vm/include/open/vm_ee.h (revision 0) +++ vm/include/open/vm_ee.h (revision 0) @@ -0,0 +1,470 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _VM_EE_H_ +#define _VM_EE_H_ + +/** + * @file + * + * + */ +#include "open/types.h" +#include "open/rt_types.h" +#include "open/em.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +* Acquires lock associated with method +*/ +DECLARE_OPEN(void, method_lock, (Method_Handle mh)); + +/* +* Releases lock associated with method +*/ +DECLARE_OPEN(void, method_unlock, (Method_Handle mh)); + +/** +* Looks for a method in native libraries of a class loader. +* +* @param[in] method - a searching native-method structure +* @return The pointer to found a native function. +* @note The function raises UnsatisfiedLinkError with a method name +* in an exception message, if the specified method is not found.*/ +DECLARE_OPEN(void *, method_get_native_func_addr, (Method_Handle method)); + +/** +* Address of the memory location containing the address of the code. +* Used for static and special methods which have been resolved but not jitted. (FIXME??) +* The call would be: +* call dword ptr [addr] +* +* @return The address where the code pointer for a given method is. +* +* A simple JIT that doesn't support recompilation (see e.g. +* vm_register_jit_recompiled_method_callback) can only +* generate code with indirect branches through the address provided +* by method_get_indirect_address(). +*/ +DECLARE_OPEN(void *, method_get_indirect_address, (Method_Handle method)); + +/** +* @return The offset in bytes from the start of the vtable to the entry for +* a given method. +*/ +DECLARE_OPEN(size_t, method_get_vtable_offset, (Method_Handle method)); + +/** +* Allocate the "read-write" data block for this method. This memory block +* cannot be retrieved later. The intention is to use the data block for data +* that may be needed during the program execution (e.g. tables for +* switch statements). +* +* Separation of data allocated by method_allocate_data_block() and +* method_allocate_info_block() may help improve locality of +* references to data accessed during execution of compiled code and data +* accessed during stack uwinding. +* +* @sa method_allocate_info_block +*/ +DECLARE_OPEN(Byte *, method_allocate_data_block, (Method_Handle method, + JIT_Handle j, + size_t size, + size_t alignment)); + +/** +* Allocated a "read-only" data block. +* +* (? 20030314) This function is deprecated. In all new code, use +* method_allocate_data_block() only. At some point, we +* will revisit this interface to have more control over the layout +* of various memory blocks allocated by the VM. +*/ + +DECLARE_OPEN(Byte *, method_allocate_jit_data_block, (Method_Handle method, + JIT_Handle j, + size_t size, + size_t alignment)); + + +/** +* This function allows allocation of multiple chunks of code with different +* heat values. The JIT is responsible for specifying ids that are unique +* within the same method. +* The first instruction of the chunk with id=0 is the entry point +* of the method. +* +* Deprecated. +* +* @return If the CAA_Allocate argument is specified, memory is +* allocated and a pointer to it is returned. If the +* CAA_Simulate argument is specified, no memory is +* allocated - the same as pass parameter size = 0 - function returns +* only current address for allocation in pool but no memory is allocated. +*/ +DECLARE_OPEN(Byte *, +method_allocate_code_block, (Method_Handle m, + JIT_Handle j, + size_t size, + size_t alignment, + CodeBlockHeat heat, + int id, + Code_Allocation_Action action)); + + +/** +* Allocate an info block for this method. An info block can be later +* retrieved by the JIT. The JIT may for instance store GC maps for +* root set enumeration and stack unwinding in the onfo block. +* +* @sa method_allocate_data_block +*/ +DECLARE_OPEN(Byte *, method_allocate_info_block, (Method_Handle method, + JIT_Handle j, + size_t size)); + + +/** +* Retrieve the memory block allocated earlier by +* method_allocate_code_block(). +* A pair uniquely identifies a code block. +*/ +DECLARE_OPEN(Byte *, method_get_code_block_addr_jit, (Method_Handle method, + JIT_Handle j)); + +/** +* Get the size of the memory block allocated earlier by +* method_allocate_code_block(). +*/ +DECLARE_OPEN(unsigned, method_get_code_block_size_jit, (Method_Handle method, + JIT_Handle j)); + +/** +* Retrieve the memory block allocated earlier by +* method_allocate_code_block(). +* A triple uniquely identifies a +* code block. +*/ +DECLARE_OPEN(Byte *, method_get_code_block_addr_jit_new, (Method_Handle method, + JIT_Handle j, + int id)); + +/** +* Get the size of the memory block allocated earlier by +* method_allocate_code_block(). +* A triple uniquely identifies a +* code block. +*/ +DECLARE_OPEN(unsigned, method_get_code_block_size_jit_new, (Method_Handle method, + JIT_Handle j, + int id)); + +/** +* Retrieve the memory block allocated earlier by +* method_allocate_info_block(). +* A pair uniquely identifies a JIT info block. +*/ +DECLARE_OPEN(Byte *, method_get_info_block_jit, (Method_Handle method, + JIT_Handle j)); + +/** +* Get the size of the memory block allocated earlier by +* method_allocate_info_block(). +*/ + +DECLARE_OPEN(unsigned, method_get_info_block_size_jit, (Method_Handle method, + JIT_Handle j)); + +/** + * Called by a JIT in order to be notified whenever the vtable entries for the + * given method are changed. This could happen, e.g., when a method is first + * compiled, or when it is recompiled. The callback_data pointer + * will be passed back to the JIT during the callback. The callback method is + * JIT_recompiled_method_callback. + */ +DECLARE_OPEN(void, vm_register_jit_recompiled_method_callback, (JIT_Handle jit, Method_Handle method, + void *callback_data)); + +/** + * Called by a JIT to have the VM replace a section of executable code in a + * thread-safe fashion. This function does not synchronize the I- or D-caches. + * It may be a lot cheaper to batch up the patch requests, so we may need to + * extend this interface. + */ +DECLARE_OPEN(void, vm_patch_code_block, (Byte *code_block, Byte *new_code, size_t size)); + +/** + * Called by a JIT to have VM synchronously (in the same thread) compile a method + * It is a requirement that JIT calls this routine only during compilation of + * other method, not during run-time. + */ +DECLARE_OPEN(JIT_Result, vm_compile_method, (JIT_Handle jit, Method_Handle method)); + + +/** +* Adds information about inlined method. +* @param[in] method - method which is inlined +* @param[in] codeSize - size of inlined code block +* @param[in] codeAddr - size of inlined code block +* @param[in] mapLength - number of AddrLocation elements in addrLocationMap +* @param[in] addrLocationMap - native addresses to bytecode locations +* correspondence table +* @param[in] compileInfo - VM specific information. +* @param[in] outer_method - target method to which inlining was made +*/ +DECLARE_OPEN(void, vm_compiled_method_load, (Method_Handle method, U_32 codeSize, + void* codeAddr, U_32 mapLength, + AddrLocation* addrLocationMap, + void* compileInfo, Method_Handle outer_method)); + + +DECLARE_OPEN(Method_Side_Effects, method_get_side_effects, (Method_Handle mh)); +DECLARE_OPEN(void, method_set_side_effects, (Method_Handle mh, Method_Side_Effects mse)); + +//Has side effect: initiates classloading of classes annotating the method, if any. +DECLARE_OPEN(BOOLEAN, method_has_annotation, (Method_Handle target, Class_Handle antn_type)); +/** +* Set the number of exception handlers in the code generated by the JIT +* j for a given method. The JIT must then +* call method_set_target_handler_info() +* for each of the num_handlers exception handlers. +*/ +DECLARE_OPEN(void, method_set_num_target_handlers, (Method_Handle method, + JIT_Handle j, + unsigned num_handlers)); + +/** +* Set the information about an exception handler in the code generated by +* the JIT. +*/ +DECLARE_OPEN(void, method_set_target_handler_info, (Method_Handle method, + JIT_Handle j, + unsigned eh_number, + void *start_ip, + void *end_ip, + void *handler_ip, + Class_Handle catch_cl, + Boolean exc_obj_is_dead)); + +//----------------------------------------------------------------------------- +// Constant pool resolution +//----------------------------------------------------------------------------- +// +// The following byte codes reference constant pool entries: +// +// field +// getstatic static field +// putstatic static field +// getfield non-static field +// putfield non-static field +// +// method +// invokevirtual virtual method +// invokespecial special method +// invokestatic static method +// invokeinterface interface method +// +// class +// new class +// anewarray class +// checkcast class +// instanceof class +// multianewarray class +// + +// +// For the method invocation byte codes, certain linkage exceptions are thrown +// at run-time: +// +// (1) invocation of a native methods throws the UnsatisfiedLinkError if the +// code that implements the method cannot be loaded or linked. +// (2) invocation of an interface method throws +// - IncompatibleClassChangeError if the object does not implement +// the called method, or the method is implemented as static +// - IllegalAccessError if the implemented method is not public +// - AbstractMethodError if the implemented method is abstract +// + +/** +* @name Resolution-related functions +*/ +//@{ + +/** +* Resolve a reference to a non-static field. +* The idx parameter is interpreted as a constant pool index for JVM. +* Used for getfield and putfield in JVM. +*/ +DECLARE_OPEN(Field_Handle, +resolve_nonstatic_field, (Compile_Handle h, Class_Handle ch, unsigned idx, unsigned putfield)); + +/** +* Resolve constant pool reference to a static field. +* The idx parameter is interpreted as a constant pool index for JVM. +* Used for getstatic and putstatic in JVM. +*/ +DECLARE_OPEN(Field_Handle, +resolve_static_field, (Compile_Handle h, Class_Handle ch, unsigned idx, unsigned putfield)); + +/** +* Resolve a method. +* The idx parameter is interpreted as a constant pool index for JVM. +*/ +DECLARE_OPEN(Method_Handle, +resolve_method, (Compile_Handle h, Class_Handle ch, unsigned idx)); + + +/** +* Resolve a method. Same as resolve_method() but the VM checks +* that the method can be used for a virtual dispatch. +* The idx parameter is interpreted as a constant pool index for JVM. +*/ +DECLARE_OPEN(Method_Handle, +resolve_virtual_method, (Compile_Handle h, Class_Handle c, unsigned index)); + +/** +* Resolve a method. Same as resolve_method() but the VM checks +* that the method is static (i.e. it is not an instance method). +* The idx parameter is interpreted as a constant pool index for +* JVM. +*/ +DECLARE_OPEN(Method_Handle, +resolve_static_method, (Compile_Handle h, Class_Handle c, unsigned index)); + +/** +* Resolve a method. Same as resolve_method() but the VM checks +* that the method is declared in an interface type. +* The idx parameter is interpreted as a constant pool index for JVM. +*/ +DECLARE_OPEN(Method_Handle, +resolve_interface_method, (Compile_Handle h, Class_Handle c, unsigned index)); + +// +// resolve constant pool reference to a virtual method +// used for invokespecial +// +DECLARE_OPEN(Method_Handle, +resolve_special_method, (Compile_Handle h, Class_Handle c, unsigned index)); + +//@} + +// +// resolve constant pool reference to a class +// used for +// (1) new +// - InstantiationError exception if resolved class is abstract +// (2) anewarray +// (3) multianewarray +// +// resolve_class_new is used for resolving references to class entries by the +// the new byte code. +// +/** +* Resolve a class and provide error checking if the class cannot have an +* instance, i.e. it is abstract (or is an interface class). +* The idx parameter is interpreted as a constant pool index for JVM. +*/ +DECLARE_OPEN(Class_Handle, resolve_class_new, (Compile_Handle h, Class_Handle c, unsigned index)); + +// +// resolve_class is used by all the other byte codes that reference classes, +// as well as exception handlers. +// +DECLARE_OPEN(Class_Handle, resolve_class, (Compile_Handle h, Class_Handle c, unsigned index)); + +DECLARE_OPEN(U_32, class_get_depth, (Class_Handle cl)); +/// Check if fast_instanceof is applicable for the class +DECLARE_OPEN(BOOLEAN, class_is_support_fast_instanceof, (Class_Handle cl)); + +/** +* @return The offset to the vtable pointer in an object. +*/ +DECLARE_OPEN(size_t, object_get_vtable_offset, ()); + +/** +* @return The vtable handle of the given class. +*/ +DECLARE_OPEN(VTable_Handle, class_get_vtable, (Class_Handle ch)); + +/** +* @return Class handle given object's VTable_Handle. +*/ +DECLARE_OPEN(Class_Handle, vtable_get_class, (VTable_Handle vh)); + + +/** +* @return The allocation handle to be used for the object allocation +* routines, given a class handle. +*/ +DECLARE_OPEN(Allocation_Handle, class_get_allocation_handle, (Class_Handle ch)); + +/** +* @return The class handle corresponding to a given allocation handle. +*/ +DECLARE_OPEN(Class_Handle, allocation_handle_get_class, (Allocation_Handle ah)); + + +/** +* Returns the address of the global flag that specifies whether +* MethodEntry event is enabled. JIT should call this function in case +* a method is compiled with exe_notify_method_entry flag set. +*/ +DECLARE_OPEN(char *, get_method_entry_flag_address, ()); + +/** +* Returns the address of the global flag that specifies whether +* MethodExit event is enabled. JIT should call this function in case +* a method is compiled with exe_notify_method_exit flag set. +*/ +DECLARE_OPEN(char *, get_method_exit_flag_address, ()); + + +/** +* @return The address and bit mask, for the flag which determine whether field +* access event should be sent. JIT may use the following expression to +* determine if specified field access should be tracked: +* ( **address & *mask != 0 ) +* +* @param field - handle of the field +* @param[out] address - pointer to the address of the byte which contains the flag +* @param[out] mask - pointer to the bit mask of the flag +*/ +DECLARE_OPEN(void, +field_get_track_access_flag, (Field_Handle field, char** address, char* mask)); + +/** +* @return the address and bit mask, for the flag which determine whether field +* modification event should be sent. JIT may use the following expression to +* determine if specified field modification should be tracked: +* ( **address & *mask != 0 ) +* +* @param field - handle of the field +* @param[out] address - pointer to the address of the byte which contains the flag +* @param[out] mask - pointer to the bit mask of the flag +*/ +DECLARE_OPEN(void, +field_get_track_modification_flag, (Field_Handle field, char** address, + char* mask)); + +#ifdef __cplusplus +} +#endif + + +#endif Index: vm/include/open/vm_interface.h =================================================================== --- vm/include/open/vm_interface.h (revision 639193) +++ vm/include/open/vm_interface.h (working copy) @@ -18,7 +18,6 @@ #ifndef _VM_INTERFACE_H #define _VM_INTERFACE_H -#include "open/hycomp.h" #include "open/types.h" #include "open/rt_types.h" #include "open/rt_helpers.h" @@ -30,49 +29,14 @@ #define GET_INTERFACE(get_adapter, func_name) \ (func_name##_t)get_adapter(#func_name) +DECLARE_OPEN(int, vector_get_first_element_offset, (Class_Handle element_type)); //vector_first_element_offset_class_handle +DECLARE_OPEN(int, vector_get_length_offset, ()); //vector_length_offset -PROTOTYPE_WITH_NAME(void*, get_vm_interface, (const char* func_name)); - - -// Allocation Handle -PROTOTYPE_WITH_NAME(Class_Handle, allocation_handle_get_class, (Allocation_Handle ah)); - //Class PROTOTYPE_WITH_NAME(Class_Handle, class_get_array_element_class, (Class_Handle cl)); PROTOTYPE_WITH_NAME(unsigned , class_get_array_element_size, (Class_Handle ch)); -PROTOTYPE_WITH_NAME(Class_Handle, class_get_array_of_class, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(Type_Info_Handle, class_get_element_type_info, (Class_Handle ch)); -PROTOTYPE_WITH_NAME(const char* , class_get_name, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(Class_Handle, class_get_super_class, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(int , class_get_depth, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(VTable_Handle, class_get_vtable, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(Allocation_Handle, class_get_allocation_handle, (Class_Handle ch)); -PROTOTYPE_WITH_NAME(unsigned , class_get_boxed_data_size, (Class_Handle ch)); +//PROTOTYPE_WITH_NAME(Class_Handle, class_get_array_of_class, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(Class_Handle, class_get_class_of_primitive_type, (VM_Data_Type typ)); -PROTOTYPE_WITH_NAME(Method_Handle, class_get_method_by_name, (Class_Handle ch, const char* name)); -PROTOTYPE_WITH_NAME(Field_Handle, class_get_field_by_name, (Class_Handle ch, const char* name)); -PROTOTYPE_WITH_NAME(ClassLoaderHandle, class_get_class_loader, (Class_Handle ch)); - -PROTOTYPE_WITH_NAME(Boolean , class_is_array, (Class_Handle cl)); -PROTOTYPE_WITH_NAME(Boolean , class_is_enum, (Class_Handle ch)); -PROTOTYPE_WITH_NAME(Boolean , class_is_final, (Class_Handle cl)); //class_is_final -PROTOTYPE_WITH_NAME(Boolean , class_is_throwable, (Class_Handle ch)); //class_hint_is_exceptiontype -PROTOTYPE_WITH_NAME(BOOLEAN , class_is_interface, (Class_Handle cl)); //class_is_interface2 -PROTOTYPE_WITH_NAME(Boolean , class_is_abstract, (Class_Handle cl)); //class_is_abstract -PROTOTYPE_WITH_NAME(Boolean , class_is_initialized, (Class_Handle ch)); //class_needs_initialization && class_is_initialized() -PROTOTYPE_WITH_NAME(BOOLEAN , class_is_finalizable, (Class_Handle ch)); -PROTOTYPE_WITH_NAME(Boolean , class_is_instanceof, (Class_Handle s, Class_Handle t)); -PROTOTYPE_WITH_NAME(Boolean , class_is_support_fast_instanceof, (Class_Handle cl));// class_get_fast_instanceof_flag -PROTOTYPE_WITH_NAME(Boolean , class_is_primitive, (Class_Handle vmTypeHandle)); - -PROTOTYPE_WITH_NAME(Class_Handle, class_lookup_class_by_name_using_bootstrap_class_loader, (const char *name)); -PROTOTYPE_WITH_NAME(Method_Handle, class_lookup_method_recursively, - (Class_Handle clss, - const char *name, - const char *descr)); - - //Field PROTOTYPE_WITH_NAME(void* , field_get_address, (Field_Handle fh)); @@ -80,7 +44,7 @@ PROTOTYPE_WITH_NAME(const char* , field_get_descriptor, (Field_Handle fh)); PROTOTYPE_WITH_NAME(const char* , field_get_name, (Field_Handle fh)); PROTOTYPE_WITH_NAME(unsigned , field_get_offset, (Field_Handle fh)); -PROTOTYPE_WITH_NAME(Type_Info_Handle, field_get_type_info, (Field_Handle fh)); //field_get_type_info_of_field_value +PROTOTYPE_WITH_NAME(Type_Info_Handle, field_get_type_info, (Field_Handle fh)); //field_get_type_info PROTOTYPE_WITH_NAME(Boolean , field_is_final, (Field_Handle fh)); PROTOTYPE_WITH_NAME(Boolean , field_is_magic, (Field_Handle fh)); //Boolean field_is_magic(Field_Handle fh); PROTOTYPE_WITH_NAME(Boolean , field_is_private, (Field_Handle fh)); @@ -89,18 +53,12 @@ //Method -PROTOTYPE_WITH_NAME(Method_Handle, method_get_overridden_method, (Class_Handle ch, Method_Handle mh));//method_find_overridden_method -PROTOTYPE_WITH_NAME(Byte* , method_get_info_block_jit, (Method_Handle m, JIT_Handle j)); -PROTOTYPE_WITH_NAME(unsigned , method_get_info_block_size_jit, (Method_Handle m, JIT_Handle j)); PROTOTYPE_WITH_NAME(const char* , method_get_name, (Method_Handle mh)); PROTOTYPE_WITH_NAME(const char* , method_get_descriptor, (Method_Handle mh)); PROTOTYPE_WITH_NAME(const Byte* , method_get_byte_code_addr, (Method_Handle mh)); PROTOTYPE_WITH_NAME(uint32 , method_get_byte_code_size, (Method_Handle mh)); PROTOTYPE_WITH_NAME(uint16 , method_get_max_stack, (Method_Handle mh)); PROTOTYPE_WITH_NAME(uint32 , method_get_num_handlers, (Method_Handle mh)); -PROTOTYPE_WITH_NAME(uint32 , method_get_offset, (Method_Handle mh)); -PROTOTYPE_WITH_NAME(void* , method_get_indirect_address, (Method_Handle mh)); -PROTOTYPE_WITH_NAME(void* , method_get_native_func_addr, (Method_Handle mh)); PROTOTYPE_WITH_NAME(uint32 , method_vars_get_number, (Method_Handle mh)); PROTOTYPE_WITH_NAME(unsigned , method_args_get_number, (Method_Signature_Handle mh)); PROTOTYPE_WITH_NAME(Type_Info_Handle, method_args_get_type_info, (Method_Signature_Handle msh, unsigned idx)); @@ -112,17 +70,8 @@ unsigned handler_id, unsigned *begin_offset, unsigned *end_offset, unsigned *handler_offset, unsigned *handler_cpindex)); -PROTOTYPE_WITH_NAME(Byte* , method_get_code_block_addr_jit_new, - (Method_Handle mh, - JIT_Handle j, - int id)); -PROTOTYPE_WITH_NAME(unsigned , method_get_code_block_size_jit_new, - (Method_Handle nh, - JIT_Handle j, - int id)); -PROTOTYPE_WITH_NAME(Method_Side_Effects, method_get_side_effects, (Method_Handle mh)); -PROTOTYPE_WITH_NAME(Boolean , method_has_annotation, (Method_Handle mh, Class_Handle antn_type)); + PROTOTYPE_WITH_NAME(Boolean , method_is_private, (Method_Handle mh)); PROTOTYPE_WITH_NAME(Boolean , method_is_static, (Method_Handle mh)); PROTOTYPE_WITH_NAME(Boolean , method_is_native, (Method_Handle mh)); @@ -130,70 +79,8 @@ PROTOTYPE_WITH_NAME(Boolean , method_is_final, (Method_Handle mh)); PROTOTYPE_WITH_NAME(Boolean , method_is_abstract, (Method_Handle mh)); PROTOTYPE_WITH_NAME(Boolean , method_is_strict, (Method_Handle mh)); -PROTOTYPE_WITH_NAME(Boolean , method_is_overridden, (Method_Handle mh)); PROTOTYPE_WITH_NAME(Boolean , method_is_no_inlining, (Method_Handle mh)); - -PROTOTYPE_WITH_NAME(void , method_set_side_effects, (Method_Handle mh, Method_Side_Effects mse)); -PROTOTYPE_WITH_NAME(void , method_set_num_target_handlers, - (Method_Handle mh, - JIT_Handle j, - unsigned num_handlers)); -PROTOTYPE_WITH_NAME(void , method_set_target_handler_info, - (Method_Handle mh, - JIT_Handle j, - unsigned eh_number, - void *start_ip, - void *end_ip, - void *handler_ip, - Class_Handle catch_cl, - Boolean exc_obj_is_dead)); - - -PROTOTYPE_WITH_NAME(void , method_lock, (Method_Handle m)); -PROTOTYPE_WITH_NAME(void , method_unlock, (Method_Handle m)); - -PROTOTYPE_WITH_NAME(Byte* , method_allocate_code_block, - (Method_Handle m, - JIT_Handle j, - size_t size, - size_t alignment, - CodeBlockHeat heat, - int id, - Code_Allocation_Action action)); -PROTOTYPE_WITH_NAME(Byte* , method_allocate_data_block, (Method_Handle m, JIT_Handle j, size_t size, size_t alignment)); -PROTOTYPE_WITH_NAME(Byte* , method_allocate_info_block, (Method_Handle m, JIT_Handle j, size_t size)); -PROTOTYPE_WITH_NAME(Byte* , method_allocate_jit_data_block, (Method_Handle m, JIT_Handle j, size_t size, size_t alignment)); - - -//Object -PROTOTYPE_WITH_NAME(int , object_get_vtable_offset, ()); - - -//Resolve -PROTOTYPE_WITH_NAME(Class_Handle, resolve_class, (Compile_Handle h, Class_Handle c, unsigned index)); -PROTOTYPE_WITH_NAME(Class_Handle, resolve_class_new, (Compile_Handle h, Class_Handle c, unsigned index)); -PROTOTYPE_WITH_NAME(Method_Handle, resolve_special_method, (Compile_Handle h, Class_Handle c, unsigned index)); -PROTOTYPE_WITH_NAME(Method_Handle, resolve_interface_method, (Compile_Handle h, Class_Handle c, unsigned index)); -PROTOTYPE_WITH_NAME(Method_Handle, resolve_static_method, (Compile_Handle h, Class_Handle c, unsigned index)); -PROTOTYPE_WITH_NAME(Method_Handle, resolve_virtual_method, (Compile_Handle h, Class_Handle c, unsigned index)); -PROTOTYPE_WITH_NAME(Field_Handle, resolve_nonstatic_field, - (Compile_Handle h, - Class_Handle c, - unsigned index, - unsigned putfield)); -PROTOTYPE_WITH_NAME(Field_Handle, resolve_static_field, - (Compile_Handle h, - Class_Handle c, - unsigned index, - unsigned putfield)); - -//Type Info - -//Vector -PROTOTYPE_WITH_NAME(int , vector_get_first_element_offset, (Class_Handle element_type)); //vector_first_element_offset_class_handle -PROTOTYPE_WITH_NAME(int , vector_get_length_offset, ()); //vector_length_offset - //Vm PROTOTYPE_WITH_NAME(IDATA , vm_tls_alloc, (UDATA* key)); //IDATA VMCALL hythread_tls_alloc(hythread_tls_key_t *handle) PROTOTYPE_WITH_NAME(UDATA , vm_tls_get_offset, (UDATA key)); //UDATA VMCALL hythread_tls_get_offset(hythread_tls_key_t key) @@ -201,49 +88,19 @@ PROTOTYPE_WITH_NAME(UDATA , vm_tls_is_fast, (void));//UDATA VMCALL hythread_uses_fast_tls PROTOTYPE_WITH_NAME(IDATA , vm_get_tls_offset_in_segment, (void));//IDATA VMCALL hythread_get_hythread_offset_in_tls(void) - +/////////////////////// tmp declarations ////////////// +DECLARE_OPEN(size_t, class_get_object_size, (Class_Handle ch)); PROTOTYPE_WITH_NAME(void , vm_properties_destroy_keys, (char** keys));//void destroy_properties_keys(char** keys) PROTOTYPE_WITH_NAME(void , vm_properties_destroy_value, (char* value));//void destroy_property_value(char* value) PROTOTYPE_WITH_NAME(char** , vm_properties_get_keys, (PropertyTable table_number));//char** get_properties_keys(PropertyTable table_number); PROTOTYPE_WITH_NAME(char** , vm_properties_get_keys_starting_with, (const char* prefix, PropertyTable table_number));//get_properties_keys_staring_with PROTOTYPE_WITH_NAME(char* , vm_properties_get_value, (const char* key, PropertyTable table_number));//char* get_property(const char* key, PropertyTable table_number) - - PROTOTYPE_WITH_NAME(Class_Handle, vm_get_system_object_class, ()); // get_system_object_class PROTOTYPE_WITH_NAME(Class_Handle, vm_get_system_class_class, ()); // get_system_class_class PROTOTYPE_WITH_NAME(Class_Handle, vm_get_system_string_class, ()); // get_system_string_class -PROTOTYPE_WITH_NAME(void* , vm_get_vtable_base, ()); //POINTER_SIZE_INT vm_get_vtable_base() +PROTOTYPE_WITH_NAME(void* , vm_get_vtable_base_address, ()); //POINTER_SIZE_INT vm_get_vtable_base() PROTOTYPE_WITH_NAME(void* , vm_get_heap_base_address, ()); //vm_heap_base_address PROTOTYPE_WITH_NAME(void* , vm_get_heap_ceiling_address, ()); //vm_heap_ceiling_address -PROTOTYPE_WITH_NAME(Boolean , vm_is_heap_compressed, ());//vm_references_are_compressed(); -PROTOTYPE_WITH_NAME(Boolean , vm_is_vtable_compressed, ());//vm_vtable_pointers_are_compressed(); -PROTOTYPE_WITH_NAME(void , vm_patch_code_block, (Byte *code_block, Byte *new_code, size_t size)); -PROTOTYPE_WITH_NAME(JIT_Result , vm_compile_method, (JIT_Handle jit, Method_Handle method)); -PROTOTYPE_WITH_NAME(void , vm_register_jit_extended_class_callback, - (JIT_Handle jit, - Class_Handle clss, - void* callback_data)); -PROTOTYPE_WITH_NAME(void , vm_register_jit_overridden_method_callback, - (JIT_Handle jit, - Method_Handle method, - void* callback_data)); -PROTOTYPE_WITH_NAME(void , vm_register_jit_recompiled_method_callback, - (JIT_Handle jit, - Method_Handle method, - void *callback_data)); -PROTOTYPE_WITH_NAME(void , vm_compiled_method_load, - (Method_Handle method, uint32 codeSize, - void* codeAddr, - uint32 mapLength, - AddrLocation* addrLocationMap, - void* compileInfo, - Method_Handle outer_method));//compiled_method_load - - -/////////////////////////// temporary /////////////////////////// -//VTable -PROTOTYPE_WITH_NAME(Class_Handle , vtable_get_class, (VTable_Handle vh)); - - - +PROTOTYPE_WITH_NAME(BOOLEAN , vm_is_heap_compressed, ());//vm_references_are_compressed(); +PROTOTYPE_WITH_NAME(BOOLEAN , vm_is_vtable_compressed, ());//vm_vtable_pointers_are_compressed(); #endif // _VM_INTERFACE_H Index: vm/include/open/vm_class_support.h =================================================================== --- vm/include/open/vm_class_support.h (revision 639193) +++ vm/include/open/vm_class_support.h (working copy) @@ -117,11 +117,6 @@ */ void vm_recompile_method(JIT_Handle jit, Method_Handle method); -/// FIXME - This isn't method interface function! -// Replaces method_get_JIT_id -JIT_Handle -compilation_get_JIT_id(Compile_Handle compile_handle); - /** * Enables allocation of multiple chunks of code with different heat values. * @@ -207,7 +202,7 @@ * Returns TRUE if vtable pointers within objects are to be treated * as offsets rather than raw pointers. */ -Boolean vm_vtable_pointers_are_compressed(); +Boolean vm_is_vtable_compressed(); /** * @return the number of bytes allocated by VM in VTable @@ -219,7 +214,7 @@ * Returns the base address of the vtable memory area. This value will * never change and can be cached at startup. */ -POINTER_SIZE_INT vm_get_vtable_base(); +POINTER_SIZE_INT vm_get_vtable_base_address(); /** * Returns the width in bytes (e.g. 4 or 8) of the vtable type Index: vm/include/open/vm_class_loading.h =================================================================== --- vm/include/open/vm_class_loading.h (revision 639193) +++ vm/include/open/vm_class_loading.h (working copy) @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Intel, Pavel Pervov - * @version $Revision: 1.6 $ - */ #ifndef _VM_CLASS_LOADING_H #define _VM_CLASS_LOADING_H @@ -28,7 +24,33 @@ * from the virtual machine and interested components. */ +#include "open/types.h" +#ifdef __cplusplus +extern "C" { +#endif + +DECLARE_OPEN(ClassLoaderHandle, class_get_class_loader, (Class_Handle ch)); + +/** +* @return A class corresponding to a primitive type. For all primitive types t +* t == class_get_primitive_type_of_class(class_get_class_of_primitive_type(t)) +*/ +DECLARE_OPEN(Class_Handle, class_get_class_of_primitive_type, (VM_Data_Type typ)); + + +/** +* @return An VM_Data_Type value for a given class. +*/ +DECLARE_OPEN(VM_Data_Type, class_get_primitive_type_of_class, (Class_Handle ch)); + +/** +* Given a class handle cl construct a class handle of the type +* representing array of cl. If class cl is value type, assume +* that the element is a reference to a boxed instance of that type. +*/ +DECLARE_OPEN(Class_Handle, class_get_array_of_class, (Class_Handle ch)); + /** * @defgroup Extended VM Class Loading Extended Interface * The extended functionality is implemented on the basis of basic interfaces @@ -46,10 +68,10 @@ * * @return The handle for C++ class representation, if found. Otherwise, NULL. * - * @note Replaces cl_get_class. + * @note Replaces cl_get_class. FIXME */ -Class_Handle -class_loader_lookup_class(Open_Class_Loader_Handle classloader, const char* name); +DECLARE_OPEN(Class_Handle, +class_loader_lookup_class, (ClassLoaderHandle classloader, const char* name)); /** @@ -60,11 +82,18 @@ * * @return The handle for the C++ class representation, if loaded successfully; otherwise, NULL. * - * @note Replaces cl_load_class. + * @note Replaces cl_load_class. FIXME */ -Class_Handle -class_loader_load_class(Open_Class_Loader_Handle classloader, const char* name); +DECLARE_OPEN(Class_Handle, +class_loader_load_class, (ClassLoaderHandle classloader, const char* name)); +/** +* Find already loaded class of a given name. +* +* @return NULL if a class is not loaded. +*/ +DECLARE_OPEN(Class_Handle, class_lookup_boot_class,(const char *name)); + /** @ingroup Extended * * Tries to load the class given its name and using the bootstrap class loader. @@ -73,11 +102,8 @@ * @param exc - the exception code for a class loading failure * * @result The handle for the C++ class representation, if loaded successfully; otherwise, NULL. - * - * @note Replaces class_load_class_by_name_using_system_class_loader. */ -Class_Handle -vm_load_class_with_bootstrap(const char* name); +DECLARE_OPEN(Class_Handle, class_load_boot_class, (const char* name)); /** * Returns the C++ class structure representing the system @@ -86,35 +112,39 @@ * This function is the fast equivalent of the vm_load_class_with_bootstrap("java/lang/Object") function. * * @return the handle for the java.lang.Object C++ class representation. - * - * @note Replaces get_system_object_class. */ -Class_Handle -vm_get_java_lang_object_class(); +DECLARE_OPEN(Class_Handle, vm_get_java_lang_object_class, ()); /** * Returns the C++ class structure representing the system class - * java.lang.string. + * java.lang.String. * * This function is the fast equivalent of the vm_load_class_with_bootstrap("java/lang/String") function. * * @return The handle of java.lang.String C++ class representation - * - * @note Replaces get_system_string_class. */ -Class_Handle -vm_get_java_lang_string_class(); +DECLARE_OPEN(Class_Handle, vm_get_java_lang_string_class, ()); /** +* Returns the C++ class structure representing the system class +* java.lang.Class. +* +* This function is the fast equivalent of the vm_load_class_with_bootstrap("java/lang/Class") function. +* +* @return The handle of java.lang.Class C++ class representation +*/ +DECLARE_OPEN(Class_Handle, vm_get_java_lang_class_class, ()); + +/** * Stores the pointer to verifier-specific data into the class loader C++ structure. * * @param classloader - the handle to the class loader to set the verifier data in * @param data - the pointer to the verifier data * - * @note Replaces cl_set_verify_data_ptr. + * @note Replaces cl_set_verify_data_ptr. FIXME */ -void -class_loader_set_verifier_data_ptr(Open_Class_Loader_Handle classloader, const void* data); +DECLARE_OPEN(void, +class_loader_set_verifier_data_ptr, (ClassLoaderHandle classloader, const void* data)); /** * Returns the pointer to verifier-specific data associated with the given class loader. @@ -123,29 +153,30 @@ * * @return The pointer to the verifier data * - * @note Replaces cl_get_verify_data_ptr. + * @note Replaces cl_get_verify_data_ptr. FIXME */ -void* -class_loader_get_verifier_data_ptr(Open_Class_Loader_Handle classloader); +DECLARE_OPEN(void*, class_loader_get_verifier_data_ptr, (ClassLoaderHandle classloader)); /** * Acquires the lock on a given class loader. * * @param classloader - the handle to the C++ class loader structure to acquire lock on. * - * @note Replaces cl_acquire_lock. + * @note Replaces cl_acquire_lock. FIXME */ -void -class_loader_lock(Open_Ñlass_Loader_Handle classloader); +DECLARE_OPEN(void, class_loader_lock, (ClassLoaderHandle classloader)); /** * Releases the lock on a given class loader. * * @param classloader - the handle to the C++ class loader structure to release lock on. * - * @note Replaces cl_acquire_lock. + * @note Replaces cl_acquire_lock. FXIME */ -void -class_loader_unlock(Open_Class_Loader_Handle classloader); +DECLARE_OPEN(void, class_loader_unlock, (ClassLoaderHandle classloader)); +#ifdef __cplusplus +} +#endif + #endif // _VM_CLASS_LOADING_H Index: vm/include/open/vm.h =================================================================== --- vm/include/open/vm.h (revision 639193) +++ vm/include/open/vm.h (working copy) @@ -64,145 +64,62 @@ /** * Dynamic interface adaptor, should return specific API by its name. */ -VMEXPORT void* get_vm_interface(const char*); +DECLARE_OPEN(void *, vm_get_interface, (const char*)); -/** - * Begin class-related functions. - */ +////////////////////////// temporarily moved from jit_import.h -/** - * @return A handle for the Object class. For Java applications, it's - * java.lang.Object. - */ -VMEXPORT Class_Handle get_system_object_class(); - -/** - * @return A handle for the Class class. For Java applications, it's - * java.lang.Class. - */ -VMEXPORT Class_Handle get_system_class_class(); - -/** - * @return A handle for the string class. For Java applications, it's - * java.lang.String. - */ - -VMEXPORT Class_Handle get_system_string_class(); - -/** - * Find already loaded class of a given name. - * - * @return NULL if a class is not loaded. - */ -VMEXPORT Class_Handle -class_lookup_class_by_name_using_bootstrap_class_loader(const char *name); - -/** - * The following three functions will be eventually renamed to - * \arg class_is_final - * \arg class_is_abstract - * \arg class_is_interface - * but right now that would conflict - * with the names of some internal macros. - */ - -VMEXPORT Boolean class_is_final(Class_Handle ch); -VMEXPORT Boolean class_is_abstract(Class_Handle ch); -VMEXPORT BOOLEAN class_is_interface(Class_Handle ch); - /** - * @return TRUE if the class is likely to be used as an exception object. - * This is a hint only. If the result is FALSE, the class may still - * be used for exceptions but it is less likely. - */ -VMEXPORT Boolean class_hint_is_exceptiontype(Class_Handle ch); +* @return The number of exception handlers defined for this method in the +* bytecodes. +*/ -/** - * @return TRUE if the class is a value type. - */ - VMEXPORT Boolean class_is_valuetype(Class_Handle ch); +VMEXPORT unsigned method_get_num_handlers(Method_Handle method); -/** - * @return TRUE if the class represents an enum. - * For Java 1.4 always returns FALSE. - */ -VMEXPORT Boolean class_is_enum(Class_Handle ch); +VMEXPORT void method_get_handler_info(Method_Handle method, + unsigned handler_id, + unsigned *begin_offset, + unsigned *end_offset, + unsigned *handler_offset, + unsigned *handler_class_index); -/** - * This function can only be called if (class_is_enum(ch) == TRUE) - * The returned value is the type of the underlying int type. - */ -VMEXPORT VM_Data_Type class_get_enum_int_type(Class_Handle ch); -/** - * @return TRUE if the class represents a primitive type (int, float, etc.) - */ - VMEXPORT Boolean class_is_primitive(Class_Handle ch); -/** - * @return The name of the class. - */ - VMEXPORT const char *class_get_name(Class_Handle ch); +//@} +/** @name Method-related functions +*/ +//@{ /** - * @return The name of the package containing the class. - */ - VMEXPORT const char *class_get_package_name(Class_Handle ch); +* @ingroup bytecodes +*/ +/////////////////////////////////////////////////////// +// begin method-related functions: bytecodes +/////////////////////////////////// /** - * The super class of the current class. - * @return NULL for the system object class, i.e. - * class_get_super_class(get_system_object_class()) == NULL - */ -VMEXPORT Class_Handle class_get_super_class(Class_Handle ch); +* Get a pointer to the buffer containing the bytecodes for this method. +* Bytecodes are either JVML instructions or CIL instructions. +*/ +VMEXPORT const Byte *method_get_byte_code_addr(Method_Handle method); /** - * @return The vtable handle of the given class. - */ - VMEXPORT VTable_Handle class_get_vtable(Class_Handle ch); +* Size if the buffer returned by method_get_byte_code_addr(). +*/ -/** - * @return The allocation handle to be used for the object allocation - * routines, given a class handle. - */ -VMEXPORT Allocation_Handle class_get_allocation_handle(Class_Handle ch); +VMEXPORT size_t method_get_byte_code_size(Method_Handle method); /** - * @return The class handle corresponding to a given allocation handle. - */ -VMEXPORT Class_Handle allocation_handle_get_class(Allocation_Handle ah); +* Maximum depth of the evaluation stack in this method. +*/ -/** - * @return An VM_Data_Type value for a given class. - */ - VMEXPORT VM_Data_Type class_get_primitive_type_of_class(Class_Handle ch); +VMEXPORT unsigned method_get_max_stack(Method_Handle method); +////////////////////////// +// end method-related functions: bytecodes +/////////////////////////////////////////////////////// -/** - * @return A class corresponding to a primitive type. For all primitive types t - * t == class_get_primitive_type_of_class(class_get_class_of_primitive_type(t)) - */ - VMEXPORT Class_Handle class_get_class_of_primitive_type(VM_Data_Type typ); -/** - * @return TRUE is the class is an array. - */ -VMEXPORT Boolean class_is_array(Class_Handle ch); - -/** - * @return TRUE if class s is assignment - * compatible with class t. - */ -VMEXPORT Boolean class_is_instanceof(Class_Handle s, Class_Handle t); - /** * Given a class handle cl construct a class handle of the type - * representing array of cl. If class cl is value type, assume - * that the element is a reference to a boxed instance of that type. - */ - VMEXPORT Class_Handle class_get_array_of_class(Class_Handle ch); - -/** - * Given a class handle cl construct a class handle of the type * representing array of cl. Class cl is assumed to be a * value type. * @@ -211,30 +128,6 @@ VMEXPORT Class_Handle class_get_array_of_unboxed(Class_Handle ch); /** - * @return For a class that is an array return the type info for the elements - * of the array. - */ - VMEXPORT Type_Info_Handle class_get_element_type_info(Class_Handle ch); - - /** - * @return TRUE if the class is already fully initialized. - */ - VMEXPORT Boolean class_is_initialized(Class_Handle ch); - -/** - * @return TRUE if the class is neither initialized nor in the process - * of being initialized. The intention is that the JIT will emit a call - * to VM_RT_INITIALIZE_CLASS before every access to a static - * field in Java. - */ - VMEXPORT Boolean class_needs_initialization(Class_Handle ch); - -/** - * For Java returns FALSE. - */ - VMEXPORT Boolean class_is_before_field_init(Class_Handle ch); - -/** * Number of instance fields defined in a class. That doesn't include * inherited fields. */ @@ -273,9 +166,6 @@ */ VMEXPORT unsigned class_get_number_methods(Class_Handle ch); -/// Check if fast_instanceof is applicable for the class -VMEXPORT Boolean class_get_fast_instanceof_flag(Class_Handle cl); - /** * Get handle for a method declared in class. */ @@ -292,25 +182,15 @@ VMEXPORT void* class_alloc_via_classloader(Class_Handle ch, int32 size); /** - * @return TRUE if this is an array of primitives. - */ - VMEXPORT Boolean class_is_non_ref_array(Class_Handle ch); - -/** - * @return TRUE if the class has a non-trivial finalizer. - */ - VMEXPORT BOOLEAN class_is_finalizable(Class_Handle ch); - -/** * This exactly what I want. * Get the alignment of the class. */ VMEXPORT unsigned class_get_alignment(Class_Handle ch); -/** - * Get the alignment of the class when it's unboxed. + /** + * @return The size in bytes of an instance in the heap. */ - VMEXPORT unsigned class_get_alignment_unboxed(Class_Handle ch); + DECLARE_OPEN(size_t, class_get_object_size, (Class_Handle ch)); /** * @return For a class handle that represents and array, return the size of the @@ -319,11 +199,6 @@ VMEXPORT unsigned class_element_size(Class_Handle ch); /** - * @return The size in bytes of an instance in the heap. - */ - VMEXPORT unsigned class_get_boxed_data_size(Class_Handle ch); - -/** * @return The offset to the start of user data form the start of a boxed * instance. */ @@ -344,25 +219,7 @@ */ VMEXPORT Class_Handle class_get_array_element_class(Class_Handle ch); -/** - * @return The offset from the start of the vtable at which the - * superclass hierarchy is stored. This is for use with fast type - * checking. - */ - VMEXPORT int vtable_get_super_array_offset(); -/** - * @return Class handle given object's VTable_Handle. - */ - DECLARE_OPEN(Class_Handle, vtable_get_class, (VTable_Handle vh)); - -/** - * @return The number of superclass hierarchy elements that are - * stored within the vtable. This is for use with fast type checking. - */ - VMEXPORT int vm_max_fast_instanceof_depth(); - - //// // begin class iterator related functions. //// @@ -418,10 +275,6 @@ /// //// -// end class-related functions. -//// - -//// // begin field-related functions. //// @@ -433,7 +286,7 @@ /** * @return The type info that represents the type of the field. */ - VMEXPORT Type_Info_Handle field_get_type_info_of_field_value(Field_Handle fh); + VMEXPORT Type_Info_Handle field_get_type_info(Field_Handle fh); /** * @return The class that represents the type of the field. @@ -474,11 +327,6 @@ VMEXPORT Boolean field_is_literal(Field_Handle fh); /** - * For Java always FALSE. - */ - VMEXPORT Boolean field_is_unmanaged_static(Field_Handle fh); - -/** * @return The offset to an instance field. */ VMEXPORT unsigned field_get_offset(Field_Handle fh); @@ -514,33 +362,6 @@ */ VMEXPORT Boolean field_is_private(Field_Handle fh); -/** - * @return The address and bit mask, for the flag which determine whether field - * access event should be sent. JIT may use the following expression to - * determine if specified field access should be tracked: - * ( **address & *mask != 0 ) - * - * @param field - handle of the field - * @param[out] address - pointer to the address of the byte which contains the flag - * @param[out] mask - pointer to the bit mask of the flag - */ -VMEXPORT void -field_get_track_access_flag(Field_Handle field, char** address, char* mask); - -/** - * @return the address and bit mask, for the flag which determine whether field - * modification event should be sent. JIT may use the following expression to - * determine if specified field modification should be tracked: - * ( **address & *mask != 0 ) - * - * @param field - handle of the field - * @param[out] address - pointer to the address of the byte which contains the flag - * @param[out] mask - pointer to the bit mask of the flag - */ -VMEXPORT void -field_get_track_modification_flag(Field_Handle field, char** address, - char* mask); - //// // end field-related functions. //// @@ -565,16 +386,6 @@ */ VMEXPORT Class_Handle method_get_class(Method_Handle mh); -/* -* Acquires lock associated with method -*/ -VMEXPORT void method_lock(Method_Handle mh); - -/* -* Releases lock associated with method -*/ -VMEXPORT void method_unlock(Method_Handle mh); - /** * @return TRUE if the method is private. */ @@ -615,18 +426,6 @@ VMEXPORT Boolean method_is_strict(Method_Handle m); /** - * @return TRUE if the method has been overriden in a subclass - * and FALSE otherwise. - * - * @note If method_is_overridden returns FALSE, loading - * of a subclass later in the execution of the program may change - * invalidate this condition. If a JIT uses method_is_overridden - * to implement unconditional inlining, it must be prepared to patch the code later - * (see vm_register_jit_overridden_method_callback). - */ -VMEXPORT Boolean method_is_overridden(Method_Handle m); - -/** * @return TRUE if the method should not be inlined. There may also * be other reasons why a method shouldn't be inlined, e.g., native methods * can't be inlined and in Java you can't inlined methods that are @@ -636,25 +435,11 @@ VMEXPORT Boolean method_is_no_inlining(Method_Handle mh); /** - * Always FALSE for Java. - */ -VMEXPORT Boolean method_is_require_security_object(Method_Handle mh); - -/** * @return A signature that can be used to iterate over method's arguments * and query the type of the method result. */ VMEXPORT Method_Signature_Handle method_get_signature(Method_Handle mh); -/** - * Class ch is a subclass of method_get_class(mh). - * The function returns a method handle for an accessible method overriding - * mh in ch or in its closest superclass that overrides - * mh. - * Class ch must be a class not an interface. - */ -VMEXPORT Method_Handle method_find_overridden_method(Class_Handle ch, Method_Handle mh); - //// // begin method iterator related functions. /// @@ -690,53 +475,16 @@ */ VMEXPORT const char *method_sig_get_descriptor(Method_Signature_Handle s); -/** - * Return a signature that can be used to iterate over method's arguments - * and query the type of the method result. - * Java doesn't have standalone signatures, so for Java, always return NULL. - */ -VMEXPORT Method_Signature_Handle method_standalone_signature(Class_Handle ch, - unsigned idx); - //// // end method signature-related functions. //// -//// -// begin local variables-related functions. -/// - /** * @return the number of local variables defined for the method. */ VMEXPORT unsigned method_vars_get_number(Method_Handle mh); /** - * Return the type info of the local variable number idx. - * Since local variables are not typed in Java. this function - * always returns NULL for Java methods. - */ -VMEXPORT Type_Info_Handle method_vars_get_type_info(Method_Handle mh, - unsigned idx); -/** - * @return TRUE if the local variable is a managed pointer. - */ -VMEXPORT Boolean method_vars_is_managed_pointer(Method_Handle mh, unsigned idx); - -/** - * @return TRUE if the local variable is pinned. - */ -VMEXPORT Boolean method_vars_is_pinned(Method_Handle mh, unsigned idx); - -/** - * end local variables-related functions. - */ - -/** - * begin argument-related functions. - */ - -/** * @return the number of arguments defined for the method. * This number automatically includes the this pointer (if present). */ @@ -750,30 +498,10 @@ */ VMEXPORT Type_Info_Handle method_args_get_type_info(Method_Signature_Handle msh, unsigned idx); -/** - * @return TRUE if the argument is a managed pointer. - */ -VMEXPORT Boolean method_args_is_managed_pointer(Method_Signature_Handle msh, unsigned idx); -//// -// end argument-related functions. -//// - -//// -// begin return value-related functions. -//// VMEXPORT Type_Info_Handle method_ret_type_get_type_info(Method_Signature_Handle msh); -/** - * @return TRUE if the return value is a managed pointer. - */ -VMEXPORT Boolean method_ret_type_is_managed_pointer(Method_Signature_Handle msh); - //// -// end return value-related functions. -//// - -//// // end method-related functions. //// @@ -795,10 +523,6 @@ */ VMEXPORT int vector_length_offset(); -/** - * Deprecated. Please use vector_length_offset instead. - */ -VMEXPORT int array_length_offset(); /** * Return the offset to the first element of the vector of the given type. @@ -807,12 +531,7 @@ */ VMEXPORT int vector_first_element_offset(VM_Data_Type element_type); -/** - * Deprecated. Please use vector_first_element_offset instead. - */ -VMEXPORT int array_first_element_offset(VM_Data_Type element_type); - /** * Return the offset to the first element of the vector of the given type. * Assume that the elements are boxed. Byte offset. @@ -820,11 +539,6 @@ VMEXPORT int vector_first_element_offset_class_handle(Class_Handle element_type); /** - * Deprecated. Please use vector_first_element_offset_class_handle instead. - */ -VMEXPORT int array_first_element_offset_class_handle(Class_Handle element_type); - -/** * Return the offset to the first element of the vector of the given type. * If the class is a value type, assume that elements are unboxed. * If the class is not a value type, assume that elements are references. @@ -832,11 +546,6 @@ VMEXPORT int vector_first_element_offset_unboxed(Class_Handle element_type); /** - * Deprecated. Please use vector_first_element_offset_unboxed instead. - */ -VMEXPORT int array_first_element_offset_unboxed(Class_Handle element_type); - -/** * Return the length of a vector. The caller must ensure that GC will not * move or deallocate the vector while vector_get_length() is active. */ @@ -860,150 +569,111 @@ // end vector layout functions. //// -//// -// begin miscellaneous functions. -//// /** * @return TRUE if references within objects and vector elements are * to be treated as offsets rather than raw pointers. */ -VMEXPORT Boolean vm_references_are_compressed(); +DECLARE_OPEN(BOOLEAN, vm_is_heap_compressed, ()); /** * @return The starting address of the GC heap. */ -VMEXPORT void *vm_heap_base_address(); +DECLARE_OPEN(void *, vm_get_heap_base_address, ()); /** * @return The ending address of the GC heap. */ -VMEXPORT void *vm_heap_ceiling_address(); +DECLARE_OPEN(void *, vm_get_heap_ceiling_address, ()); /** * @return TRUE if vtable pointers within objects are to be treated * as offsets rather than raw pointers. */ -VMEXPORT Boolean vm_vtable_pointers_are_compressed(); +DECLARE_OPEN(BOOLEAN, vm_is_vtable_compressed, ()); /** - * @return The offset to the vtable pointer in an object. - */ -VMEXPORT int object_get_vtable_offset(); - -/** * @return The base address of the vtable memory area. This value will * never change and can be cached at startup. */ -VMEXPORT POINTER_SIZE_INT vm_get_vtable_base(); +DECLARE_OPEN(void *, vm_get_vtable_base_address, ()); -/** - * @return The width in bytes (e.g. 4 or 8) of the vtable type - * information in each object's header. This is typically used - * by the JIT for generating type-checking code, e.g. for inlined - * type checks or for inlining of virtual methods. - */ -VMEXPORT unsigned vm_get_vtable_ptr_size(); +typedef enum { + VM_PROPERTIES = 0, + JAVA_PROPERTIES = 1 +} PropertyTable; /** - * @return A printable signature. The character buffer is owned by the - * caller. Call free_string_buffer to reclaim the memory. - */ -VMEXPORT char *method_sig_get_string(Method_Signature_Handle msh); - -/** - * Free a string buffer returned by method_sig_get_string. - */ -VMEXPORT void free_string_buffer(char *buffer); - -/** * Sets the property for table_number property table. NULL value is supported. */ -VMEXPORT void set_property(const char* key, const char* value, PropertyTable table_number); +DECLARE_OPEN(void, vm_property_set, (const char* key, const char* value, PropertyTable table_number)); /** * @return The value of the property from table_number property table if it - * has been set by set_property function. Otherwise NULL. + * has been set by vm_property_set function. Otherwise NULL. */ -VMEXPORT char* get_property(const char* key, PropertyTable table_number); +DECLARE_OPEN(char*, vm_properties_get_value, (const char* key, PropertyTable table_number)); /** - * Safety frees memory of value returned by get_property function. + * Safely frees memory of value returned by vm_properties_get_value function. */ -VMEXPORT void destroy_property_value(char* value); +DECLARE_OPEN(void, vm_properties_destroy_value, (char* value)); /** * Checks if the property is set. * - * @return -1 if table_number is incorrect.
- * 1 if property is set in table_number property table.
- * 0 otherwise. + * @return TRUE if property is set in table_number property table, + * FALSE otherwise. */ -VMEXPORT int is_property_set(const char* key, PropertyTable table_number); +DECLARE_OPEN(BOOLEAN, vm_property_is_set, (const char* key, PropertyTable table_number)); /** * Unsets the property in table_number property table. */ -VMEXPORT void unset_property(const char* key, PropertyTable table_number); +DECLARE_OPEN(void, vm_property_unset, (const char* key, PropertyTable table_number)); /** * @return An array of keys from table_number properties table. */ -VMEXPORT char** get_properties_keys(PropertyTable table_number); +DECLARE_OPEN(char**, vm_properties_get_keys, (PropertyTable table_number)); /** * @return An array of keys which start with specified prefix from * table_number properties table. */ -VMEXPORT char** get_properties_keys_staring_with(const char* prefix, PropertyTable table_number); +DECLARE_OPEN(char**, vm_properties_get_keys_starting_with, (const char* prefix, PropertyTable table_number)); /** - * Safety frees array of keys memory which returned by get_properties_keys - * or get_properties_keys_staring_with functions. + * Safety frees array of keys memory which returned by vm_properties_get_keys + * or vm_properties_get_keys_starting_with functions. */ -VMEXPORT void destroy_properties_keys(char** keys); +DECLARE_OPEN(void, vm_properties_destroy_keys, (char** keys)); /** * Tries to interpret property value as Boolean and returns it. * In case of failure returns default_value. */ -VMEXPORT Boolean get_boolean_property(const char* property, Boolean default_value, PropertyTable table_number); +DECLARE_OPEN(BOOLEAN, vm_property_get_bool, (const char* property, BOOLEAN default_value, PropertyTable table_number)); /** * Tries to interpret property value as int and returns it. In case of failure * returns default_value. */ -VMEXPORT int get_int_property(const char *property_name, int default_value, PropertyTable table_number); +DECLARE_OPEN(int, vm_property_get_int, (const char *property_name, int default_value, PropertyTable table_number)); /** * Tries to interpret property value as int and returns it. In case of failure * returns default_value. */ -VMEXPORT size_t get_size_property(const char *property_name, size_t default_value, PropertyTable table_number); +DECLARE_OPEN(size_t, vm_property_get_size, (const char *property_name, size_t default_value, PropertyTable table_number)); - -//Tries to interpret property value as int and returns it. In case of failure returns default_value. -// Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, and 'g' or 'G' for gigabytes (for example, 32k is the same as 32768). -VMEXPORT int64 get_numerical_property(const char *property_name, int64 default_value, PropertyTable table_number); - /** - * Returns the address of the global flag that specifies whether - * MethodEntry event is enabled. JIT should call this function in case - * a method is compiled with exe_notify_method_entry flag set. + * Tries to interpret property value as int and returns it. In case of failure returns default_value. + * Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, + * and 'g' or 'G' for gigabytes (for example, 32k is the same as 32768). */ -VMEXPORT char *get_method_entry_flag_address(); +DECLARE_OPEN(I_64, vm_property_get_number, (const char *property_name, I_64 default_value, PropertyTable table_number)); -/** - * Returns the address of the global flag that specifies whether - * MethodExit event is enabled. JIT should call this function in case - * a method is compiled with exe_notify_method_exit flag set. - */ -VMEXPORT char *get_method_exit_flag_address(); - -//// -// end miscellaneous functions. -//// - #ifdef __cplusplus } #endif Index: vm/include/jit_import.h =================================================================== --- vm/include/jit_import.h (revision 639193) +++ vm/include/jit_import.h (working copy) @@ -1,565 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * These are the functions that a JIT built as a DLL may call. - */ - -#ifndef _JIT_IMPORT_H -#define _JIT_IMPORT_H - -#include - -#include "jit_export.h" -#include "open/types.h" -#include "open/vm.h" -#include "jit_import_rt.h" -#include "vm_core_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef void *Method_Iterator; - -/** - * @name Direct call-related functions - */ -//@{ - -/** - * These functions allow a JIT to be notified whenever a VM data structure changes that - * would require code patching or recompilation. - * - * Called by a JIT in order to be notified whenever the given class (or any of - * its subclasses?) is extended. The callback_data pointer will - * be passed back to the JIT during the callback. The callback function is - * JIT_extended_class_callback. - */ -VMEXPORT void vm_register_jit_extended_class_callback(JIT_Handle jit, Class_Handle clss, - void *callback_data); - -/** - * Called by a JIT in order to be notified whenever the given method is - * overridden by a newly loaded class. The callback_data pointer - * will be passed back to the JIT during the callback. The callback function is - * JIT_overridden_method_callback. - */ -VMEXPORT void vm_register_jit_overridden_method_callback(JIT_Handle jit, Method_Handle method, - void *callback_data); - -/** - * Called by a JIT in order to be notified whenever the vtable entries for the - * given method are changed. This could happen, e.g., when a method is first - * compiled, or when it is recompiled. The callback_data pointer - * will be passed back to the JIT during the callback. The callback method is - * JIT_recompiled_method_callback. - */ -VMEXPORT void vm_register_jit_recompiled_method_callback(JIT_Handle jit, Method_Handle method, - void *callback_data); - -/** - * Called by a JIT to have the VM replace a section of executable code in a - * thread-safe fashion. This function does not synchronize the I- or D-caches. - * It may be a lot cheaper to batch up the patch requests, so we may need to - * extend this interface. - */ -VMEXPORT void vm_patch_code_block(Byte *code_block, Byte *new_code, size_t size); - -/** - * Called by a JIT to have the VM recompile a method using the specified JIT. After - * recompilation, the corresponding vtable entries will be updated, and the necessary - * callbacks to JIT_recompiled_method_callback will be made. It is a - * requirement that the method has not already been compiled by the given JIT; - * this means that multiple instances of a JIT may need to be active at the same time. - */ - -VMEXPORT void vm_recompile_method(JIT_Handle jit, Method_Handle method); - -/** - * Called by a JIT to have VM synchronously (in the same thread) compile a method - * It is a requirement that JIT calls this routine only during compilation of - * other method, not during run-time. - */ - -VMEXPORT JIT_Result vm_compile_method(JIT_Handle jit, Method_Handle method); - -//@} -/** @name Exception-related compile-time functions - */ -//@{ - -/** - * @return The number of exception handlers defined for this method in the - * bytecodes. - */ - -VMEXPORT unsigned method_get_num_handlers(Method_Handle method); - -/** - * Deprecated. - * - * @sa method_get_handler_info - */ -VMEXPORT void method_get_handler_info_full(Method_Handle method, - unsigned handler_id, - unsigned *begin_offset, - unsigned *end_offset, - unsigned *handler_offset, - unsigned *handler_len, - unsigned *filter_offset, - unsigned *handler_class_index); - -/** - * This is a simpler version of method_get_handler_info_full() that works - * only for JVM. - */ -VMEXPORT void method_get_handler_info(Method_Handle method, - unsigned handler_id, - unsigned *begin_offset, - unsigned *end_offset, - unsigned *handler_offset, - unsigned *handler_class_index); - -/** - * Deprecated. - * - * @return For Java methods, it always returns FALSE since JVM - * handlers do not have a finally clause. - */ -VMEXPORT Boolean method_handler_has_finally(Method_Handle method, - unsigned handler_id); - -/** - * Deprecated. - * - * @return For Java methods, it always returns FALSE since JVM - * handlers do not have a filters. - */ - -VMEXPORT Boolean method_handler_has_filter(Method_Handle method, - unsigned handler_id); - -/** - * Deprecated. - * - * @return For Java methods, it always returns FALSE since JVM - * handlers do not have a fault clause. - */ - -VMEXPORT Boolean method_handler_has_fault(Method_Handle method, - unsigned handler_id); - -/** - * Set the number of exception handlers in the code generated by the JIT - * j for a given method. The JIT must then - * call method_set_target_handler_info() - * for each of the num_handlers exception handlers. - */ - -VMEXPORT void method_set_num_target_handlers(Method_Handle method, - JIT_Handle j, - unsigned num_handlers); - -/** - * Set the information about an exception handler in the code generated by - * the JIT. - */ -VMEXPORT void method_set_target_handler_info(Method_Handle method, - JIT_Handle j, - unsigned eh_number, - void *start_ip, - void *end_ip, - void *handler_ip, - Class_Handle catch_cl, - Boolean exc_obj_is_dead); - - -//@} -/** @name Method-related functions - */ -//@{ - -/** - * @ingroup bytecodes - */ -/////////////////////////////////////////////////////// -// begin method-related functions: bytecodes -/////////////////////////////////// - -/** - * Get a pointer to the buffer containing the bytecodes for this method. - * Bytecodes are either JVML instructions or CIL instructions. - */ - VMEXPORT const Byte *method_get_byte_code_addr(Method_Handle method); - -/** - * Size if the buffer returned by method_get_byte_code_addr(). - */ - -VMEXPORT size_t method_get_byte_code_size(Method_Handle method); - -/** - * Maximum depth of the evaluation stack in this method. - */ - -VMEXPORT unsigned method_get_max_stack(Method_Handle method); -////////////////////////// -// end method-related functions: bytecodes -/////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////// -// begin method-related functions: compiled code -//////////////////////////// -/** - * @return The address where the code pointer for a given method is. - * - * A simple JIT that doesn't support recompilation (see e.g. - * vm_register_jit_recompiled_method_callback) can only - * generate code with indirect branches through the address provided - * by method_get_indirect_address(). - */ - -VMEXPORT void *method_get_indirect_address(Method_Handle method); - -/** - * @return The offset in bytes from the start of the vtable to the entry for - * a given method. - */ -VMEXPORT unsigned method_get_offset(Method_Handle method); -/////////////////////////// -// end method-related functions: compiled code -/////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////// -// begin method memory allocation-related functions. -///////////////////////////////// - -/** - * Allocate the "read-write" data block for this method. This memory block - * cannot be retrieved later. The intention is to use the data block for data - * that may be needed during the program execution (e.g. tables for - * switch statements). - * - * Separation of data allocated by method_allocate_data_block() and - * method_allocate_info_block() may help improve locality of - * references to data accessed during execution of compiled code and data - * accessed during stack uwinding. - * - * @sa method_allocate_info_block - */ - -VMEXPORT Byte *method_allocate_data_block(Method_Handle method, - JIT_Handle j, - size_t size, - size_t alignment); - -/** - * Allocated a "read-only" data block. - * - * (? 20030314) This function is deprecated. In all new code, use - * method_allocate_data_block() only. At some point, we - * will revisit this interface to have more control over the layout - * of various memory blocks allocated by the VM. - */ - -VMEXPORT Byte *method_allocate_jit_data_block(Method_Handle method, - JIT_Handle j, - size_t size, - size_t alignment); - - -/** - * This function allows allocation of multiple chunks of code with different - * heat values. The JIT is responsible for specifying ids that are unique - * within the same method. - * The first instruction of the chunk with id=0 is the entry point - * of the method. - * - * Deprecated. - * - * @return If the CAA_Allocate argument is specified, memory is - * allocated and a pointer to it is returned. If the - * CAA_Simulate argument is specified, no memory is - * allocated - the same as pass parameter size = 0 - function returns - * only current address for allocation in pool but no memory is allocated. - */ - -VMEXPORT Byte * -method_allocate_code_block(Method_Handle m, - JIT_Handle j, - size_t size, - size_t alignment, - CodeBlockHeat heat, - int id, - Code_Allocation_Action action); - - -VMEXPORT void -method_set_relocatable(Method_Handle m, JIT_Handle j, NativeCodePtr code_address, Boolean is_relocatable); - - -/** - * Allocate an info block for this method. An info block can be later - * retrieved by the JIT. The JIT may for instance store GC maps for - * root set enumeration and stack unwinding in the onfo block. - * - * @sa method_allocate_data_block - */ -VMEXPORT Byte *method_allocate_info_block(Method_Handle method, - JIT_Handle j, - size_t size); - - -/** - * Retrieve the memory block allocated earlier by - * method_allocate_code_block(). - * A pair uniquely identifies a code block. - */ - -VMEXPORT Byte *method_get_code_block_addr_jit(Method_Handle method, - JIT_Handle j); - -/** - * Get the size of the memory block allocated earlier by - * method_allocate_code_block(). - */ - -VMEXPORT unsigned method_get_code_block_size_jit(Method_Handle method, - JIT_Handle j); - -/** - * Retrieve the memory block allocated earlier by - * method_allocate_code_block(). - * A triple uniquely identifies a - * code block. - */ - -VMEXPORT Byte *method_get_code_block_addr_jit_new(Method_Handle method, - JIT_Handle j, - int id); - -/** - * Get the size of the memory block allocated earlier by - * method_allocate_code_block(). - * A triple uniquely identifies a - * code block. - */ - -VMEXPORT unsigned method_get_code_block_size_jit_new(Method_Handle method, - JIT_Handle j, - int id); - -/** - * Retrieve the memory block allocated earlier by - * method_allocate_info_block(). - * A pair uniquely identifies a JIT info block. - */ - -VMEXPORT Byte *method_get_info_block_jit(Method_Handle method, - JIT_Handle j); - -/** - * Get the size of the memory block allocated earlier by - * method_allocate_info_block(). - */ - -VMEXPORT unsigned method_get_info_block_size_jit(Method_Handle method, - JIT_Handle j); - -/////////////////////////////////////////////////////// -// begin functions for iterating over methods compiled by a given JIT. -///////////////////////////////////// - -#define METHOD_JIT_ITER_END 0 - -/** - * Here are the obvious three functions to iterate over all methods - * compiled by a given JIT. - */ - -VMEXPORT Method_Iterator method_get_first_method_jit(JIT_Handle j); -VMEXPORT Method_Iterator method_get_next_method_jit(Method_Iterator mi); -VMEXPORT Method_Handle method_get_method_jit(Method_Iterator mi); - -///////////////////////////////////////// -// end functions for iterating over methods compiled by a given JIT. -/////////////////////////////////////////////////////// -////////////////////////////// -// end method-related functions. -/////////////////////////////////////////////////////// - -/** - * @name Resolution-related functions - */ -//@{ - -/** - * Resolve a class. - * - * The idx parameter is interpreted as a constant pool index for JVM. - */ - -VMEXPORT Class_Handle -vm_resolve_class(Compile_Handle h, Class_Handle ch, unsigned idx); - -/** - * Resolve a class and provide error checking if the class cannot have an - * instance, i.e. it is abstract (or is an interface class). - * The idx parameter is interpreted as a constant pool index for JVM. - */ - -VMEXPORT Class_Handle -vm_resolve_class_new(Compile_Handle h, Class_Handle c, unsigned index); - -/** - * Resolve a reference to a non-static field. - * The idx parameter is interpreted as a constant pool index for JVM. - * Used for getfield and putfield in JVM. - */ - -VMEXPORT Field_Handle -resolve_nonstatic_field(Compile_Handle h, Class_Handle ch, unsigned idx, unsigned putfield); - -/** - * Resolve constant pool reference to a static field. - * The idx parameter is interpreted as a constant pool index for JVM. - * Used for getstatic and putstatic in JVM. - */ - -VMEXPORT Field_Handle -resolve_static_field(Compile_Handle h, Class_Handle ch, unsigned idx, unsigned putfield); - -/** - * Resolve a method. - * The idx parameter is interpreted as a constant pool index for JVM. - */ -VMEXPORT Method_Handle -resolve_method(Compile_Handle h, Class_Handle ch, unsigned idx); - - -/** - * Resolve a method. Same as resolve_method() but the VM checks - * that the method can be used for a virtual dispatch. - * The idx parameter is interpreted as a constant pool index for JVM. - */ - -VMEXPORT Method_Handle -resolve_virtual_method(Compile_Handle h, Class_Handle c, unsigned index); - -/** - * Resolve a method. Same as resolve_method() but the VM checks - * that the method is static (i.e. it is not an instance method). - * The idx parameter is interpreted as a constant pool index for - * JVM. - */ - -VMEXPORT Method_Handle -resolve_static_method(Compile_Handle h, Class_Handle c, unsigned index); - -/** - * Resolve a method. Same as resolve_method() but the VM checks - * that the method is declared in an interface type. - * The idx parameter is interpreted as a constant pool index for JVM. - */ - -VMEXPORT Method_Handle -resolve_interface_method(Compile_Handle h, Class_Handle c, unsigned index); - -//@} -/** @name Miscellaneous functions - */ -//@{ - -/** -* Looks for a method in native libraries of a class loader. -* -* @param[in] method - a searching native-method structure -* @return The pointer to found a native function. -* @note The function raises UnsatisfiedLinkError with a method name -* in an exception message, if the specified method is not found.*/ -VMEXPORT void* method_get_native_func_addr(Method_Handle method); - -/** - * @return The JIT handle for a the current compilation. - * - * The VM keeps track of the JIT that was invoked for and can return this value at - * any point during the compilation. - * (? 20030314) Does the method_ prefix really make sense here? - * Perhaps we should rename this function? - */ - -VMEXPORT JIT_Handle method_get_JIT_id(Compile_Handle h); - -//@} -/** @name Experimental functions - */ -//@{ - -/** - * These functions are currently not part of the official interface, - * although they may be promoted in some form in the future. - * - * @return TRUE if the VM's functionality for monitorenter - * and monitorexit may be inlined by the JIT; otherwise, FALSE. - * - * If TRUE is returned, then the output arguments will be - * filled in with the synchronization parameters. - * - * @param thread_id_register - the register number that holds the thread ID which - * is used to identify the locking thread - * @param sync_header_offset - the offset in bytes of the synchronization header - * from the start of the object - * @param sync_header_width - the width in bytes of the synchronization header - * @param lock_owner_offset - the offset in bytes of the lock owner field from - * the start of the object - * @param lock_owner_width - the width in bytes of the lock owner field in the - * synchronization header - * @param jit_clears_ccv - TRUE if the JIT-generated code needs - * to clear the ar.ccv register, - * FALSE if the VM ensures it is - * already cleared - * - * @note This is useful only for monitorenter/monitorexit, but not - * monitorenter_static/monitorexit_static, since the JIT doesn't - * know how to map the class_handle to an object. - */ -VMEXPORT Boolean jit_may_inline_object_synchronization(unsigned *thread_id_register, - unsigned *sync_header_offset, - unsigned *sync_header_width, - unsigned *lock_owner_offset, - unsigned *lock_owner_width, - Boolean *jit_clears_ccv); - -typedef enum CallingConvention { - CC_Vm, - CC_Jrockit, - CC_Rotor, - CC_Stdcall, - CC_Cdecl -} CallingConvention; - -VMEXPORT CallingConvention vm_managed_calling_convention(); - -#ifdef __cplusplus -} -#endif - -#endif // _JIT_IMPORT_H Index: vm/interpreter/src/interpreter_ti.cpp =================================================================== --- vm/interpreter/src/interpreter_ti.cpp (revision 639193) +++ vm/interpreter/src/interpreter_ti.cpp (working copy) @@ -24,7 +24,8 @@ #include "interp_defs.h" #include "interp_native.h" #include "port_malloc.h" - +#include "open/vm_class_info.h" +#include "open/vm_ee.h" #include "thread_generic.h" static jint skip_old_frames(VM_thread *thread) Index: vm/interpreter/src/interpreter.cpp =================================================================== --- vm/interpreter/src/interpreter.cpp (revision 639193) +++ vm/interpreter/src/interpreter.cpp (working copy) @@ -20,6 +20,7 @@ #include "open/vm_class_info.h" #include +#include "vtable.h" #include "exceptions.h" #include "exceptions_int.h" #include "vm_arrays.h" Index: vm/interpreter/src/interp_stack_trace.cpp =================================================================== --- vm/interpreter/src/interp_stack_trace.cpp (revision 639193) +++ vm/interpreter/src/interp_stack_trace.cpp (working copy) @@ -25,6 +25,8 @@ #include "stack_trace.h" #include "exceptions.h" #include "jvmti_support.h" +#include "vtable.h" +#include "jit_import_rt.h" // ppervov: HACK: allows using STL modifiers (dec/hex) and special constants (endl) using namespace std; @@ -185,18 +187,13 @@ } if (method->is_native()) { - DEBUG_GC("[METHOD ]: " - << method->get_class()->get_name()->bytes << "." - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_GC("[METHOD ]: " << method); interp_si_goto_previous(si); continue; } DEBUG_GC("[METHOD "<< si->stack.size << " " << (int)si->locals.varNum << "]: " - << class_get_name(method_get_class(method)) << "." - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + << method); if (si->stack.size) for(i = 0; i <= si->stack.index; i++) { @@ -284,18 +281,13 @@ } if (method->is_native()) { - DEBUG_GC("[METHOD ]: " - << method->get_class()->get_name()->bytes << "." - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_GC("[METHOD ]: " << method); interp_si_goto_previous(si); continue; } DEBUG_GC("[METHOD "<< si->stack.size << " " << (int)si->locals.varNum << "]: " - << method->get_class()->get_name()->bytes << "." - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + << method); if (si->stack.size) for(i = 0; i <= si->stack.index; i++) { Index: vm/interpreter/src/interp_native_ipf.cpp =================================================================== --- vm/interpreter/src/interp_native_ipf.cpp (revision 639193) +++ vm/interpreter/src/interp_native_ipf.cpp (working copy) @@ -27,7 +27,8 @@ #include "interp_native.h" #include "interp_defs.h" #include "ini.h" -#include "open/jthread.h" +#include "vtable.h" +//#include "open/jthread.h" @@ -268,16 +269,9 @@ void interpreterInvokeStaticNative(StackFrame& prevFrame, StackFrame& frame, Method *method) { - DEBUG_TRACE("\n<<< native_invoke_static : " - << method->get_class()->get_name()->bytes << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_TRACE("\n<<< native_invoke_static : " << method); + DEBUG_TRACE_PLAIN("interpreter static native: " << frame.method); - DEBUG_TRACE_PLAIN("interpreter static native: " - << frame.method->get_class()->get_name()->bytes - << " " << frame.method->get_name()->bytes - << frame.method->get_descriptor()->bytes << endl); - GenericFunctionPointer f = interpreterGetNativeMethodAddr(method); if (f == 0) { DEBUG_TRACE(" interpreter_invoke_native >>>\n"); @@ -545,16 +539,9 @@ assert(method->is_native()); assert(!method->is_static()); - DEBUG_TRACE_PLAIN("interpreter virtual native: " - << frame.method->get_class()->get_name()->bytes - << " " << frame.method->get_name()->bytes - << frame.method->get_descriptor()->bytes << endl); + DEBUG_TRACE_PLAIN("interpreter virtual native: " << frame.method); + DEBUG_TRACE("\n<<< native_invoke_virtual: " << method); - DEBUG_TRACE("\n<<< native_invoke_virtual: " - << method->get_class()->get_name()->bytes << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); - uword *args = (uword*) ALLOC_FRAME((sz + 1) * sizeof(uword)); uword fpargs[6 + 1 /* for fptypes */]; // types of fpargs[6], 0 - float, 1 - double Index: vm/interpreter/src/interp_defs.h =================================================================== --- vm/interpreter/src/interp_defs.h (revision 639193) +++ vm/interpreter/src/interp_defs.h (working copy) @@ -25,6 +25,7 @@ #define LOG_DOMAIN "interpreter.unspecified" #include "cxxlog.h" +#include "vm_log.h" #include "environment.h" #include "vm_threads.h" Index: vm/interpreter/src/interp_native_ia32.cpp =================================================================== --- vm/interpreter/src/interp_native_ia32.cpp (revision 639193) +++ vm/interpreter/src/interp_native_ia32.cpp (working copy) @@ -27,7 +27,7 @@ #include "interp_native.h" #include "interp_defs.h" #include "ini.h" -//#include "open/jthread.h" +#include "vtable.h" using namespace std; @@ -83,10 +83,7 @@ jvalue *args) { assert(!hythread_is_suspend_enabled()); - DEBUG_TRACE("\n<<< interpreter_invoke_native: " - << class_get_name(method_get_class(method)) << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_TRACE("\n<<< interpreter_invoke_native: " << method); GenericFunctionPointer f = interpreterGetNativeMethodAddr(method); if (f == 0) { @@ -260,16 +257,9 @@ return; } - DEBUG_TRACE("\n<<< native_invoke_static : " - << class_get_name(method_get_class(method)) << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_TRACE("\n<<< native_invoke_static : " << method); + DEBUG_TRACE_PLAIN("interpreter static native: " << frame.method); - DEBUG_TRACE_PLAIN("interpreter static native: " - << class_get_name(method_get_class(frame.method)) - << " " << frame.method->get_name()->bytes - << frame.method->get_descriptor()->bytes << endl); - M2N_ALLOC_MACRO; frame.This = *(method->get_class()->get_class_handle()); @@ -369,10 +359,7 @@ if (!*ref) { DEBUG2( "VM WARNING: Reference with null value returned from jni function:\n" - "VM WARNING: Method name: " - << class_get_name(method_get_class(method)) - << "/" << method->get_name()->bytes - << method->get_descriptor()->bytes << + "VM WARNING: Method name: " << method << "\nVM WARNING: Not allowed, return NULL (0) instead\n"); } prevFrame.stack.pick().ref = *ref; @@ -487,16 +474,9 @@ assert(method->is_native()); assert(!method->is_static()); - DEBUG_TRACE_PLAIN("interpreter virtual native: " - << class_get_name(method_get_class(frame.method)) - << " " << frame.method->get_name()->bytes - << frame.method->get_descriptor()->bytes << endl); + DEBUG_TRACE_PLAIN("interpreter virtual native: " << frame.method); + DEBUG_TRACE("\n<<< native_invoke_virtual: " << method); - DEBUG_TRACE("\n<<< native_invoke_virtual: " - << class_get_name(method_get_class(method)) << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); - uword *args = (uword*) ALLOC_FRAME((sz + 1) * sizeof(uword)); args[0] = (uword) get_jni_native_intf(); args[1] = (uword) &frame.This; @@ -601,10 +581,7 @@ if (!*ref) { DEBUG2( "VM WARNING: Reference with null value returned from jni function:\n" - "VM WARNING: Method name: " - << class_get_name(method_get_class(method)) - << "/" << method->get_name()->bytes - << method->get_descriptor()->bytes << + "VM WARNING: Method name: " << method << "\nVM WARNING: Not allowed, return NULL (0) instead\n"); } prevFrame.stack.pick().ref = *ref; Index: vm/interpreter/src/interp_vm_helpers.cpp =================================================================== --- vm/interpreter/src/interp_vm_helpers.cpp (revision 639193) +++ vm/interpreter/src/interp_vm_helpers.cpp (working copy) @@ -18,6 +18,8 @@ * @author Ivan Volosyuk * @version $Revision: 1.6.4.4.4.3 $ */ +#include "open/vm_ee.h" +#include "open/vm_class_loading.h" #include "interp_vm_helpers.h" #include "interpreter_imports.h" #include "interp_native.h" @@ -25,6 +27,7 @@ #include "compile.h" #include "cxxlog.h" #include "interp_defs.h" +#include "vtable.h" void interp_throw_exception(const char* exc_name) { M2N_ALLOC_MACRO; Index: vm/interpreter/src/interp_native_em64t.cpp =================================================================== --- vm/interpreter/src/interp_native_em64t.cpp (revision 639193) +++ vm/interpreter/src/interp_native_em64t.cpp (working copy) @@ -23,7 +23,7 @@ #include "interpreter_exports.h" #include "interpreter_imports.h" -//#include "find_natives.h" +#include "vtable.h" #include "exceptions.h" #include "mon_enter_exit.h" #include "open/jthread.h" @@ -74,10 +74,7 @@ assert(!hythread_is_suspend_enabled()); - DEBUG_TRACE("\n<<< interpreter_invoke_native: " - << method->get_class()->get_name()->bytes << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_TRACE("\n<<< interpreter_invoke_native: " << method); GenericFunctionPointer f = interpreterGetNativeMethodAddr(method); if (f == 0) { @@ -284,16 +281,9 @@ return; } - DEBUG_TRACE("\n<<< native_invoke_static : " - << method->get_class()->get_name()->bytes << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); + DEBUG_TRACE("\n<<< native_invoke_static : " << method); + DEBUG_TRACE_PLAIN("interpreter static native: " << frame.method); - DEBUG_TRACE_PLAIN("interpreter static native: " - << frame.method->get_class()->get_name()->bytes - << " " << frame.method->get_name()->bytes - << frame.method->get_descriptor()->bytes << endl); - M2N_ALLOC_MACRO; int sz = method->get_num_arg_slots(); @@ -571,16 +561,9 @@ assert(method->is_native()); assert(!method->is_static()); - DEBUG_TRACE_PLAIN("interpreter virtual native: " - << frame.method->get_class()->get_name()->bytes - << " " << frame.method->get_name()->bytes - << frame.method->get_descriptor()->bytes << endl); + DEBUG_TRACE_PLAIN("interpreter virtual native: " << frame.method); + DEBUG_TRACE("\n<<< native_invoke_virtual: " << method); - DEBUG_TRACE("\n<<< native_invoke_virtual: " - << method->get_class()->get_name()->bytes << " " - << method->get_name()->bytes - << method->get_descriptor()->bytes << endl); - int n_ints = 0; #ifdef _WIN32 /* important difference in calling conventions */ #define n_fps n_ints Index: vm/vmcore/build/vmcore.exp =================================================================== --- vm/vmcore/build/vmcore.exp (revision 639193) +++ vm/vmcore/build/vmcore.exp (working copy) @@ -15,7 +15,7 @@ class_get_array_element_size; class_get_array_of_class; class_get_array_of_unboxed; - class_get_boxed_data_size; + class_get_object_size; class_get_class_loader; class_get_class_of_primitive_type; class_cp_get_const_addr; @@ -27,7 +27,7 @@ class_get_declaring_class; class_get_depth; class_get_element_type_info; - class_get_fast_instanceof_flag; + class_is_support_fast_instanceof; class_get_field; class_get_field_by_name; class_get_flags; @@ -47,7 +47,7 @@ class_get_super_class; class_get_super_offset; class_get_vtable; - class_hint_is_exceptiontype; + class_is_throwable; class_is_array; class_cp_is_entry_resolved; class_is_enum; @@ -65,7 +65,8 @@ class_iterator_initialize; class_load_class_by_descriptor; class_load_class_by_name; - class_lookup_class_by_name_using_bootstrap_class_loader; + class_load_boot_class; + class_lookup_boot_class; class_loader_load_native_lib; class_loader_lookup; class_lookup_method_recursively; @@ -78,7 +79,6 @@ class_is_abstract; class_is_final; class_is_interface; - compiled_method_load; compress_reference; class_cp_get_class_name; class_cp_get_field_class_name; @@ -91,8 +91,8 @@ class_cp_get_method_descriptor; class_cp_get_method_name; curr_arg; - destroy_properties_keys; - destroy_property_value; + vm_properties_destroy_keys; + vm_properties_destroy_value; field_get_address; field_get_class; field_get_class_of_field_value; @@ -103,7 +103,7 @@ field_get_track_access_flag; field_get_track_modification_flag; field_get_type; - field_get_type_info_of_field_value; + field_get_type_info; field_is_enumerable_reference; field_is_final; field_is_injected; @@ -122,30 +122,30 @@ gc_max_memory; gc_time_since_last_gc; gc_total_memory; - get_boolean_property; + vm_property_get_bool; get_curr_arg_class; get_file_and_line; - get_int_property; + vm_property_get_int; get_jvalue_arg_array; get_method_entry_flag_address; get_method_exit_flag_address; - get_numerical_property; - get_properties_keys; - get_properties_keys_staring_with; - get_property; - get_size_property; - get_system_class_class; - get_system_object_class; - get_system_string_class; + vm_property_get_number; + vm_properties_get_keys; + vm_properties_get_keys_starting_with; + vm_properties_get_value; + vm_property_get_size; + vm_get_java_lang_class_class; + vm_get_java_lang_object_class; + vm_get_java_lang_string_class; get_thread_ptr; - get_vm_interface; + vm_get_interface; initialize_arg_list_iterator; init_log_system; is_enabled; is_info_enabled; is_it_finalize_thread; is_log_enabled; - is_property_set; + vm_property_is_set; is_trace_enabled; is_warn_enabled; Java_java_lang_ClassLoader_defineClass0; @@ -486,7 +486,7 @@ method_args_get_type_info; method_args_has_this; method_args_is_managed_pointer; - method_find_overridden_method; + class_get_overridden_method; method_get_argument_list; method_get_byte_code_addr; method_get_byte_code_size; @@ -510,7 +510,7 @@ method_get_native_func_addr; method_get_next_method_jit; method_get_num_handlers; - method_get_offset; + method_get_vtable_offset; method_get_return_type; method_get_return_type_class; method_get_side_effects; @@ -567,7 +567,7 @@ set_native_finalizer_thread_flag; set_native_ref_enqueue_thread_flag; set_out; - set_property; + vm_property_set; set_thread_specific_out; set_threshold; shutdown_log_system; @@ -590,7 +590,7 @@ type_info_is_vector; type_info_is_void; uncompress_compressed_reference; - unset_property; + unvm_property_set; vector_first_element_offset; vector_first_element_offset_class_handle; vector_first_element_offset_unboxed; @@ -602,6 +602,7 @@ vm_attach; vm_check_if_monitor; vm_compile_method; + vm_compiled_method_load; vm_create_helper_for_function; vm_detach; vm_enqueue_reference; @@ -617,10 +618,10 @@ vm_get_gc_thread_local; vm_helper_get_addr; vm_helper_get_addr_optimized; - vm_get_vtable_base; + vm_get_vtable_base_address; vm_get_vtable_ptr_size; - vm_heap_base_address; - vm_heap_ceiling_address; + vm_get_heap_base_address; + vm_get_heap_ceiling_address; vm_heavy_finalizer_block_mutator; vm_helper_get_by_name; vm_helper_get_calling_convention; @@ -642,7 +643,7 @@ vm_patch_code_block; vm_reclaim_native_objs; vm_recompile_method; - vm_references_are_compressed; + vm_is_heap_compressed; vm_register_jit_extended_class_callback; vm_register_jit_overridden_method_callback; vm_register_jit_recompiled_method_callback; @@ -650,7 +651,7 @@ vm_resolve_class_new; vm_resume_threads_after; vm_vector_size; - vm_vtable_pointers_are_compressed; + vm_is_vtable_compressed; vtable_get_class; vtable_get_super_array_offset; Index: vm/vmcore/include/mem_alloc.h =================================================================== --- vm/vmcore/include/mem_alloc.h (revision 639193) +++ vm/vmcore/include/mem_alloc.h (working copy) @@ -22,7 +22,7 @@ #ifndef _MEM_ALLOC_H_ #define _MEM_ALLOC_H_ -#include "jit_import.h" +#include "open/rt_types.h" #include "port_vmem.h" #define KBYTE 1024 Index: vm/vmcore/include/dll_jit_intf.h =================================================================== --- vm/vmcore/include/dll_jit_intf.h (revision 639193) +++ vm/vmcore/include/dll_jit_intf.h (working copy) @@ -151,28 +151,6 @@ } Boolean - extended_class_callback(Class_Handle extended_class, - Class_Handle new_class, - void *callback_data) - { - if (_extended_class_callback != NULL) { - return _extended_class_callback(this, extended_class, new_class, callback_data); - } - return FALSE; - } - - Boolean - overridden_method_callback(Method_Handle overridden_method, - Method_Handle new_method, - void *callback_data) - { - if (_overridden_method_callback != NULL) { - return _overridden_method_callback(this, overridden_method, new_method, callback_data); - } - return FALSE; - } - - Boolean recompiled_method_callback(Method_Handle recompiled_method, void *callback_data) { @@ -307,18 +285,6 @@ ); Boolean - (*_extended_class_callback)(JIT_Handle jit, - Class_Handle extended_class, - Class_Handle new_class, - void *callback_data); - - Boolean - (*_overridden_method_callback)(JIT_Handle jit, - Method_Handle overridden_method, - Method_Handle new_method, - void *callback_data); - - Boolean (*_recompiled_method_callback)(JIT_Handle jit, Method_Handle recompiled_method, void *callback_data); Index: vm/vmcore/include/object_layout.h =================================================================== --- vm/vmcore/include/object_layout.h (revision 639193) +++ vm/vmcore/include/object_layout.h (working copy) @@ -136,13 +136,13 @@ inline ManagedObject *get_raw_reference_pointer(ManagedObject **slot_addr) { #ifdef REFS_USE_RUNTIME_SWITCH - if (vm_references_are_compressed()) { + if (vm_is_heap_compressed()) { #endif // REFS_USE_RUNTIME_SWITCH #ifdef REFS_RUNTIME_OR_COMPRESSED COMPRESSED_REFERENCE offset = *((COMPRESSED_REFERENCE *)slot_addr); assert(is_compressed_reference(offset)); if (offset != 0) { - return (ManagedObject*)((POINTER_SIZE_INT)vm_heap_base_address() + offset); + return (ManagedObject*)((POINTER_SIZE_INT)vm_get_heap_base_address() + offset); } return NULL; @@ -229,10 +229,10 @@ POINTER_SIZE_INT padding2; }; - VTable *vt_unsafe() { return (VTable*)(vt_offset + vm_get_vtable_base()); } + VTable *vt_unsafe() { return (VTable*)(vt_offset + (UDATA)vm_get_vtable_base_address()); } VTable *vt() { assert(vt_offset); return vt_unsafe(); } static VTable *allocation_handle_to_vtable(Allocation_Handle ah) { - return (VTable *) ((POINTER_SIZE_INT)ah + vm_get_vtable_base()); + return (VTable *) ((UDATA)ah + (UDATA)vm_get_vtable_base_address()); } static bool are_vtable_pointers_compressed() { return true; } #else // USE_COMPRESSED_VTABLE_POINTERS Index: vm/vmcore/include/jvmti_direct.h =================================================================== --- vm/vmcore/include/jvmti_direct.h (revision 639193) +++ vm/vmcore/include/jvmti_direct.h (working copy) @@ -25,6 +25,7 @@ #include "jni_direct.h" #include "jvmti.h" #include "open/hythread_ext.h" +#include "open/rt_types.h" #include "vm_core_types.h" #include "vm_threads.h" Index: vm/vmcore/include/class_member.h =================================================================== --- vm/vmcore/include/class_member.h (revision 639193) +++ vm/vmcore/include/class_member.h (working copy) @@ -17,6 +17,7 @@ #ifndef __CLASS_MEMBER_H__ #define __CLASS_MEMBER_H__ +#include "open/rt_types.h" #include "annotation.h" #include "Class.h" #include "vm_java_support.h" @@ -370,9 +371,6 @@ }; -struct Inline_Record; - - // 20020222 This is only temporary to support the new JIT interface. // We will reimplement the signature support. struct Method_Signature { @@ -570,10 +568,6 @@ */ CodeChunkInfo *create_code_chunk_info_mt(); - // Notify JITs whenever this method is overridden by a newly loaded class. - void register_jit_overridden_method_callback(JIT *jit_to_be_notified, void *callback_data); - void do_jit_overridden_method_callbacks(Method *overriding_method); - // Notify JITs whenever this method is recompiled or initially compiled. void register_jit_recompiled_method_callback(JIT *jit_to_be_notified, void *callback_data); void do_jit_recompiled_method_callbacks(); @@ -785,12 +779,7 @@ return -1; } - Inline_Record *inline_records; - void set_inline_assumption(JIT *jit, Method *caller); void method_was_overridden(); - - Method_Change_Notification_Record *_notify_override_records; - // Records JITs to be notified when a method is recompiled or initially compiled. Method_Change_Notification_Record *_notify_recompiled_records; Index: vm/vmcore/include/jit_export_rt.h =================================================================== --- vm/vmcore/include/jit_export_rt.h (revision 639193) +++ vm/vmcore/include/jit_export_rt.h (working copy) @@ -41,26 +41,6 @@ // to be notified whenever, e.g., a VM data structure changes that would require // code patching or recompilation. -// The callback that corresponds to vm_register_jit_extended_class_callback. -// The newly loaded class is new_class. The JIT should return TRUE if any code was modified -// (consequently the VM will ensure correctness such as synchronizing I- and D-caches), -// and FALSE otherwise. -JITEXPORT Boolean -JIT_extended_class_callback(JIT_Handle jit, - Class_Handle extended_class, - Class_Handle new_class, - void *callback_data); - -// The callback that corresponds to vm_register_jit_overridden_method_callback. -// The overriding method is new_method. The JIT should return TRUE if any code was modified -// (consequently the VM will ensure correctness such as synchronizing I- and D-caches), -// and FALSE otherwise. -JITEXPORT Boolean -JIT_overridden_method_callback(JIT_Handle jit, - Method_Handle overridden_method, - Method_Handle new_method, - void *callback_data); - // The callback that corresponds to vm_register_jit_recompiled_method_callback. // The JIT should return TRUE if any code was modified (consequently the VM will ensure // correctness such as synchronizing I- and D-caches), and FALSE otherwise. @@ -164,7 +144,7 @@ // Returns TRUE if the JIT will compress references within objects and vector elements by representing -// them as offsets rather than raw pointers. The JIT should call the VM function vm_references_are_compressed() +// them as offsets rather than raw pointers. The JIT should call the VM function vm_is_heap_compressed() // during initialization in order to decide whether it should compress references. JITEXPORT Boolean JIT_supports_compressed_references(JIT_Handle jit); Index: vm/vmcore/include/jit_intf_cpp.h =================================================================== --- vm/vmcore/include/jit_intf_cpp.h (revision 639193) +++ vm/vmcore/include/jit_intf_cpp.h (working copy) @@ -28,6 +28,7 @@ #include "open/types.h" +#include "open/rt_types.h" #include "jit_intf.h" #include "jit_export_jpda.h" #include "jni.h" @@ -76,13 +77,7 @@ OpenMethodExecutionParams flags // in ) = 0; - virtual void - method_was_overridden(Method_Handle UNREF caller, - Method_Handle UNREF callee - ) {}; - - // // Unwind a stack frame for a method give the context. // @@ -203,23 +198,12 @@ void * UNREF addr1, void * UNREF addr2){ }; - virtual Boolean - extended_class_callback(Class_Handle UNREF extended_class, - Class_Handle UNREF new_class, - void * UNREF callback_data) { return FALSE; }; - - virtual Boolean - overridden_method_callback(Method_Handle UNREF overridden_method, - Method_Handle UNREF new_method, - void * UNREF callback_data) { return FALSE; }; - - virtual Boolean recompiled_method_callback(Method_Handle UNREF recompiled_method, void * UNREF callback_data) { return FALSE; }; // Returns TRUE if the JIT will compress references within objects and vector elements by representing - // them as offsets rather than raw pointers. The JIT should call the VM function vm_references_are_compressed() + // them as offsets rather than raw pointers. The JIT should call the VM function vm_is_heap_compressed() // during initialization in order to decide whether it should compress references. virtual Boolean supports_compressed_references() = 0; Index: vm/vmcore/include/Class.h =================================================================== --- vm/vmcore/include/Class.h (revision 639193) +++ vm/vmcore/include/Class.h (working copy) @@ -28,9 +28,10 @@ #include #include "open/gc.h" +#include "open/rt_types.h" #include "port_malloc.h" #include "String_Pool.h" -#include "vtable.h" +//#include "vtable.h" #include "jit_intf.h" #include @@ -61,8 +62,9 @@ class Package; struct VM_thread; struct AnnotationTable; +struct VTable; +struct Intfc_Table; - /** The constant pool entry descriptor. * For each constant pool entry, the descriptor content varies depending * on the constant pool tag that corresponds to this constant pool entry. @@ -800,9 +802,6 @@ // class; after super class is loaded, it becomes a pointer to class // structure of the super class. // - // The offset of this field is returned by class_get_super_offset. - // Make sure to update this function if the field is moved around. - // Class_Super m_super_class; // class name in internal (VM, class-file) format @@ -817,7 +816,7 @@ Package* m_package; // Distance in the hierarchy from java/lang/Object - int m_depth; + uint32 m_depth; // The field m_is_suitable_for_fast_instanceof should be 0 // if depth==0 or depth>=vm_max_fast_instanceof_depth() @@ -942,9 +941,6 @@ // shift corresponding to size of element of array, undefined for non-arrays unsigned int m_array_element_shift; - // type descriptor for array element class - TypeDesc* m_array_element_type_desc; - // Number of superinterfaces uint16 m_num_superinterfaces; @@ -1016,10 +1012,6 @@ // thread, which currently executes VM_thread* m_initializing_thread; - // Notify JITs whenever tis class is extended by calling their - // JIT_extended_class_callback callback function, - Class_Extended_Notification_Record* m_notify_extended_records; - // These fields store information for // Class Hierarchy Analysis JIT optimizations // first class extending this class @@ -1131,7 +1123,7 @@ /** Gets depth in the hierarchy of the given class. * @return A number of classes in the super-class hierarchy.*/ - int get_depth() const { return m_depth; } + uint32 get_depth() const { return m_depth; } bool get_fast_instanceof_flag() const { return m_is_suitable_for_fast_instanceof; } /** Gets the vtable for the given class. @@ -1263,14 +1255,6 @@ return m_array_element_class; } - /** Gets the array-element type descriptor. - * @return Type descriptor for the element of an array - * represented by this class.*/ - TypeDesc* get_array_element_type_desc() const { - assert(is_array()); - return m_array_element_type_desc; - } - /** Gets the class state. * @return The class state.*/ Class_State get_state() const { return m_state; } @@ -1741,20 +1725,6 @@ * such interface exists for the object.*/ static void* helper_get_interface_vtable(ManagedObject* obj, Class* iid); - /** Registers a callback that is called to notify the given JIT - * whenever the given class is extended. The callback_data - * pointer will be passed back to the JIT during the callback. The JIT's callback - * function is JIT_extended_class_callback. - * @param[in] jit_to_be_notified - JIT to notify on extending the class - * @param[in] callback_data - data to be passed back to JIT, when the callback - * is called*/ - void register_jit_extended_class_callback(JIT* jit_to_be_notified, void* callback_data); - - /** Calls registered JITs callbacks to notify that the given class was - * extended by new_class. - * @param[in] new_subclass - a subclass extending the given class*/ - void do_jit_extended_class_callbacks(Class* new_subclass); - // SourceDebugExtension class attribute support /** Checks whether the given class has the Index: vm/vmcore/include/vtable.h =================================================================== --- vm/vmcore/include/vtable.h (revision 639193) +++ vm/vmcore/include/vtable.h (working copy) @@ -54,6 +54,15 @@ #define GC_BYTES_IN_VTABLE (sizeof(void*)) #define MAX_FAST_INSTOF_DEPTH 5 +/** +* @return The number of superclass hierarchy elements that are +* stored within the vtable. This is for use with fast type checking. +*/ +inline unsigned vm_max_fast_instanceof_depth() +{ + return MAX_FAST_INSTOF_DEPTH; +} + typedef struct VTable { Byte _gc_private_information[GC_BYTES_IN_VTABLE]; ManagedObject* jlC; Index: vm/vmcore/include/jit_export_jpda.h =================================================================== --- vm/vmcore/include/jit_export_jpda.h (revision 639193) +++ vm/vmcore/include/jit_export_jpda.h (working copy) @@ -23,6 +23,8 @@ #define _JIT_EXPORT_JPDA_H #include "open/types.h" +#include "open/rt_types.h" +#include "open/em.h" #ifdef __cplusplus extern "C" { Index: vm/vmcore/src/jni/jni_array.cpp =================================================================== --- vm/vmcore/src/jni/jni_array.cpp (revision 639193) +++ vm/vmcore/src/jni/jni_array.cpp (working copy) @@ -26,6 +26,7 @@ #include "Class.h" #include "environment.h" #include "object_handles.h" +#include "open/vm_class_loading.h" #include "open/vm_util.h" #include "vm_threads.h" Index: vm/vmcore/src/jni/jni.cpp =================================================================== --- vm/vmcore/src/jni/jni.cpp (revision 639193) +++ vm/vmcore/src/jni/jni.cpp (working copy) @@ -36,6 +36,7 @@ #include "jni.h" #include "lock_manager.h" +#include "vtable.h" #include "Class.h" #include "classloader.h" #include "environment.h" Index: vm/vmcore/src/jni/jni_method.cpp =================================================================== --- vm/vmcore/src/jni/jni_method.cpp (revision 639193) +++ vm/vmcore/src/jni/jni_method.cpp (working copy) @@ -29,6 +29,7 @@ #include "jni_utils.h" #include "jni_direct.h" +#include "vtable.h" #include "Class.h" #include "environment.h" #include "exceptions.h" Index: vm/vmcore/src/jni/jni_utils.cpp =================================================================== --- vm/vmcore/src/jni/jni_utils.cpp (revision 639193) +++ vm/vmcore/src/jni/jni_utils.cpp (working copy) @@ -681,7 +681,7 @@ if(loader == NULL) { bool res = st_get_frame(0, &stf); if (res) - loader = (ClassLoader*)class_get_class_loader(method_get_class(stf.method)); + loader = stf.method->get_class()->get_class_loader(); else loader = env->vm->vm_env->system_class_loader; } Index: vm/vmcore/src/lil/lil.cpp =================================================================== --- vm/vmcore/src/lil/lil.cpp (revision 639193) +++ vm/vmcore/src/lil/lil.cpp (working copy) @@ -349,7 +349,6 @@ // ? 20030613: I really don't want this code here, but for now... Class_Handle UNUSED ch = type_info_get_class(tih); assert(ch); - assert(class_is_valuetype(ch)); ASSERT(0, "Unexpected data type"); } case VM_DATA_TYPE_MP: Index: vm/vmcore/src/jit/dll_jit.cpp =================================================================== --- vm/vmcore/src/jit/dll_jit.cpp (revision 639193) +++ vm/vmcore/src/jit/dll_jit.cpp (working copy) @@ -39,8 +39,6 @@ _get_root_set_for_thread_dump(NULL), _fix_handler_context(NULL), _get_address_of_this(NULL), -_extended_class_callback(NULL), -_overridden_method_callback(NULL), _recompiled_method_callback(NULL), _execute_method(NULL), _get_bc_location_for_native(NULL), @@ -84,12 +82,6 @@ GET_OPTIONAL_FUNCTION(fn, handle, "JIT_next_command_line_argument"); _next_command_line_argument = (void (*)(JIT_Handle, const char *, const char *)) fn; - GET_OPTIONAL_FUNCTION(fn, handle, "JIT_extended_class_callback"); - _extended_class_callback = (Boolean (*)(JIT_Handle, Class_Handle, Class_Handle, void *)) fn; - - GET_OPTIONAL_FUNCTION(fn, handle, "JIT_overridden_method_callback"); - _overridden_method_callback = (Boolean (*)(JIT_Handle, Method_Handle, Method_Handle, void *)) fn; - GET_OPTIONAL_FUNCTION(fn, handle, "JIT_recompiled_method_callback"); _recompiled_method_callback = (Boolean (*)(JIT_Handle, Method_Handle, void *)) fn; Index: vm/vmcore/src/jit/jit_runtime_support.cpp =================================================================== --- vm/vmcore/src/jit/jit_runtime_support.cpp (revision 639193) +++ vm/vmcore/src/jit/jit_runtime_support.cpp (working copy) @@ -36,6 +36,7 @@ #include #include +#include "vtable.h" #include "Class.h" #include "environment.h" #include "exceptions.h" @@ -55,6 +56,8 @@ #include "vm_threads.h" #include "open/types.h" #include "open/bytecodes.h" +#include "open/vm_class_loading.h" +#include "open/vm_ee.h" #include "open/vm_util.h" #include "jvmti_interface.h" @@ -263,7 +266,7 @@ // We need to get the vtable in more than one place below // Here are some macros to helper smooth over the compressed vtables const POINTER_SIZE_INT vtable_off = object_get_vtable_offset(); - const POINTER_SIZE_INT vtable_add = vm_vtable_pointers_are_compressed() ? vm_get_vtable_base() : 0; + const POINTER_SIZE_INT vtable_add = vm_is_vtable_compressed() ? (POINTER_SIZE_INT)vm_get_vtable_base_address() : 0; // Setup locals cs = lil_parse_onto_end(cs, (type ? "locals 1;" : "locals 2;")); @@ -291,7 +294,7 @@ if (type) { if(type->get_fast_instanceof_flag()) { cs = lil_parse_onto_end(cs, - vm_vtable_pointers_are_compressed() ? "ld l0,[i0+%0i:g4],zx;" : "ld l0,[i0+%0i:pint];", + vm_is_vtable_compressed() ? "ld l0,[i0+%0i:g4],zx;" : "ld l0,[i0+%0i:pint];", vtable_off); assert(cs); cs = lil_parse_onto_end(cs, @@ -309,7 +312,7 @@ is_fast_off, depth_off); assert(cs); cs = lil_parse_onto_end(cs, - vm_vtable_pointers_are_compressed() ? "ld l0,[i0+%0i:g4],zx;" : "ld l0,[i0+%0i:pint];", + vm_is_vtable_compressed() ? "ld l0,[i0+%0i:g4],zx;" : "ld l0,[i0+%0i:pint];", vtable_off); assert(cs); cs = lil_parse_onto_end(cs, @@ -333,7 +336,7 @@ "out platform:pint,pint:g4;"); assert(cs); cs = lil_parse_onto_end(cs, - vm_vtable_pointers_are_compressed() ? "ld l0,[i0+%0i:g4],zx;" : "ld l0,[i0+%0i:pint];", + vm_is_vtable_compressed() ? "ld l0,[i0+%0i:g4],zx;" : "ld l0,[i0+%0i:pint];", vtable_off); assert(cs); cs = lil_parse_onto_end(cs, @@ -2343,7 +2346,7 @@ * call class_is_subtype(o0, o1) */ LilCodeStub *cs2; - if (vm_vtable_pointers_are_compressed()) + if (vm_is_vtable_compressed()) { cs2 = lil_parse_onto_end (cs, @@ -2364,7 +2367,7 @@ "ld o0, [l0+%0i:ref];" "o1 = i1;" "call %1i;", - OFFSET(VTable, clss) + (vm_vtable_pointers_are_compressed() ? vm_get_vtable_base() : 0), + OFFSET(VTable, clss) + (vm_is_vtable_compressed() ? (UDATA)vm_get_vtable_base_address() : 0), (void*) class_is_subtype); if (is_checkcast) { @@ -2404,7 +2407,7 @@ * check if i1 == l2 */ LilCodeStub *cs2; - if (vm_vtable_pointers_are_compressed()) + if (vm_is_vtable_compressed()) { cs2 = lil_parse_onto_end (cs, @@ -2426,7 +2429,7 @@ "jc i1 != l2, failed;", Class::get_offset_of_depth(), (POINTER_SIZE_INT)sizeof(Class*), - OFFSET(VTable, superclasses) - sizeof(Class*) + (vm_vtable_pointers_are_compressed() ? vm_get_vtable_base() : 0) + OFFSET(VTable, superclasses) - sizeof(Class*) + (vm_is_vtable_compressed() ? (UDATA)vm_get_vtable_base_address() : 0) ); if (is_checkcast) { Index: vm/vmcore/src/jit/compile.cpp =================================================================== --- vm/vmcore/src/jit/compile.cpp (revision 639193) +++ vm/vmcore/src/jit/compile.cpp (working copy) @@ -23,6 +23,8 @@ #include "vm_log.h" #include "open/vm_type_access.h" +#include "open/vm_class_info.h" +#include "open/vm_ee.h" #include "apr_strings.h" #include "lock_manager.h" @@ -863,8 +865,8 @@ } } -VMEXPORT void compiled_method_load(Method_Handle method, uint32 codeSize, - void* codeAddr, uint32 mapLength, +VMEXPORT void vm_compiled_method_load(Method_Handle method, U_32 codeSize, + void* codeAddr, U_32 mapLength, AddrLocation* addrLocationMap, void* compileInfo, Method_Handle outer_method) { Index: vm/vmcore/src/jit/native_overrides.cpp =================================================================== --- vm/vmcore/src/jit/native_overrides.cpp (revision 639193) +++ vm/vmcore/src/jit/native_overrides.cpp (working copy) @@ -19,7 +19,7 @@ * @version $Revision: 1.1.2.1.4.4 $ */ - +#include "vtable.h" #include "Class.h" #include "environment.h" #include "lil.h" @@ -29,6 +29,7 @@ #include "object_layout.h" #include "open/types.h" #include "open/vm_util.h" +#include "open/vm_ee.h" #include "open/vm.h" // *** This is for readInternal override Index: vm/vmcore/src/gc/root_set_enum_common.cpp =================================================================== --- vm/vmcore/src/gc/root_set_enum_common.cpp (revision 639193) +++ vm/vmcore/src/gc/root_set_enum_common.cpp (working copy) @@ -21,7 +21,9 @@ #define LOG_DOMAIN "enumeration" #include "cxxlog.h" +#include "vm_log.h" +#include "jit_import_rt.h" #include "root_set_enum_internal.h" #include "GlobalClassLoaderIterator.h" #include "jit_intf_cpp.h" @@ -32,6 +34,7 @@ #include "open/gc.h" #include "finalize.h" #include "cci.h" +#include "vtable.h" void vm_enumerate_interned_strings() { @@ -303,9 +306,7 @@ #endif TRACE2("enumeration", "enumerating eip=" << (void *) si_get_ip(si) << " is_first=" << !si_get_jit_context(si)->is_ip_past - << " " << class_get_name(method_get_class(cci->get_method())) - << "." << method_get_name(cci->get_method()) - << method_get_descriptor(cci->get_method())); + << " " << cci->get_method()); cci->get_jit()->get_root_set_from_stack_frame(cci->get_method(), 0, si_get_jit_context(si)); ClassLoader* cl = cci->get_method()->get_class()->get_class_loader(); assert (cl); @@ -329,16 +330,13 @@ } TRACE2("enumeration", "enumerated eip=" << (void *) si_get_ip(si) << " is_first=" << !si_get_jit_context(si)->is_ip_past - << " " << class_get_name(method_get_class(cci->get_method())) - << "." << method_get_name(cci->get_method()) - << method_get_descriptor(cci->get_method())); + << " " << cci->get_method()); } else { #ifdef VM_STATS vm_stats_inc(VM_Statistics::get_vm_stats().num_unwind_native_frames_gc); #endif TRACE2("enumeration", "enumeration local handles " - << (m2n_get_method(si_get_m2n(si)) ? method_get_name(m2n_get_method(si_get_m2n(si))) : "") - << (m2n_get_method(si_get_m2n(si)) ? method_get_descriptor(m2n_get_method(si_get_m2n(si))) : "")); + << m2n_get_method(si_get_m2n(si))); oh_enumerate_handles(m2n_get_local_handles(si_get_m2n(si))); Method* m = m2n_get_method(si_get_m2n(si)); if (m) { Index: vm/vmcore/src/jvmti/jvmti_stack.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_stack.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_stack.cpp (working copy) @@ -39,6 +39,7 @@ #include "jit_intf_cpp.h" #include "thread_manager.h" #include "cci.h" +#include "open/vm_class_info.h" class JavaStackIterator { Index: vm/vmcore/src/jvmti/jvmti_class.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_class.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_class.cpp (working copy) @@ -412,9 +412,9 @@ *status_ptr = 0; - if( class_is_primitive( cl ) ) { + if( cl->is_primitive() ) { *status_ptr = JVMTI_CLASS_STATUS_PRIMITIVE; - } else if( class_is_array( cl ) ) { + } else if( cl->is_array() ) { *status_ptr = JVMTI_CLASS_STATUS_ARRAY; } else { switch(cl->get_state()) Index: vm/vmcore/src/jvmti/jvmti_internal.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_internal.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_internal.cpp (working copy) @@ -26,6 +26,7 @@ #include "cxxlog.h" #include "environment.h" +#include "vtable.h" #include "jvmti_internal.h" static Boolean is_valid_instance(jobject obj, Class* clss) Index: vm/vmcore/src/jvmti/jvmti_locals.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_locals.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_locals.cpp (working copy) @@ -37,6 +37,7 @@ #include "jit_intf_cpp.h" #include "cci.h" #include "Class.h" +#include "vtable.h" #define LOG_DOMAIN "jvmti.locals" Index: vm/vmcore/src/jvmti/jvmti.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti.cpp (working copy) @@ -317,11 +317,11 @@ !strncmp(option, "-Xrun", 5)) { TRACE2("jvmti", "Enabling EM JVMTI mode"); - set_property("vm.jvmti.enabled", "true", VM_PROPERTIES); + vm_property_set("vm.jvmti.enabled", "true", VM_PROPERTIES); break; } } - if (TRUE == get_boolean_property("vm.jvmti.enabled", FALSE, VM_PROPERTIES)) { + if (TRUE == vm_property_get_bool("vm.jvmti.enabled", FALSE, VM_PROPERTIES)) { p_env->TI->setEnabled(); } } @@ -656,7 +656,7 @@ { status = true; - cml_report_inlined = (bool) get_boolean_property( + cml_report_inlined = (bool) vm_property_get_bool( "vm.jvmti.compiled_method_load.inlined", FALSE, VM_PROPERTIES); Index: vm/vmcore/src/jvmti/jvmti_heap.h =================================================================== --- vm/vmcore/src/jvmti/jvmti_heap.h (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_heap.h (working copy) @@ -23,6 +23,7 @@ // DRLVM exported headers #include #include +#include #include // DRLVM internal headers @@ -106,7 +107,7 @@ if (class_is_array(clss)) { return vm_vector_size(clss, get_vector_length(obj)); } else { - return class_get_boxed_data_size(clss); + return class_get_object_size(clss); } } Index: vm/vmcore/src/jvmti/jvmti_tags.h =================================================================== --- vm/vmcore/src/jvmti/jvmti_tags.h (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_tags.h (working copy) @@ -89,7 +89,7 @@ inline tag_pair** ti_get_object_tptr(Managed_Object_Handle obj) { ManagedObject *o = (ManagedObject*)obj; - if (class_is_array(o->vt()->clss)) { + if (o->vt()->clss->is_array()) { return (tag_pair**)((VM_Vector*)obj)->get_tag_pointer_address(); } else { return (tag_pair**)((ManagedObject*)obj)->get_tag_pointer_address(); Index: vm/vmcore/src/jvmti/jvmti_break_intf.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_break_intf.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_break_intf.cpp (working copy) @@ -39,8 +39,8 @@ #include "cci.h" #include "port_thread.h" #include "port_crash_handler.h" +#include "open/vm_class_info.h" - #if (defined _IA32_) || (defined _EM64T_) #include "encoder.h" Index: vm/vmcore/src/jvmti/jvmti_object.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_object.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_object.cpp (working copy) @@ -28,7 +28,7 @@ #include "object_handles.h" #include "object_generic.h" #include "mon_enter_exit.h" - +#include "vtable.h" #include "thread_manager.h" #include "suspend_checker.h" #include "open/vm.h" @@ -78,7 +78,7 @@ if(object_clss->is_array()) *size_ptr = object_clss->calculate_array_size(get_vector_length((Vector_Handle)mo)); else - *size_ptr = class_get_boxed_data_size(object_clss); + *size_ptr = class_get_object_size(object_clss); assert(*size_ptr > 0); tmn_suspend_enable(); Index: vm/vmcore/src/jvmti/jvmti_roots.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_roots.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_roots.cpp (working copy) @@ -28,7 +28,7 @@ #include #include #include - +#include "jit_import_rt.h" // VM headers #include "Class.h" #include "cci.h" Index: vm/vmcore/src/jvmti/jvmti_pop_frame.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (working copy) @@ -34,6 +34,7 @@ #include "jvmti_break_intf.h" #include "cci.h" #include "clog.h" +#include "open/vm_class_info.h" static void jvmti_pop_frame_callback() { Index: vm/vmcore/src/jvmti/jvmti_step.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_step.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_step.cpp (working copy) @@ -23,6 +23,7 @@ #include "jvmti.h" #include "Class.h" #include "cxxlog.h" +#include "vm_log.h" #include "jvmti_utils.h" #include "jvmti_internal.h" #include "jit_intf_cpp.h" @@ -440,12 +441,8 @@ } while( true ); for( unsigned index = 0; index < *count; index++ ) { - TRACE2( "jvmti.break.ss", "Step: " << class_get_name(method_get_class(method)) - << "." << method_get_name(method) << method_get_descriptor(method) - << " :" << bytecode_index << "\n -> " - << class_get_name(method_get_class((*next_step)[index].method)) - << "." << method_get_name((*next_step)[index].method) - << method_get_descriptor((*next_step)[index].method) + TRACE2( "jvmti.break.ss", "Step: " << method + << ((*next_step)[index].method) << " :" << (*next_step)[index].location << " :" << (*next_step)[index].native_location << ", event: " << (*next_step)[index].no_event ); @@ -630,9 +627,7 @@ assert(bp); TRACE2("jvmti.break.ss", "SingleStep occured: " - << class_get_name(method_get_class((Method*)bp->method)) << "." - << method_get_name((Method*)bp->method) - << method_get_descriptor((Method*)bp->method) + << ((Method*)bp->method) << " :" << bp->location << " :" << bp->addr); DebugUtilsTI *ti = VM_Global_State::loader_env->TI; @@ -688,20 +683,14 @@ { TRACE2("jvmti.break.ss", "Calling JIT global SingleStep breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); // fire global event func((jvmtiEnv*)env, jni_env, (jthread)hThread, method, location); TRACE2("jvmti.break.ss", "Finished JIT global SingleStep breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); env = next_env; continue; @@ -719,10 +708,7 @@ { TRACE2("jvmti.break.ss", "Calling JIT local SingleStep breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); found = true; func((jvmtiEnv*)env, jni_env, @@ -730,9 +716,7 @@ TRACE2("jvmti.break.ss", "Finished JIT local SingleStep breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) + << ((Method*)method) << " :" << location << " :" << addr); } } @@ -777,9 +761,7 @@ for (unsigned iii = 0; iii < locations_number; iii++) { TRACE2("jvmti.break.ss", "Set single step breakpoint: " - << class_get_name(method_get_class(locations[iii].method)) << "." - << method_get_name(locations[iii].method) - << method_get_descriptor(locations[iii].method) + << locations[iii].method << " :" << locations[iii].location << " :" << locations[iii].native_location); @@ -926,9 +908,7 @@ if (NULL == call_ip) { TRACE2("jvmti.break.ss", "SingleStep IP shifted in prediction to: " - << class_get_name(method_get_class(func)) << "." - << method_get_name(func) - << method_get_descriptor(func) + << func << " :" << next_location << " :" << ip2); bc = next_location; ip = ip2; Index: vm/vmcore/src/jvmti/jvmti_method.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_method.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_method.cpp (working copy) @@ -681,10 +681,7 @@ { BEGIN_RAISE_AREA; - TRACE2("jvmti.event.method.entry", "MethodEntry: " << - class_get_name(method_get_class(method)) << "." << - method_get_name(method) << method_get_descriptor(method)); - + TRACE2("jvmti.event.method.entry", "MethodEntry: " << method); jvmti_process_method_entry_event(reinterpret_cast(method)); END_RAISE_AREA; @@ -694,9 +691,7 @@ { BEGIN_RAISE_AREA; - TRACE2("jvmti.event.method.exit", "MethodExit: " << - class_get_name(method_get_class(method)) << "." << - method_get_name(method) << method_get_descriptor(method)); + TRACE2("jvmti.event.method.exit", "MethodExit: " << method); Method *m = reinterpret_cast(method); jmethodID mid = reinterpret_cast(method); Index: vm/vmcore/src/jvmti/jvmti_event.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_event.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_event.cpp (working copy) @@ -24,6 +24,7 @@ #define LOG_DOMAIN "jvmti" #include "cxxlog.h" +#include "vm_log.h" #include "port_mutex.h" #include "open/gc.h" @@ -595,17 +596,13 @@ if (NULL != func) { TRACE2("jvmti.event.cml", - "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD calling, method = " << - method->get_class()->get_name()->bytes << "." << method->get_name()->bytes << - method->get_descriptor()->bytes); + "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD calling, method = " << method); func((jvmtiEnv*)ti_env, (jmethodID)method, codeSize, codeAddr, mapLength, jvmtiLocationMap, NULL); TRACE2("jvmti.event.cml", - "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD finished, method = " << - method->get_class()->get_name()->bytes << "." << method->get_name()->bytes << - method->get_descriptor()->bytes); + "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD finished, method = " << method); } } @@ -638,9 +635,7 @@ if (NULL != func) { TRACE2("jvmti.event.cml", - "Emitting JVMTI_EVENT_COMPILED_METHOD_LOAD for chuncks of " << - method->get_class()->get_name()->bytes << "." << method->get_name()->bytes << - method->get_descriptor()->bytes); + "Emitting JVMTI_EVENT_COMPILED_METHOD_LOAD for chuncks of " << method); for (CodeChunkInfo* cci = method->get_first_JIT_specific_info(); cci; cci = cci->_next) { @@ -688,9 +683,7 @@ } TRACE2("jvmti.event.cml", - "Emitting JVMTI_EVENT_COMPILED_METHOD_LOAD done for chuncks of " << - method->get_class()->get_name()->bytes << "." << method->get_name()->bytes << - method->get_descriptor()->bytes); + "Emitting JVMTI_EVENT_COMPILED_METHOD_LOAD done for chuncks of " << method); } } @@ -762,8 +755,7 @@ for (int jjj = 0; jjj < (*klass)->get_number_of_methods(); jjj++) { Method* method = (*klass)->get_method(jjj); - TRACE2("jvmti.event", " Method = " << method->get_name()->bytes << - method->get_descriptor()->bytes << + TRACE2("jvmti.event", " Method = " << method << (method->get_state() == Method::ST_Compiled ? " compiled" : " not compiled")); if (method->get_state() == Method::ST_Compiled) { jvmti_send_chunks_compiled_method_load_event(method); @@ -937,10 +929,7 @@ JNIEnv *jni_env = p_TLS_vmthread->jni_env; jvmtiEnv *jvmti_env = (jvmtiEnv*) ti_env; if (NULL != ti_env->event_table.MethodExit) { - TRACE2("jvmti.stack", "Calling MethodExit callback for method: " - << class_get_name(method_get_class((Method*)method)) - << "." << method_get_name((Method*)method) - << method_get_descriptor((Method*)method)); + TRACE2("jvmti.stack", "Calling MethodExit callback for method: " << method); ti_env->event_table.MethodExit(jvmti_env, jni_env, thread, method, was_popped_by_exception, ret_val); } ti_env = next_env; @@ -966,9 +955,7 @@ #ifndef NDEBUG if( curr_thread->jvmti_thread.frame_pop_listener ) { TRACE2("jvmti.stack", "Prepare to PopFrame callback for thread: " - << curr_thread << ", method: " << class_get_name(method_get_class((Method*)method)) - << "." << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) + << curr_thread << ", method: " << method << ", depth: " << depth << (was_popped_by_exception == JNI_TRUE ? " by exception" : "")); } @@ -995,9 +982,7 @@ TRACE2("jvmti.stack", "Calling PopFrame callback for thread: " << curr_thread << ", listener: " << report << ", env: " << report->env << ", depth: " << report->depth - << " -> " << class_get_name(method_get_class((Method*)method)) - << "." << method_get_name((Method*)method) - << method_get_descriptor((Method*)method)); + << " -> " << method); jvmti_process_frame_pop_event( reinterpret_cast(report->env), @@ -1091,10 +1076,7 @@ JNIEnv *jni_env = p_TLS_vmthread->jni_env; assert(method); - TRACE2("jvmti.event.popframe", "PopFrame event is called for method:" - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) ); + TRACE2("jvmti.event.popframe", "PopFrame event is called for method:" << method); if (NULL != ti_env->event_table.FramePop) ti_env->event_table.FramePop(jvmti_env, jni_env, thread, method, @@ -1134,12 +1116,9 @@ if (env->global_events[JVMTI_EVENT_NATIVE_METHOD_BIND - JVMTI_MIN_EVENT_TYPE_VAL]) { - TRACE2("jvmti.event.bind", "Calling global NativeMethodBind event for method:" - << (method ? class_get_name(method_get_class((Method*)method)) : "(nil)") << "." - << (method ? method_get_name((Method*)method) : "(nil)") - << (method ? method_get_descriptor((Method*)method) : "" ) ); + TRACE2("jvmti.event.bind", + "Calling global NativeMethodBind event for method:" << method); - callback((jvmtiEnv*)env, jni_env, j_thread, method, address, new_address_ptr); @@ -1156,12 +1135,9 @@ if (et->thread == thread) { - TRACE2("jvmti.event.bind", "Calling local NativeMethodBind event for method:" - << (method ? class_get_name(method_get_class((Method*)method)) : "(nil)") << "." - << (method ? method_get_name((Method*)method) : "(nil)") - << (method ? method_get_descriptor((Method*)method) : "" ) ); + TRACE2("jvmti.event.bind", + "Calling local NativeMethodBind event for method:" << method); - callback((jvmtiEnv *)env, jni_env, j_thread, method, address, new_address_ptr); } @@ -1211,17 +1187,13 @@ jvmtiEnv *jvmti_env = (jvmtiEnv*) ti_env; TRACE2("jvmti.break.ss", "Calling SingleStep callback for env " << jvmti_env << ": " << - class_get_name(method_get_class((Method*)method)) << "." << - method_get_name((Method*)method) << - method_get_descriptor((Method*)method) << " :" << location); + method << " :" << location); if (NULL != ti_env->event_table.SingleStep) ti_env->event_table.SingleStep(jvmti_env, jni_env, thread, method, location); TRACE2("jvmti.break.ss", "Finished SingleStep callback for env " << jvmti_env << ": " << - class_get_name(method_get_class((Method*)method)) << "." << - method_get_name((Method*)method) << - method_get_descriptor((Method*)method) << " :" << location); + method << " :" << location); ti_env = next_env; } } @@ -1252,7 +1224,7 @@ tmn_suspend_enable(); // get field class - //Type_Info_Handle field_type = field_get_type_info_of_field_value(field); + //Type_Info_Handle field_type = field_get_type_info(field); //Class_Handle clss = type_info_get_class(field_type); //ASSERT(clss, "Can't get class handle for field type."); //jclass field_klass = struct_Class_to_java_lang_Class_Handle(clss); @@ -1324,7 +1296,7 @@ // get field class tmn_suspend_enable(); - //Type_Info_Handle field_type = field_get_type_info_of_field_value(field); + //Type_Info_Handle field_type = field_get_type_info(field); //Class_Handle clss = type_info_get_class(field_type); //ASSERT(clss, "Can't get class handle for field type."); //jclass field_klass = struct_Class_to_java_lang_Class_Handle(clss); Index: vm/vmcore/src/jvmti/jvmti_property.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_property.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_property.cpp (working copy) @@ -78,7 +78,7 @@ const char* bcp_property = XBOOTCLASSPATH_A; // get bootclasspath property - char *bcp_prop = get_property(bcp_property, VM_PROPERTIES); + char *bcp_prop = vm_properties_get_value(bcp_property, VM_PROPERTIES); size_t len_bcp = 0; @@ -94,17 +94,17 @@ strcpy(new_bcp + len_bcp + 1, segment); // update bootclasspath property - set_property(bcp_property, new_bcp, VM_PROPERTIES); - set_property(bcp_property, new_bcp, JAVA_PROPERTIES); + vm_property_set(bcp_property, new_bcp, VM_PROPERTIES); + vm_property_set(bcp_property, new_bcp, JAVA_PROPERTIES); STD_FREE(new_bcp); } else { // update bootclasspath property - set_property(bcp_property, segment, VM_PROPERTIES); - set_property(bcp_property, segment, JAVA_PROPERTIES); + vm_property_set(bcp_property, segment, VM_PROPERTIES); + vm_property_set(bcp_property, segment, JAVA_PROPERTIES); } - destroy_property_value(bcp_prop); + vm_properties_destroy_value(bcp_prop); return JVMTI_ERROR_NONE; } @@ -145,7 +145,7 @@ jint properties_count = 0; - char** keys = get_properties_keys(JAVA_PROPERTIES); + char** keys = vm_properties_get_keys(JAVA_PROPERTIES); while(keys[properties_count] != NULL) properties_count++; @@ -164,7 +164,7 @@ for (int jjj = 0; jjj < iii; jjj++) _deallocate((unsigned char *)prop_names_array[iii]); _deallocate((unsigned char *)prop_names_array); - destroy_properties_keys(keys); + vm_properties_destroy_keys(keys); return errorCode; } strcpy(prop_names_array[iii], keys[iii]); @@ -172,7 +172,7 @@ *count_ptr = properties_count; *property_ptr = prop_names_array; - destroy_properties_keys(keys); + vm_properties_destroy_keys(keys); return JVMTI_ERROR_NONE; } @@ -201,7 +201,7 @@ if (NULL == property || NULL == value_ptr) return JVMTI_ERROR_NULL_POINTER; - char *value = get_property(property, JAVA_PROPERTIES); + char *value = vm_properties_get_value(property, JAVA_PROPERTIES); if (NULL == value) return JVMTI_ERROR_NOT_AVAILABLE; @@ -211,7 +211,7 @@ strcpy(ret, value); *value_ptr = ret; } - destroy_property_value(value); + vm_properties_destroy_value(value); return errorCode; } @@ -244,7 +244,7 @@ return JVMTI_ERROR_NOT_AVAILABLE; Global_Env *vm_env = ((TIEnv*)env)->vm->vm_env; - set_property(property, value, JAVA_PROPERTIES); + vm_property_set(property, value, JAVA_PROPERTIES); return JVMTI_ERROR_NONE; } Index: vm/vmcore/src/jvmti/jvmti_break.cpp =================================================================== --- vm/vmcore/src/jvmti/jvmti_break.cpp (revision 639193) +++ vm/vmcore/src/jvmti/jvmti_break.cpp (working copy) @@ -28,6 +28,7 @@ #include "environment.h" #include "Class.h" #include "cxxlog.h" +#include "vm_log.h" #include "cci.h" #include "suspend_checker.h" @@ -44,12 +45,7 @@ assert(bp); TRACE2("jvmti.break", "Process breakpoint: " - << (bp->method - ? class_get_name(method_get_class((Method*)bp->method)) : "(nil)") - << "." - << (bp->method ? method_get_name((Method*)bp->method) : "(nil)") - << (bp->method ? method_get_descriptor((Method*)bp->method) : "") - << " :" << bp->location << " :" << bp->addr ); + << bp->method << " :" << bp->location << " :" << bp->addr ); DebugUtilsTI *ti = VM_Global_State::loader_env->TI; if (ti->getPhase() != JVMTI_PHASE_LIVE) @@ -75,18 +71,12 @@ if (env->global_events[JVMTI_EVENT_BREAKPOINT - JVMTI_MIN_EVENT_TYPE_VAL]) { TRACE2("jvmti.break", "Calling global breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); func((jvmtiEnv*)env, jni_env, (jthread)hThread, method, location); TRACE2("jvmti.break", "Finished global breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); } else { @@ -101,18 +91,12 @@ if (et->thread == hythread_self()) { TRACE2("jvmti.break", "Calling local breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); func((jvmtiEnv*)env, jni_env, (jthread)hThread, method, location); TRACE2("jvmti.break", "Finished local breakpoint callback: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location << " :" << addr); + << method << " :" << location << " :" << addr); } } } @@ -138,10 +122,7 @@ jmethodID method, jlocation location) { - TRACE2("jvmti.break", "SetBreakpoint is called for method: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) + TRACE2("jvmti.break", "SetBreakpoint is called for method: " << method << " :" << location); SuspendEnabledChecker sec; @@ -158,11 +139,7 @@ return JVMTI_ERROR_INVALID_METHODID; Method *m = (Method*) method; - TRACE2("jvmti.break", "SetBreakpoint: " - << class_get_name(method_get_class((Method *)method)) << "." - << method_get_name((Method *)method) - << method_get_descriptor((Method *)method) - << " :" << location); + TRACE2("jvmti.break", "SetBreakpoint: " << method << " :" << location); #if defined (__INTEL_COMPILER) #pragma warning( push ) @@ -217,10 +194,7 @@ jmethodID method, jlocation location) { - TRACE2("jvmti.break", "ClearBreakpoint is called for method: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) + TRACE2("jvmti.break", "ClearBreakpoint is called for method: " << method << " :" << location); SuspendEnabledChecker sec; jvmtiError errorCode; @@ -236,11 +210,7 @@ return JVMTI_ERROR_INVALID_METHODID; Method *m = (Method*) method; - TRACE2("jvmti.break", "ClearBreakpoint: " - << class_get_name(method_get_class((Method*)method)) << "." - << method_get_name((Method*)method) - << method_get_descriptor((Method*)method) - << " :" << location); + TRACE2("jvmti.break", "ClearBreakpoint: " << method << " :" << location); #if defined (__INTEL_COMPILER) #pragma warning( push ) Index: vm/vmcore/src/reflection/reflection.cpp =================================================================== --- vm/vmcore/src/reflection/reflection.cpp (revision 639193) +++ vm/vmcore/src/reflection/reflection.cpp (working copy) @@ -32,6 +32,7 @@ #include "port_malloc.h" #include "open/vm_type_access.h" +#include "open/vm_class_info.h" #include "exceptions.h" #include "heap.h" @@ -123,6 +124,12 @@ VM_Global_State::loader_env->java_lang_reflect_Constructor_Class); } +Boolean field_is_injected(Field_Handle f) +{ + assert(f); + return ((Field*)f)->is_injected(); +} + jobject reflection_reflect_field(JNIEnv *jenv, Field_Handle field) { // We do not reflect injected fields Index: vm/vmcore/src/reflection/annotations.cpp =================================================================== --- vm/vmcore/src/reflection/annotations.cpp (revision 639193) +++ vm/vmcore/src/reflection/annotations.cpp (working copy) @@ -214,7 +214,7 @@ // FIXME this behaviour should be evaluated against JSR-175 spec Class* enum_type = field_descriptor_to_type(jenv, value.enum_const.type, clss); if (enum_type) { - if (class_is_enum(enum_type)) { + if (enum_type->is_enum()) { jobject enum_value = reflection_get_enum_value(jenv, enum_type, value.enum_const.name); if (enum_value) { return enum_value; Index: vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp =================================================================== --- vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp (revision 639193) +++ vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp (working copy) @@ -29,6 +29,8 @@ #define LOG_DOMAIN "vm.core.classes" #include "cxxlog.h" +#include "open/vm_class_loading.h" +#include "open/vm_class_info.h" #include "Package.h" #include "classloader.h" #include "jni_utils.h" @@ -40,6 +42,68 @@ #include "java_lang_VMClassRegistry.h" #include "java_lang_ClassLoader.h" +// This function is for native library support +// It takes a class name with .s not /s. +// FIXME: caller could convert it itself +Class_Handle class_find_loaded(ClassLoaderHandle loader, const char* name) +{ + char* name3 = strdup(name); + char* p = name3; + while (*p) { + if (*p=='.') *p='/'; + p++; + } + Global_Env* env = VM_Global_State::loader_env; + String* name2 = env->string_pool.lookup(name3); + Class* ch; + if (loader) { + ch = loader->LookupClass(name2); + } else { + ch = env->bootstrap_class_loader->LookupClass(name2); + } + STD_FREE(name3); + if(ch && (!ch->verify(env) || !ch->prepare(env))) return NULL; + return ch; +} + +Class_Handle class_find_class_from_loader(ClassLoaderHandle loader, const char* n, Boolean init) +{ + ASSERT_RAISE_AREA; + assert(hythread_is_suspend_enabled()); // -salikh + char *new_name = strdup(n); + char *p = new_name; + while (*p) { + if (*p == '.') *p = '/'; + p++; + } + String* name = VM_Global_State::loader_env->string_pool.lookup(new_name); + STD_FREE(new_name); + Class* ch; + if (loader) { + ch = class_load_verify_prepare_by_loader_jni( + VM_Global_State::loader_env, name, loader); + } else { + assert(hythread_is_suspend_enabled()); + ch = class_load_verify_prepare_from_jni(VM_Global_State::loader_env, name); + } + if (!ch) return NULL; + // All initialization from jni should not propagate exceptions and + // should return to calling native method. + if(init) { + class_initialize_from_jni(ch); + + if (exn_raised()) { + return NULL; + } + } + + if(exn_raised()) { + return 0; + } + + return ch; +} + /* * Class: java_lang_VMClassRegistry * Method: defineClass Index: vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp =================================================================== --- vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp (revision 639193) +++ vm/vmcore/src/kernel_classes/native/org_apache_harmony_vm_VMStack.cpp (working copy) @@ -28,6 +28,7 @@ #include +#include "open/vm_class_loading.h" #include "open/jthread.h" #include "stack_trace.h" #include "jni_direct.h" Index: vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.cpp =================================================================== --- vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.cpp (revision 639193) +++ vm/vmcore/src/kernel_classes/native/org_apache_harmony_drlvm_VMHelper.cpp (working copy) @@ -19,8 +19,10 @@ #include "org_apache_harmony_drlvm_VMHelper.h" #include "open/vm.h" +#include "open/vm_ee.h" #include "open/vm_util.h" #include "environment.h" +#include "vtable.h" #include JNIEXPORT jint JNICALL Java_org_apache_harmony_drlvm_VMHelper_getPointerTypeSize (JNIEnv *, jclass) { @@ -44,7 +46,7 @@ /** @return vtable base offset if is in compressed-refs mode or -1*/ JNIEXPORT jlong JNICALL Java_org_apache_harmony_drlvm_VMHelper_getCompressedModeVTableBaseOffset(JNIEnv *, jclass) { #ifdef USE_COMPRESSED_VTABLE_POINTERS - return (jlong)vm_get_vtable_base(); + return (jlong)vm_get_vtable_base_address(); #else return -1; #endif Index: vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp =================================================================== --- vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp (revision 639193) +++ vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMReflection.cpp (working copy) @@ -30,6 +30,7 @@ #define LOG_DOMAIN "vm.core.reflection" #include "cxxlog.h" +#include "open/vm_class_loading.h" #include "reflection.h" #include "environment.h" #include "exceptions.h" @@ -91,7 +92,7 @@ (JNIEnv *jenv, jclass, jlong member) { Field_Handle fh = (Field_Handle) ((POINTER_SIZE_INT) member); - Type_Info_Handle fti = field_get_type_info_of_field_value(fh); + Type_Info_Handle fti = field_get_type_info(fh); return descriptor_to_jclass(fti); } Index: vm/vmcore/src/exception/exceptions.cpp =================================================================== --- vm/vmcore/src/exception/exceptions.cpp (revision 639193) +++ vm/vmcore/src/exception/exceptions.cpp (working copy) @@ -22,6 +22,7 @@ #define LOG_DOMAIN "exn" #include "clog.h" +#include "vtable.h" #include "heap.h" #include "classloader.h" #include "exceptions.h" @@ -35,8 +36,8 @@ #include "vm_arrays.h" #include "vm_strings.h" #include "cci.h" +#include "open/vm_class_info.h" - bool exn_raised() { // no need to disable gc for simple null equality check Index: vm/vmcore/src/exception/exceptions_impl.cpp =================================================================== --- vm/vmcore/src/exception/exceptions_impl.cpp (revision 639193) +++ vm/vmcore/src/exception/exceptions_impl.cpp (working copy) @@ -23,6 +23,7 @@ #define LOG_DOMAIN "exn" #include "clog.h" +#include "vtable.h" #include "Class.h" #include "classloader.h" #include "exceptions.h" Index: vm/vmcore/src/exception/exceptions_jit.cpp =================================================================== --- vm/vmcore/src/exception/exceptions_jit.cpp (revision 639193) +++ vm/vmcore/src/exception/exceptions_jit.cpp (working copy) @@ -23,9 +23,10 @@ #define LOG_DOMAIN "exn" #include "clog.h" +#include "open/vm_class_info.h" #include "Class.h" #include "open/types.h" - +#include "vtable.h" #include "classloader.h" #include "exceptions.h" #include "exceptions_impl.h" Index: vm/vmcore/src/class_support/Prepare.cpp =================================================================== --- vm/vmcore/src/class_support/Prepare.cpp (revision 639193) +++ vm/vmcore/src/class_support/Prepare.cpp (working copy) @@ -29,7 +29,7 @@ #include "classloader.h" #include "nogc.h" #include "Package.h" - +#include "vtable.h" #include "vm_strings.h" #include "open/vm_util.h" #include "open/gc.h" @@ -787,9 +787,6 @@ index = m->get_index(); // mark superclass' method "m" as being overridden m->method_was_overridden(); - - // notify interested JITs that "m" was overridden by "method" - m->do_jit_overridden_method_callbacks(&method); } break; } @@ -882,7 +879,7 @@ memcpy(&vtable->superclasses, &get_super_class()->m_vtable->superclasses, sizeof(vtable->superclasses)); - for(int i = 0; i < vm_max_fast_instanceof_depth(); i++) { + for(unsigned i = 0; i < vm_max_fast_instanceof_depth(); i++) { if(vtable->superclasses[i] == NULL) { vtable->superclasses[i] = this; break; @@ -1309,10 +1306,10 @@ m_vtable->methods[i] = NULL; // for now } - if(vm_vtable_pointers_are_compressed()) + if(vm_is_vtable_compressed()) { m_allocation_handle = - (Allocation_Handle)((POINTER_SIZE_INT)m_vtable - vm_get_vtable_base()); + (Allocation_Handle)((UDATA)m_vtable - (UDATA)vm_get_vtable_base_address()); } else { @@ -1373,7 +1370,7 @@ // Set up the class_properties field. if(is_array()) { - m_array_element_size = (vm_references_are_compressed() + m_array_element_size = (vm_is_heap_compressed() ? sizeof(COMPRESSED_REFERENCE) : sizeof(RAW_REFERENCE)); m_array_element_shift = m_array_element_size == 8 ? 3 : 2; m_vtable->class_properties |= CL_PROP_ARRAY_MASK; Index: vm/vmcore/src/class_support/Initialize.cpp =================================================================== --- vm/vmcore/src/class_support/Initialize.cpp (revision 639193) +++ vm/vmcore/src/class_support/Initialize.cpp (working copy) @@ -23,6 +23,7 @@ #define LOG_DOMAIN "classloader" #include "cxxlog.h" +#include "vtable.h" #include "Class.h" #include "open/jthread.h" #include "open/gc.h" @@ -208,7 +209,7 @@ } tmn_suspend_disable(); - if (class_needs_initialization(clss)) { + if (!clss->is_initialized()) { clss->initialize(); } tmn_suspend_enable(); @@ -235,7 +236,7 @@ } tmn_suspend_disable(); - if(class_needs_initialization(clss)) { + if(!clss->is_initialized()) { clss->initialize(); } } // class_initialize_ex Index: vm/vmcore/src/class_support/C_Interface.cpp =================================================================== --- vm/vmcore/src/class_support/C_Interface.cpp (revision 639193) +++ vm/vmcore/src/class_support/C_Interface.cpp (working copy) @@ -28,6 +28,7 @@ #include "vm_arrays.h" #include "vm_strings.h" #include "properties.h" +#include "vtable.h" #include "open/hythread_ext.h" #include "port_mutex.h" @@ -40,14 +41,16 @@ #include "open/vm_type_access.h" #include "open/vm_class_info.h" +#include "open/vm_class_loading.h" +#include "open/vm_ee.h" #include "jit_intf.h" -Boolean class_is_final(Class_Handle cl) { +BOOLEAN class_is_final(Class_Handle cl) { assert(cl); return cl->is_final(); } -Boolean class_is_abstract(Class_Handle cl) { +BOOLEAN class_is_abstract(Class_Handle cl) { assert(cl); return cl->is_abstract(); } @@ -58,7 +61,7 @@ } -Boolean class_is_array(Class_Handle cl) { +BOOLEAN class_is_array(Class_Handle cl) { assert(cl); return cl->is_array(); } //class_is_array @@ -342,25 +345,6 @@ return code_block; } // method_allocate_code_block - - -void method_set_relocatable(Method_Handle m, JIT_Handle j, NativeCodePtr code_address, Boolean is_relocatable) -{ - Global_Env *env = VM_Global_State::loader_env; - CodeChunkInfo *cci; - Method_Handle method = env->em_interface->LookupCodeChunk(code_address, FALSE, - NULL, NULL, reinterpret_cast(&cci)); - assert(method); - assert(method == m); - assert(cci); - assert(cci->get_jit() == j); - assert(cci->get_method() == m); - cci->set_relocatable(is_relocatable); -} //method_set_relocatable - - - - Byte *method_get_code_block_addr_jit(Method_Handle m, JIT_Handle j) { assert(m); @@ -439,7 +423,7 @@ -unsigned method_get_offset(Method_Handle m) +size_t method_get_vtable_offset(Method_Handle m) { assert(m); return ((Method *)m)->get_offset(); @@ -495,15 +479,6 @@ return ((Method *)m)->get_return_java_type(); } - - -Boolean method_is_overridden(Method_Handle m) -{ - assert(m); - return ((Method *)m)->is_overridden(); -} //method_is_overridden - - Boolean method_is_fake(Method_Handle m) { assert(m); @@ -511,16 +486,6 @@ } //method_is_fake - -JIT_Handle method_get_JIT_id(Compile_Handle h) -{ - assert(h); - Compilation_Handle* ch = (Compilation_Handle*)h; - return ch->jit; -} //method_get_JIT_id - - - const char* class_get_name(Class_Handle cl) { assert(cl); @@ -535,26 +500,13 @@ } //class_get_flags -int class_get_super_offset() +U_32 class_get_depth(Class_Handle cl) { - return sizeof(VTable*); -} //class_get_super_offset - - -int vtable_get_super_array_offset() -{ - VTable *vtable = 0; - return (int) (((Byte *)&vtable->superclasses) - (Byte *)vtable); -}//vtable_get_super_array_offset - - -int class_get_depth(Class_Handle cl) -{ assert(cl); return cl->get_depth(); } //class_get_depth -Boolean class_get_fast_instanceof_flag(Class_Handle cl) +BOOLEAN class_is_support_fast_instanceof(Class_Handle cl) { assert(cl); return cl->get_fast_instanceof_flag(); @@ -565,20 +517,12 @@ return vh->clss; } // vtable_get_class -Boolean class_is_initialized(Class_Handle ch) +BOOLEAN class_is_initialized(Class_Handle ch) { assert(ch); return ch->is_initialized(); } //class_is_initialized - - -Boolean class_needs_initialization(Class_Handle ch) -{ - assert(ch); - return !ch->is_initialized(); -} //class_needs_initialization - Class_Handle class_get_super_class(Class_Handle cl) { assert(cl); @@ -622,7 +566,7 @@ return ch->_resolve_class(VM_Global_State::loader_env, cp_index); } -Boolean class_is_instanceof(Class_Handle s, Class_Handle t) +BOOLEAN class_is_instanceof(Class_Handle s, Class_Handle t) { assert(s); assert(t); @@ -645,7 +589,7 @@ -Boolean class_hint_is_exceptiontype(Class_Handle ch) +BOOLEAN class_is_throwable(Class_Handle ch) { assert(ch); Global_Env *env = VM_Global_State::loader_env; @@ -658,7 +602,7 @@ ch = class_get_super_class(ch); } return FALSE; -} //class_hint_is_exceptiontype +} //class_is_throwable @@ -864,40 +808,6 @@ } - - - - -Class_Handle -vm_resolve_class(Compile_Handle h, - Class_Handle c, - unsigned index) -{ - assert(c); - return (Class*) resolve_class(h, c, index); -} //vm_resolve_class - - - -Class_Handle -vm_resolve_class_new(Compile_Handle h, - Class_Handle c, - unsigned index) -{ - assert(c); - return resolve_class_new(h, c, index); -} //vm_resolve_class_new - - - -Class_Handle resolve_class_from_constant_pool(Class_Handle c_handle, unsigned index) -{ - assert(c_handle); - return c_handle->_resolve_class(VM_Global_State::loader_env, index); -} - - - ClassLoaderHandle class_get_class_loader(Class_Handle ch) { @@ -908,19 +818,15 @@ Class_Handle -class_load_class_by_name(const char *name, - Class_Handle ch) +class_load_boot_class(const char *name) { - assert(ch); Global_Env *env = VM_Global_State::loader_env; String *n = env->string_pool.lookup(name); - return ch->get_class_loader()->LoadClass(env, n); -} //class_load_class_by_name + return env->bootstrap_class_loader->LoadClass(env, n); +} - - Class_Handle -class_lookup_class_by_name_using_bootstrap_class_loader(const char *name) +class_lookup_boot_class(const char *name) { Global_Env *env = VM_Global_State::loader_env; String *n = env->string_pool.lookup(name); @@ -970,67 +876,6 @@ return ch->get_class_loader()->LoadClass(env, n);; } //class_load_class_by_descriptor - -Class_Handle class_find_loaded(ClassLoaderHandle loader, const char* name) -{ - char* name3 = strdup(name); - char* p = name3; - while (*p) { - if (*p=='.') *p='/'; - p++; - } - Global_Env* env = VM_Global_State::loader_env; - String* name2 = env->string_pool.lookup(name3); - Class* ch; - if (loader) { - ch = loader->LookupClass(name2); - } else { - ch = env->bootstrap_class_loader->LookupClass(name2); - } - STD_FREE(name3); - if(ch && (!ch->verify(env) || !ch->prepare(env))) return NULL; - return ch; -} - -Class_Handle class_find_class_from_loader(ClassLoaderHandle loader, const char* n, Boolean init) -{ - ASSERT_RAISE_AREA; - assert(hythread_is_suspend_enabled()); // -salikh - char *new_name = strdup(n); - char *p = new_name; - while (*p) { - if (*p == '.') *p = '/'; - p++; - } - String* name = VM_Global_State::loader_env->string_pool.lookup(new_name); - STD_FREE(new_name); - Class* ch; - if (loader) { - ch = class_load_verify_prepare_by_loader_jni( - VM_Global_State::loader_env, name, loader); - } else { - assert(hythread_is_suspend_enabled()); - ch = class_load_verify_prepare_from_jni(VM_Global_State::loader_env, name); - } - if (!ch) return NULL; - // All initialization from jni should not propagate exceptions and - // should return to calling native method. - if(init) { - class_initialize_from_jni(ch); - - if (exn_raised()) { - return NULL; - } - } - - if(exn_raised()) { - return 0; - } - - return ch; -} - - // // The following do not cause constant pools to be resolve, if they are not // resolved already @@ -1279,16 +1124,7 @@ } //class_lookup_method_recursively -struct ChList { - JIT_Handle jit; - Compilation_Handle ch; - ChList* next; -}; - -static ChList* chs = NULL; - - -int object_get_vtable_offset() +size_t object_get_vtable_offset() { return 0; } //object_get_vtable_offset @@ -1311,27 +1147,27 @@ -Class_Handle get_system_object_class() +Class_Handle vm_get_java_lang_object_class() { Global_Env *env = VM_Global_State::loader_env; return env->JavaLangObject_Class; -} //get_system_object_class +} //vm_get_java_lang_object_class -Class_Handle get_system_class_class() +Class_Handle vm_get_java_lang_class_class() { Global_Env *env = VM_Global_State::loader_env; return env->JavaLangClass_Class; -} //get_system_class_class +} //vm_get_java_lang_class_class -Class_Handle get_system_string_class() +Class_Handle vm_get_java_lang_string_class() { Global_Env *env = VM_Global_State::loader_env; return env->JavaLangString_Class; -} //get_system_string_class +} //vm_get_java_lang_string_class @@ -1365,14 +1201,6 @@ } //vector_first_element_offset_unboxed -int array_first_element_offset_unboxed(Class_Handle element_type) -{ - assert(element_type); - return vector_first_element_offset_unboxed(element_type); -} //array_first_element_offset_unboxed - - - int vector_first_element_offset(VM_Data_Type element_type) { switch(element_type) { @@ -1402,19 +1230,9 @@ } //method_is_java - - -// 20020220 TO DO: -// 1. Add the is_value_type field to the Java build of VM? -Boolean class_is_valuetype(Class_Handle ch) +BOOLEAN class_is_enum(Class_Handle ch) { assert(ch); - return class_is_primitive(ch); -} //class_is_valuetype - -Boolean class_is_enum(Class_Handle ch) -{ - assert(ch); return ch->is_enum() ? TRUE : FALSE; } //class_is_enum @@ -1478,19 +1296,8 @@ } } //class_get_array_of_unboxed - - - -Boolean field_is_unmanaged_static(Field_Handle fh) +BOOLEAN class_is_primitive(Class_Handle ch) { - assert(fh); - return FALSE; -} //field_is_unmanaged_static - - - -Boolean class_is_primitive(Class_Handle ch) -{ assert(ch); return ch->is_primitive(); } //class_is_primitive @@ -1648,7 +1455,7 @@ } //method_args_has_this -unsigned class_number_fields(Class_Handle ch) +U_16 class_number_fields(Class_Handle ch) { assert(ch); return ch->get_number_of_fields(); @@ -1674,7 +1481,7 @@ } // class_num_instance_fields_recursive -Field_Handle class_get_field(Class_Handle ch, unsigned idx) +Field_Handle class_get_field(Class_Handle ch, U_16 idx) { assert(ch); if(idx >= ch->get_number_of_fields()) return NULL; @@ -1785,13 +1592,6 @@ } //field_is_enumerable_reference -Boolean field_is_injected(Field_Handle f) -{ - assert(f); - return ((Field*)f)->is_injected(); -} //field_is_injected - - ///////////////////////////////////////////////////////////////////// // New GC interface demo @@ -1813,19 +1613,6 @@ ///////////////////////////////////////////////////////////////////// // New signature stuff - - - -Type_Info_Handle method_vars_get_type_info(Method_Handle mh, - unsigned UNREF idx) -{ - assert(mh); - // Always NULL for Java. - return 0; -} //method_vars_get_type_info - - - Type_Info_Handle method_args_get_type_info(Method_Signature_Handle msh, unsigned idx) { @@ -1848,78 +1635,20 @@ return ms->return_type_desc; } //method_ret_type_get_type_info - - -Boolean method_vars_is_managed_pointer(Method_Handle mh, unsigned idx) +Type_Info_Handle field_get_type_info(Field_Handle fh) { - assert(mh); - Type_Info_Handle tih = method_vars_get_type_info(mh, idx); - TypeDesc* td = (TypeDesc*)tih; - assert(td); - return td->is_managed_pointer(); -} //method_vars_is_managed_pointer - - -Boolean method_vars_is_pinned(Method_Handle mh, unsigned UNREF idx) -{ - assert(mh); - // 20030626 This is wrong, but equivalent to the existing code when I wrote this. - return FALSE; -} //method_vars_is_pinned - - -Boolean method_args_is_managed_pointer(Method_Signature_Handle msh, unsigned idx) -{ - assert(msh); - Type_Info_Handle tih = method_args_get_type_info(msh, idx); - TypeDesc* td = (TypeDesc*)tih; - assert(td); - return td->is_managed_pointer(); -} //method_args_is_managed_pointer - - - -Boolean method_ret_type_is_managed_pointer(Method_Signature_Handle msh) -{ - assert(msh); - Type_Info_Handle tih = method_ret_type_get_type_info(msh); - TypeDesc* td = (TypeDesc*)tih; - assert(td); - return td->is_managed_pointer(); -} //method_ret_type_is_managed_pointer - - - - -void free_string_buffer(char *buffer) -{ - STD_FREE(buffer); -} //free_string_buffer - - -Type_Info_Handle field_get_type_info_of_field_value(Field_Handle fh) -{ assert(fh); Field *field = (Field *)fh; TypeDesc* td = field->get_field_type_desc(); assert(td); return td; -} //field_get_type_info_of_field_value +} //field_get_type_info - -Type_Info_Handle class_get_element_type_info(Class_Handle ch) -{ - assert(ch); - TypeDesc* td = ch->get_array_element_type_desc(); - assert(td); - return td; -} //class_get_element_type_info - ///////////////////////////////////////////////////// // New GC stuff -Boolean class_is_non_ref_array(Class_Handle ch) +BOOLEAN class_is_non_ref_array(Class_Handle ch) { assert(ch); // Use the if statement to normalize the value of TRUE @@ -1988,15 +1717,6 @@ & CL_PROP_ALIGNMENT_MASK); } //class_get_alignment - - -// (20020313) Should it always be the same as class_get_alignment? -unsigned class_get_alignment_unboxed(Class_Handle ch) -{ - assert(ch); - return class_get_alignment(ch); -} //class_get_alignment_unboxed - // // Returns the size of an element in the array class. // @@ -2006,13 +1726,11 @@ return ch->get_array_element_size(); } //class_element_size - - -unsigned class_get_boxed_data_size(Class_Handle ch) +size_t class_get_object_size(Class_Handle ch) { assert(ch); return ch->get_allocated_size(); -} //class_get_boxed_data_size +} //class_get_object_size @@ -2042,21 +1760,10 @@ } //method_is_no_inlining - -Boolean method_is_require_security_object(Method_Handle mh) -{ - assert(mh); - return FALSE; -} //method_is_require_security_object - - - -#define QUAL_NAME_BUFF_SIZE 128 - // Class ch is a subclass of method_get_class(mh). The function returns a method handle // for an accessible method overriding mh in ch or in its closest superclass that overrides mh. // Class ch must be a class not an interface. -Method_Handle method_find_overridden_method(Class_Handle ch, Method_Handle mh) +Method_Handle class_get_overridden_method(Class_Handle ch, Method_Handle mh) { assert(ch); assert(mh); @@ -2082,7 +1789,7 @@ } } return m; -} //method_find_overridden_method +} //class_get_overridden_method @@ -2167,28 +1874,28 @@ } -VMEXPORT Boolean vm_references_are_compressed() +BOOLEAN vm_is_heap_compressed() { return REFS_IS_COMPRESSED_MODE; -} //vm_references_are_compressed +} //vm_is_heap_compressed -VMEXPORT void *vm_heap_base_address() +void *vm_get_heap_base_address() { return (void*)VM_Global_State::loader_env->heap_base; -} //vm_heap_base_address +} //vm_get_heap_base_address -VMEXPORT void *vm_heap_ceiling_address() +void *vm_get_heap_ceiling_address() { return (void *)VM_Global_State::loader_env->heap_end; -} //vm_heap_ceiling_address +} //vm_get_heap_ceiling_address -Boolean vm_vtable_pointers_are_compressed() +BOOLEAN vm_is_vtable_compressed() { return ManagedObject::are_vtable_pointers_compressed(); -} //vm_vtable_pointers_are_compressed +} //vm_is_vtable_compressed Class_Handle allocation_handle_get_class(Allocation_Handle ah) @@ -2196,9 +1903,9 @@ assert(ah); VTable *vt; - if (vm_vtable_pointers_are_compressed()) + if (vm_is_vtable_compressed()) { - vt = (VTable *) ((POINTER_SIZE_INT)ah + vm_get_vtable_base()); + vt = (VTable *) ((UDATA)ah + (UDATA)vm_get_vtable_base_address()); } else { @@ -2214,55 +1921,11 @@ return ch->get_allocation_handle(); } - -unsigned vm_get_vtable_ptr_size() -{ - if(vm_vtable_pointers_are_compressed()) - { - return sizeof(uint32); - } - else - { - return sizeof(POINTER_SIZE_INT); - } -} - -int vm_max_fast_instanceof_depth() -{ - return MAX_FAST_INSTOF_DEPTH; -} - - //////////////////////////////////////////////////////////////////////////////////// // Direct call-related functions that allow a JIT to be notified whenever a VM data // structure changes that would require code patching or recompilation. //////////////////////////////////////////////////////////////////////////////////// -// Called by a JIT in order to be notified whenever the given class (or any of its subclasses?) -// is extended. The callback_data pointer will be passed back to the JIT during the callback. -// The callback function is JIT_extended_class_callback. -void vm_register_jit_extended_class_callback(JIT_Handle jit, Class_Handle clss, - void* callback_data) -{ - assert(clss); - JIT* jit_to_be_notified = (JIT*)jit; - Class *c = (Class *)clss; - clss->register_jit_extended_class_callback(jit_to_be_notified, callback_data); -} // vm_register_jit_extended_class_callback - - -// Called by a JIT in order to be notified whenever the given method is overridden by a newly -// loaded class. The callback_data pointer will be passed back to the JIT during the callback. -// The callback function is JIT_overridden_method_callback. -void vm_register_jit_overridden_method_callback(JIT_Handle jit, Method_Handle method, - void* callback_data) -{ - assert(method); - JIT* jit_to_be_notified = (JIT*)jit; - method->register_jit_overridden_method_callback(jit_to_be_notified, callback_data); -} //vm_register_jit_overridden_method_callback - - // Called by a JIT in order to be notified whenever the given method is recompiled or // initially compiled. The callback_data pointer will be passed back to the JIT during the callback. // The callback method is JIT_recompiled_method_callback. @@ -2295,17 +1958,6 @@ } //vm_patch_code_block - -// Called by a JIT to have the VM recompile a method using the specified JIT. After -// recompilation, the corresponding vtable entries will be updated, and the necessary -// callbacks to JIT_recompiled_method_callback will be made. It is a requirement that -// the method has not already been compiled by the given JIT; this means that multiple -// instances of a JIT may need to be active at the same time. -void vm_recompile_method(JIT_Handle jit, Method_Handle method) -{ - compile_do_compilation_jit((Method*) method, (JIT*) jit); -} // vm_recompile_method - // Called by JIT during compilation to have the VM synchronously request a JIT (maybe another one) // to compile another method. JIT_Result vm_compile_method(JIT_Handle jit, Method_Handle method) @@ -2435,13 +2087,8 @@ } // method_iterator_advance -CallingConvention vm_managed_calling_convention() +void vm_property_set(const char* key, const char* value, PropertyTable table_number) { - return CC_Vm; -} //vm_managed_calling_convention - -void set_property(const char* key, const char* value, PropertyTable table_number) -{ assert(key); switch(table_number) { case JAVA_PROPERTIES: @@ -2455,7 +2102,7 @@ } } -char* get_property(const char* key, PropertyTable table_number) +char* vm_properties_get_value(const char* key, PropertyTable table_number) { assert(key); char* value; @@ -2473,7 +2120,7 @@ return value; } -void destroy_property_value(char* value) +void vm_properties_destroy_value(char* value) { if (value) { @@ -2482,25 +2129,25 @@ } } -int is_property_set(const char* key, PropertyTable table_number) +BOOLEAN vm_property_is_set(const char* key, PropertyTable table_number) { - int value; + bool value; assert(key); switch(table_number) { case JAVA_PROPERTIES: - value = VM_Global_State::loader_env->JavaProperties()->is_set(key) ? 1 : 0; + value = VM_Global_State::loader_env->JavaProperties()->is_set(key); break; case VM_PROPERTIES: - value = VM_Global_State::loader_env->VmProperties()->is_set(key) ? 1 : 0; + value = VM_Global_State::loader_env->VmProperties()->is_set(key); break; default: - value = -1; + value = false; ASSERT(0, "Unknown property table: " << table_number); } - return value; + return value ? TRUE : FALSE; } -void unset_property(const char* key, PropertyTable table_number) +void vm_property_unset(const char* key, PropertyTable table_number) { assert(key); switch(table_number) { @@ -2515,7 +2162,7 @@ } } -char** get_properties_keys(PropertyTable table_number) +char** vm_properties_get_keys(PropertyTable table_number) { char** value; switch(table_number) { @@ -2532,7 +2179,7 @@ return value; } -char** get_properties_keys_staring_with(const char* prefix, PropertyTable table_number) +char** vm_properties_get_keys_starting_with(const char* prefix, PropertyTable table_number) { assert(prefix); char** value; @@ -2550,7 +2197,7 @@ return value; } -void destroy_properties_keys(char** keys) +void vm_properties_destroy_keys(char** keys) { if (keys) { @@ -2559,29 +2206,29 @@ } } -int get_int_property(const char *property_name, int default_value, PropertyTable table_number) +int vm_property_get_int(const char *property_name, int default_value, PropertyTable table_number) { assert(property_name); - char *value = get_property(property_name, table_number); + char *value = vm_properties_get_value(property_name, table_number); int return_value = default_value; if (NULL != value) { return_value = atoi(value); - destroy_property_value(value); + vm_properties_destroy_value(value); } return return_value; } -int64 get_numerical_property(const char *property_name, int64 default_value, PropertyTable table_number) +int64 vm_property_get_number(const char *property_name, int64 default_value, PropertyTable table_number) { assert(property_name); - char *value = get_property(property_name, table_number); + char *value = vm_properties_get_value(property_name, table_number); int64 return_value = default_value; if (NULL != value) { int64 size = atol(value); int sizeModifier = tolower(value[strlen(value) - 1]); - destroy_property_value(value); + vm_properties_destroy_value(value); size_t unit = 1; switch (sizeModifier) { @@ -2598,10 +2245,10 @@ } return return_value; } -Boolean get_boolean_property(const char *property_name, Boolean default_value, PropertyTable table_number) +BOOLEAN vm_property_get_bool(const char *property_name, BOOLEAN default_value, PropertyTable table_number) { assert(property_name); - char *value = get_property(property_name, table_number); + char *value = vm_properties_get_value(property_name, table_number); if (NULL == value) { return default_value; @@ -2621,18 +2268,18 @@ { return_value = TRUE; } - destroy_property_value(value); + vm_properties_destroy_value(value); return return_value; } -size_t get_size_property(const char *property_name, size_t default_value, PropertyTable table_number) +size_t vm_property_get_size(const char *property_name, size_t default_value, PropertyTable table_number) { char* size_string; size_t size; int sizeModifier; size_t unit = 1; - size_string = get_property(property_name, table_number); + size_string = vm_properties_get_value(property_name, table_number); if (size_string == NULL) { return default_value; @@ -2640,7 +2287,7 @@ size = atol(size_string); sizeModifier = tolower(size_string[strlen(size_string) - 1]); - destroy_property_value(size_string); + vm_properties_destroy_value(size_string); switch (sizeModifier) { case 'k': unit = 1024; break; @@ -2662,6 +2309,7 @@ Annotation* antn = table->table[i]; Type_Info_Handle tih = (Type_Info_Handle) type_desc_create_from_java_descriptor(antn->type->bytes, owner->get_class_loader()); if (tih) { + //FIXME optimize: first check if class name matches Class* type = type_info_get_class(tih); if (antn_type == type) { return antn; @@ -2673,7 +2321,7 @@ } -Boolean method_has_annotation(Method_Handle target, Class_Handle antn_type) { +BOOLEAN method_has_annotation(Method_Handle target, Class_Handle antn_type) { assert(target); assert(antn_type); if (target->get_declared_annotations()) { Index: vm/vmcore/src/class_support/Environment.cpp =================================================================== --- vm/vmcore/src/class_support/Environment.cpp (revision 639193) +++ vm/vmcore/src/class_support/Environment.cpp (working copy) @@ -312,13 +312,13 @@ } static size_t parse_size_prop(const char* name, size_t default_size) { - if(!is_property_set(name, VM_PROPERTIES)) { + if(!vm_property_is_set(name, VM_PROPERTIES)) { return default_size; } - char* value = get_property(name, VM_PROPERTIES); + char* value = vm_properties_get_value(name, VM_PROPERTIES); size_t size = parse_size(value); - destroy_property_value(value); + vm_properties_destroy_value(value); return size; } @@ -330,7 +330,7 @@ GlobalCodeMemoryManager = new PoolManager(pool_size, system_page_size, use_large_pages, true/*is_code*/, true/*is_resize_allowed*/); - bool compress_vtables = vm_vtable_pointers_are_compressed(); + bool compress_vtables = vm_is_vtable_compressed(); pool_size = parse_size_prop("vm.vtable_pool_size", compress_vtables?DEFAULT_VTABLE_POOL_SIZE_NO_RESIZE : DEFAULT_VTABLE_POOL_SIZE); assert(pool_size); Index: vm/vmcore/src/class_support/Class.cpp =================================================================== --- vm/vmcore/src/class_support/Class.cpp (revision 639193) +++ vm/vmcore/src/class_support/Class.cpp (working copy) @@ -41,7 +41,7 @@ #include "cci.h" #include "interpreter.h" #include "port_threadunsafe.h" - +#include "vtable.h" #include "inline_info.h" #ifdef _IPF_ @@ -87,7 +87,6 @@ m_num_dimensions = 0; m_array_base_class = m_array_element_class = NULL; - m_array_element_type_desc = NULL; m_access_flags = 0; m_num_superinterfaces = 0; @@ -135,8 +134,6 @@ m_num_field_padding_bytes = 0; - m_notify_extended_records = 0; - m_depth = 0; m_is_suitable_for_fast_instanceof = 0; @@ -167,12 +164,6 @@ if(m_lock) delete m_lock; - - if(m_array_element_type_desc) - { - delete m_array_element_type_desc; - m_array_element_type_desc = NULL; - } } @@ -319,8 +310,6 @@ m_cha_next_sibling = get_super_class()->m_cha_first_child; get_super_class()->m_cha_first_child = this; } - // Notify interested JITs that the superclass has been extended. - superClass->do_jit_extended_class_callbacks(this); } // @@ -380,7 +369,6 @@ m_state = ST_Initialized; assert(elementClass); - m_array_element_type_desc = type_desc_create_from_class(elementClass); // insert Java field, required by spec - 'length I' m_num_fields = 1; @@ -441,6 +429,14 @@ } +Field* class_resolve_nonstatic_field(Class* clss, unsigned cp_index) +{ + Field* f = clss->_resolve_field(VM_Global_State::loader_env, cp_index); + return (!f || f->is_static()) ? NULL : f; +} // class_resolve_nonstatic_field + + + Field* Class::lookup_field_recursive(const String* name, const String* desc) { // Step 1: lookup in self @@ -624,9 +620,7 @@ _jits = NULL; _side_effects = MSE_Unknown; _method_sig = 0; - inline_records = 0; - _notify_override_records = NULL; _notify_recompiled_records = NULL; _index = 0; _max_stack=_max_locals=_n_exceptions=_n_handlers=0; @@ -1114,47 +1108,6 @@ } }; - -void Class::register_jit_extended_class_callback(JIT* jit_to_be_notified, void* callback_data) -{ - // Don't insert the same entry repeatedly on the notify_extended_records list. - Class_Extended_Notification_Record* nr = m_notify_extended_records; - while(nr != NULL) { - if(nr->equals(this, jit_to_be_notified, callback_data)) { - return; - } - nr = nr->next; - } - - // Insert a new notification record. - Class_Extended_Notification_Record* new_nr = - (Class_Extended_Notification_Record*)STD_MALLOC(sizeof(Class_Extended_Notification_Record)); - new_nr->class_of_interest = this; - new_nr->jit = jit_to_be_notified; - new_nr->callback_data = callback_data; - new_nr->next = m_notify_extended_records; - m_notify_extended_records = new_nr; -} // Class::register_jit_extended_class_callback - - -void Class::do_jit_extended_class_callbacks(Class* new_subclass) -{ - Class_Extended_Notification_Record* nr; - for(nr = m_notify_extended_records; nr != NULL; nr = nr->next) { - JIT* jit_to_be_notified = nr->jit; - Boolean code_was_modified = - jit_to_be_notified->extended_class_callback(this, - new_subclass, nr->callback_data); - if(code_was_modified) { -#ifdef _IPF_ - sync_i_cache(); - do_mf(); -#endif // _IPF_ - } - } -} // Class::do_jit_extended_class_callbacks - - void Class::lock() { m_lock->_lock(); @@ -1184,11 +1137,6 @@ size += m_static_data_size; if(!is_interface()) size += sizeof(VTable); - for(Class_Extended_Notification_Record* mcnr = m_notify_extended_records; - mcnr != NULL; mcnr = mcnr->next) - { - size += sizeof(Class_Extended_Notification_Record); - } size += sizeof(Lock_Manager); return size; Index: vm/vmcore/src/class_support/Resolve.cpp =================================================================== --- vm/vmcore/src/class_support/Resolve.cpp (revision 639193) +++ vm/vmcore/src/class_support/Resolve.cpp (working copy) @@ -96,13 +96,14 @@ #include "Class.h" #include "classloader.h" #include "environment.h" -#include "jit_intf.h" #include "compile.h" #include "exceptions.h" #include "interpreter.h" #include "open/bytecodes.h" #include "open/vm_class_info.h" +#include "open/vm_class_loading.h" +#include "open/vm_ee.h" #include "open/vm_util.h" @@ -763,14 +764,6 @@ } -Field_Handle resolve_field(Compile_Handle h, - Class_Handle c, - unsigned index) -{ - return c->_resolve_field(compile_handle_to_environment(h), index); -} // resolve_field - - // // resolve constant pool reference to a non-static field // used for getfield and putfield Index: vm/vmcore/src/class_support/method.cpp =================================================================== --- vm/vmcore/src/class_support/method.cpp (revision 639193) +++ vm/vmcore/src/class_support/method.cpp (working copy) @@ -543,118 +543,11 @@ return _exceptions[n]; } - - -////////////////////////////////////////////////////// -// begin inlining support - -struct Inline_Record { - JIT *jit; - Method *caller; - Inline_Record *next; - bool equals(JIT *jit_, Method* caller_){ - if (jit == jit_ && - caller == caller_) - return true; - return false; - } -}; - - -void Method::set_inline_assumption(JIT *jit, Method *caller) -{ - // don't insert a record repeatedly - Inline_Record *itr = inline_records; - while (itr != NULL){ - if (itr->equals(jit, caller) ) - return; - itr = itr->next; - } - Inline_Record *ir = (Inline_Record *)STD_MALLOC(sizeof(Inline_Record)); - ir->jit = jit; - ir->caller = caller; - ir->next = inline_records; - inline_records = ir; -} //Method::set_inline_assumption - - void Method::method_was_overridden() { _flags.is_overridden = 1; - - while(inline_records) { - Inline_Record *curr = inline_records; - curr->jit->method_was_overridden(curr->caller, this); - inline_records = curr->next; - STD_FREE(curr); - } } //Method::method_was_overridden - -// end inlining support -////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////// -// begin support for JIT notification when methods are overridden - -// Notify the given JIT whenever this method is overridden by a newly loaded class. -// The callback_data pointer will be passed back to the JIT during the callback. -// The JIT's callback function is JIT_overridden_method_callback. -void Method::register_jit_overridden_method_callback(JIT *jit_to_be_notified, void *callback_data) -{ - // Don't insert the same entry repeatedly on the notify_override_records list. - Method_Change_Notification_Record *nr = _notify_override_records; - while (nr != NULL) { - if (nr->equals(jit_to_be_notified, callback_data)) { - return; - } - nr = nr->next; - } - - // Insert a new notification record. - Method_Change_Notification_Record *new_nr = - (Method_Change_Notification_Record *)STD_MALLOC(sizeof(Method_Change_Notification_Record)); - new_nr->method_of_interest = this; - new_nr->jit = jit_to_be_notified; - new_nr->callback_data = callback_data; - new_nr->next = _notify_override_records; - _notify_override_records = new_nr; -} //Method::register_jit_overridden_method_callback - - -void Method::do_jit_overridden_method_callbacks(Method *overriding_method) -{ - Method_Change_Notification_Record *nr; - for (nr = _notify_override_records; nr != NULL; nr = nr->next) { - JIT *jit_to_be_notified = nr->jit; - Boolean code_was_modified = - jit_to_be_notified->overridden_method_callback(/*overridden_method*/ this, - /*new_method*/ overriding_method, - nr->callback_data); - if (code_was_modified) { -#ifdef _IPF_ - // 20030128 Is this flush_hw_cache() necessary? - CodeChunkInfo *jit_info; - for (jit_info = get_first_JIT_specific_info(); jit_info; jit_info = jit_info->_next) { - if (jit_info->get_jit() == jit_to_be_notified) { - flush_hw_cache((Byte *)jit_info->get_code_block_addr(), jit_info->get_code_block_size()); - } - } - sync_i_cache(); - do_mf(); -#endif //_IPF_ - } - } -} //Method::do_jit_overridden_method_callbacks - -// end support for JIT notification when methods are overridden -//////////////////////////////////////////////////////////////////// - - - - -//////////////////////////////////////////////////////////////////// // begin support for JIT notification when methods are recompiled // Notify the given JIT whenever this method is recompiled or initially compiled. Index: vm/vmcore/src/class_support/type.cpp =================================================================== --- vm/vmcore/src/class_support/type.cpp (revision 639193) +++ vm/vmcore/src/class_support/type.cpp (working copy) @@ -30,6 +30,8 @@ #include "environment.h" #include "lock_manager.h" #include "open/types.h" +#include "open/vm_class_loading.h" +#include "open/vm_class_info.h" #include "open/vm_util.h" #include "type.h" #include "open/vm.h" Index: vm/vmcore/src/class_support/classloader.cpp =================================================================== --- vm/vmcore/src/class_support/classloader.cpp (revision 639193) +++ vm/vmcore/src/class_support/classloader.cpp (working copy) @@ -25,6 +25,8 @@ #include +#include "open/vm_class_loading.h" +#include "jit_import_rt.h" #include "classloader.h" #include "object_layout.h" #include "String_Pool.h" @@ -1645,7 +1647,7 @@ STD_FREE(vmboot); // check if vm.bootclasspath.appendclasspath property is set to true - if( TRUE == get_boolean_property("vm.bootclasspath.appendclasspath", FALSE, VM_PROPERTIES) ) { + if( TRUE == vm_property_get_bool("vm.bootclasspath.appendclasspath", FALSE, VM_PROPERTIES) ) { // append classpath to bootclasspath char * cp = m_env->JavaProperties()->get("java.class.path"); SetClasspathFromString(cp, tmp_pool); @@ -2122,7 +2124,7 @@ // get class and class loader of a given method Class_Handle klass = method_get_class( method ); - ClassLoader *loader = (ClassLoader*)class_get_class_loader( klass ); + ClassLoader *loader = klass->get_class_loader(); return loader->LookupNative( method ); } Index: vm/vmcore/src/init/finalize.cpp =================================================================== --- vm/vmcore/src/init/finalize.cpp (revision 639193) +++ vm/vmcore/src/init/finalize.cpp (working copy) @@ -37,7 +37,8 @@ #include "nogc.h" #include "jit_runtime_support.h" #include "finalize.h" - +#include "vtable.h" +#include "jit_import_rt.h" #include "finalizer_thread.h" /* added for NATIVE FINALIZER THREAD */ #include "ref_enqueue_thread.h" /* added for NATIVE REFERENCE ENQUEUE THREAD */ @@ -47,7 +48,7 @@ #undef LOG_DOMAIN #include "cxxlog.h" - +#include "vm_log.h" #include "thread_generic.h" #ifndef USE_GC_STATIC @@ -506,7 +507,7 @@ VM_Global_State::loader_env->VoidVoidDescriptor_String); assert(finalize); - TRACE2("finalize", "finalize object " << class_get_name(handle->object->vt()->clss)); + TRACE2("finalize", "finalize object " << handle->object->vt()->clss); vm_execute_java_method_array( (jmethodID) finalize, 0, args); tmn_suspend_enable(); @@ -517,7 +518,7 @@ INFO2("finalize", "Uncaught exception " << exn_get_name() << " while running a finalize of the object" - << class_get_name(object->vt()->clss) << "."); + << object->vt()->clss << "."); tmn_suspend_enable(); } #endif @@ -574,7 +575,7 @@ INFO2("ref", "Uncaught exception " << exn_get_name() << " while running a enqueue method of the object" - << class_get_name(object->vt()->clss) << "."); + << object->vt()->clss << "."); tmn_suspend_enable(); } Index: vm/vmcore/src/init/vm.cpp =================================================================== --- vm/vmcore/src/init/vm.cpp (revision 639193) +++ vm/vmcore/src/init/vm.cpp (working copy) @@ -15,9 +15,7 @@ * limitations under the License. */ -#include "Class.h" #include "environment.h" -#include "compile.h" #include "object_layout.h" @@ -26,24 +24,3 @@ // tag pointer is not allocated by default, enabled by TI VMEXPORT bool ManagedObject::_tag_pointer = false; - -///////////////////////////////////////////////////////////////// -// begin Class -///////////////////////////////////////////////////////////////// - - -Field* class_resolve_nonstatic_field(Class* clss, unsigned cp_index) -{ - Compilation_Handle ch; - ch.env = VM_Global_State::loader_env; - ch.jit = NULL; - Field_Handle fh = resolve_field(&ch, (Class_Handle)clss, cp_index); - if(!fh || field_is_static(fh)) - return NULL; - return fh; -} // class_resolve_nonstatic_field - - -///////////////////////////////////////////////////////////////// -// end Class -///////////////////////////////////////////////////////////////// Index: vm/vmcore/src/init/vm_init.cpp =================================================================== --- vm/vmcore/src/init/vm_init.cpp (revision 639193) +++ vm/vmcore/src/init/vm_init.cpp (working copy) @@ -27,7 +27,7 @@ #include "open/gc.h" #include "open/hythread_ext.h" #include "open/jthread.h" // this is for jthread_self() - +#include "vtable.h" #include "init.h" #include "classloader.h" #include "jni_utils.h" @@ -135,7 +135,7 @@ } extern "C" VMEXPORT -void* get_vm_interface(const char* func_name){ +void* vm_get_interface(const char* func_name){ static apr_dso_handle_t* descriptor = get_harmonyvm_handle(); void* p_func = NULL; int ret = apr_dso_sym((apr_dso_handle_sym_t*) &p_func, descriptor, func_name); @@ -146,18 +146,6 @@ if (p_func) { return p_func; - } else if (strcmp(func_name,"class_is_support_fast_instanceof") == 0) { - return (void*)class_get_fast_instanceof_flag; - } else if (strcmp(func_name,"class_is_final") == 0) { - return (void*)class_is_final; - } else if (strcmp(func_name,"class_is_throwable") == 0) { - return (void*)class_hint_is_exceptiontype; - } else if (strcmp(func_name,"class_is_abstract") == 0) { - return (void*)class_is_abstract; - } else if (strcmp(func_name,"field_get_type_info") == 0) { - return (void*)field_get_type_info_of_field_value; - } else if (strcmp(func_name,"method_get_overridden_method") == 0) { - return (void*)method_find_overridden_method; } else if (strcmp(func_name,"vector_get_first_element_offset") == 0) { return (void*)vector_first_element_offset_class_handle; } else if (strcmp(func_name,"vector_get_length_offset") == 0) { @@ -172,32 +160,6 @@ return (void*)hythread_uses_fast_tls; } else if (strcmp(func_name,"vm_get_tls_offset_in_segment") == 0) { return (void*)hythread_get_hythread_offset_in_tls; - } else if (strcmp(func_name,"vm_get_system_object_class") == 0) { - return (void*)get_system_object_class; - } else if (strcmp(func_name,"vm_get_system_class_class") == 0) { - return (void*)get_system_class_class; - } else if (strcmp(func_name,"vm_get_system_string_class") == 0) { - return (void*)get_system_string_class; - } else if (strcmp(func_name,"vm_get_heap_base_address") == 0) { - return (void*)vm_heap_base_address; - } else if (strcmp(func_name,"vm_get_heap_ceiling_address") == 0) { - return (void*)vm_heap_ceiling_address; - } else if (strcmp(func_name,"vm_is_heap_compressed") == 0) { - return (void*)vm_references_are_compressed; - } else if (strcmp(func_name,"vm_is_vtable_compressed") == 0) { - return (void*)vm_vtable_pointers_are_compressed; - } else if (strcmp(func_name,"vm_compiled_method_load") == 0) { - return (void*)compiled_method_load; - } else if (strcmp(func_name,"vm_properties_destroy_keys") == 0) { - return (void*)destroy_properties_keys; - } else if (strcmp(func_name,"vm_properties_destroy_value") == 0) { - return (void*)destroy_property_value; - } else if (strcmp(func_name,"vm_properties_get_keys") == 0) { - return (void*)get_properties_keys; - } else if (strcmp(func_name,"vm_properties_get_keys_starting_with") == 0) { - return (void*)get_properties_keys_staring_with; - } else if (strcmp(func_name,"vm_properties_get_value") == 0) { - return (void*)get_property; } else { return NULL; } @@ -291,8 +253,8 @@ return JNI_OK; } - int64 ms = get_numerical_property("gc.ms", 0, VM_PROPERTIES); - int64 mx = get_numerical_property("gc.mx", 0, VM_PROPERTIES); + int64 ms = vm_property_get_number("gc.ms", 0, VM_PROPERTIES); + int64 mx = vm_property_get_number("gc.mx", 0, VM_PROPERTIES); // Currently 4Gb is maximum for compressed mode // If GC cannot allocate heap up to 4Gb, gc_init() will fail int64 max_size = ((int64)4096)*1024*1024; @@ -306,7 +268,7 @@ #elif defined(REFS_USE_RUNTIME_SWITCH) if (ms >= max_size || mx >= max_size) { // Large heap; use uncompressed references - set_property("vm.compress_references", "false", VM_PROPERTIES); + vm_property_set("vm.compress_references", "false", VM_PROPERTIES); vm_env->compress_references = false; return JNI_OK; } @@ -346,7 +308,7 @@ */ static jint check_compression() { // Check for a mismatch between whether the various VM components all compress references or not. - Boolean vm_compression = vm_references_are_compressed(); + Boolean vm_compression = vm_is_heap_compressed(); Boolean gc_compression = gc_supports_compressed_references(); if (vm_compression) { if (!gc_compression) { @@ -830,20 +792,20 @@ return JNI_ERR; } - tm_properties->use_soft_unreservation = get_boolean_property("thread.soft_unreservation", FALSE, VM_PROPERTIES); + tm_properties->use_soft_unreservation = vm_property_get_bool("thread.soft_unreservation", FALSE, VM_PROPERTIES); parse_vm_arguments2(vm_env); - vm_env->verify = get_boolean_property("vm.use_verifier", TRUE, VM_PROPERTIES); + vm_env->verify = vm_property_get_bool("vm.use_verifier", TRUE, VM_PROPERTIES); #ifdef REFS_USE_RUNTIME_SWITCH - vm_env->compress_references = get_boolean_property("vm.compress_references", TRUE, VM_PROPERTIES); + vm_env->compress_references = vm_property_get_bool("vm.compress_references", TRUE, VM_PROPERTIES); #endif // use platform default values for field sorting and field compaction // if these values are not specifed on command line // see Global_Env::Global_Env for defaults - vm_env->sort_fields = get_boolean_property("vm.sort_fields", vm_env->sort_fields, VM_PROPERTIES); - vm_env->compact_fields = get_boolean_property("vm.compact_fields", vm_env->compact_fields, VM_PROPERTIES); - vm_env->use_common_jar_cache = get_boolean_property("vm.common_jar_cache", TRUE, VM_PROPERTIES); + vm_env->sort_fields = vm_property_get_bool("vm.sort_fields", vm_env->sort_fields, VM_PROPERTIES); + vm_env->compact_fields = vm_property_get_bool("vm.compact_fields", vm_env->compact_fields, VM_PROPERTIES); + vm_env->use_common_jar_cache = vm_property_get_bool("vm.common_jar_cache", TRUE, VM_PROPERTIES); vm_env->init_pools(); @@ -860,7 +822,7 @@ parse_jit_arguments(&vm_env->vm_arguments); vm_env->pin_interned_strings = - (bool)get_boolean_property("vm.pin_interned_strings", FALSE, VM_PROPERTIES); + (bool)vm_property_get_bool("vm.pin_interned_strings", FALSE, VM_PROPERTIES); initialize_verify_stack_enumeration(); @@ -883,7 +845,7 @@ // compressed references, so it never answers "true" to supports_compressed_references(). // ppervov: this check is not correct since a call to // gc_supports_compressed_references returns capability while a call to - // vm_references_are_compressed returns current VM state, not potential + // vm_is_heap_compressed returns current VM state, not potential // ability to support compressed mode // So, this check is turned off for now and it is FIXME // 20071109 process_compression_modes() now automatically selects compression @@ -1061,7 +1023,7 @@ hythread_suspend_enable(); - if (get_boolean_property("vm.finalize", TRUE, VM_PROPERTIES)) { + if (vm_property_get_bool("vm.finalize", TRUE, VM_PROPERTIES)) { // Load and initialize finalizer thread. vm_env->java_lang_FinalizerThread_Class = preload_class(vm_env, "java/lang/FinalizerThread"); Index: vm/vmcore/src/interpreter/interp_exports.cpp =================================================================== --- vm/vmcore/src/interpreter/interp_exports.cpp (revision 639193) +++ vm/vmcore/src/interpreter/interp_exports.cpp (working copy) @@ -40,7 +40,7 @@ static bool val; if (!inited) { val = interp_enabled && - get_boolean_property("vm.use_interpreter", FALSE, VM_PROPERTIES); + vm_property_get_bool("vm.use_interpreter", FALSE, VM_PROPERTIES); inited = true; INFO2("init", "Use interpreter = " << val); } Index: vm/vmcore/src/stack/stack_trace.cpp =================================================================== --- vm/vmcore/src/stack/stack_trace.cpp (revision 639193) +++ vm/vmcore/src/stack/stack_trace.cpp (working copy) @@ -22,6 +22,7 @@ #define LOG_DOMAIN "vm.stack" #include "cxxlog.h" #include "vm_log.h" +#include "open/vm_class_info.h" #include "m2n.h" #include "stack_iterator.h" Index: vm/vmcore/src/object/vm_arrays.cpp =================================================================== --- vm/vmcore/src/object/vm_arrays.cpp (revision 639193) +++ vm/vmcore/src/object/vm_arrays.cpp (working copy) @@ -26,6 +26,7 @@ #include +#include "vtable.h" #include "environment.h" #include "exceptions.h" #include "object_handles.h" Index: vm/vmcore/src/object/object_handles.cpp =================================================================== --- vm/vmcore/src/object/object_handles.cpp (revision 639193) +++ vm/vmcore/src/object/object_handles.cpp (working copy) @@ -24,6 +24,7 @@ #include +#include "jit_import_rt.h" #include "environment.h" #include "exceptions.h" #include "open/gc.h" @@ -86,8 +87,8 @@ void GcFrame::add_object(ManagedObject** p) { assert(p); - assert(NULL == *p || (*p >= vm_heap_base_address() - && *p < vm_heap_ceiling_address())); + assert(NULL == *p || (*p >= vm_get_heap_base_address() + && *p < vm_get_heap_ceiling_address())); assert(!hythread_is_suspend_enabled()); ensure_capacity(); Index: vm/vmcore/src/thread/verify_stack_enumeration.cpp =================================================================== --- vm/vmcore/src/thread/verify_stack_enumeration.cpp (revision 639193) +++ vm/vmcore/src/thread/verify_stack_enumeration.cpp (working copy) @@ -209,15 +209,15 @@ void initialize_verify_stack_enumeration() { - verify_stack_enumeration_flag = get_boolean_property("verify.rse", false, VM_PROPERTIES); + verify_stack_enumeration_flag = vm_property_get_bool("verify.rse", false, VM_PROPERTIES); if (verify_stack_enumeration_flag) { INFO("verify stack enumeration mode"); - int n = get_int_property("verify.rse.after", 0, VM_PROPERTIES); + int n = vm_property_get_int("verify.rse.after", 0, VM_PROPERTIES); if (n > 0) verify_stack_enumeration_counter = n; INFO(">verify after " << verify_stack_enumeration_counter); - n = get_int_property("verify.rse.period", 0, VM_PROPERTIES); + n = vm_property_get_int("verify.rse.period", 0, VM_PROPERTIES); if (n > 0) verify_stack_enumeration_period = n; INFO(">verify each " << verify_stack_enumeration_period << num_suffix(verify_stack_enumeration_period) << " iteration"); Index: vm/vmcore/src/thread/thread_manager.cpp =================================================================== --- vm/vmcore/src/thread/thread_manager.cpp (revision 639193) +++ vm/vmcore/src/thread/thread_manager.cpp (working copy) @@ -39,7 +39,7 @@ #include "exceptions.h" #include "Class.h" #include "environment.h" - +#include "vtable.h" #include "open/vm_util.h" #include "nogc.h" #include "sync_bits.h" Index: vm/vmcore/src/thread/thread_java_basic.cpp =================================================================== --- vm/vmcore/src/thread/thread_java_basic.cpp (revision 639193) +++ vm/vmcore/src/thread/thread_java_basic.cpp (working copy) @@ -240,7 +240,7 @@ static size_t default_stacksize; if (0 == default_stacksize) { - size_t stack_size = get_size_property("thread.stacksize", 0, VM_PROPERTIES); + size_t stack_size = vm_property_get_size("thread.stacksize", 0, VM_PROPERTIES); default_stacksize = stack_size ? stack_size : TM_DEFAULT_STACKSIZE; } Index: vm/vmcore/src/ncai/ncai_step.cpp =================================================================== --- vm/vmcore/src/ncai/ncai_step.cpp (revision 639193) +++ vm/vmcore/src/ncai/ncai_step.cpp (working copy) @@ -530,7 +530,7 @@ } Class_Handle klass = method_get_class((Method_Handle)m); - ClassLoader* loader = (ClassLoader*)class_get_class_loader(klass); + ClassLoader* loader = klass->get_class_loader(); GenericFunctionPointer func = loader->LookupNative((Method_Handle)m); assert(func); Index: vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp =================================================================== --- vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp (revision 639193) +++ vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp (working copy) @@ -610,13 +610,3 @@ lil_free_code_stub(cs); return addr; } - - -Boolean jit_may_inline_object_synchronization(unsigned * UNREF thread_id_register, - unsigned * UNREF sync_header_offset, - unsigned * UNREF sync_header_width, - unsigned * UNREF lock_owner_offset, - unsigned * UNREF lock_owner_width, - Boolean * UNREF jit_clears_ccv) { - return FALSE; -} Index: vm/vmcore/src/util/em64t/base/compile_em64t.cpp =================================================================== --- vm/vmcore/src/util/em64t/base/compile_em64t.cpp (revision 639193) +++ vm/vmcore/src/util/em64t/base/compile_em64t.cpp (working copy) @@ -20,6 +20,7 @@ */ #include "open/types.h" +#include "open/vm_class_info.h" #include "open/vm_type_access.h" #include "open/vm_util.h" #include "environment.h" Index: vm/vmcore/src/util/vm_stats.cpp =================================================================== --- vm/vmcore/src/util/vm_stats.cpp (revision 639193) +++ vm/vmcore/src/util/vm_stats.cpp (working copy) @@ -24,6 +24,7 @@ #define LOG_DOMAIN "vm.stats" #include "cxxlog.h" +#include "vtable.h" #include "environment.h" #include "open/vm_util.h" #include "jit_runtime_support.h" Index: vm/vmcore/src/util/crash_dump.cpp =================================================================== --- vm/vmcore/src/util/crash_dump.cpp (revision 639193) +++ vm/vmcore/src/util/crash_dump.cpp (working copy) @@ -308,10 +308,10 @@ #ifdef PLATFORM_POSIX bool call_dbg = (VM_Global_State::loader_env == NULL) || - get_boolean_property("vm.crash_handler", FALSE, VM_PROPERTIES); + vm_property_get_bool("vm.crash_handler", FALSE, VM_PROPERTIES); #else // WIN bool call_dbg = (VM_Global_State::loader_env == NULL) || - get_boolean_property("vm.assert_dialog", TRUE, VM_PROPERTIES); + vm_property_get_bool("vm.assert_dialog", TRUE, VM_PROPERTIES); #endif if (!call_dbg) flags &= ~PORT_CRASH_CALL_DEBUGGER; Index: vm/vmcore/src/util/mem_alloc.cpp =================================================================== --- vm/vmcore/src/util/mem_alloc.cpp (revision 639193) +++ vm/vmcore/src/util/mem_alloc.cpp (working copy) @@ -31,7 +31,7 @@ #include "environment.h" #include "nogc.h" -#include "open/vm.h" // for the declaration of vm_get_vtable_base() +#include "open/vm.h" // for the declaration of vm_get_vtable_base_address() #include "mem_alloc.h" #include "vm_stats.h" #include "port_malloc.h" @@ -237,11 +237,11 @@ return p; } -POINTER_SIZE_INT vm_get_vtable_base() +void* vm_get_vtable_base_address() { // Subtract a small number (like 1) from the real base so that // no valid vtable offsets will ever be 0. assert (VM_Global_State::loader_env->VTableMemoryManager); assert (VM_Global_State::loader_env->VTableMemoryManager->get_pool_base()); - return (POINTER_SIZE_INT) (VM_Global_State::loader_env->VTableMemoryManager->get_pool_base() - 8); -} //vm_get_vtable_base + return (void*) (VM_Global_State::loader_env->VTableMemoryManager->get_pool_base() - 8); +} //vm_get_vtable_base_address Index: vm/vmcore/src/util/ia32/base/optimize_ia32.cpp =================================================================== --- vm/vmcore/src/util/ia32/base/optimize_ia32.cpp (revision 639193) +++ vm/vmcore/src/util/ia32/base/optimize_ia32.cpp (working copy) @@ -31,11 +31,12 @@ #include "cxxlog.h" #include "open/types.h" +#include "open/vm_ee.h" #include "environment.h" #include "encoder.h" #include "open/vm_util.h" #include "compile.h" - +#include "vtable.h" // *** This is for readInternal override #include "jni_utils.h" #include "vm_arrays.h" Index: vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp =================================================================== --- vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp (revision 639193) +++ vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp (working copy) @@ -37,6 +37,7 @@ #include "encoder.h" #include "vm_arrays.h" #include "compile.h" +#include "vtable.h" #ifdef PLATFORM_POSIX Index: vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp =================================================================== --- vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp (revision 639193) +++ vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp (working copy) @@ -29,8 +29,9 @@ #include "open/types.h" #include "open/gc.h" +#include "open/vm_class_info.h" #include "open/vm_util.h" - +#include "vtable.h" #include "environment.h" #include "Class.h" #include "object_layout.h" Index: vm/vmcore/src/util/ia32/base/compile_IA32.cpp =================================================================== --- vm/vmcore/src/util/ia32/base/compile_IA32.cpp (revision 639193) +++ vm/vmcore/src/util/ia32/base/compile_IA32.cpp (working copy) @@ -34,7 +34,7 @@ #include "lock_manager.h" #include "open/types.h" #include "open/vm_type_access.h" - +#include "open/vm_class_info.h" #include "Class.h" #include "type.h" #include "environment.h" Index: vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp =================================================================== --- vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp (revision 639193) +++ vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp (working copy) @@ -410,12 +410,3 @@ return addr; } //getaddress__vm_monitor_exit_static_naked -Boolean jit_may_inline_object_synchronization(unsigned * UNREF thread_id_register, - unsigned * UNREF sync_header_offset, - unsigned * UNREF sync_header_width, - unsigned * UNREF lock_owner_offset, - unsigned * UNREF lock_owner_width, - Boolean * UNREF jit_clears_ccv) -{ - return FALSE; -} Index: vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp =================================================================== --- vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp (revision 639193) +++ vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp (working copy) @@ -690,11 +690,11 @@ // sc6 = super_class->get_offset_of_depth() // sc4 = offset(superclasses) - 8 emitter.ipf_adds(sc1, offset_is_suitable, super_class); - if (vm_vtable_pointers_are_compressed()) + if (vm_is_vtable_compressed()) { emitter.ipf_ld(int_mem_size_4, mem_ld_none, mem_none, sc3, sub_object); emitter.ipf_adds(sc6, offset_depth, super_class); - emit_mov_imm_compactor(emitter, sc4, offset_superclasses + vm_get_vtable_base()); + emit_mov_imm_compactor(emitter, sc4, offset_superclasses + vm_get_vtable_base_address()); } else { @@ -745,7 +745,7 @@ (void **)p_class_is_subtype, out0, save_pfs, save_b0, save_gp); // sc3 contains the vtable pointer or the vtable offset - emit_mov_imm_compactor(emitter, sc2, (vm_vtable_pointers_are_compressed() ? vm_get_vtable_base() : 0) + offset_clss); + emit_mov_imm_compactor(emitter, sc2, (vm_is_vtable_compressed() ? vm_get_vtable_base_address() : 0) + offset_clss); emitter.ipf_add(sc1, sc2, sc3); emitter.ipf_ld(int_mem_size_8, mem_ld_none, mem_none, out0+0, sc1); emitter.ipf_mov(out0+1, super_class); @@ -973,10 +973,10 @@ VTable *dummy_vtable = NULL; const int offset_clss = (int) ((Byte*)&dummy_vtable->clss - (Byte*)dummy_vtable); - if (vm_vtable_pointers_are_compressed()) + if (vm_is_vtable_compressed()) { emitter.ipf_ld(int_mem_size_4, mem_ld_none, mem_none, sc5, src); - emit_mov_imm_compactor(emitter, sc1, vm_get_vtable_base() + offset_clss); + emit_mov_imm_compactor(emitter, sc1, vm_get_vtable_base_address() + offset_clss); } else { @@ -1131,33 +1131,6 @@ - -Boolean jit_may_inline_object_synchronization(unsigned *thread_id_register, - unsigned *sync_header_offset, - unsigned *sync_header_width, - unsigned *lock_owner_offset, - unsigned *lock_owner_width, - Boolean *jit_clears_ccv) -{ - // FIXME: code outdated - assert(0); - abort(); -#if 0 - if (!vm_get_boolean_property_value_with_default("vm.jit_may_inline_sync")) - return FALSE; - - *thread_id_register = THREAD_ID_REG; - *sync_header_offset = ManagedObject::header_offset(); - *sync_header_width = 4; - *lock_owner_offset = ManagedObject::header_offset() + STACK_KEY_OFFSET; - *lock_owner_width = 2; - *jit_clears_ccv = jit_clears_ccv_in_monitor_enter(); - return TRUE; -#endif -} - - - static void gen_vm_rt_monitorenter_fast_path(Merced_Code_Emitter &emitter, bool check_null) { return; // ichebyki Index: vm/vmcore/src/util/ipf/base/compile_ipf.cpp =================================================================== --- vm/vmcore/src/util/ipf/base/compile_ipf.cpp (revision 639193) +++ vm/vmcore/src/util/ipf/base/compile_ipf.cpp (working copy) @@ -192,7 +192,7 @@ emitter.ipf_adds(SCRATCH_GENERAL_REG2, (int)offset_allocation_handle, SCRATCH_GENERAL_REG7, SCRATCH_PRED_REG3); emitter.ipf_ld(int_mem_size_8, mem_ld_none, mem_none, SCRATCH_GENERAL_REG3, SCRATCH_GENERAL_REG2, SCRATCH_PRED_REG3); - if (vm_vtable_pointers_are_compressed()) + if (vm_is_vtable_compressed()) { emitter.ipf_st(int_mem_size_4, mem_st_none, mem_none, RETURN_VALUE_REG, SCRATCH_GENERAL_REG3, SCRATCH_PRED_REG3); } @@ -340,7 +340,7 @@ unsigned num_fields = class_num_instance_fields_recursive(c); for(unsigned i=0; i isInstanceInitializer; FilterAttr isStrict; FilterAttr isInitLocals; - FilterAttr isOverridden; StlMap operandFilters; - Filter() : isInitialized(false), isNegative(false), isOR(false), mnemonic(Mnemonic_NULL), operandNumber(-1), rtKind(Opnd::RuntimeInfo::Kind_Null), rtHelperID(VM_RT_UNKNOWN), rtIntHelperName("none"), isNative(false), isStatic(false), isSynchronized(false), isNoInlining(false), isInstance(false), isFinal(false), isVirtual(false), isAbstract(false), isClassInitializer(false), isInstanceInitializer(false), isStrict(false), isInitLocals(false), isOverridden(false), operandFilters(Jitrino::getGlobalMM()) {} + Filter() : isInitialized(false), isNegative(false), isOR(false), mnemonic(Mnemonic_NULL), operandNumber(-1), rtKind(Opnd::RuntimeInfo::Kind_Null), rtHelperID(VM_RT_UNKNOWN), rtIntHelperName("none"), isNative(false), isStatic(false), isSynchronized(false), isNoInlining(false), isInstance(false), isFinal(false), isVirtual(false), isAbstract(false), isClassInitializer(false), isInstanceInitializer(false), isStrict(false), isInitLocals(false), operandFilters(Jitrino::getGlobalMM()) {} Filter& operator=(const Filter& c) { Filter& f = *this; @@ -134,7 +133,6 @@ f.isInstanceInitializer = c.isInstanceInitializer; f.isStrict = c.isStrict; f.isInitLocals = c.isInitLocals; - f.isOverridden = c.isOverridden; for(StlMap::const_iterator it = c.operandFilters.begin(); it !=c.operandFilters.end(); it++) { f.operandFilters[it->first] = it->second; @@ -504,15 +502,6 @@ config->counters[num].filter.isInitLocals.value=(std::string(val) == "true")? true : false; config->counters[num].filter.isInitLocals.isInitialized=true; } - } else if ((int)line.find(".isOverridden") != -1) { - char * val = (char *)std::strstr(line.c_str(),"=")+1; - if ((std::string(val) == "true") && (std::strstr(line.c_str(), "IsNegative"))) { - config->counters[num].filter.isOverridden.isNegative=true; - } else { - config->counters[num].filter.isInitialized=true; - config->counters[num].filter.isOverridden.value=(std::string(val) == "true")? true : false; - config->counters[num].filter.isOverridden.isInitialized=true; - } } } else if (std::strstr(c_line, "[begin]") == c_line) { } else if (std::strstr(c_line, "[end]") == c_line) { @@ -960,19 +949,7 @@ if(!(filter.isOR || res)) return false; } - if(filter.isOverridden.isInitialized) { - if(!rt || ((rt->getKind() != Opnd::RuntimeInfo::Kind_MethodDirectAddr) && (rt->getKind() != Opnd::RuntimeInfo::Kind_MethodDirectAddr))) - return false; - res = filter.isOverridden.value == ((MethodDesc *)rt->getValue(0))->isOverridden(); - if(filter.isOverridden.isNegative) - res = !res; - if(filter.isOR && res) - return true; - if(!(filter.isOR || res)) - return false; - } - return filter.isOR ? false : true; } Index: vm/jitrino/src/jet/cg_meth.cpp =================================================================== --- vm/jitrino/src/jet/cg_meth.cpp (revision 639193) +++ vm/jitrino/src/jet/cg_meth.cpp (working copy) @@ -29,7 +29,8 @@ #include #include -#include +//#include +#include "open/vm_ee.h" #if !defined(_IPF_) #include "enc_ia32.h" @@ -863,7 +864,7 @@ stackFix = gen_stack_to_args(true, cs, 0); vpark(); gen_gc_stack(-1, true); - unsigned offset = method_get_offset(meth); + unsigned offset = method_get_vtable_offset(meth); //ld(jobj, gr_ret, m_base, voff(m_stack.scratch())); runlock(gr_ret); ld(jobj, gr_ret, gr_ret, offset); @@ -871,7 +872,7 @@ } else if (opcod == OPCODE_INVOKEVIRTUAL) { AR gr = valloc(jobj); - unsigned offset = method_get_offset(meth); + unsigned offset = method_get_vtable_offset(meth); Opnd ptr; if (g_vtbl_squeeze) { ld4(gr, thiz.reg(), rt_vtable_offset); Index: vm/jitrino/src/jet/bcproc.cpp =================================================================== --- vm/jitrino/src/jet/bcproc.cpp (revision 639193) +++ vm/jitrino/src/jet/bcproc.cpp (working copy) @@ -23,8 +23,10 @@ #include "stats.h" #include "open/vm_class_info.h" +#include "open/vm_class_loading.h" #include "jit_import.h" -#include "jit_intf.h" +//#include "jit_intf.h" +#include "open/vm_ee.h" /** * @file @@ -403,7 +405,7 @@ jinst.op0); if (meth != NULL) { Class_Handle klass = method_get_class(meth); - if (class_needs_initialization(klass)) { + if (!class_is_initialized(klass)) { gen_call_vm(ci_helper_o, rt_helper_init_class, 0, klass); } } Index: vm/jitrino/src/jet/cg_instr.cpp =================================================================== --- vm/jitrino/src/jet/cg_instr.cpp (revision 639193) +++ vm/jitrino/src/jet/cg_instr.cpp (working copy) @@ -27,6 +27,8 @@ #include "trace.h" #include "jit_runtime_support.h" #include "jit_intf.h" +#include "open/vm_ee.h" +#include "open/vm_class_loading.h" namespace Jitrino { namespace Jet { @@ -384,8 +386,7 @@ static char* wbMethAddr = NULL; if (doGenWB4J && NULL == wbMethAddr) { - wbKlass = class_load_class_by_name(wbKlassName, m_klass); - //class_find_class_from_loader(NULL, wbKlassName, true); + wbKlass = class_load_boot_class(wbKlassName); if (wbKlass != NULL) { wbMeth = class_lookup_method_recursively(wbKlass, wbMethName, wbMethSig); } Index: vm/jitrino/src/jet/compiler.cpp =================================================================== --- vm/jitrino/src/jet/compiler.cpp (revision 639193) +++ vm/jitrino/src/jet/compiler.cpp (working copy) @@ -30,9 +30,11 @@ #endif #include "open/vm_class_info.h" +#include "open/vm_class_loading.h" #include "open/vm.h" #include "open/hythread_ext.h" #include "open/vm_type_access.h" +#include "open/vm_ee.h" #include "jit_import.h" #include "jit_runtime_support.h" #include "jit_intf.h" @@ -355,7 +357,7 @@ // We need to report 'this' additionally for the following cases: // - non-static sync methods - to allow VM to call monitor_exit() for // abrupt exit - // - constructors of classes with class_hint_is_exceptiontype == true + // - constructors of classes with class_is_throwable == true // to allow correct handling of stack trace in VM (see // stack_trace.cpp + com_openintel_drl_vm_VMStack.cpp: // Java_com_openintel_drl_vm_VMStack_getStackState. @@ -1470,13 +1472,13 @@ rt_helper_new = (char*)vm_helper_get_addr(VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE); - g_refs_squeeze = vm_references_are_compressed(); - g_vtbl_squeeze = vm_vtable_pointers_are_compressed(); - OBJ_BASE = (const char*)vm_heap_base_address(); - VTBL_BASE = (const char*)vm_get_vtable_base(); + g_refs_squeeze = vm_is_heap_compressed(); + g_vtbl_squeeze = vm_is_vtable_compressed(); + OBJ_BASE = (const char*)vm_get_heap_base_address(); + VTBL_BASE = (const char*)vm_get_vtable_base_address(); NULL_REF = g_refs_squeeze ? OBJ_BASE : NULL; - g_jvmtiMode = (bool)get_boolean_property("vm.jvmti.enabled", false, VM_PROPERTIES); + g_jvmtiMode = (bool)vm_property_get_bool("vm.jvmti.enabled", false, VM_PROPERTIES); rt_helper_monitor_enter = (char*)vm_helper_get_addr(VM_RT_MONITOR_ENTER); Index: vm/jitrino/src/jet/structs.h =================================================================== --- vm/jitrino/src/jet/structs.h (revision 639193) +++ vm/jitrino/src/jet/structs.h (working copy) @@ -32,6 +32,7 @@ #include "jdefs.h" #include "jframe.h" +#include "open/vm_class_info.h" #include "open/vm.h" #include "jit_import.h" @@ -572,7 +573,7 @@ /** Tests whether the method is constructor of Exception. */ bool meth_is_exc_ctor(void) { - return class_hint_is_exceptiontype(m_klass) && meth_is_ctor(); + return class_is_throwable(m_klass) && meth_is_ctor(); } protected: Index: vm/jitrino/src/jet/cg_fld_arr.cpp =================================================================== --- vm/jitrino/src/jet/cg_fld_arr.cpp (revision 639193) +++ vm/jitrino/src/jet/cg_fld_arr.cpp (working copy) @@ -27,7 +27,8 @@ #include "cg.h" #include #include -#include +//#include +#include "open/vm_ee.h" #include "trace.h" #include "VMMagic.h" @@ -217,7 +218,7 @@ if (fld != NULL) { Class_Handle klass = field_get_class(fld); assert(klass); - if (klass != m_klass && class_needs_initialization(klass)) { + if (klass != m_klass && !class_is_initialized(klass)) { gen_call_vm(ci_helper_o, rt_helper_init_class, 0, klass); } fieldOp.fld = fld; Index: vm/jitrino/src/jet/jet.cpp =================================================================== --- vm/jitrino/src/jet/jet.cpp (revision 639193) +++ vm/jitrino/src/jet/jet.cpp (working copy) @@ -828,24 +828,6 @@ return FALSE; } -extern "C" JITEXPORT -Boolean JIT_extended_class_callback(JIT_Handle jit, - Class_Handle extended_class, - Class_Handle new_class, - void *callback_data) -{ - return FALSE; -} - -extern "C" JITEXPORT -Boolean JIT_overridden_method_callback(JIT_Handle jit, - Method_Handle overridden_method, - Method_Handle new_method, - void *callback_data) -{ - return FALSE; -} - /** * @see rt_unwind */ Index: vm/jitrino/src/jet/cg_obj.cpp =================================================================== --- vm/jitrino/src/jet/cg_obj.cpp (revision 639193) +++ vm/jitrino/src/jet/cg_obj.cpp (working copy) @@ -29,8 +29,10 @@ #include #include "open/vm_class_info.h" +#include "open/vm_class_loading.h" +#include "open/vm_ee.h" #include "jit_import.h" -#include "jit_intf.h" +//#include "jit_intf.h" /** * @file @@ -170,10 +172,10 @@ if (klass == NULL) { gen_call_throw(ci_helper_linkerr, rt_helper_throw_linking_exc, 0, enclClass, cpIndex, OPCODE_NEW); } else { - if ( klass!=enclClass && class_needs_initialization(klass)) { + if ( klass!=enclClass && !class_is_initialized(klass)) { gen_call_vm(ci_helper_o, rt_helper_init_class, 0, klass); } - unsigned size = class_get_boxed_data_size(klass); + unsigned size = class_get_object_size(klass); Allocation_Handle ah = class_get_allocation_handle(klass); gen_call_vm(ci_new, rt_helper_new, 0, size, ah); } Index: vm/jitrino/src/jet/rt.cpp =================================================================== --- vm/jitrino/src/jet/rt.cpp (revision 639193) +++ vm/jitrino/src/jet/rt.cpp (working copy) @@ -28,7 +28,8 @@ #include "jet.h" -#include "jit_intf.h" +#include "jit_import_rt.h" +#include "open/vm_ee.h" #include "port_threadunsafe.h" #include "EMInterface.h" Index: vm/jitrino/src/jet/trace.cpp =================================================================== --- vm/jitrino/src/jet/trace.cpp (revision 639193) +++ vm/jitrino/src/jet/trace.cpp (working copy) @@ -28,6 +28,7 @@ #include "../shared/mkernel.h" #include "open/vm_class_info.h" +#include "open/vm_ee.h" #include "jit_intf.h" #ifdef _WIN32 Index: vm/jitrino/src/optimizer/escanalyzer.cpp =================================================================== --- vm/jitrino/src/optimizer/escanalyzer.cpp (revision 639193) +++ vm/jitrino/src/optimizer/escanalyzer.cpp (working copy) @@ -5829,7 +5829,6 @@ Log::out() << " isVirtual: " << mdesc->isVirtual() << std::endl; Log::out() << " isAbstract: " << mdesc->isAbstract() << std::endl; Log::out() << " isInstanceInitializer: " << mdesc->isInstanceInitializer() << std::endl; - Log::out() << " isOverridden: " << mdesc->isOverridden() << std::endl; } static bool isVMHelperCall(Inst* inst, VM_RT_SUPPORT id) { Index: vm/jitrino/src/vm/VMInterface.cpp =================================================================== --- vm/jitrino/src/vm/VMInterface.cpp (revision 639193) +++ vm/jitrino/src/vm/VMInterface.cpp (working copy) @@ -22,11 +22,18 @@ #include "mkernel.h" +typedef enum { + VM_PROPERTIES = 0, + JAVA_PROPERTIES = 1 +} PropertyTable; + #define DYNAMIC_OPEN #include "VMInterface.h" #include "open/vm_class_info.h" +#include "open/vm_class_loading.h" #include "open/vm_interface.h" #include "open/vm_type_access.h" +#include "open/vm_ee.h" #include "jit_import_rt.h" #include "jit_runtime_support.h" @@ -50,13 +57,13 @@ static class_get_array_element_class_t class_get_array_element_class = 0; static class_get_array_element_size_t class_get_array_element_size = 0; static class_get_array_of_class_t class_get_array_of_class = 0; -static class_get_element_type_info_t class_get_element_type_info = 0; +static class_is_non_ref_array_t class_is_non_ref_array = 0; static class_get_name_t class_get_name = 0; static class_get_super_class_t class_get_super_class = 0; static class_get_depth_t class_get_depth = 0; static class_get_vtable_t class_get_vtable = 0; static class_get_allocation_handle_t class_get_allocation_handle = 0; -static class_get_boxed_data_size_t class_get_boxed_data_size = 0; +static class_get_object_size_t class_get_object_size = 0; static class_cp_get_num_array_dimensions_t class_cp_get_num_array_dimensions = 0; static class_get_class_of_primitive_type_t class_get_class_of_primitive_type = 0; static class_get_const_string_intern_addr_t class_get_const_string_intern_addr = 0; @@ -69,16 +76,16 @@ static class_is_array_t class_is_array = 0; static class_is_enum_t class_is_enum = 0; static class_is_final_t class_is_final = 0; //class_is_final -static class_is_throwable_t class_is_throwable = 0; //class_hint_is_exceptiontype +static class_is_throwable_t class_is_throwable = 0; //class_is_throwable static class_is_interface_t class_is_interface = 0; //class_is_interface2 static class_is_abstract_t class_is_abstract = 0; //class_is_abstract static class_is_initialized_t class_is_initialized = 0; //class_needs_initialization && class_is_initialized() static class_is_finalizable_t class_is_finalizable = 0; static class_is_instanceof_t class_is_instanceof = 0; -static class_is_support_fast_instanceof_t class_is_support_fast_instanceof = 0;// class_get_fast_instanceof_flag +static class_is_support_fast_instanceof_t class_is_support_fast_instanceof = 0;// class_is_support_fast_instanceof static class_is_primitive_t class_is_primitive = 0; -static class_lookup_class_by_name_using_bootstrap_class_loader_t class_lookup_class_by_name_using_bootstrap_class_loader = 0; +static class_lookup_boot_class_t class_lookup_boot_class = 0; static class_lookup_method_recursively_t class_lookup_method_recursively = 0; // Const Pool @@ -97,7 +104,7 @@ static field_get_descriptor_t field_get_descriptor = 0; static field_get_name_t field_get_name = 0; static field_get_offset_t field_get_offset = 0; -static field_get_type_info_t field_get_type_info = 0; //field_get_type_info_of_field_value +static field_get_type_info_t field_get_type_info = 0; //field_get_type_info static field_is_final_t field_is_final = 0; static field_is_magic_t field_is_magic = 0; //Boolean field_is_magic(Field_Handle fh); static field_is_private_t field_is_private = 0; @@ -106,7 +113,7 @@ //Method -static method_get_overridden_method_t method_get_overridden_method = 0;//method_find_overridden_method +static class_get_overridden_method_t class_get_overridden_method = 0;//class_get_overridden_method static method_get_info_block_jit_t method_get_info_block_jit = 0; static method_get_info_block_size_jit_t method_get_info_block_size_jit = 0; static method_get_name_t method_get_name = 0; @@ -115,7 +122,7 @@ static method_get_byte_code_size_t method_get_byte_code_size = 0; static method_get_max_stack_t method_get_max_stack = 0; static method_get_num_handlers_t method_get_num_handlers = 0; -static method_get_offset_t method_get_offset = 0; +static method_get_vtable_offset_t method_get_vtable_offset = 0; static method_get_indirect_address_t method_get_indirect_address = 0; static method_get_native_func_addr_t method_get_native_func_addr = 0; static method_vars_get_number_t method_vars_get_number = 0; @@ -137,7 +144,6 @@ static method_is_final_t method_is_final = 0; static method_is_abstract_t method_is_abstract = 0; static method_is_strict_t method_is_strict = 0; -static method_is_overridden_t method_is_overridden = 0; static method_is_no_inlining_t method_is_no_inlining = 0; @@ -194,25 +200,23 @@ static vm_tls_is_fast_t vm_tls_is_fast = 0;//UDATA VMCALL hythread_uses_fast_tls static vm_get_tls_offset_in_segment_t vm_get_tls_offset_in_segment = 0;//IDATA VMCALL hythread_get_hythread_offset_in_tls(void) -static vm_properties_destroy_keys_t vm_properties_destroy_keys = 0;//void destroy_properties_keys(char** keys) -static vm_properties_destroy_value_t vm_properties_destroy_value = 0;//void destroy_property_value(char* value) -static vm_properties_get_keys_t vm_properties_get_keys = 0;//char** get_properties_keys(PropertyTable table_number); +static vm_properties_destroy_keys_t vm_properties_destroy_keys = 0;//void vm_properties_destroy_keys(char** keys) +static vm_properties_destroy_value_t vm_properties_destroy_value = 0;//void vm_properties_destroy_value(char* value) +static vm_properties_get_keys_t vm_properties_get_keys = 0;//char** vm_properties_get_keys(PropertyTable table_number); static vm_properties_get_keys_starting_with_t vm_properties_get_keys_starting_with = 0; -static vm_properties_get_value_t vm_properties_get_value = 0;//char* get_property(const char* key, PropertyTable table_number) +static vm_properties_get_value_t vm_properties_get_value = 0;//char* vm_properties_get_value(const char* key, PropertyTable table_number) -static vm_get_system_object_class_t vm_get_system_object_class = 0; // get_system_object_class -static vm_get_system_class_class_t vm_get_system_class_class = 0; // get_system_class_class -static vm_get_system_string_class_t vm_get_system_string_class = 0; // get_system_string_class -static vm_get_vtable_base_t vm_get_vtable_base = 0; //POINTER_SIZE_INT vm_get_vtable_base() -static vm_get_heap_base_address_t vm_get_heap_base_address = 0; //vm_heap_base_address -static vm_get_heap_ceiling_address_t vm_get_heap_ceiling_address = 0; //vm_heap_ceiling_address -static vm_is_heap_compressed_t vm_is_heap_compressed = 0;//vm_references_are_compressed(); -static vm_is_vtable_compressed_t vm_is_vtable_compressed = 0;//vm_vtable_pointers_are_compressed(); +static vm_get_java_lang_object_class_t vm_get_java_lang_object_class = 0; // vm_get_java_lang_object_class +static vm_get_java_lang_class_class_t vm_get_java_lang_class_class = 0; // vm_get_java_lang_class_class +static vm_get_java_lang_string_class_t vm_get_java_lang_string_class = 0; // vm_get_java_lang_string_class +static vm_get_vtable_base_address_t vm_get_vtable_base_address = 0; //POINTER_SIZE_INT vm_get_vtable_base_address() +static vm_get_heap_base_address_t vm_get_heap_base_address = 0; //vm_get_heap_base_address +static vm_get_heap_ceiling_address_t vm_get_heap_ceiling_address = 0; //vm_get_heap_ceiling_address +static vm_is_heap_compressed_t vm_is_heap_compressed = 0;//vm_is_heap_compressed(); +static vm_is_vtable_compressed_t vm_is_vtable_compressed = 0;//vm_is_vtable_compressed(); static vm_patch_code_block_t vm_patch_code_block = 0; static vm_compile_method_t vm_compile_method = 0; -static vm_register_jit_extended_class_callback_t vm_register_jit_extended_class_callback = 0; -static vm_register_jit_overridden_method_callback_t vm_register_jit_overridden_method_callback = 0; static vm_register_jit_recompiled_method_callback_t vm_register_jit_recompiled_method_callback = 0; static vm_compiled_method_load_t vm_compiled_method_load = 0; static vm_helper_get_addr_t vm_helper_get_addr = 0; @@ -244,13 +248,13 @@ class_get_array_element_class = GET_INTERFACE(vm, class_get_array_element_class); class_get_array_element_size = GET_INTERFACE(vm, class_get_array_element_size); class_get_array_of_class = GET_INTERFACE(vm, class_get_array_of_class); - class_get_element_type_info = GET_INTERFACE(vm, class_get_element_type_info); + class_is_non_ref_array = GET_INTERFACE(vm, class_is_non_ref_array); class_get_name = GET_INTERFACE(vm, class_get_name); class_get_super_class = GET_INTERFACE(vm, class_get_super_class); class_get_depth = GET_INTERFACE(vm, class_get_depth); class_get_vtable = GET_INTERFACE(vm, class_get_vtable); class_get_allocation_handle = GET_INTERFACE(vm, class_get_allocation_handle); - class_get_boxed_data_size = GET_INTERFACE(vm, class_get_boxed_data_size); + class_get_object_size = GET_INTERFACE(vm, class_get_object_size); class_cp_get_num_array_dimensions = GET_INTERFACE(vm, class_cp_get_num_array_dimensions); class_get_class_of_primitive_type = GET_INTERFACE(vm, class_get_class_of_primitive_type); class_get_const_string_intern_addr = GET_INTERFACE(vm, class_get_const_string_intern_addr); @@ -272,7 +276,7 @@ class_is_support_fast_instanceof = GET_INTERFACE(vm, class_is_support_fast_instanceof); class_is_primitive = GET_INTERFACE(vm, class_is_primitive); - class_lookup_class_by_name_using_bootstrap_class_loader = GET_INTERFACE(vm, class_lookup_class_by_name_using_bootstrap_class_loader); + class_lookup_boot_class = GET_INTERFACE(vm, class_lookup_boot_class); class_lookup_method_recursively = GET_INTERFACE(vm, class_lookup_method_recursively); // Const Pool @@ -300,7 +304,7 @@ //Method - method_get_overridden_method = GET_INTERFACE(vm, method_get_overridden_method); + class_get_overridden_method = GET_INTERFACE(vm, class_get_overridden_method); method_get_info_block_jit = GET_INTERFACE(vm, method_get_info_block_jit); method_get_info_block_size_jit = GET_INTERFACE(vm, method_get_info_block_size_jit); method_get_name = GET_INTERFACE(vm, method_get_name); @@ -309,7 +313,7 @@ method_get_byte_code_size = GET_INTERFACE(vm, method_get_byte_code_size); method_get_max_stack = GET_INTERFACE(vm, method_get_max_stack); method_get_num_handlers = GET_INTERFACE(vm, method_get_num_handlers); - method_get_offset = GET_INTERFACE(vm, method_get_offset); + method_get_vtable_offset = GET_INTERFACE(vm, method_get_vtable_offset); method_get_indirect_address = GET_INTERFACE(vm, method_get_indirect_address); method_get_native_func_addr = GET_INTERFACE(vm, method_get_native_func_addr); method_vars_get_number = GET_INTERFACE(vm, method_vars_get_number); @@ -331,7 +335,6 @@ method_is_final = GET_INTERFACE(vm, method_is_final); method_is_abstract = GET_INTERFACE(vm, method_is_abstract); method_is_strict = GET_INTERFACE(vm, method_is_strict); - method_is_overridden = GET_INTERFACE(vm, method_is_overridden); method_is_no_inlining = GET_INTERFACE(vm, method_is_no_inlining); @@ -395,18 +398,16 @@ vm_properties_get_value = GET_INTERFACE(vm, vm_properties_get_value); - vm_get_system_object_class = GET_INTERFACE(vm, vm_get_system_object_class); - vm_get_system_class_class = GET_INTERFACE(vm, vm_get_system_class_class); - vm_get_system_string_class = GET_INTERFACE(vm, vm_get_system_string_class); - vm_get_vtable_base = GET_INTERFACE(vm, vm_get_vtable_base); + vm_get_java_lang_object_class = GET_INTERFACE(vm, vm_get_java_lang_object_class); + vm_get_java_lang_class_class = GET_INTERFACE(vm, vm_get_java_lang_class_class); + vm_get_java_lang_string_class = GET_INTERFACE(vm, vm_get_java_lang_string_class); + vm_get_vtable_base_address = GET_INTERFACE(vm, vm_get_vtable_base_address); vm_get_heap_base_address = GET_INTERFACE(vm, vm_get_heap_base_address); vm_get_heap_ceiling_address = GET_INTERFACE(vm, vm_get_heap_ceiling_address); vm_is_heap_compressed = GET_INTERFACE(vm, vm_is_heap_compressed); vm_is_vtable_compressed = GET_INTERFACE(vm, vm_is_vtable_compressed); vm_patch_code_block = GET_INTERFACE(vm, vm_patch_code_block); vm_compile_method = GET_INTERFACE(vm, vm_compile_method); - vm_register_jit_extended_class_callback = GET_INTERFACE(vm, vm_register_jit_extended_class_callback); - vm_register_jit_overridden_method_callback = GET_INTERFACE(vm, vm_register_jit_overridden_method_callback); vm_register_jit_recompiled_method_callback = GET_INTERFACE(vm, vm_register_jit_recompiled_method_callback); vm_compiled_method_load = GET_INTERFACE(vm, vm_compiled_method_load); vm_helper_get_addr = GET_INTERFACE(vm, vm_helper_get_addr); @@ -535,17 +536,17 @@ void* VMInterface::getSystemObjectVMTypeHandle() { - return vm_get_system_object_class(); + return vm_get_java_lang_object_class(); } void* VMInterface::getSystemClassVMTypeHandle() { - return vm_get_system_class_class(); + return vm_get_java_lang_class_class(); } void* VMInterface::getSystemStringVMTypeHandle() { - return vm_get_system_string_class(); + return vm_get_java_lang_string_class(); } void* @@ -566,7 +567,7 @@ bool VMInterface::isArrayOfPrimitiveElements(void* vmClassHandle) { - return type_info_is_primitive(class_get_element_type_info((Class_Handle) vmClassHandle))?true:false; + return class_is_non_ref_array((Class_Handle) vmClassHandle); } bool @@ -622,7 +623,7 @@ uint32 VMInterface::getObjectSize(void * vmTypeHandle) { - return class_get_boxed_data_size((Class_Handle) vmTypeHandle); + return class_get_object_size((Class_Handle) vmTypeHandle); } void* VMInterface::getSuperTypeVMTypeHandle(void* vmTypeHandle) { @@ -668,7 +669,7 @@ uint64 VMInterface::getVTableBase() { - return (uint64)vm_get_vtable_base(); + return (uint64)vm_get_vtable_base_address(); } void* VMInterface::getTypeHandleFromAllocationHandle(void* vmAllocationHandle) @@ -712,8 +713,7 @@ uint32 MethodDesc::getByteCodeSize() const {return (uint32) method_get_byte_code_size(drlMethod);} uint16 MethodDesc::getMaxStack() const {return (uint16) method_get_max_stack(drlMethod);} uint32 MethodDesc::getNumHandlers() const {return method_get_num_handlers(drlMethod);} -bool MethodDesc::isOverridden() const {return method_is_overridden(drlMethod)?true:false;} -uint32 MethodDesc::getOffset() const {return method_get_offset(drlMethod);} +uint32 MethodDesc::getOffset() const {return method_get_vtable_offset(drlMethod);} void* MethodDesc::getIndirectAddress() const {return method_get_indirect_address(drlMethod);} void* MethodDesc::getNativeAddress() const {return method_get_native_func_addr(drlMethod);} @@ -1020,25 +1020,13 @@ if (type->isUnresolvedType()) { return NULL; } - Method_Handle m = method_get_overridden_method((Class_Handle) type->getVMTypeHandle(), + Method_Handle m = class_get_overridden_method((Class_Handle) type->getVMTypeHandle(), methodDesc->getMethodHandle()); if (!m) return NULL; return getMethodDesc(m); } -void CompilationInterface::setNotifyWhenClassIsExtended(ObjectType * type, - void * callbackData) { - void * typeHandle = type->getVMTypeHandle(); - vm_register_jit_extended_class_callback(getJitHandle(), (Class_Handle) typeHandle,callbackData); -} - -void CompilationInterface::setNotifyWhenMethodIsOverridden(MethodDesc * methodDesc, - void * callbackData) { - Method_Handle drlMethod = methodDesc->getMethodHandle(); - vm_register_jit_overridden_method_callback(getJitHandle(), drlMethod, callbackData); -} - void CompilationInterface::setNotifyWhenMethodIsRecompiled(MethodDesc * methodDesc, void * callbackData) { Method_Handle drlMethod = methodDesc->getMethodHandle(); @@ -1064,7 +1052,7 @@ } ObjectType * CompilationInterface::findClassUsingBootstrapClassloader( const char * klassName ) { - Class_Handle cls = class_lookup_class_by_name_using_bootstrap_class_loader(klassName); + Class_Handle cls = class_lookup_boot_class(klassName); if( NULL == cls ) { return NULL; } Index: vm/jitrino/src/vm/JITInterface.cpp =================================================================== --- vm/jitrino/src/vm/JITInterface.cpp (revision 639193) +++ vm/jitrino/src/vm/JITInterface.cpp (working copy) @@ -151,30 +151,7 @@ } //opt does not support counters patching today. } -// Called if JIT registered itself to be notified when the class is extended -// Returns TRUE if any code was modified and FALSE otherwise. -extern "C" -JITEXPORT Boolean -JIT_extended_class_callback(JIT_Handle jit, Class_Handle extended_class, - Class_Handle new_class, void *callback_data) -{ - return FALSE; -} - // Called if JIT registered itself to be notified when the method is -// overridden -// Returns TRUE if any code was modified and FALSE otherwise -extern "C" -JITEXPORT Boolean -JIT_overridden_method_callback(JIT_Handle jit, - Method_Handle overridden_method, - Method_Handle new_method, - void *callback_data) -{ - return FALSE; -} - -// Called if JIT registered itself to be notified when the method is // recompiled // Returns TRUE if any code was modified and FALSE otherwise extern "C" Index: vm/jitrino/src/vm/VMInterface.h =================================================================== --- vm/jitrino/src/vm/VMInterface.h (revision 639193) +++ vm/jitrino/src/vm/VMInterface.h (working copy) @@ -85,9 +85,6 @@ // returns true if vtable pointers are compressed static bool isVTableCompressed(); - // returns size of vtable pointer (currently 4 if compressed and 8 otherwise) - //static uint32 getVTablePtrSize() {return vm_get_vtable_ptr_size();} - // returns the offset of an object's virtual table static uint32 getVTableOffset(); // returns the base for all vtables (addend to compressed vtable pointer) @@ -237,7 +234,6 @@ // // DRL kernel // - bool isOverridden() const; uint32 getOffset() const; void* getIndirectAddress() const; void* getNativeAddress() const; @@ -380,8 +376,6 @@ void unlockMethodData(void); // methods that register JIT to be notified of various events - void setNotifyWhenClassIsExtended(ObjectType * type, void * callbackData); - void setNotifyWhenMethodIsOverridden(MethodDesc * methodDesc, void * callbackData); void setNotifyWhenMethodIsRecompiled(MethodDesc * methodDesc, void * callbackData); // write barrier instructions