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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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)

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC