Skip to content

Commit 2eaf1cf

Browse files
committed
Increase interned to 16bits and adjust layout
1 parent fbc9c52 commit 2eaf1cf

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Include/cpython/unicodeobject.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ typedef struct {
109109
3: Interned, Immortal, and Static
110110
This categorization allows the runtime to determine the right
111111
cleanup mechanism at runtime shutdown. */
112-
uint8_t interned;
112+
uint16_t interned;
113113
/* Character size:
114114
115115
- PyUnicode_1BYTE_KIND (1):
@@ -149,7 +149,6 @@ typedef struct {
149149
the extra four bytes on 32-bit Windows. This is restricted features
150150
for specific compilers including GCC, MSVC, Clang and IBM's XL compiler. */
151151
unsigned short :10;
152-
unsigned char :8;
153152
} state;
154153
} PyASCIIObject;
155154

Objects/unicodeobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15726,7 +15726,7 @@ immortalize_interned(PyObject *s)
1572615726
_Py_DecRefTotal(_PyThreadState_GET());
1572715727
}
1572815728
#endif
15729-
FT_ATOMIC_STORE_UINT8_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_IMMORTAL);
15729+
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_IMMORTAL);
1573015730
_Py_SetImmortal(s);
1573115731
}
1573215732

@@ -15845,7 +15845,7 @@ intern_common(PyInterpreterState *interp, PyObject *s /* stolen */,
1584515845
_Py_DecRefTotal(_PyThreadState_GET());
1584615846
#endif
1584715847
}
15848-
FT_ATOMIC_STORE_UINT8_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_MORTAL);
15848+
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_MORTAL);
1584915849

1585015850
/* INTERNED_MORTAL -> INTERNED_IMMORTAL (if needed) */
1585115851

@@ -15981,7 +15981,7 @@ _PyUnicode_ClearInterned(PyInterpreterState *interp)
1598115981
Py_UNREACHABLE();
1598215982
}
1598315983
if (!shared) {
15984-
FT_ATOMIC_STORE_UINT8_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_NOT_INTERNED);
15984+
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_NOT_INTERNED);
1598515985
}
1598615986
}
1598715987
#ifdef INTERNED_STATS

0 commit comments

Comments
 (0)