Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93376 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11114 invoked from network); 17 May 2016 14:28:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2016 14:28:19 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.179 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.179 mail-yw0-f179.google.com Received: from [209.85.161.179] ([209.85.161.179:36358] helo=mail-yw0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/00-11000-18A2B375 for ; Tue, 17 May 2016 10:28:19 -0400 Received: by mail-yw0-f179.google.com with SMTP id x189so16999316ywe.3 for ; Tue, 17 May 2016 07:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=flXAL70X5QOPaKBPrgG1Y7wTiIlD9PHEFdcLXMNpneU=; b=z/eA+ibsGcQmIJ1G6V5NlZAkNg6ADeOZKl9o7iWzS+skhTN0WZ/HVa3uUeq9IIIvy6 LQ1o9ZMxWQ8sB8cbnQ0W0WM9AFZNrha26DkNMYnuWh+vQxQElaYsK44ORV47a9vcltt3 8dqjieQajHMWDyNHW5lckb8BSMaSpsmBK+SCiWYazF8dkpX3FUci8IOmlxfhMvJjkY6o 1AijkdsqbHSmb4E3FP33Hdccw5eeJCWqFJDEZglewuaB87rJavBGNFKHy2x4IUE4+/mF W28zfXKA5c08M07sP2Sp5FYIWvA0oywH16SikPPTTsR9FCRtDIbNPcEmtKlyYb2AA/Sd Mrtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=flXAL70X5QOPaKBPrgG1Y7wTiIlD9PHEFdcLXMNpneU=; b=fl4u5P19tfYXk39VfSmSE8KDn20Kuao7x5xH8FPpvItCm8jwU9gHPW/N8ii/br2F5Q u9ayFat5Nh8MibkyiJo00NjZCElxbZ4ZpGbwGR4N3Ehpi269nlYYAQzAw/b+A/jBksjt 4BUZqDw1Jrn+n1M9M+HHWho4VJqx5f6e5OLm1D5v6NaeFRc4q1Sm1oU3fHFNnmiU+WcX mO6tsBrVdA+jeIsrawAqBJKgOGv5naj3Ew/L9FCJgUaKfzbpBLEMzlGThRE/O27r5Od6 FzXzfF25j8dIvjtqq395xrOD3TUWC8TUrP3wqawNl4NOnkmu1CNCHRx/z3eVNEEly3Ai 2L4w== X-Gm-Message-State: AOPr4FUm0ZJn9Gv3BjrnaSrK26Dm2elYZ7qfCn3nGvnpwNCnnRla5l0/4sqtAQ6bMMO2cEgclKn82P/8od1Xfw== MIME-Version: 1.0 X-Received: by 10.37.208.201 with SMTP id h192mr765903ybg.46.1463495294932; Tue, 17 May 2016 07:28:14 -0700 (PDT) Received: by 10.13.239.3 with HTTP; Tue, 17 May 2016 07:28:14 -0700 (PDT) In-Reply-To: References: Date: Tue, 17 May 2016 16:28:14 +0200 Message-ID: To: Jesse Schalken Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c0563002f5f7405330a8d82 Subject: Re: [PHP-DEV] Do symbol references always go through a hash table? From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c0563002f5f7405330a8d82 Content-Type: text/plain; charset=UTF-8 On Tue, May 17, 2016 at 3:03 PM, Jesse Schalken wrote: > Hi Internals, > > I'd like to know whether references to > classes/functions/methods/properties/variables always go through a hash > table at runtime, or if the name is optimised into a pointer or fixed > offset. I recall seeing such an optimisation for local variables, but what > about the others? > > Thanks > A property access $foo->bar (where "bar" is a literal and not the result of an expression) uses a polymorphic runtime cache, which will store the class entry and property offset the first time the instruction is executed. Afterwards, if $foo is an instance of the same class, we will directly use this offset. Otherwise, a full lookup from the property name table with visibility checks and all those other bells an whistles has to be performed. The same holds for pretty much all other symbol references as well, so classes, functions, methods, etc. Nikita --94eb2c0563002f5f7405330a8d82--