Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113584 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27365 invoked from network); 17 Mar 2021 03:34:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Mar 2021 03:34:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3D59C1804C0 for ; Tue, 16 Mar 2021 20:27:55 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2053.outbound.protection.outlook.com [40.107.21.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 16 Mar 2021 20:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=glkfGaaZZYYXg+19Sd7MB6ms/+FdQUaexe2LZ6/hYoM=; b=Yz07bBn0YQ8yWOSLxVyutqGcx21SuSS1RlZ9cvWvzyRTnVy5gZXbCgjwMPGn8s/qvr3t6M2rbfgHz9IPTLNtGcWlP85EGP+myl8NHRWOoHnrbPRHSLFsWM/kYVyle2Ml9OLWKFrCsdOqBUac/xzBIDBIDqHYHTgLUxqWLScflQI= Received: from AM6PR10CA0083.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::24) by DB8PR08MB4171.eurprd08.prod.outlook.com (2603:10a6:10:a4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 03:27:51 +0000 Received: from AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::4c) by AM6PR10CA0083.outlook.office365.com (2603:10a6:209:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 03:27:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.php.net; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.php.net; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT035.mail.protection.outlook.com (10.152.16.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.30 via Frontend Transport; Wed, 17 Mar 2021 03:27:50 +0000 Received: ("Tessian outbound de94f9ae513a:v87"); Wed, 17 Mar 2021 03:27:50 +0000 X-CR-MTA-TID: 64aa7808 Received: from 0e6002624d6f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9649C69D-9A7A-46F5-93CF-FE4DE95B9B7D.1; Wed, 17 Mar 2021 03:27:43 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0e6002624d6f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 17 Mar 2021 03:27:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AFeHgVCUweYEJ3zL6dsamQI5wHHCz3LnqzrwMkWuCweh2tStAvWYrI/XrkJ7UlQYXT9pweOwLWK0Xuz32gsJhzr9b9LLtL2HV6XBydgaXzfg5gETlpg+MiV5gyDba7/4U/U5EseTOgeK5Z5IPmU7zzdHs1XntM2kNdCgJsUezB8q7NFZ55ECDpLVhJUpHM1ntlEkJq+LZAtGh3xETblJuZ1Bmrb6I1AdutSReiDrd+6+v6vYU0jXMsHg8jM75ZNTvEonr0APsh4dj7ULe4MkdyKKyqr3AXzxRwW1n0iY6Rwx3rv3U/KPeyxmyxNbvMxM4X11mpXxF2s8ZoZvRfj+LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=glkfGaaZZYYXg+19Sd7MB6ms/+FdQUaexe2LZ6/hYoM=; b=RCqw6hcjkDqTDpFfyq1HkZfJczUEGSjgZHhAhdhWVPWET4B2kSA8ALgI/nAwX/u0ZFfzNDaiD5KWp+d61tTUvRU+p9YlniUZM3LCblgzG8wtdOS5GF77T6PXFjD1IMLTK4X+XU94vbRyfQb5n7uppGMvKaY13uZXsx2A2gvilcLZ5vSaGMp3BNXbLhqoJD48+QauX2PrzwnLIU2OORR3rLeJkKrgawyf3pDLFI2srISTtRdtWGYgpfRJie5TkpXy3+SPGDXmTOQd3TxziLNQjl5pr4nWqMKYTzJYe/vHRA76YGvaKuI8HYscJIrlOSOhrS+qh8Lk/jJ5Le8fVJLipQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=glkfGaaZZYYXg+19Sd7MB6ms/+FdQUaexe2LZ6/hYoM=; b=Yz07bBn0YQ8yWOSLxVyutqGcx21SuSS1RlZ9cvWvzyRTnVy5gZXbCgjwMPGn8s/qvr3t6M2rbfgHz9IPTLNtGcWlP85EGP+myl8NHRWOoHnrbPRHSLFsWM/kYVyle2Ml9OLWKFrCsdOqBUac/xzBIDBIDqHYHTgLUxqWLScflQI= Received: from VE1PR08MB5565.eurprd08.prod.outlook.com (2603:10a6:800:1b2::12) by VI1PR08MB4384.eurprd08.prod.outlook.com (2603:10a6:803:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 03:27:41 +0000 Received: from VE1PR08MB5565.eurprd08.prod.outlook.com ([fe80::fcd3:5b65:dcd1:3663]) by VE1PR08MB5565.eurprd08.prod.outlook.com ([fe80::fcd3:5b65:dcd1:3663%4]) with mapi id 15.20.3955.018; Wed, 17 Mar 2021 03:27:41 +0000 To: "internals@lists.php.net" CC: nd Thread-Topic: RFC: PHP JIT/arm64 port Thread-Index: Adca3D/0MbeEAkm8T2OFI5fdn29ziA== Date: Wed, 17 Mar 2021 03:27:40 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: BFC01B635AEF034D9D0932A014CB002A.0 x-checkrecipientchecked: true Authentication-Results-Original: lists.php.net; dkim=none (message not signed) header.d=none;lists.php.net; dmarc=none action=none header.from=arm.com; x-originating-ip: [203.126.0.113] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3d621ac9-7248-462d-16b2-08d8e8f4a4c6 x-ms-traffictypediagnostic: VI1PR08MB4384:|DB8PR08MB4171: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 19EB0vqdLvZAWZ1OleMI1R4OGn5t39lNx74gd+opdSle4U6ciM7eiNyRhwPlHPOq+fK8n+A5zmrh21YpwLlNDJjf8kybOwI6lsPpfnlxYvwiZj2SobYYKt4gc+M2saSZAKhPlAY06TbJcv1jk+K40X83jQ4BkCKMh67OBjWN97woo1pgfYl+0IrEzwpULqn8fs02GYLqxpDmmvHFA51Lab0iSMS9qeLJN2EZCLNQNebJlVNQXH086AxbojrBXDE9CnFuFiVscrEXbR5Y1b/OKUPFhk2BNJga8nPNgwTYqP82m3Ldzw4jsepmhct2PsF/Oc1NYnemeN5qn4it9k+spS+tSoXIYG+PlVwfImcUouUAPqgqryonDr/EmV4lYYiJIyXkatVp5fRb5ZF7ii6K4d5xZzM2MHnMGflq4/iMkAozE7C8QGWb/dRIugGZLeFzDDA6whLvj/OwyDjSYzHmIvwZuNoIhkHVYEGy7Sc61+ra30kohWhGGHRv5wSqG2Xl/XZtIEhWR9dUVzMPZkX/iytP5pFuaMNVxL37yLyQVuMEyk1gG7hshTG9u3DUgBwsdMuIOEvgrioOzzqUIWvv+K3sWqP1ZVdLLobDqqIeffEFN0uF0jtmEVGYNYyt72m5 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB5565.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(366004)(39860400002)(346002)(376002)(52536014)(7696005)(478600001)(6916009)(9686003)(2906002)(8676002)(55016002)(966005)(9326002)(33656002)(21615005)(26005)(86362001)(8936002)(71200400001)(83380400001)(66476007)(66946007)(66446008)(66556008)(64756008)(6506007)(316002)(166002)(4326008)(5660300002)(76116006)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?QQPNbaHB5zh2HXnIHeeRiuIIMB14kK54OVCjRaEbJ97KtwVtYWLuGcDwTZXs?= =?us-ascii?Q?4hCtq8nPrRWXHIqhTyG2OMTIhBX4tAsBIAsKXoVEQrsSZLq3VxmnouJY8z8X?= =?us-ascii?Q?T2reBhsFEORVnxIwruJexasOvXsTfw4LRDM8UAjllEQtfX4QrqYJ7TrcIEwa?= =?us-ascii?Q?cpDZiop0uN/FSz5GsP9d5FnWke0L22YrKXMtIVM8OesI1SKNP6HC/sx0PiDg?= =?us-ascii?Q?YsH1rMGXSq7x+B/E1qIMeY7YS3nwlq157QhTb0IQ3VQsSdnXLf1Cox6mYoqJ?= =?us-ascii?Q?LAZhvib3lph/esbHPkO/TqXSCxHIxp8yXBZGZIm7Jitx9LsqP0Tt/P+NiWQg?= =?us-ascii?Q?7WKpB7mTDeYrLMbqyTdlyVuKjajTYrP4kpC3F5IFUHWCxsGrr2DVACI5G2pr?= =?us-ascii?Q?DPzKhKE7FdQuf1LDTqID2/2vRSFgsSoPfZ/NFtgU+h6mssdojCV5CEfYuWyD?= =?us-ascii?Q?aN8DwKYQhfWDvwAqxtjwbYPrtFKmIlxL7n3MEElutfcz3icYDCkA1/uagcq8?= =?us-ascii?Q?hmxujpcPDzPuN9VpfLYitxg0+41piro7Fq2Kaq+WtNLulAlRGUqz1g+Hd1YJ?= =?us-ascii?Q?TAXiSOGpKp6UuxkLUjKiwDoDCK9PGGspbzCouhjONFtXltVsWnK2OyUICVnR?= =?us-ascii?Q?kGD6nirSl/iA8w8N6UTs8HUjwHppzoyELfWFK0eW7MDiLZqM6kkqnrW5l0E5?= =?us-ascii?Q?wBi5gcW5wuWgvObpVnReR3U5hl1uO1HEjdGGT6/QPexkJ+gHTqgL3K4NjDvM?= =?us-ascii?Q?URCG4FezrVu4g92XUVkQeOGaxIycP/VlJuqX2fbqyjRAZQU4z+yX9ILXLfcP?= =?us-ascii?Q?pTkA7IPBSZIFA3GirJFH5iiuSIkl2WtXQf8U50MpPEIzb7q8TBtZwgVwRM/s?= =?us-ascii?Q?EuWFC+S5+CxwqITEnmtWJAcTOSrEG1VPI/pBzDLQ+kWaJ70WLNesHSkmKRRu?= =?us-ascii?Q?5aaJOuufRc0qMvnM3sPE2MWXN8ag+crJsUkvqLwTz3bXlSEsxQDMKv4dRmyI?= =?us-ascii?Q?O+O2BnlCtrPeAClyhS2MFlW29V5Wv8Das/6PwbBb8wyO3mWfQ7iXubqK6GVQ?= =?us-ascii?Q?2FOif9351ILJTPGn6fX/cP/4hi4BdW6LCV480n+jGYjFpaY1tKmHzoLOrRwj?= =?us-ascii?Q?57Jx1yKtaZryK2w0r06q/5D/jy6Jv3nnVBFxaSvbx7ERhKYw9gAh6dYVhtWu?= =?us-ascii?Q?OB10lVI/aIYFmVC1VAyNtie1tQrkHeAgfdByYct2AXAN9rQ6RRJGZ+U/iX2H?= =?us-ascii?Q?9zqscy8ygvym1scAv0ZjXpzSqwFQGRevgik4dqGXu7YUjPaPppDGeguaLHzD?= =?us-ascii?Q?m1A=3D?= x-ms-exchange-transport-forked: True Content-Type: multipart/alternative; boundary="_000_VE1PR08MB55650EEDE7D8DE84A09A7339EB6A9VE1PR08MB5565eurp_" MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4384 Original-Authentication-Results: lists.php.net; dkim=none (message not signed) header.d=none;lists.php.net; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: d20ef35d-c219-4a58-c9f8-08d8e8f49eff X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WYdu699ZbRF5v5SCOGfXD0VFUIMxxOoet7S0sYPXEz5cNoeEm6AZARDinbG80f+RBBMj7w7nlSEbT9pbS6QgPPV1CJaDQto8MyBWcYxWf8BIpecHzCi3rpci3Gj+SHCHk+PLWd5jkZ5dQHyJVzlK4RdaC7r7XR4DmOAtG1o7w51Q8nvtyxU+mZ2f/HKS8RrXgLKC+kE4oI82lHEYiR1EtsmOc6KXi/ARg1gDT/03YLv2ywUUfMculKvKyh0yoSrb7DTn4sgS/+vvekWaaAP4RMLPjLe+168gN9ml7Izp5QKJF4kmS8kX9j762jWeaS3ygtoTgTxcYpDo8BlqT//7434sVfE8VNL+FMR2BSdffbq9D22wMAsRcOi2c9FN9xDE5bwiCOcxVX4iex1jguGrr5oVpnawldh4/q47ILa0stttSqEmUiLxrtYqYZxok8VN+j3aO384vEGaRAJmOS/q84VhyR19HdslOOabRMBzmGPR9PD08WFxBZNK2yKFQ9fx/MKFqo6zAQyORAxrlhqnZqTKy2IUbBJge3O6E2qioT3jr5VnoSKSuXWawpqA3YDOsdkJFXKSqI4Pnv6+FV8sVN76oIuJqrVlI/tVV+7xysXM37C5Kowu0JMVzlnsZLUlCobE5B+sCMhqxYYGPOR3K/AckyfBlNW2PGgokrcNphpffHMi3iWuaX7lY+Rir6VViMTiq+CwHJlC43yPAd1kI655QLaarbnxqUFW4WzCZso= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(39860400002)(376002)(136003)(346002)(396003)(46966006)(36840700001)(36860700001)(8936002)(7696005)(356005)(8676002)(26005)(21615005)(478600001)(4326008)(83380400001)(82740400003)(6916009)(33656002)(5660300002)(186003)(52536014)(55016002)(336012)(70586007)(70206006)(47076005)(9686003)(86362001)(9326002)(81166007)(316002)(166002)(966005)(82310400003)(2906002)(6506007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 03:27:50.6425 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d621ac9-7248-462d-16b2-08d8e8f4a4c6 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4171 Subject: RFC: PHP JIT/arm64 port From: Hao.Sun@arm.com (Hao Sun) --_000_VE1PR08MB55650EEDE7D8DE84A09A7339EB6A9VE1PR08MB5565eurp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Internals, Currently PHP JIT only supports x86 and x86_64 CPUs on POSIX platforms and = Windows.[1] With the prevalence of PHP language and the notable growth of ARM-based servers market, we believe JIT/arm64 would be in urgent= need in the near future. As an initial effort to enable PHP JIT/arm64, we (ARM) have supported the b= asic functionality, and (partially) implemented the compilation for several opcodes. Currently a number of simple JIT test cases from PHP test = framework can be passed on ARM-based machine. There are still a lot of missing parts, such as hot loops, class/object/array operations, excepti= on handling, etc, and we will continue working on them. We would like to share our work with you (See the draft patch https://githu= b.com/shqking/php-src/commit/6aaf935). Any feedback would be greatly appreciated, and please let we know if anyone= wants to contribute to this port. Thanks, Hao SUN Email: hao.sun@arm.com ------------------------------------------------------- Main updates: 1. JIT backend for AArch64 A new alternative, i.e. AArch64, was added while building PHP JIT. See the = updates in the following files. Note that we adopt capstone[2] for disassembly on AArch64. build/Makefile.global ext/opcache/config.m4 ext/opcache/config.w32 ext/opcache/jit/Makefile.frag ext/opcache/jit/zend_jit.c ext/opcache/jit/zend_jit_vm_helpers.c ext/opcache/jit/zend_jit_disasm_arm64.c ext/opcache/jit/zend_jit_gdb.c ext/opcache/jit/zend_jit_perf_dump.c 2. DynASM library PHP JIT uses DynASM[3] (developed for LuaJIT project) to generate native co= de on the fly. We added two useful but missing features, global label reference and dynamic register names, into DynASM/arm64. See the updates in= files: ext/opcache/jit/dynasm/dasm_arm64.h ext/opcache/jit/dynasm/dasm_arm64.lua Note that these two features are available on DynASM/x86. 3. compilation for opcodes on AArch64 Our main work falls in the following files. ext/opcache/jit/zend_jit_arm64.h ext/opcache/jit/zend_jit_arm64.dasc ext/opcache/jit/zend_jit_internal.h Zend/zend_vm_opcodes.h * AArch64 registers and calling conventions are defined. * Instruction cache must be flushed for the JIT-ed code on AArch64. See mac= ro JIT_CACHE_FLUSH in file 'zend_jit_internal.h'. * We have (partially) implemented the compilation for several opcodes, main= ly for the function-based JIT (with opcache.jit=3D1203). Currently, test cases involving internal function call (e.g. var_dump), additions with= integers/floating-point numbers, integer overflows and simple exception, can be supported now. See our newly added test cases under direc= tory 'ext/opcache/tests/jit/arm64/'. * Trace counter stubs are implemented for tracing JIT (with opcache.jit=3D1255). See zend_jit_hybrid_trace_counter_stub() and zend_jit_= hybrid_hot_trace_stub() in file 'zend_jit_arm64.dasc'. Hot functions can be recognized and compiled successfully. See the test case 'h= ot_func_002.phpt'. How to build and test: Our local test environment is an ARM-based server with Ubuntu 20.04 and GCC= -10. We follow the building commands as shown in the readme file [4]. Note that library capstone should be installed in advance. We suggest running the JIT test cases using the following command. In our l= ocal test, 59 out of all 128 cases can be passed currently. $ make test TESTS=3D'-d opcache.jit=3D1203 ext/opcache/tests/jit/' [1] https://wiki.php.net/rfc/jit [2] https://www.capstone-engine.org/ [3] https://luajit.org/dynasm.html [4] https://github.com/php/php-src --_000_VE1PR08MB55650EEDE7D8DE84A09A7339EB6A9VE1PR08MB5565eurp_--