51
51
import com .oracle .graal .python .builtins .objects .code .CodeNodes .CreateCodeNode ;
52
52
import com .oracle .graal .python .builtins .objects .code .PCode ;
53
53
import com .oracle .graal .python .builtins .objects .common .EconomicMapStorage ;
54
+ import com .oracle .graal .python .builtins .objects .common .HashingCollectionNodes .GetDictStorageNode ;
54
55
import com .oracle .graal .python .builtins .objects .common .HashingStorage ;
55
56
import com .oracle .graal .python .builtins .objects .common .HashingStorage .DictEntry ;
56
57
import com .oracle .graal .python .builtins .objects .common .HashingStorageLibrary ;
@@ -412,11 +413,13 @@ void handlePList(VirtualFrame frame, PList l, int version, DataOutputStream buff
412
413
@ Specialization (limit = "1" )
413
414
void handlePDict (VirtualFrame frame , PDict d , int version , DataOutputStream buffer ,
414
415
@ Cached ("createBinaryProfile()" ) ConditionProfile hasFrame ,
415
- @ CachedLibrary ("d.getDictStorage()" ) HashingStorageLibrary lib ) {
416
+ @ Cached GetDictStorageNode getStore ,
417
+ @ CachedLibrary ("getStore.execute(d)" ) HashingStorageLibrary lib ) {
416
418
writeByte (TYPE_DICT , version , buffer );
417
- int len = lib .lengthWithFrame (d .getDictStorage (), hasFrame , frame );
419
+ HashingStorage dictStorage = getStore .execute (d );
420
+ int len = lib .lengthWithFrame (dictStorage , hasFrame , frame );
418
421
writeInt (len , version , buffer );
419
- for (DictEntry entry : d .entries ()) {
422
+ for (DictEntry entry : lib .entries (dictStorage )) {
420
423
getRecursiveNode ().execute (frame , entry .key , version , buffer );
421
424
getRecursiveNode ().execute (frame , entry .value , version , buffer );
422
425
}
@@ -443,33 +446,37 @@ private static String getSourceCode(PCode c) {
443
446
@ Specialization (limit = "1" )
444
447
void handlePSet (VirtualFrame frame , PSet s , int version , DataOutputStream buffer ,
445
448
@ Cached ("createBinaryProfile()" ) ConditionProfile hasFrame ,
446
- @ CachedLibrary ("s.getDictStorage()" ) HashingStorageLibrary lib ) {
449
+ @ Cached GetDictStorageNode getStore ,
450
+ @ CachedLibrary ("getStore.execute(s)" ) HashingStorageLibrary lib ) {
447
451
writeByte (TYPE_SET , version , buffer );
448
452
int len ;
453
+ HashingStorage dictStorage = getStore .execute (s );
449
454
if (hasFrame .profile (frame != null )) {
450
- len = lib .lengthWithState (s . getDictStorage () , PArguments .getThreadState (frame ));
455
+ len = lib .lengthWithState (dictStorage , PArguments .getThreadState (frame ));
451
456
} else {
452
- len = lib .length (s . getDictStorage () );
457
+ len = lib .length (dictStorage );
453
458
}
454
459
writeInt (len , version , buffer );
455
- for (DictEntry entry : s .entries ()) {
460
+ for (DictEntry entry : lib .entries (dictStorage )) {
456
461
getRecursiveNode ().execute (frame , entry .key , version , buffer );
457
462
}
458
463
}
459
464
460
465
@ Specialization (limit = "1" )
461
466
void handlePForzenSet (VirtualFrame frame , PFrozenSet s , int version , DataOutputStream buffer ,
462
467
@ Cached ("createBinaryProfile()" ) ConditionProfile hasFrame ,
463
- @ CachedLibrary ("s.getDictStorage()" ) HashingStorageLibrary lib ) {
468
+ @ Cached GetDictStorageNode getStore ,
469
+ @ CachedLibrary ("getStore.execute(s)" ) HashingStorageLibrary lib ) {
464
470
writeByte (TYPE_FROZENSET , version , buffer );
465
471
int len ;
472
+ HashingStorage dictStorage = getStore .execute (s );
466
473
if (hasFrame .profile (frame != null )) {
467
- len = lib .lengthWithState (s . getDictStorage () , PArguments .getThreadState (frame ));
474
+ len = lib .lengthWithState (dictStorage , PArguments .getThreadState (frame ));
468
475
} else {
469
- len = lib .length (s . getDictStorage () );
476
+ len = lib .length (dictStorage );
470
477
}
471
478
writeInt (len , version , buffer );
472
- for (DictEntry entry : s .entries ()) {
479
+ for (DictEntry entry : lib .entries (dictStorage )) {
473
480
getRecursiveNode ().execute (frame , entry .key , version , buffer );
474
481
}
475
482
}
0 commit comments