@@ -1530,82 +1530,85 @@ specialize_load_global_lock_held(
1530
1530
_PyLoadGlobalCache * cache = (_PyLoadGlobalCache * )(instr + 1 );
1531
1531
assert (PyUnicode_CheckExact (name ));
1532
1532
if (!PyDict_CheckExact (globals )) {
1533
- unspecialize ( instr , SPEC_FAIL_LOAD_GLOBAL_NON_DICT );
1534
- return ;
1533
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_LOAD_GLOBAL_NON_DICT );
1534
+ goto fail ;
1535
1535
}
1536
1536
PyDictKeysObject * globals_keys = ((PyDictObject * )globals )-> ma_keys ;
1537
1537
if (!DK_IS_UNICODE (globals_keys )) {
1538
- unspecialize ( instr , SPEC_FAIL_LOAD_GLOBAL_NON_STRING_OR_SPLIT );
1539
- return ;
1538
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_LOAD_GLOBAL_NON_STRING_OR_SPLIT );
1539
+ goto fail ;
1540
1540
}
1541
1541
Py_ssize_t index = _PyDictKeys_StringLookup (globals_keys , name );
1542
1542
if (index == DKIX_ERROR ) {
1543
- unspecialize ( instr , SPEC_FAIL_EXPECTED_ERROR );
1544
- return ;
1543
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_EXPECTED_ERROR );
1544
+ goto fail ;
1545
1545
}
1546
1546
PyInterpreterState * interp = _PyInterpreterState_GET ();
1547
1547
if (index != DKIX_EMPTY ) {
1548
1548
if (index != (uint16_t )index ) {
1549
- unspecialize ( instr , SPEC_FAIL_OUT_OF_RANGE );
1550
- return ;
1549
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
1550
+ goto fail ;
1551
1551
}
1552
1552
uint32_t keys_version = _PyDict_GetKeysVersionForCurrentState (
1553
1553
interp , (PyDictObject * ) globals );
1554
1554
if (keys_version == 0 ) {
1555
- unspecialize ( instr , SPEC_FAIL_OUT_OF_VERSIONS );
1556
- return ;
1555
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_VERSIONS );
1556
+ goto fail ;
1557
1557
}
1558
1558
if (keys_version != (uint16_t )keys_version ) {
1559
- unspecialize ( instr , SPEC_FAIL_OUT_OF_RANGE );
1560
- return ;
1559
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
1560
+ goto fail ;
1561
1561
}
1562
1562
cache -> index = (uint16_t )index ;
1563
1563
cache -> module_keys_version = (uint16_t )keys_version ;
1564
1564
specialize (instr , LOAD_GLOBAL_MODULE );
1565
1565
return ;
1566
1566
}
1567
1567
if (!PyDict_CheckExact (builtins )) {
1568
- unspecialize ( instr , SPEC_FAIL_LOAD_GLOBAL_NON_DICT );
1569
- return ;
1568
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_LOAD_GLOBAL_NON_DICT );
1569
+ goto fail ;
1570
1570
}
1571
1571
PyDictKeysObject * builtin_keys = ((PyDictObject * )builtins )-> ma_keys ;
1572
1572
if (!DK_IS_UNICODE (builtin_keys )) {
1573
- unspecialize ( instr , SPEC_FAIL_LOAD_GLOBAL_NON_STRING_OR_SPLIT );
1574
- return ;
1573
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_LOAD_GLOBAL_NON_STRING_OR_SPLIT );
1574
+ goto fail ;
1575
1575
}
1576
1576
index = _PyDictKeys_StringLookup (builtin_keys , name );
1577
1577
if (index == DKIX_ERROR ) {
1578
- unspecialize ( instr , SPEC_FAIL_EXPECTED_ERROR );
1579
- return ;
1578
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_EXPECTED_ERROR );
1579
+ goto fail ;
1580
1580
}
1581
1581
if (index != (uint16_t )index ) {
1582
- unspecialize ( instr , SPEC_FAIL_OUT_OF_RANGE );
1583
- return ;
1582
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
1583
+ goto fail ;
1584
1584
}
1585
1585
uint32_t globals_version = _PyDict_GetKeysVersionForCurrentState (
1586
1586
interp , (PyDictObject * ) globals );
1587
1587
if (globals_version == 0 ) {
1588
- unspecialize ( instr , SPEC_FAIL_OUT_OF_VERSIONS );
1589
- return ;
1588
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_VERSIONS );
1589
+ goto fail ;
1590
1590
}
1591
1591
if (globals_version != (uint16_t )globals_version ) {
1592
- unspecialize ( instr , SPEC_FAIL_OUT_OF_RANGE );
1593
- return ;
1592
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
1593
+ goto fail ;
1594
1594
}
1595
1595
uint32_t builtins_version = _PyDict_GetKeysVersionForCurrentState (
1596
1596
interp , (PyDictObject * ) builtins );
1597
1597
if (builtins_version == 0 ) {
1598
- unspecialize ( instr , SPEC_FAIL_OUT_OF_VERSIONS );
1599
- return ;
1598
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_VERSIONS );
1599
+ goto fail ;
1600
1600
}
1601
1601
if (builtins_version > UINT16_MAX ) {
1602
- unspecialize ( instr , SPEC_FAIL_OUT_OF_RANGE );
1603
- return ;
1602
+ SPECIALIZATION_FAIL ( LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
1603
+ goto fail ;
1604
1604
}
1605
1605
cache -> index = (uint16_t )index ;
1606
1606
cache -> module_keys_version = (uint16_t )globals_version ;
1607
1607
cache -> builtin_keys_version = (uint16_t )builtins_version ;
1608
1608
specialize (instr , LOAD_GLOBAL_BUILTIN );
1609
+ return ;
1610
+ fail :
1611
+ unspecialize (instr );
1609
1612
}
1610
1613
1611
1614
void
0 commit comments