33
33
import java .util .Collections ;
34
34
import java .util .HashMap ;
35
35
import java .util .HashSet ;
36
+ import java .util .List ;
36
37
import java .util .Map ;
37
38
import java .util .Set ;
38
39
import java .util .concurrent .ConcurrentHashMap ;
@@ -224,14 +225,21 @@ public static CallSite getSuperCallSite() {
224
225
}
225
226
226
227
public static void addMethodReadFieldsPacked (int readBits , String methodsPacked ) {
227
- Set <FrameField > reads = FrameField .unpack (readBits );
228
+ Set <FrameField > reads = Collections . synchronizedSet ( FrameField .unpack (readBits ) );
228
229
229
230
if (DEBUG ) LOG .debug ("Adding method field reads: {} for {}" , reads , methodsPacked );
230
231
231
- for (String name : Helpers .SEMICOLON_PATTERN .split (methodsPacked )) {
232
- if (FrameField .needsFrame (readBits )) FRAME_AWARE_METHODS .add (name );
233
- if (FrameField .needsScope (readBits )) SCOPE_AWARE_METHODS .add (name );
234
- METHOD_FRAME_READS .put (name , reads );
232
+ String [] names = Helpers .SEMICOLON_PATTERN .split (methodsPacked );
233
+
234
+ if (FrameField .needsFrame (readBits )) FRAME_AWARE_METHODS .addAll (Arrays .asList (names ));
235
+ if (FrameField .needsScope (readBits )) SCOPE_AWARE_METHODS .addAll (Arrays .asList (names ));
236
+
237
+ for (String name : names ) {
238
+ Set <FrameField > current = METHOD_FRAME_READS .putIfAbsent (name , reads );
239
+
240
+ if (current != null ) {
241
+ current .addAll (reads );
242
+ }
235
243
}
236
244
}
237
245
@@ -240,13 +248,28 @@ public static void addMethodWriteFieldsPacked(int writeBits, String methodsPacke
240
248
241
249
if (DEBUG ) LOG .debug ("Adding scope-aware method names: {} for {}" , writes , methodsPacked );
242
250
243
- for (String name : Helpers .SEMICOLON_PATTERN .split (methodsPacked )) {
244
- if (FrameField .needsFrame (writeBits )) FRAME_AWARE_METHODS .add (name );
245
- if (FrameField .needsScope (writeBits )) SCOPE_AWARE_METHODS .add (name );
246
- METHOD_FRAME_WRITES .put (name , writes );
251
+ String [] names = Helpers .SEMICOLON_PATTERN .split (methodsPacked );
252
+
253
+ if (FrameField .needsFrame (writeBits )) FRAME_AWARE_METHODS .addAll (Arrays .asList (names ));
254
+ if (FrameField .needsScope (writeBits )) SCOPE_AWARE_METHODS .addAll (Arrays .asList (names ));
255
+
256
+ for (String name : names ) {
257
+ Set <FrameField > current = METHOD_FRAME_WRITES .putIfAbsent (name , writes );
258
+
259
+ if (current != null ) {
260
+ current .addAll (writes );
261
+ }
247
262
}
248
263
}
249
264
265
+ public static void addMethodReadFields (String name , FrameField [] reads ) {
266
+ addMethodReadFieldsPacked (FrameField .pack (reads ), name );
267
+ }
268
+
269
+ public static void addMethodWriteFields (String name , FrameField [] write ) {
270
+ addMethodWriteFieldsPacked (FrameField .pack (write ), name );
271
+ }
272
+
250
273
@ Deprecated
251
274
public static void addFrameAwareMethods (String ... methods ) {
252
275
if (DEBUG ) LOG .debug ("Adding frame-aware method names: {}" , Arrays .toString (methods ));
0 commit comments