gh-101907: Stop using _Py_OPCODE and _Py_OPARG macros (GH-101912)

* gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h

* Make cases_generator correct on Windows
This commit is contained in:
Steve Dower 2023-02-20 14:56:48 +00:00 committed by GitHub
parent c00faf7943
commit a99eb5cd99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 200 additions and 184 deletions

View file

@ -274,31 +274,31 @@ write_instr(_Py_CODEUNIT *codestr, struct instr *instruction, int ilen)
int caches = _PyOpcode_Caches[opcode];
switch (ilen - caches) {
case 4:
codestr->opcode = EXTENDED_ARG;
codestr->oparg = (oparg >> 24) & 0xFF;
codestr->op.code = EXTENDED_ARG;
codestr->op.arg = (oparg >> 24) & 0xFF;
codestr++;
/* fall through */
case 3:
codestr->opcode = EXTENDED_ARG;
codestr->oparg = (oparg >> 16) & 0xFF;
codestr->op.code = EXTENDED_ARG;
codestr->op.arg = (oparg >> 16) & 0xFF;
codestr++;
/* fall through */
case 2:
codestr->opcode = EXTENDED_ARG;
codestr->oparg = (oparg >> 8) & 0xFF;
codestr->op.code = EXTENDED_ARG;
codestr->op.arg = (oparg >> 8) & 0xFF;
codestr++;
/* fall through */
case 1:
codestr->opcode = opcode;
codestr->oparg = oparg & 0xFF;
codestr->op.code = opcode;
codestr->op.arg = oparg & 0xFF;
codestr++;
break;
default:
Py_UNREACHABLE();
}
while (caches--) {
codestr->opcode = CACHE;
codestr->oparg = 0;
codestr->op.code = CACHE;
codestr->op.arg = 0;
codestr++;
}
}