comparison src/share/vm/utilities/accessFlags.hpp @ 710:e5b0439ef4ae

6655638: dynamic languages need method handles Summary: initial implementation, with known omissions (x86/64, sparc, compiler optim., c-oops, C++ interp.) Reviewed-by: kvn, twisti, never
author jrose
date Wed, 08 Apr 2009 10:56:49 -0700
parents a61af66fc99e
children c18cbe5936b8
comparison
equal deleted inserted replaced
709:1d037ecd7960 710:e5b0439ef4ae
1 /* 1 /*
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
45 JVM_ACC_HAS_CHECKED_EXCEPTIONS = 0x00400000, 45 JVM_ACC_HAS_CHECKED_EXCEPTIONS = 0x00400000,
46 JVM_ACC_HAS_JSRS = 0x00800000, 46 JVM_ACC_HAS_JSRS = 0x00800000,
47 JVM_ACC_IS_OLD = 0x00010000, // RedefineClasses() has replaced this method 47 JVM_ACC_IS_OLD = 0x00010000, // RedefineClasses() has replaced this method
48 JVM_ACC_IS_OBSOLETE = 0x00020000, // RedefineClasses() has made method obsolete 48 JVM_ACC_IS_OBSOLETE = 0x00020000, // RedefineClasses() has made method obsolete
49 JVM_ACC_IS_PREFIXED_NATIVE = 0x00040000, // JVMTI has prefixed this native method 49 JVM_ACC_IS_PREFIXED_NATIVE = 0x00040000, // JVMTI has prefixed this native method
50 JVM_MH_INVOKE_BITS // = 0x10001100 // MethodHandle.invoke quasi-native
51 = (JVM_ACC_NATIVE | JVM_ACC_SYNTHETIC | JVM_ACC_MONITOR_MATCH),
50 52
51 // klassOop flags 53 // klassOop flags
52 JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000, // True if this class has miranda methods in it's vtable 54 JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000, // True if this class has miranda methods in it's vtable
53 JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor 55 JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor
54 JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method 56 JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method
70 JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI 72 JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI
71 JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI 73 JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI
72 74
73 // flags accepted by set_field_flags() 75 // flags accepted by set_field_flags()
74 JVM_ACC_FIELD_FLAGS = 0x00008000 | JVM_ACC_WRITTEN_FLAGS 76 JVM_ACC_FIELD_FLAGS = 0x00008000 | JVM_ACC_WRITTEN_FLAGS
77
75 }; 78 };
76 79
77 80
78 class AccessFlags VALUE_OBJ_CLASS_SPEC { 81 class AccessFlags VALUE_OBJ_CLASS_SPEC {
79 friend class VMStructs; 82 friend class VMStructs;
111 bool has_checked_exceptions () const { return (_flags & JVM_ACC_HAS_CHECKED_EXCEPTIONS ) != 0; } 114 bool has_checked_exceptions () const { return (_flags & JVM_ACC_HAS_CHECKED_EXCEPTIONS ) != 0; }
112 bool has_jsrs () const { return (_flags & JVM_ACC_HAS_JSRS ) != 0; } 115 bool has_jsrs () const { return (_flags & JVM_ACC_HAS_JSRS ) != 0; }
113 bool is_old () const { return (_flags & JVM_ACC_IS_OLD ) != 0; } 116 bool is_old () const { return (_flags & JVM_ACC_IS_OLD ) != 0; }
114 bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; } 117 bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; }
115 bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; } 118 bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; }
119
120 // JSR 292: A method of the form MethodHandle.invoke(A...)R method is
121 // neither bytecoded nor a JNI native, but rather a fast call through
122 // a lightweight method handle object. Because it is not bytecoded,
123 // it has the native bit set, but the monitor-match bit is also set
124 // to distinguish it from a JNI native (which never has the match bit set).
125 // The synthetic bit is also present, because such a method is never
126 // explicitly defined in Java code.
127 bool is_method_handle_invoke () const { return (_flags & JVM_MH_INVOKE_BITS) == JVM_MH_INVOKE_BITS; }
116 128
117 // klassOop flags 129 // klassOop flags
118 bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; } 130 bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
119 bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; } 131 bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
120 bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; } 132 bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; }
197 209
198 // Conversion 210 // Conversion
199 jshort as_short() { return (jshort)_flags; } 211 jshort as_short() { return (jshort)_flags; }
200 jint as_int() { return _flags; } 212 jint as_int() { return _flags; }
201 213
214 inline friend AccessFlags accessFlags_from(jint flags);
215
202 // Printing/debugging 216 // Printing/debugging
203 void print_on(outputStream* st) const PRODUCT_RETURN; 217 void print_on(outputStream* st) const PRODUCT_RETURN;
204 }; 218 };
219
220 inline AccessFlags accessFlags_from(jint flags) {
221 AccessFlags af;
222 af._flags = flags;
223 return af;
224 }