@@ -344,6 +344,7 @@ static void doLocalsStorageUncachedAST(PFrame pyFrame, Frame frameToSync, @Suppr
344
344
@ Specialization (guards = { //
345
345
"!isBytecodeFrame(frameToSync)" ,
346
346
"isDictWithCustomStorage(pyFrame)" ,
347
+ "!hasCustomLocals(frameToSync, pyFrame)" ,
347
348
"frameToSync.getFrameDescriptor() == cachedFd" ,
348
349
}, //
349
350
limit = "1" )
@@ -389,7 +390,7 @@ static void doGenericDictCachedAST(VirtualFrame frame, PFrame pyFrame, Frame fra
389
390
}
390
391
}
391
392
392
- @ Specialization (guards = {"!isBytecodeFrame(frameToSync)" , "isDictWithCustomStorage(pyFrame)" }, replaces = "doGenericDictCachedAST" )
393
+ @ Specialization (guards = {"!isBytecodeFrame(frameToSync)" , "isDictWithCustomStorage(pyFrame)" , "!hasCustomLocals(frameToSync, pyFrame)" }, replaces = "doGenericDictCachedAST" )
393
394
static void doGenericDictAST (VirtualFrame frame , PFrame pyFrame , Frame frameToSync , @ SuppressWarnings ("unused" ) Node location ,
394
395
@ Cached HashingCollectionNodes .SetItemNode setItemNode ,
395
396
@ Cached BranchProfile updatedStorage ,
@@ -474,6 +475,7 @@ static void doLocalsStorageUncached(PFrame pyFrame, Frame frameToSync, @Suppress
474
475
@ Specialization (guards = { //
475
476
"isBytecodeFrame(frameToSync)" ,
476
477
"isDictWithCustomStorage(pyFrame)" ,
478
+ "!hasCustomLocals(frameToSync, pyFrame)" ,
477
479
"frameToSync.getFrameDescriptor() == cachedFd" ,
478
480
"variableSlotCount(cachedFd) < 32"
479
481
}, limit = "1" )
@@ -501,6 +503,7 @@ static void doGenericDictCachedExploded(VirtualFrame frame, PFrame pyFrame, Fram
501
503
@ Specialization (guards = { //
502
504
"isBytecodeFrame(frameToSync)" ,
503
505
"isDictWithCustomStorage(pyFrame)" ,
506
+ "!hasCustomLocals(frameToSync, pyFrame)" ,
504
507
"frameToSync.getFrameDescriptor() == cachedFd" ,
505
508
}, limit = "1" , replaces = "doGenericDictCachedExploded" )
506
509
static void doGenericDictCachedLoop (VirtualFrame frame , PFrame pyFrame , Frame frameToSync , @ SuppressWarnings ("unused" ) Node location ,
@@ -523,7 +526,8 @@ static void doGenericDictCachedLoop(VirtualFrame frame, PFrame pyFrame, Frame fr
523
526
}
524
527
}
525
528
526
- @ Specialization (guards = {"isBytecodeFrame(frameToSync)" , "isDictWithCustomStorage(pyFrame)" }, replaces = {"doGenericDictCachedExploded" , "doGenericDictCachedLoop" })
529
+ @ Specialization (guards = {"isBytecodeFrame(frameToSync)" , "isDictWithCustomStorage(pyFrame)" , "!hasCustomLocals(frameToSync, pyFrame)" }, replaces = {"doGenericDictCachedExploded" ,
530
+ "doGenericDictCachedLoop" })
527
531
static void doGenericDict (VirtualFrame frame , PFrame pyFrame , Frame frameToSync , @ SuppressWarnings ("unused" ) Node location ,
528
532
@ Cached BranchProfile updatedStorage ,
529
533
@ Cached ConditionProfile hasFrame ,
@@ -542,7 +546,7 @@ static void doGenericDict(VirtualFrame frame, PFrame pyFrame, Frame frameToSync,
542
546
}
543
547
}
544
548
545
- @ Specialization (guards = "!isDictWithCustomStorage( pyFrame)" )
549
+ @ Specialization (guards = "hasCustomLocals(frameToSync, pyFrame)" )
546
550
@ SuppressWarnings ("unused" )
547
551
static void doCustomLocalsObject (PFrame pyFrame , Frame frameToSync , Node location ) {
548
552
// nothing to do; we already worked on the custom object
@@ -611,6 +615,10 @@ protected static boolean isDictWithCustomStorage(PFrame pyFrame) {
611
615
return localsObject instanceof PDict && PGuards .isBuiltinDict ((PDict ) localsObject );
612
616
}
613
617
618
+ protected static boolean hasCustomLocals (Frame frameToSync , PFrame pyFrame ) {
619
+ return PArguments .getSpecialArgument (frameToSync ) == pyFrame .getLocalsDict ();
620
+ }
621
+
614
622
protected static LocalsStorage getLocalsStorage (PFrame pyFrame ) {
615
623
return (LocalsStorage ) ((PDict ) pyFrame .getLocalsDict ()).getDictStorage ();
616
624
}
0 commit comments