Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116885 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30079 invoked from network); 17 Jan 2022 11:02:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jan 2022 11:02:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 07C141804BA for ; Mon, 17 Jan 2022 04:12:31 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 04:12:30 -0800 (PST) Received: by mail-qt1-f180.google.com with SMTP id v7so18956324qtw.13 for ; Mon, 17 Jan 2022 04:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EVj1ccipPj1jYhLkssk39lmAvksNVuckbT7P51MJuWU=; b=Df9FQc+TAWc9idujO0jNS8MpIsv8Fo8jQPWWcDlRGghHfwRIJ0SmMmMd2OyxXvQlqR yuncCAG4Z7EtcDu/q2U4b0xEDebbl31O+X/qmjmFPaseF8bOf0riXhMz59fj6eBBUhaX T83QyPMmYRcpddU7em7ovzVrVDUgL8OxolCT16qYjCujh87hag6kXIIO1Gs7qJ1gTUxT UO5piqWwj2sbQK2G+cwAnRqqGxA1JQgsUShb+MLAofc7NMORsKmMvNENdVhUYxaloenh BBWcqpfqmWKXVwMcNxU6T3BFFKuex7ByM8p2gFHfYnAmAN8KHVIlvenmfihGdDwGp4gJ O1rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EVj1ccipPj1jYhLkssk39lmAvksNVuckbT7P51MJuWU=; b=yDkL5u9GOdyJDNpp9GsZh8R1K7IDkcgrwHpMZZde9og52xfbMID2WkKyeN3g8iTawV 4waaPVYahVsjCtjmmlP2e7a7q2oIeRzdHrxMFyt3Ydx4FSH7cdF3ihLHw6WdMLQv3yVN wAFlP03rSG1szbh0nmO1ZCxdDSyKkB9ulrPFrYWJj3ol0y9brL7sj3RHpIcvKKqc4/wF MKKw/MymrUylvipXz9QUUhoqAt/8zXqbg0/p4acDLbw3guh9wg838XfZD1avLEJy4Fwc DwtwEYPiYHcIJKdQCZyXb9ZkrwBZmc3ej2xAJ4NHHUuQzD+ETvApV9jklGRfMuTOrqjK CAsQ== X-Gm-Message-State: AOAM532G1eGWJzR69LI9Qbdu9lrB5Su9GXEr7CeahsEgHePX7ixOjf6k I2K419IwhCCr4RPSfwcp3zycB6edhrbeEyDHJfc= X-Google-Smtp-Source: ABdhPJxkmd5l5kaviA5NByBQVoXU4uJIkthJRHPk5emv1eqZGwmU9pZPa/sOwiB4dxG7wfbj+V301o1ljLfW2CI5IdQ= X-Received: by 2002:ac8:5acf:: with SMTP id d15mr17251058qtd.5.1642421549948; Mon, 17 Jan 2022 04:12:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 17 Jan 2022 15:12:19 +0300 Message-ID: To: "Su, Tao" Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000000e638b05d5c6117c" Subject: Re: [PHP-DEV] Reason for ZEND_JIT_COUNTER_INIT set to 32531? From: dmitrystogov@gmail.com (Dmitry Stogov) --0000000000000e638b05d5c6117c Content-Type: text/plain; charset="UTF-8" Oh, probably this is just the biggest prime number that fits into a signed 16-bit number :) 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 > > > > > --0000000000000e638b05d5c6117c--