cvs -d :pserver:cvsread@cvs.xdebug.org:/repository login
# passwd = srmread
cvs -d :pserver:cvsread@cvs.xdebug.org:/repository co -d vld vle
cd vld
./configure && make && make install
php -dextension=vld.so -dvld.active=1 script.php
能够看到编译后的OPCODE
执行:
php -dextension=vld.so -dvld.active=1 xml.php
<?php
$xw = new xmlWriter();
$xw->openMemory();
$xw->startDocument('1.0','UTF-8');
$xw->startElement('html');
$xw->startElement('head');
$xw->writeElement('title', 'Hello World!');
$xw->endElement();
$xw->startElement('body');
$xw->text('Hello World!');
$xw->endElement();
$xw->endElement();
$xw->endDocument();
echo $xw->outputMemory(true);
?>
Branch analysis from position: 0
Return found
filename: /home/hanyh/workspace/php/learn/xml.php
function name: (null)
number of ops: 40
compiled vars: !0 = $xw
line # op fetch ext return operands
-------------------------------------------------------------------------------
2 0 ZEND_FETCH_CLASS :0 'xmlWriter'
1 NEW $1 :0
2 DO_FCALL_BY_NAME 0
3 ASSIGN !0, $1
3 4 ZEND_INIT_METHOD_CALL $4 !0, 'openMemory'
5 DO_FCALL_BY_NAME 0
4 6 ZEND_INIT_METHOD_CALL $6 !0, 'startDocument'
7 SEND_VAL '1.0'
8 SEND_VAL 'UTF-8'
9 DO_FCALL_BY_NAME 2
5 10 ZEND_INIT_METHOD_CALL $8 !0, 'startElement'
11 SEND_VAL 'html'
12 DO_FCALL_BY_NAME 1
6 13 ZEND_INIT_METHOD_CALL $10 !0, 'startElement'
14 SEND_VAL 'head'
15 DO_FCALL_BY_NAME 1
7 16 ZEND_INIT_METHOD_CALL $12 !0, 'writeElement'
17 SEND_VAL 'title'
18 SEND_VAL 'Hello+World%21'
19 DO_FCALL_BY_NAME 2
8 20 ZEND_INIT_METHOD_CALL $14 !0, 'endElement'
21 DO_FCALL_BY_NAME 0
9 22 ZEND_INIT_METHOD_CALL $16 !0, 'startElement'
23 SEND_VAL 'body'
24 DO_FCALL_BY_NAME 1
10 25 ZEND_INIT_METHOD_CALL $18 !0, 'text'
26 SEND_VAL 'Hello+World%21'
27 DO_FCALL_BY_NAME 1
11 28 ZEND_INIT_METHOD_CALL $20 !0, 'endElement'
29 DO_FCALL_BY_NAME 0
12 30 ZEND_INIT_METHOD_CALL $22 !0, 'endElement'
31 DO_FCALL_BY_NAME 0
13 32 ZEND_INIT_METHOD_CALL $24 !0, 'endDocument'
33 DO_FCALL_BY_NAME 0
14 34 ZEND_INIT_METHOD_CALL $26 !0, 'outputMemory'
35 SEND_VAL true
36 DO_FCALL_BY_NAME 1
37 ECHO $27
16 38 RETURN 1
39* ZEND_HANDLE_EXCEPTION
<?xml version="1.0" encoding="UTF-8"?>
<html><head><title>Hello World!</title></head><body>Hello World!</body></html>