Re: com php-src: Fixes for x32 ABI: Zend/zend_long.h Zend/zend_types.h ext/date/lib/timelib_structs.h ext/standard/file.c ext/standard/streamsfuncs.c
| From: | Dmitry Stogov | Date: | Mon, 25 May 2015 14:30:49 +0000 |
| Subject: | Re: com php-src: Fixes for x32 ABI: Zend/zend_long.h Zend/zend_types.h ext/date/lib/timelib_structs.h ext/standard/file.c ext/standard/streamsfuncs.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-86904@lists.php.net to get a copy of this message | ||
Hi Nikita,
I've never able to check PHP on X32. Is it compatible now?
Did you see any performance improvement in comparison to x86 and X86_64?
Complete X32 support probably needs additional effort to enable global
register variables and assembler code conversion...
Thanks. Dmitry.
On Sat, May 23, 2015 at 10:18 PM, Nikita Popov <nikic@php.net> wrote:
> Commit: f3dde29394831c59fc927bd5e7a7800a3fbe8519
> Author: Nikita Popov <nikic@php.net> Sat, 23 May 2015 21:15:11
> +0200
> Parents: d5f695ce7b095610fe028166d8e3ce9c958d8020
> Branches: master
>
> Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=f3dde29394831c59fc927bd5e7a7800a3fbe8519
>
> Log:
> Fixes for x32 ABI
>
> I'm assuming that we want to have 64bit zend_longs on x32 here.
>
> This fixes two typos in __x86_64__ macros and adds sign-extension
> when assigning STREAM_COPY_ALL to zend_long.
>
> Changed paths:
> M Zend/zend_long.h
> M Zend/zend_types.h
> M ext/date/lib/timelib_structs.h
> M ext/standard/file.c
> M ext/standard/streamsfuncs.c
>
>
> Diff:
> diff --git a/Zend/zend_long.h b/Zend/zend_long.h
> index 1acd2cf..4c81105 100644
> --- a/Zend/zend_long.h
> +++ b/Zend/zend_long.h
> @@ -25,7 +25,7 @@
> #include "main/php_stdint.h"
>
> /* This is the heart of the whole int64 enablement in zval. */
> -#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) ||
> defined(_WIN64)
> +#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) ||
> defined(_WIN64)
> # define ZEND_ENABLE_ZVAL_LONG64 1
> #endif
>
> diff --git a/Zend/zend_types.h b/Zend/zend_types.h
> index d66da1e..3834835 100644
> --- a/Zend/zend_types.h
> +++ b/Zend/zend_types.h
> @@ -802,7 +802,7 @@ static zend_always_inline uint32_t zval_delref_p(zval*
> pz) {
> return --GC_REFCOUNT(Z_COUNTED_P(pz));
> }
>
> -#if SIZEOF_ZEND_LONG == 4
> +#if SIZEOF_SIZE_T == 4
> # define ZVAL_COPY_VALUE_EX(z, v, gc, t) \
> do {
> \
> uint32_t _w2 = v->value.ww.w2;
> \
> @@ -810,14 +810,14 @@ static zend_always_inline uint32_t
> zval_delref_p(zval* pz) {
> z->value.ww.w2 = _w2;
> \
> Z_TYPE_INFO_P(z) = t;
> \
> } while (0)
> -#elif SIZEOF_ZEND_LONG == 8
> +#elif SIZEOF_SIZE_T == 8
> # define ZVAL_COPY_VALUE_EX(z, v, gc, t) \
> do {
> \
> Z_COUNTED_P(z) = gc;
> \
> Z_TYPE_INFO_P(z) = t;
> \
> } while (0)
> #else
> -# error "Unknbown SIZEOF_ZEND_LONG"
> +# error "Unknown SIZEOF_SIZE_T"
> #endif
>
> #define ZVAL_COPY_VALUE(z, v)
> \
> diff --git a/ext/date/lib/timelib_structs.h
> b/ext/date/lib/timelib_structs.h
> index d68fbc1..33e9fce 100644
> --- a/ext/date/lib/timelib_structs.h
> +++ b/ext/date/lib/timelib_structs.h
> @@ -121,7 +121,7 @@ typedef unsigned __int64 uint64_t;
> #include <strings.h>
> #endif
>
> -#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) ||
> defined(_WIN64)
> +#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) ||
> defined(_WIN64)
> typedef int64_t timelib_long;
> typedef uint64_t timelib_ulong;
> # define TIMELIB_LONG_MAX INT64_MAX
> diff --git a/ext/standard/file.c b/ext/standard/file.c
> index 7aa1ce7..01c043f 100644
> --- a/ext/standard/file.c
> +++ b/ext/standard/file.c
> @@ -522,7 +522,7 @@ PHP_FUNCTION(file_get_contents)
> zend_bool use_include_path = 0;
> php_stream *stream;
> zend_long offset = -1;
> - zend_long maxlen = PHP_STREAM_COPY_ALL;
> + zend_long maxlen = (ssize_t) PHP_STREAM_COPY_ALL;
> zval *zcontext = NULL;
> php_stream_context *context = NULL;
> zend_string *contents;
> diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
> index fa9758b..965bd67 100644
> --- a/ext/standard/streamsfuncs.c
> +++ b/ext/standard/streamsfuncs.c
> @@ -397,7 +397,7 @@ PHP_FUNCTION(stream_get_contents)
> {
> php_stream *stream;
> zval *zsrc;
> - zend_long maxlen = PHP_STREAM_COPY_ALL,
> + zend_long maxlen = (ssize_t)
> PHP_STREAM_COPY_ALL,
> desiredpos = -1L;
> zend_string *contents;
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>