mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8001107: @Stable annotation for constant folding of lazily evaluated variables
Co-authored-by: John Rose <john.r.rose@oracle.com> Reviewed-by: rbackman, twisti, kvn
This commit is contained in:
parent
19d50345e1
commit
f0e77ac67f
25 changed files with 419 additions and 84 deletions
|
@ -125,6 +125,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
|||
_method_LambdaForm_Compiled,
|
||||
_method_LambdaForm_Hidden,
|
||||
_sun_misc_Contended,
|
||||
_field_Stable,
|
||||
_annotation_LIMIT
|
||||
};
|
||||
const Location _location;
|
||||
|
@ -143,14 +144,23 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
|||
assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
|
||||
_annotations_present |= nth_bit((int)id);
|
||||
}
|
||||
|
||||
void remove_annotation(ID id) {
|
||||
assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
|
||||
_annotations_present &= ~nth_bit((int)id);
|
||||
}
|
||||
|
||||
// Report if the annotation is present.
|
||||
bool has_any_annotations() { return _annotations_present != 0; }
|
||||
bool has_annotation(ID id) { return (nth_bit((int)id) & _annotations_present) != 0; }
|
||||
bool has_any_annotations() const { return _annotations_present != 0; }
|
||||
bool has_annotation(ID id) const { return (nth_bit((int)id) & _annotations_present) != 0; }
|
||||
|
||||
void set_contended_group(u2 group) { _contended_group = group; }
|
||||
u2 contended_group() { return _contended_group; }
|
||||
u2 contended_group() const { return _contended_group; }
|
||||
|
||||
bool is_contended() { return has_annotation(_sun_misc_Contended); }
|
||||
bool is_contended() const { return has_annotation(_sun_misc_Contended); }
|
||||
|
||||
void set_stable(bool stable) { set_annotation(_field_Stable); }
|
||||
bool is_stable() const { return has_annotation(_field_Stable); }
|
||||
};
|
||||
|
||||
// This class also doubles as a holder for metadata cleanup.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue