02e0774721
Any vector instructions that take a pointer to a base and might modify it are now flagged with MayModifyStack. Any that actually do modify the stack (this can be determined by looking at the input types) will produe two dests: their original result and a new StkPtr. getStackValue calls into VectorEffects to extract the new type and/or value. The instructions currently assume that the stack cell they might be modifying is already synced to memory. This may change in the future when we don't have to do a full SpillStack before the helpers.
69 linhas
1.3 KiB
PHP
69 linhas
1.3 KiB
PHP
<?php
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
class dumper {
|
|
private static $idx = 0;
|
|
private $n;
|
|
public $prop = 'default value';
|
|
function __construct() {
|
|
$this->n = self::$idx++;
|
|
printf("dumper %d constructing\n", $this->n);
|
|
}
|
|
function __destruct() {
|
|
printf("dumper %d destructing\n", $this->n);
|
|
var_dump($this);
|
|
}
|
|
}
|
|
|
|
function makeObj() {
|
|
return new dumper;
|
|
}
|
|
|
|
function &makeObjRef() {
|
|
return new dumper();
|
|
}
|
|
|
|
function makeArr() {
|
|
$a = array();
|
|
$a['dumper'] = new dumper;
|
|
return $a;
|
|
}
|
|
|
|
function &makeArrRef() {
|
|
static $a = array();
|
|
var_dump($a);
|
|
$a['dumper'] = new dumper;
|
|
return $a;
|
|
}
|
|
|
|
function main() {
|
|
echo "Entering main\n";
|
|
// SetM with array base on the stack
|
|
makeArr()['dumper'] = new stdclass;
|
|
makeArrRef()['dumper'] = 24;
|
|
makeArrRef()[234] = 234;
|
|
|
|
// More complex SetM with array base on the stack, then with a ref
|
|
makeArr()['dumper']->prop = null;
|
|
makeArrRef()['dumper']->propp = null;
|
|
makeArrRef()['dumper']->proppp = null;
|
|
|
|
|
|
// Clear out the reference to destruct the array
|
|
$ref =& makeArrRef();
|
|
var_dump($ref);
|
|
$ref = null;
|
|
|
|
makeObj()->prop = 'foo';
|
|
var_dump(makeObj()->prop);
|
|
makeObjRef()->prop = 'bar';
|
|
var_dump(makeObjRef()->prop[2]);
|
|
|
|
echo "Done with main\n";
|
|
}
|
|
|
|
echo "Calling main\n";
|
|
main();
|
|
echo "Main has returned\n";
|
|
|