Skip to content

Commit ea9d794

Browse files
generatedunixname89002005232357meta-codesync[bot]
authored andcommitted
Revert D92722098
Summary: This diff reverts D92722098 S620883, it could be causing pyperf samples to drop Depends on D92722098 Differential Revision: D92927513 fbshipit-source-id: f01a36f7688f3b01c667f21e6725c344f79de45c
1 parent 32508cf commit ea9d794

11 files changed

Lines changed: 1 addition & 95 deletions

File tree

cinderx/Jit/cell_helpers.c

Lines changed: 0 additions & 17 deletions
This file was deleted.

cinderx/Jit/hir/builder.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,13 +2979,8 @@ void HIRBuilder::emitStoreDeref(
29792979
Register* old = temps_.AllocateStack();
29802980
Register* dst = tc.frame.localsplus[idx];
29812981
Register* src = tc.frame.stack.pop();
2982-
#ifdef Py_GIL_DISABLED
2983-
// Use atomic swap for thread-safe cell access in FT-Python.
2984-
tc.emit<SwapCellItem>(old, dst, src);
2985-
#else
29862982
tc.emit<StealCellItem>(old, dst);
29872983
tc.emit<SetCellItem>(dst, src, old);
2988-
#endif
29892984
}
29902985

29912986
void HIRBuilder::emitLoadAssertionError(

cinderx/Jit/hir/hir.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ bool Instr::isReplayable() const {
499499
case Opcode::kRunPeriodicTasks:
500500
case Opcode::kSend:
501501
case Opcode::kSetCellItem:
502-
case Opcode::kSwapCellItem:
503502
case Opcode::kSetCurrentAwaiter:
504503
case Opcode::kSetDictItem:
505504
case Opcode::kSetSetItem:
@@ -795,7 +794,6 @@ bool isPassthrough(const Instr& instr) {
795794
case Opcode::kSetSetItem:
796795
case Opcode::kSetUpdate:
797796
case Opcode::kStealCellItem:
798-
case Opcode::kSwapCellItem:
799797
case Opcode::kStoreArrayItem:
800798
case Opcode::kStoreAttr:
801799
case Opcode::kStoreAttrCached:

cinderx/Jit/hir/hir.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,15 +2663,6 @@ DEFINE_SIMPLE_INSTR(LoadCellItem, (TOptObject), HasOutput, Operands<1>);
26632663
// in the cell that the cell is about to lose its reference to.
26642664
DEFINE_SIMPLE_INSTR(StealCellItem, (TObject), HasOutput, Operands<1>);
26652665

2666-
// Atomically swap the cell value, returning the old value. Used in FT-Python
2667-
// for thread-safe STORE_DEREF. Takes cell as operand 0 and new value as
2668-
// operand 1. Returns the old value (owned reference for decref).
2669-
DEFINE_SIMPLE_INSTR(
2670-
SwapCellItem,
2671-
(TObject, TOptObject),
2672-
HasOutput,
2673-
Operands<2>);
2674-
26752666
// Store a value to the cell in dst. The `old` arg is unused but exists in order
26762667
// to ensure that the previous cell contents are not decref-ed until after the
26772668
// new cell contents are in place.

cinderx/Jit/hir/hir_ops.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ namespace jit::hir {
150150
V(SetUpdate) \
151151
V(Snapshot) \
152152
V(StealCellItem) \
153-
V(SwapCellItem) \
154153
V(StoreArrayItem) \
155154
V(StoreAttr) \
156155
V(StoreAttrCached) \

cinderx/Jit/hir/instr_effects.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,6 @@ MemoryEffects memoryEffects(const Instr& inst) {
162162
case Opcode::kSetCellItem:
163163
return {true, AEmpty, {inst.NumOperands(), 2}, ACellItem};
164164

165-
// Atomically swaps cell value. Steals operand 1 (new value) and returns
166-
// owned reference to old value. Used for thread-safe STORE_DEREF.
167-
case Opcode::kSwapCellItem:
168-
return {false, AEmpty, {inst.NumOperands(), 2}, ACellItem};
169-
170165
// Returns a stolen (from the cell), not borrowed, reference.
171166
case Opcode::kStealCellItem:
172167
return commonEffects(inst, AEmpty);
@@ -238,13 +233,7 @@ MemoryEffects memoryEffects(const Instr& inst) {
238233
return borrowFrom(inst, AEmpty);
239234

240235
case Opcode::kLoadCellItem:
241-
#ifdef Py_GIL_DISABLED
242-
// In FT-Python, LoadCellItem calls PyCell_GetRef which returns an
243-
// owned (new) reference.
244-
return commonEffects(inst, AEmpty);
245-
#else
246236
return borrowFrom(inst, ACellItem);
247-
#endif
248237

249238
case Opcode::kLoadField: {
250239
auto& ldfld = static_cast<const LoadField&>(inst);
@@ -438,7 +427,6 @@ bool hasArbitraryExecution(const Instr& inst) {
438427
case Opcode::kSetFunctionAttr:
439428
case Opcode::kSnapshot:
440429
case Opcode::kStealCellItem:
441-
case Opcode::kSwapCellItem:
442430
case Opcode::kStoreArrayItem:
443431
case Opcode::kStoreField:
444432
case Opcode::kTpAlloc:

cinderx/Jit/hir/parser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,6 @@ HIRParser::parseInstr(std::string_view opcode, Register* dst, int bb_index) {
10411041
case Opcode::kSetDictItem:
10421042
case Opcode::kSetFunctionAttr:
10431043
case Opcode::kStealCellItem:
1044-
case Opcode::kSwapCellItem:
10451044
case Opcode::kStoreArrayItem:
10461045
case Opcode::kStoreField:
10471046
case Opcode::kTpAlloc:

cinderx/Jit/hir/pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ Type outputType(
234234
case Opcode::kLoadGlobalCached:
235235
case Opcode::kMatchClass:
236236
case Opcode::kStealCellItem:
237-
case Opcode::kSwapCellItem:
238237
case Opcode::kWaitHandleLoadWaiter:
239238
return TOptObject;
240239

cinderx/Jit/hir/printer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ static std::string format_immediates(const Function* func, const Instr& instr) {
294294
case Opcode::kSetUpdate:
295295
case Opcode::kSnapshot:
296296
case Opcode::kStealCellItem:
297-
case Opcode::kSwapCellItem:
298297
case Opcode::kStoreArrayItem:
299298
case Opcode::kStoreSubscr:
300299
case Opcode::kWaitHandleLoadCoroOrResult:

cinderx/Jit/jit_rt.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -578,23 +578,6 @@ LoadMethodResult JITRT_LoadSpecial(PyObject* self, int special_idx);
578578
void JITRT_AtQuiescentState(PyThreadState* tstate);
579579
#endif
580580

581-
#if PY_VERSION_HEX >= 0x030D0000
582-
583-
extern "C" {
584-
585-
/*
586-
* Atomically load cell value with new reference (for LOAD_DEREF).
587-
*/
588-
PyObject* JITRT_LoadCellItem(PyCellObject* cell);
589-
590-
/*
591-
* Atomically swap cell value, returns old value for decref (for STORE_DEREF).
592-
*/
593-
PyObject* JITRT_SwapCellItem(PyCellObject* cell, PyObject* new_value);
594-
}
595-
596-
#endif
597-
598581
/*
599582
* A PyObject that is used to indicate that an iterator has finished
600583
* normally. This must never escape into managed code.

0 commit comments

Comments
 (0)