964 OP_SPREAD_ARGS = 0xB, // expand in place a varargs array (of known size) 965 OP_FOLD_ARGS = 0xC, // combine but do not remove arguments; prepend result 966 //OP_UNUSED_13 = 0xD, // unused code, perhaps for reified argument lists 967 CONV_OP_LIMIT = 0xE, // limit of CONV_OP enumeration 968 969 CONV_OP_MASK = 0xF00, // this nybble contains the conversion op field 970 CONV_TYPE_MASK = 0x0F, // fits T_ADDRESS and below 971 CONV_VMINFO_MASK = 0x0FF, // LSB is reserved for JVM use 972 CONV_VMINFO_SHIFT = 0, // position of bits in CONV_VMINFO_MASK 973 CONV_OP_SHIFT = 8, // position of bits in CONV_OP_MASK 974 CONV_DEST_TYPE_SHIFT = 12, // byte 2 has the adapter BasicType (if needed) 975 CONV_SRC_TYPE_SHIFT = 16, // byte 2 has the source BasicType (if needed) 976 CONV_STACK_MOVE_SHIFT = 20, // high 12 bits give signed SP change 977 CONV_STACK_MOVE_MASK = (1 << (32 - CONV_STACK_MOVE_SHIFT)) - 1 978 }; 979 980 static int conversion_offset_in_bytes() { return _conversion_offset; } 981 }; 982 983 984 // Interface to java.lang.invoke.MemberName objects 985 // (These are a private interface for Java code to query the class hierarchy.) 986 987 class java_lang_invoke_MemberName: AllStatic { 988 friend class JavaClasses; 989 990 private: 991 // From java.lang.invoke.MemberName: 992 // private Class<?> clazz; // class in which the method is defined 993 // private String name; // may be null if not yet materialized 994 // private Object type; // may be null if not yet materialized 995 // private int flags; // modifier bits; see reflect.Modifier 996 // private Object vmtarget; // VM-specific target value 997 // private int vmindex; // method index within class or interface 998 static int _clazz_offset; 999 static int _name_offset; 1000 static int _type_offset; 1001 static int _flags_offset; 1002 static int _vmtarget_offset; 1003 static int _vmindex_offset; | 964 OP_SPREAD_ARGS = 0xB, // expand in place a varargs array (of known size) 965 OP_FOLD_ARGS = 0xC, // combine but do not remove arguments; prepend result 966 //OP_UNUSED_13 = 0xD, // unused code, perhaps for reified argument lists 967 CONV_OP_LIMIT = 0xE, // limit of CONV_OP enumeration 968 969 CONV_OP_MASK = 0xF00, // this nybble contains the conversion op field 970 CONV_TYPE_MASK = 0x0F, // fits T_ADDRESS and below 971 CONV_VMINFO_MASK = 0x0FF, // LSB is reserved for JVM use 972 CONV_VMINFO_SHIFT = 0, // position of bits in CONV_VMINFO_MASK 973 CONV_OP_SHIFT = 8, // position of bits in CONV_OP_MASK 974 CONV_DEST_TYPE_SHIFT = 12, // byte 2 has the adapter BasicType (if needed) 975 CONV_SRC_TYPE_SHIFT = 16, // byte 2 has the source BasicType (if needed) 976 CONV_STACK_MOVE_SHIFT = 20, // high 12 bits give signed SP change 977 CONV_STACK_MOVE_MASK = (1 << (32 - CONV_STACK_MOVE_SHIFT)) - 1 978 }; 979 980 static int conversion_offset_in_bytes() { return _conversion_offset; } 981 }; 982 983 984 // A simple class that maintains an invocation count 985 class java_lang_invoke_CountingMethodHandle: public java_lang_invoke_MethodHandle { 986 friend class JavaClasses; 987 988 private: 989 static int _vmcount_offset; 990 static void compute_offsets(); 991 992 public: 993 // Accessors 994 static int vmcount(oop mh); 995 static void set_vmcount(oop mh, int count); 996 997 // Testers 998 static bool is_subclass(klassOop klass) { 999 return SystemDictionary::CountingMethodHandle_klass() != NULL && 1000 Klass::cast(klass)->is_subclass_of(SystemDictionary::CountingMethodHandle_klass()); 1001 } 1002 static bool is_instance(oop obj) { 1003 return obj != NULL && is_subclass(obj->klass()); 1004 } 1005 1006 // Accessors for code generation: 1007 static int vmcount_offset_in_bytes() { return _vmcount_offset; } 1008 }; 1009 1010 1011 1012 // Interface to java.lang.invoke.MemberName objects 1013 // (These are a private interface for Java code to query the class hierarchy.) 1014 1015 class java_lang_invoke_MemberName: AllStatic { 1016 friend class JavaClasses; 1017 1018 private: 1019 // From java.lang.invoke.MemberName: 1020 // private Class<?> clazz; // class in which the method is defined 1021 // private String name; // may be null if not yet materialized 1022 // private Object type; // may be null if not yet materialized 1023 // private int flags; // modifier bits; see reflect.Modifier 1024 // private Object vmtarget; // VM-specific target value 1025 // private int vmindex; // method index within class or interface 1026 static int _clazz_offset; 1027 static int _name_offset; 1028 static int _type_offset; 1029 static int _flags_offset; 1030 static int _vmtarget_offset; 1031 static int _vmindex_offset; |