65 using namespace cacao;
68 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
69 #define INLINELOG(code) do { if (opt_TraceInlining) { code } } while (0)
71 #define INLINELOG(code)
75 STAT_REGISTER_VAR(
int,count_all_methods,0,
"all methods",
"Number of loaded Methods")
101 #if defined(ENABLE_JAVASE)
105 vm_abort(
"method_init: class_java_lang_reflect_Method is NULL");
109 method_java_lang_reflect_Method_invoke =
112 if (method_java_lang_reflect_Method_invoke == NULL)
113 vm_abort(
"method_init: Could not resolve method java.lang.reflect.Method.invoke().");
170 u2 attribute_name_index;
172 u2 code_attributes_count;
173 u2 code_attribute_name_index;
206 descriptor_index = cb.
read_u2();
213 if ((argcount = descpool.
add_method(u)) == -1)
216 #ifdef ENABLE_VERIFIER
223 if (m->
name[0] ==
'<' &&
224 m->
name != utf8::init && m->
name != utf8::clinit) {
234 if (m->
name == utf8::clinit) {
242 #ifdef ENABLE_VERIFIER
244 if (argcount > 255) {
250 if (m->
name != utf8::clinit) {
255 "Illegal method modifiers: 0x%X",
264 "Illegal method modifiers: 0x%X",
273 "Illegal method modifiers: 0x%X",
279 if (m->
name == utf8::init) {
304 attributes_count = cb.
read_u2();
306 for (i = 0; i < attributes_count; i++) {
312 attribute_name_index = cb.
read_u2();
317 if (attribute_name == NULL)
320 if (attribute_name == utf8::Code) {
403 code_attributes_count = cb.
read_u2();
405 for (k = 0; k < code_attributes_count; k++) {
411 code_attribute_name_index = cb.
read_u2();
413 code_attribute_name =
416 if (code_attribute_name == NULL)
421 if (code_attribute_name == utf8::LineNumberTable) {
447 #if defined(ENABLE_JAVASE)
448 else if (code_attribute_name == utf8::StackMapTable) {
454 # if defined(ENABLE_JVMTI)
455 else if (code_attribute_name == utf8::LocalVariableTable) {
458 if (m->localvars != NULL) {
469 m->localvarcount = cb.
read_u2();
476 for (l = 0; l < m->localvarcount; l++) {
477 m->localvars[l].start_pc = cb.
read_u2();
478 m->localvars[l].length = cb.
read_u2();
480 uint16_t name_index = cb.
read_u2();
484 uint16_t descriptor_index = cb.
read_u2();
488 m->localvars[l].index = cb.
read_u2();
504 else if (attribute_name == utf8::Exceptions) {
533 #if defined(ENABLE_JAVASE)
534 else if (attribute_name == utf8::Signature) {
549 # if defined(ENABLE_ANNOTATIONS)
550 else if (attribute_name == utf8::RuntimeVisibleAnnotations) {
555 else if (attribute_name == utf8::RuntimeInvisibleAnnotations) {
560 else if (attribute_name == utf8::RuntimeVisibleParameterAnnotations) {
565 else if (attribute_name == utf8::RuntimeInvisibleParameterAnnotations) {
570 else if (attribute_name == utf8::AnnotationDefault) {
590 #if defined(ENABLE_REPLACEMENT)
593 m->hitcountdown = METHOD_INITIAL_HIT_COUNTDOWN;
745 int32_t paramcount = 0;
807 for (i = 0; i < paramcount; i++) {
903 for (; mp < mend; ++mp) {
912 for (child = c->
sub; child != NULL; child = child->
nextsub) {
934 #if defined(ENABLE_ANNOTATIONS)
978 #if defined(ENABLE_ANNOTATIONS)
989 c, method_parameterannotations, method_parameterannotations);
996 if (method_parameterannotations != NULL && oa.
get_length() >
slot) {
1023 #if defined(ENABLE_ANNOTATIONS)
1034 c, method_annotationdefaults, method_annotationdefaults);
1041 if (method_annotationdefaults != NULL && oa.
get_length() >
slot) {
1063 for (wi = *wl; wi != NULL; wi = wi->
next)
1126 printf(
"ASSUMPTION BROKEN (monomorphism): ");
1134 #if defined(ENABLE_TLH) && 0
1154 #if !defined(NDEBUG)
1188 #if !defined(NDEBUG)
1196 if (m->
clazz != NULL)
1217 #if !defined(NDEBUG)
1234 #if !defined(NDEBUG)
1238 printf(
"(constant_FMIref *)NULL");
1263 #if !defined(NDEBUG)
1305 method_printflags_OS(OS,m);
methodptr * interfacetable[1]
jlong jlong jlong jlong jint jmethodID jint slot
void method_break_assumption_monomorphic(methodinfo *m, method_worklist **wl)
void method_free(methodinfo *m)
#define STATISTICS(x)
Wrapper for statistics only code.
bool method_load(ClassBuffer &cb, methodinfo *m, DescriptorPool &descpool)
void * class_getconstant(classinfo *c, u4 pos, ConstantPoolTag ctype)
void method_print(methodinfo *m)
#define STAT_REGISTER_SUM_SUBGROUP(var, name, description, group)
Register a statistics summary group.
methodinfo * code_get_methodinfo_for_pv(void *pv)
bool annotation_load_method_attribute_runtimevisibleparameterannotations(ClassBuffer &cb, methodinfo *m)
bool annotation_load_method_attribute_runtimevisibleannotations(ClassBuffer &cb, methodinfo *m)
virtual java_handle_array_t * get_handle() const
s4 rawexceptiontablelength
method_assumption * assumptions
void utf_display_printable_ascii_classname(Utf8String u)
static void remove(void *stub)
Free a compiler stub from memory.
java_handle_bytearray_t * method_get_annotations(methodinfo *m)
Actual implementation of access class for Java Object arrays.
methodinfo * method_vftbl_lookup(vftbl_t *vftbl, methodinfo *m)
typedef void(JNICALL *jvmtiEventSingleStep)(jvmtiEnv *jvmti_env
T get_element(int32_t index)
union constant_FMIref::@26 p
Dummy implementation of a mutex.
void exceptions_throw_classformaterror(classinfo *c, const char *message,...)
methodinfo * method_new_builtin(builtintable_entry *bte)
JNIEnv jclass jobject const char * name
void set_element(int32_t index, T value)
java_handle_objectarray_t * method_get_parametertypearray(methodinfo *m)
int32_t method_get_parametercount(methodinfo *m)
methodinfo * class_findmethod(classinfo *c, Utf8String name, Utf8String desc)
bool resolve_class_from_typedesc(typedesc *d, bool checkaccess, bool link, classinfo **result)
classref_or_classinfo catchtype
JNIEnv jthread jobject jclass jlong size
#define MZERO(ptr, type, num)
bool loader_skip_attribute_body(ClassBuffer &cb)
void code_free_code_of_method(methodinfo *m)
void vm_abort(const char *text,...)
raw_exception_entry * rawexceptiontable
bool stackmap_load_attribute_stackmaptable(ClassBuffer &cb, methodinfo *m)
s4 method_count_implementations(methodinfo *m, classinfo *c, methodinfo **found)
JNIEnv jthread jmethodID jlocation jobject exception
bool annotation_load_method_attribute_annotationdefault(ClassBuffer &cb, methodinfo *m)
int32_t get_length() const
void method_printflags(methodinfo *m)
void method_println(methodinfo *m)
This file contains the statistics framework.
#define STAT_REGISTER_GROUP_VAR(type, var, init, name, description, group)
Register an statistics variable and add it to a group.
Simple stream class for formatted output.
bool is_valid_name() const
classinfo * class_java_lang_reflect_Method
bool method_matches(methodinfo *m, const char *name)
void read_nbytes(uint8_t *dst, size_t num_bytes)
Transfer block of classfile into a buffer.
static Utf8String from_utf8(const char *, size_t)
Fieldref, Methodref and InterfaceMethodref.
#define LLNI_classinfo_field_get(cls, field, variable)
classinfo * method_returntype_get(methodinfo *m)
const Utf8String descriptor
bool annotation_load_method_attribute_runtimeinvisibleannotations(ClassBuffer &cb, methodinfo *m)
bool loader_load_attribute_signature(ClassBuffer &cb, Utf8String &signature)
void params_from_paramtypes(s4 mflags)
OStream & operator<<(OStream &OS, const std::string &t)
void utf_display_printable_ascii(Utf8String u)
classinfo * get_class() const
ssize_t add_method(Utf8String desc)
STAT_REGISTER_GROUP_VAR_EXTERN(int, size_classinfo, 0,"size classinfo","classinfo", info_struct_stat) STAT_REGISTER_GROUP_VAR(int
void method_methodref_print(constant_FMIref *mr)
static void method_add_to_worklist(methodinfo *m, method_worklist **wl)
#define STAT_DECLARE_GROUP(var)
Declare an external group (or subgroup).
classref_or_classinfo * thrownexceptions
constant_classref * classref
java_handle_bytearray_t * method_get_annotationdefault(methodinfo *m)
bool check_size(size_t sz)
Assert that at least <sz> bytes are left to read.
static void remove(void *stub)
Free a native stub from memory.
BreakpointTable * breakpoints
void method_add_assumption_monomorphic(methodinfo *m, methodinfo *caller)
void method_methodref_println(constant_FMIref *mr)
methodinfo * method_java_lang_reflect_Method_invoke
classinfo * resolve_classref_or_classinfo_eager(classref_or_classinfo cls, bool checkaccess)
java_handle_objectarray_t * method_get_exceptionarray(methodinfo *m)
#define STAT_REGISTER_VAR(type, var, init, name, description)
Register an external statistics variable.
#define STAT_DECLARE_VAR(type, var, init)
Declare an external statistics variable.
Actual implementation of access class for java.lang.Class arrays.
#define MFREE(ptr, type, num)
java_handle_bytearray_t * method_get_parameterannotations(methodinfo *m)
bool method_canoverwrite(methodinfo *m, methodinfo *old)
bool annotation_load_method_attribute_runtimeinvisibleparameterannotations(ClassBuffer &cb, methodinfo *m)