Message266315
Demur: "This patch [ ushort.patch ] seeks to be a minimal change to achieve the desired aligned/batched memory read behavior of NEXTOP/NEXTARG."
We are concerned by undefined behaviours in CPython for portability reasons. Using a "unsigned short*" pointer avoids the undefined behaviour.
I'm talking about unsigned char* => unsigned short* conversion followed by a dereference:
+#define NEXTOPARG() (oparg = *(unsigned short*)next_instr, opcode = OPOF(oparg), oparg = ARGOF(oparg), next_instr += 2)
With ushort2.patch, the risk is reduced at once place which is now "protected" by an assertion:
+ assert(_Py_IS_ALIGNED(PyBytes_AS_STRING(co->co_code), unsigned short));
+ first_instr = (unsigned short*) PyBytes_AS_STRING(co->co_code); |
|
Date |
User |
Action |
Args |
2016-05-25 07:01:32 | vstinner | set | recipients:
+ vstinner, mark.dickinson, serhiy.storchaka, ztane, Demur Rumed, Adrian Wielgosik |
2016-05-25 07:01:32 | vstinner | set | messageid: <1464159692.43.0.255007199107.issue27097@psf.upfronthosting.co.za> |
2016-05-25 07:01:32 | vstinner | link | issue27097 messages |
2016-05-25 07:01:32 | vstinner | create | |
|