102 }
103
104 if (!OBJECT_FIELDS_ONLY) {
105 for (int i = 0; i < fieldCount; i++) {
106 final String fieldNamePrimitive = getFieldName(i, PRIMITIVE_FIELD_TYPE);
107 final Class<?> typeClass = PRIMITIVE_FIELD_TYPE.getTypeClass();
108 primitiveGetters[i] = MH.asType(MH.getter(LOOKUP, structure, fieldNamePrimitive, typeClass), Lookup.GET_PRIMITIVE_TYPE);
109 primitiveSetters[i] = MH.asType(MH.setter(LOOKUP, structure, fieldNamePrimitive, typeClass), Lookup.SET_PRIMITIVE_TYPE);
110 }
111 }
112 }
113 }
114
115 /**
116 * Property getter cache
117 * Note that we can't do the same simple caching for optimistic getters,
118 * due to the fact that they are bound to a program point, which will
119 * produce different boun method handles wrapping the same access mechanism
120 * depending on callsite
121 */
122 private MethodHandle[] GETTER_CACHE = new MethodHandle[NOOF_TYPES];
123
124 /**
125 * Create a new accessor property. Factory method used by nasgen generated code.
126 *
127 * @param key {@link Property} key.
128 * @param propertyFlags {@link Property} flags.
129 * @param getter {@link Property} get accessor method.
130 * @param setter {@link Property} set accessor method.
131 *
132 * @return New {@link AccessorProperty} created.
133 */
134 public static AccessorProperty create(final String key, final int propertyFlags, final MethodHandle getter, final MethodHandle setter) {
135 return new AccessorProperty(key, propertyFlags, -1, getter, setter);
136 }
137
138 /** Seed getter for the primitive version of this field (in -Dnashorn.fields.dual=true mode) */
139 transient MethodHandle primitiveGetter;
140
141 /** Seed setter for the primitive version of this field (in -Dnashorn.fields.dual=true mode) */
142 transient MethodHandle primitiveSetter;
|
102 }
103
104 if (!OBJECT_FIELDS_ONLY) {
105 for (int i = 0; i < fieldCount; i++) {
106 final String fieldNamePrimitive = getFieldName(i, PRIMITIVE_FIELD_TYPE);
107 final Class<?> typeClass = PRIMITIVE_FIELD_TYPE.getTypeClass();
108 primitiveGetters[i] = MH.asType(MH.getter(LOOKUP, structure, fieldNamePrimitive, typeClass), Lookup.GET_PRIMITIVE_TYPE);
109 primitiveSetters[i] = MH.asType(MH.setter(LOOKUP, structure, fieldNamePrimitive, typeClass), Lookup.SET_PRIMITIVE_TYPE);
110 }
111 }
112 }
113 }
114
115 /**
116 * Property getter cache
117 * Note that we can't do the same simple caching for optimistic getters,
118 * due to the fact that they are bound to a program point, which will
119 * produce different boun method handles wrapping the same access mechanism
120 * depending on callsite
121 */
122 private transient MethodHandle[] GETTER_CACHE = new MethodHandle[NOOF_TYPES];
123
124 /**
125 * Create a new accessor property. Factory method used by nasgen generated code.
126 *
127 * @param key {@link Property} key.
128 * @param propertyFlags {@link Property} flags.
129 * @param getter {@link Property} get accessor method.
130 * @param setter {@link Property} set accessor method.
131 *
132 * @return New {@link AccessorProperty} created.
133 */
134 public static AccessorProperty create(final String key, final int propertyFlags, final MethodHandle getter, final MethodHandle setter) {
135 return new AccessorProperty(key, propertyFlags, -1, getter, setter);
136 }
137
138 /** Seed getter for the primitive version of this field (in -Dnashorn.fields.dual=true mode) */
139 transient MethodHandle primitiveGetter;
140
141 /** Seed setter for the primitive version of this field (in -Dnashorn.fields.dual=true mode) */
142 transient MethodHandle primitiveSetter;
|