php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55695 Compiler create unused opline(NOP)
Submitted: 2011-09-14 15:32 UTC Modified: 2011-09-15 09:44 UTC
From: laruence@php.net Assigned: dmitry (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: trunk-SVN-2011-09-14 (SVN) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2011-09-14 15:32 UTC] laruence@php.net
Description:
------------
When having the following code:

<?php
class foo {
    function bar() {
        self::$bar = 42;
    }
}
?>

The compiler generates compiled a totally unused NOP opline:

$ php -dvld.active=1 -r 'class foo { function bar() { self::$bar = 42; } }'
Finding entry points
Branch analysis from position: 0
Return found
filename:       Command line code
function name:  (null)
number of ops:  2
compiled vars:  none
line     # *  op                           fetch          ext  return  operands
---------------------------------------------------------------------------------
   1     0  >   NOP                                                      
         1    > RETURN                                                   null

branch: #  0; line:     1-    1; sop:     0; eop:     1
path #1: 0, 
Class foo:
Function bar:
Finding entry points
Branch analysis from position: 0
Return found
filename:       Command line code
function name:  bar
number of ops:  4
compiled vars:  !0 = $bar
line     # *  op                           fetch          ext  return  operands
---------------------------------------------------------------------------------
         0  >   ZEND_FETCH_CLASS                              1          
         1      FETCH_W                      static member       $1      'bar'
         2      ASSIGN                                                   $1, 42
         3    > RETURN                                                   null

branch: #  0; line:     1-    1; sop:     0; eop:     3
path #1: 0, 
End of function bar.


Test script:
---------------
no


Patches

bug55695.diff (last revision 2011-09-14 15:32 UTC by laruence@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-14 15:32 UTC] laruence@php.net
The following patch has been added/updated:

Patch Name: bug55695.diff
Revision:   1316014372
URL:        https://bugs.php.net/patch-display.php?bug=55695&patch=bug55695.diff&revision=1316014372
 [2011-09-14 15:34 UTC] laruence@php.net
-Assigned To: +Assigned To: dmitry
 [2011-09-14 15:34 UTC] laruence@php.net
Dmitry, as I said in #55673, sorry for that mis-fix, heh, anyway, I report this to you, you can mark simply it as won't fix :)
 [2011-09-15 09:44 UTC] dmitry@php.net
-Status: Assigned +Status: Wont fix
 [2011-09-15 09:44 UTC] dmitry@php.net
PHP Compiler is targeted to be fast.
ZE allows to plug another compilers, opcode caches and optimizers to improve the code quality if it's necessary.

The cost of a NOP instruction is invisible, so I don't think it makes sense to invest into it.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC