Mercurial > hg > truffle
comparison src/share/vm/oops/fieldStreams.hpp @ 12264:b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
Summary: Enhance method resolution and resulting data structures, plus some refactoring.
Reviewed-by: twisti, acorn, jrose
author | drchase |
---|---|
date | Fri, 13 Sep 2013 22:38:02 -0400 |
parents | 4a916f2ce331 |
children |
comparison
equal
deleted
inserted
replaced
12261:2c98370f2611 | 12264:b2e698d2276c |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. 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. |
25 #ifndef SHARE_VM_OOPS_FIELDSTREAMS_HPP | 25 #ifndef SHARE_VM_OOPS_FIELDSTREAMS_HPP |
26 #define SHARE_VM_OOPS_FIELDSTREAMS_HPP | 26 #define SHARE_VM_OOPS_FIELDSTREAMS_HPP |
27 | 27 |
28 #include "oops/instanceKlass.hpp" | 28 #include "oops/instanceKlass.hpp" |
29 #include "oops/fieldInfo.hpp" | 29 #include "oops/fieldInfo.hpp" |
30 #include "runtime/fieldDescriptor.hpp" | |
30 | 31 |
31 // The is the base class for iteration over the fields array | 32 // The is the base class for iteration over the fields array |
32 // describing the declared fields in the class. Several subclasses | 33 // describing the declared fields in the class. Several subclasses |
33 // are provided depending on the kind of iteration required. The | 34 // are provided depending on the kind of iteration required. The |
34 // JavaFieldStream is for iterating over regular Java fields and it | 35 // JavaFieldStream is for iterating over regular Java fields and it |
41 Array<u2>* _fields; | 42 Array<u2>* _fields; |
42 constantPoolHandle _constants; | 43 constantPoolHandle _constants; |
43 int _index; | 44 int _index; |
44 int _limit; | 45 int _limit; |
45 int _generic_signature_slot; | 46 int _generic_signature_slot; |
47 fieldDescriptor _fd_buf; | |
46 | 48 |
47 FieldInfo* field() const { return FieldInfo::from_field_array(_fields, _index); } | 49 FieldInfo* field() const { return FieldInfo::from_field_array(_fields, _index); } |
50 InstanceKlass* field_holder() const { return _constants->pool_holder(); } | |
48 | 51 |
49 int init_generic_signature_start_slot() { | 52 int init_generic_signature_start_slot() { |
50 int length = _fields->length(); | 53 int length = _fields->length(); |
51 int num_fields = 0; | 54 int num_fields = 0; |
52 int skipped_generic_signature_slots = 0; | 55 int skipped_generic_signature_slots = 0; |
100 _fields = klass->fields(); | 103 _fields = klass->fields(); |
101 _constants = klass->constants(); | 104 _constants = klass->constants(); |
102 _index = 0; | 105 _index = 0; |
103 _limit = klass->java_fields_count(); | 106 _limit = klass->java_fields_count(); |
104 init_generic_signature_start_slot(); | 107 init_generic_signature_start_slot(); |
108 assert(klass == field_holder(), ""); | |
105 } | 109 } |
106 FieldStreamBase(instanceKlassHandle klass) { | 110 FieldStreamBase(instanceKlassHandle klass) { |
107 _fields = klass->fields(); | 111 _fields = klass->fields(); |
108 _constants = klass->constants(); | 112 _constants = klass->constants(); |
109 _index = 0; | 113 _index = 0; |
110 _limit = klass->java_fields_count(); | 114 _limit = klass->java_fields_count(); |
111 init_generic_signature_start_slot(); | 115 init_generic_signature_start_slot(); |
116 assert(klass == field_holder(), ""); | |
112 } | 117 } |
113 | 118 |
114 // accessors | 119 // accessors |
115 int index() const { return _index; } | 120 int index() const { return _index; } |
116 | 121 |
178 | 183 |
179 int contended_group() const { | 184 int contended_group() const { |
180 return field()->contended_group(); | 185 return field()->contended_group(); |
181 } | 186 } |
182 | 187 |
188 // bridge to a heavier API: | |
189 fieldDescriptor& field_descriptor() const { | |
190 fieldDescriptor& field = const_cast<fieldDescriptor&>(_fd_buf); | |
191 field.reinitialize(field_holder(), _index); | |
192 return field; | |
193 } | |
183 }; | 194 }; |
184 | 195 |
185 // Iterate over only the internal fields | 196 // Iterate over only the internal fields |
186 class JavaFieldStream : public FieldStreamBase { | 197 class JavaFieldStream : public FieldStreamBase { |
187 public: | 198 public: |