Skip to content

Instantly share code, notes, and snippets.

View shqking's full-sized avatar

Hao Sun shqking

  • Nvidia
  • Shanghai, China
  • 09:26 (UTC +08:00)
View GitHub Profile
@shqking
shqking / tracing-JIT-laravel-issue.md
Last active October 26, 2021 01:55
tracing-JIT-laravel

Tracing JIT issue on laravel benchmark.

  1. Both JIT/arm64 and JIT/x86 are affected.
  2. only CALL+noGRV is affected. JIT has three configurations, HYBRID, CALL with global register variabels feature(CALL+GRV for short) and CALL+noGRV. In my local test, only CALL+noGRV has this issue, i.e. --disable-gcc-global-regs should be passed.

Reproduce in laravel:

php vendor/bin/phpunit --group default
@shqking
shqking / function-jit-lavarel
Last active October 14, 2021 00:45
function JIT failed on lavarel
```
# php vendor/bin/phpunit ./tests/Integration/Notifications/SendingNotificationsWithLocaleTest.php
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.0-dev
Configuration: /opt/php-oss/framework/phpunit.xml.dist
......AddressSanitizer:DEADLYSIGNAL
=================================================================
==410160==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000348 (pc 0x7f28ee00886f bp 0x7ffe6a700290 sp 0x7ffe6a700210 T0)
@shqking
shqking / PHP-JIT-ARM64-M1.md
Last active November 23, 2021 09:25
Try out PHP JIT on AArch64 platform
@shqking
shqking / check-element.diff
Last active September 29, 2021 19:35
PHP range.phpt issue: arm64 machine only
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 6345dd4ebb..98997fb493 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2782,6 +2782,7 @@ double_str:
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
for (i = 0, element = low; i < size && element <= high; ++i, element = low + (i * step)) {
+ printf("element %d-th: %.16f\n", i, element);
ZEND_HASH_FILL_SET_DOUBLE(element);
@shqking
shqking / mmap-twice.c
Created July 22, 2021 08:35
mmap-twice
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include <sys/stat.h>
#define READ_ADDR(addr, offset) printf("==" #addr ": offset " #offset ": %p, value: %d\n", addr + offset, *(addr + offset));
@shqking
shqking / fatal-errors.md
Last active July 12, 2021 13:58
PHP-community-job-commit-0d6358f2c

opcache.jit=0 (failed in both x86 and arm64)

# ERROR 1: Laravel
Fatal error: During inheritance of JsonSerializable: Uncaught Declaration of Illuminate\Support\Fluent::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed

# ERROR 2: Amphp
Fatal error: PHPUnit\Framework\Error\Deprecated: Implicit conversion from float-string "15.24" to int loses precision in /opt/php-oss/amp/test/PromiseTest.php:329
@shqking
shqking / tlv_get_addr.S
Created May 25, 2021 05:31
tlv_get_addr disassembly code
libdyld.dylib`tlv_get_addr:
-> 0x19eb86940 <+0>: ldr x16, [x0, #0x8]
0x19eb86944 <+4>: mrs x17, TPIDRRO_EL0
0x19eb86948 <+8>: and x17, x17, #0xfffffffffffffff8
0x19eb8694c <+12>: ldr x17, [x17, x16, lsl #3]
0x19eb86950 <+16>: cbz x17, 0x19eb86960 ; <+32>
0x19eb86954 <+20>: ldr x16, [x0, #0x10]
0x19eb86958 <+24>: add x0, x17, x16
0x19eb8695c <+28>: ret
0x19eb86960 <+32>: stp x29, x30, [sp, #-0x10]!
@shqking
shqking / macos-zts.MD
Last active June 29, 2023 01:47
Macos ZTS

####Test case:

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

__thread int x = 0;

int main()
{