Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116887 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46882 invoked from network); 17 Jan 2022 16:03:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jan 2022 16:03:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 321F3180550 for ; Mon, 17 Jan 2022 09:14:07 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 17 Jan 2022 09:14:06 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 229E35C031D for ; Mon, 17 Jan 2022 12:14:06 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute5.internal (MEProxy); Mon, 17 Jan 2022 12:14:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=C5efWi N/3urSPnNB4n+VdP2bkyQ/6kHSJ32NFIXwuHk=; b=nVF4pmiYcDtTS1wWMQc4Gc bnBHOYwndan+E2l5jLjSc7LWKYf3f/ybgNmhlEytxTBjkPopRPBRc/0a+PSJxpfN xiApkj9Khw/mX5hI3No3ulPRYAqmaLuBhjUXt/NN2Trb1/pROm0NuIwRLw96iIuU EdiJtyPfkeCnM3G0BK1cRo1xV+VwT83E/Dst9PP9xWnUIhomjhvTacJYnaa6LoF0 lXdCzt7GNb3zbNvBnOeBNHBm6i/nwSxd/54M3kyKmS6tnICdjVG9xlhyPNa+F8zU disuySuSK5/OQjXLuya8c018B7h8HTCVVvD2NE4AsDVewbOTeUfXYiySAJiAK8sw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddugdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefgffek udevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E3C99AC0E9C; Mon, 17 Jan 2022 12:14:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4569-g891f756243-fm-20220111.001-g891f7562 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Mon, 17 Jan 2022 11:13:45 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Reason for ZEND_JIT_COUNTER_INIT set to 32531? From: larry@garfieldtech.com ("Larry Garfield") On Mon, Jan 17, 2022, at 6:12 AM, Dmitry Stogov wrote: > Oh, probably this is just the biggest prime number that fits into a signed > 16-bit number :) Seems like the sort of thing that should be documented inline. (Also, why it needs to be a prime number.) --Larry Garfield > On Mon, Jan 17, 2022 at 10:49 AM Su, Tao wrote: > >> Thanks Dmitry for the information. >> >> With a few debug sessions, I found that 32531 is working well >> for any thresholds, and is also a big prime number :-). >> >> >> -----Original Message----- >> From: Dmitry Stogov >> Sent: Monday, January 17, 2022 1:37 PM >> To: Su, Tao >> Cc: PHP internals >> Subject: Re: [PHP-DEV] Reason for ZEND_JIT_COUNTER_INIT set to 32531? >> >> This it's my choice. >> This number is common for all JIT counters (hot_loop, hot_func, >> hot_return). >> It's value was selected to provide the best precision when different >> counters have different thresholds. >> Unfortunately, I can't remember the exact equations or logic I used at >> that time. >> >> Thanks. Dmitry. >> >> On Thu, Jan 13, 2022 at 1:01 PM Su, Tao wrote: >> >> > Hi Internal, >> > I am not sure this is a correct mail list for asking source code >> > related question. >> > If not, I am sorry. Appreciate you guys' help. >> > >> > I am reading PHP8 JIT related source code and found that zend_jit.h >> > has a magic definition ZEND_JIT_COUNTER_INIT as 32531 which I do not >> > quite understand how this number was chosen and why? >> > Anybody can provide some historic information? >> > #define ZEND_JIT_COUNTER_INIT 32531 >> > >> > A code example using this definition (looks like the 2nd parameter >> > computes into a fixed number if hot_func is set by php.ini) >> > ZEND_OPCODE_TAIL_CALL_EX(zend_jit_trace_counter_helper, >> > ((ZEND_JIT_COUNTER_INIT + JIT_G(hot_func) - 1) / >> > JIT_G(hot_func))); >> > >> > >> > ======================================= >> > Tony Su (Su, Tao) >> > make a 'lazy' programmer diligently with efficiency >> > >> > >>