Enable 64bit integer support on 32bit arch --enable-zend-int64 - #19079
Enable 64bit integer support on 32bit arch --enable-zend-int64#19079marc-mabe wants to merge 8 commits into
--enable-zend-int64#19079Conversation
|
I think this should go through the RFC process. There have been suggestions to drop 32-bit support, so I'm sure at least some people would object to expanding support further. I could see this as an alternative to dropping 32-bit support iff we also dropped 4-byte zend_long support, as that would align 32 and 64-bit. |
|
I have fixed some cases which failed due to SIZEOF_SIZE_T != SIZEOF_ZEND_LONG, but there are probably more. Currently, the test state is as follows: |
Yes, of course. At the current state I want to get to know the work needed to be done and do some benchmarks. For dropping 32-bit support entirely it seems to be to early at least for WebAssembly + there might be people hoping for supporting older (in some cases not that old) systems - so I don't thing it would go through currently. |
4fb8912 to
6b552c1
Compare
e28b737 to
f41823a
Compare
2c3b9d7 to
9cdbff2
Compare
327a244 to
6baa1ec
Compare
|
The lower three bits of Bucket byte offset are used to store flags. If Bucket is aligned to 8 bytes, the lower three bits are always zero and this gives no problems. With the change of zend_long from 32 to 64 bits, the size of Bucket changed (to 28 bytes) and it is not aligned to 8 bytes anymore. The memory address and the flags overlap. Changing Bucket to be 32 bytes fixes things: The flags are ZEND_BIND_REF, ZEND_BIND_IMPLICIT, ZEND_BIND_EXPLICIT. They are stored here: opline->extended_value = (uint32_t)((char*)value - (char*)CG(active_op_array)->static_variables->arData) | mode;and extracted here: value = (zval*)((char*)ht->arData + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT))); |
This PR allows to use 64bit integers on 32bit platforms if compiled with
--enable-zend-int64--enable-zend-int64)PHP_SYS_SIZE = [4|8])Zend/tests/andtests/ext/The main part is that
ZEND_ENABLE_ZVAL_LONG64 1gets defined.