3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); /** * \WeakMap with https://github.com/php/php-src/issues/10043 fixed for PHP 8.2 and below. * * @template TKey of object * @template TValue of mixed */ final class WeakMapPhp83 implements \ArrayAccess, \Countable, \IteratorAggregate { /** Workaround https://github.com/php/php-src/issues/13612. */ private \stdClass $destructedEarly; /** @var \WeakMap<TKey, \WeakReference<WeakMapPhp83Value<TKey, TValue>>> */ private \WeakMap $weakMap; public function __construct() { $this->weakMap = new \WeakMap(); $this->destructedEarly = new \stdClass(); } /** * @param TKey $object */ public function offsetExists($object) : bool { $this->assertValidKey($object); return $this->weakMap->offsetExists($object) && $this->offsetGet($object) !== null; } /** * @param TKey $object * * @return TValue */ #[\ReturnTypeWillChange] public function offsetGet($object) { $this->assertValidKey($object); return $this->weakMap->offsetGet($object)->get()->get(); } /** * @param TKey $object * @param TValue $value */ public function offsetSet($object, $value) : void { $this->assertValidKey($object); $valueBefore = null; if ($this->weakMap->offsetExists($object)) { $valueBefore = $this->weakMap->offsetGet($object)->get(); } $this->weakMap->offsetSet( $object, \WeakReference::create( new WeakMapPhp83Value($this->weakMap, $this->destructedEarly, $object, $value) ) ); if ($valueBefore !== null) { $valueBefore->destroy(); } } /** * @param TKey $object */ public function offsetUnset($object) : void { $this->assertValidKey($object); $valueBefore = null; if ($this->weakMap->offsetExists($object)) { $valueBefore = $this->weakMap->offsetGet($object)->get(); } $this->weakMap->offsetUnset($object); if ($valueBefore !== null) { $valueBefore->destroy(); } } public function count() : int { return $this->weakMap->count(); } /** * @return \Traversable<TKey, TValue> */ public function getIterator() : \Traversable { foreach ($this->weakMap->getIterator() as $object => $v) { yield $object => $this->offsetGet($object); } } private function assertValidKey($key) : void { if ($key === null) { throw new \Error('Cannot append to WeakMap'); } if (!is_object($key)) { throw new \TypeError('WeakMap key must be an object'); } } } /** * @internal * * @template TKey of object * @template TValue of mixed */ class WeakMapPhp83Value { /** @var \WeakReference<\WeakMap<TKey, \WeakReference<self<TKey, TValue>>>> */ private \WeakReference $weakMap; /** @var \WeakReference<\stdClass> */ private \WeakReference $weakMapDestructedEarly; /** @var \WeakReference<TKey> */ private \WeakReference $weakKey; /** @var TValue */ private $value; private ?\stdClass $cycleRef; /** * @param \WeakMap<TKey, \WeakReference<self<TKey, TValue>>> $weakMap * @param \stdClass $destructedEarly * @param TKey $key * @param TValue $value */ public function __construct(\WeakMap $weakMap, \stdClass $destructedEarly, object $key, $value) { $this->weakMap = \WeakReference::create($weakMap); $this->weakMapDestructedEarly = \WeakReference::create($destructedEarly); $this->weakKey = \WeakReference::create($key); $this->value = $value; // make self cyclically referenced to survive GC run, inspired by CycleWithDestructor $this->cycleRef = new \stdClass(); $this->cycleRef->x = $this; } public function __destruct() { if ($this->weakMapDestructedEarly->get() === null) { $this->destroy(); return; } $weakMap = $this->weakMap->get(); if ($weakMap === null) { $this->destroy(); return; } $key = $this->weakKey->get(); if ($key !== null && $weakMap->offsetExists($key)) { // set new value wrapper, as the previous one (=$this) will be released after GC run $weakMap->offsetSet( $key, \WeakReference::create( new self($weakMap, $this->weakMapDestructedEarly->get(), $key, $this->value) ) ); } else { $this->destroy(); } } /** * @return TValue */ public function get() { return $this->value; } public function destroy() : void { $this->value = null; $this->cycleRef = null; } } function testHousekeepingOnGcRunSurvival() : void { $weakMap = new WeakMapPhp83(); $vkPairs = []; for ($i = 20; $i > 0; $i--) { for ($j = 100; $j > 0; $j--) { $k = new stdClass; $v = new stdClass; $weakMap[$k] = $v; $vkPairs[] = [$k, $v]; } gc_collect_cycles(); gc_collect_cycles(); gc_collect_cycles(); } foreach ($vkPairs as [$k, $v]) { if ($weakMap[$k] !== $v) { throw new \Error(); } } } testHousekeepingOnGcRunSurvival(); echo 'done';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                                'weakmapphp83'
  228     1        INIT_FCALL                                                   'testhousekeepingongcrunsurvival'
          2        DO_FCALL                                          0          
  230     3        ECHO                                                         'done'
          4      > RETURN                                                       1

Function testhousekeepingongcrunsurvival:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 6
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 46
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 46
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 45
Branch analysis from position: 42
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 8
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 6
Branch analysis from position: 32
Branch analysis from position: 6
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 8
Branch analysis from position: 23
Branch analysis from position: 8
filename:       /in/Wo4ZO
function name:  testHousekeepingOnGcRunSurvival
number of ops:  48
compiled vars:  !0 = $weakMap, !1 = $vkPairs, !2 = $i, !3 = $j, !4 = $k, !5 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  205     0  E >   NEW                                                  $6      'WeakMapPhp83'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $6
  207     3        ASSIGN                                                       !1, <array>
  208     4        ASSIGN                                                       !2, 20
          5      > JMP                                                          ->30
  209     6    >   ASSIGN                                                       !3, 100
          7      > JMP                                                          ->21
  210     8    >   NEW                                                  $12     'stdClass'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !4, $12
  211    11        NEW                                                  $15     'stdClass'
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !5, $15
  212    14        ASSIGN_DIM                                                   !0, !4
         15        OP_DATA                                                      !5
  213    16        INIT_ARRAY                                           ~20     !4
         17        ADD_ARRAY_ELEMENT                                    ~20     !5
         18        ASSIGN_DIM                                                   !1
         19        OP_DATA                                                      ~20
  209    20        PRE_DEC                                                      !3
         21    >   IS_SMALLER                                                   0, !3
         22      > JMPNZ                                                        ~22, ->8
  216    23    >   INIT_FCALL                                                   'gc_collect_cycles'
         24        DO_ICALL                                                     
  217    25        INIT_FCALL                                                   'gc_collect_cycles'
         26        DO_ICALL                                                     
  218    27        INIT_FCALL                                                   'gc_collect_cycles'
         28        DO_ICALL                                                     
  208    29        PRE_DEC                                                      !2
         30    >   IS_SMALLER                                                   0, !2
         31      > JMPNZ                                                        ~27, ->6
  221    32    > > FE_RESET_R                                           $28     !1, ->46
         33    > > FE_FETCH_R                                                   $28, $29, ->46
         34    >   FETCH_LIST_R                                         $30     $29, 0
         35        ASSIGN                                                       !4, $30
         36        FETCH_LIST_R                                         $32     $29, 1
         37        ASSIGN                                                       !5, $32
         38        FREE                                                         $29
  222    39        FETCH_DIM_R                                          ~34     !0, !4
         40        IS_NOT_IDENTICAL                                             !5, ~34
         41      > JMPZ                                                         ~35, ->45
  223    42    >   NEW                                                  $36     'Error'
         43        DO_FCALL                                          0          
         44      > THROW                                             0          $36
  221    45    > > JMP                                                          ->33
         46    >   FE_FREE                                                      $28
  226    47      > RETURN                                                       null

End of function testhousekeepingongcrunsurvival

Class WeakMapPhp83:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  __construct
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   NEW                                                  $1      'WeakMap'
          1        DO_FCALL                                          0          
          2        ASSIGN_OBJ                                                   'weakMap'
          3        OP_DATA                                                      $1
   23     4        NEW                                                  $4      'stdClass'
          5        DO_FCALL                                          0          
          6        ASSIGN_OBJ                                                   'destructedEarly'
          7        OP_DATA                                                      $4
   24     8      > RETURN                                                       null

End of function __construct

Function offsetexists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Wo4ZO
function name:  offsetExists
number of ops:  18
compiled vars:  !0 = $object
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   RECV                                                 !0      
   31     1        INIT_METHOD_CALL                                             'assertValidKey'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
   33     4        FETCH_OBJ_R                                          ~2      'weakMap'
          5        INIT_METHOD_CALL                                             ~2, 'offsetExists'
          6        SEND_VAR_EX                                                  !0
          7        DO_FCALL                                          0  $3      
          8      > JMPZ_EX                                              ~4      $3, ->14
   34     9    >   INIT_METHOD_CALL                                             'offsetGet'
         10        SEND_VAR_EX                                                  !0
         11        DO_FCALL                                          0  $5      
         12        TYPE_CHECK                                      1020  ~6      $5
         13        BOOL                                                 ~4      ~6
         14    >   VERIFY_RETURN_TYPE                                           ~4
         15      > RETURN                                                       ~4
   35    16*       VERIFY_RETURN_TYPE                                           
         17*     > RETURN                                                       null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  offsetGet
number of ops:  14
compiled vars:  !0 = $object
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   43     0  E >   RECV                                                 !0      
   45     1        INIT_METHOD_CALL                                             'assertValidKey'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
   47     4        FETCH_OBJ_R                                          ~2      'weakMap'
          5        INIT_METHOD_CALL                                             ~2, 'offsetGet'
          6        SEND_VAR_EX                                                  !0
          7        DO_FCALL                                          0  $3      
          8        INIT_METHOD_CALL                                             $3, 'get'
          9        DO_FCALL                                          0  $4      
         10        INIT_METHOD_CALL                                             $4, 'get'
         11        DO_FCALL                                          0  $5      
         12      > RETURN                                                       $5
   48    13*     > RETURN                                                       null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 18
filename:       /in/Wo4ZO
function name:  offsetSet
number of ops:  41
compiled vars:  !0 = $object, !1 = $value, !2 = $valueBefore
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   54     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   56     2        INIT_METHOD_CALL                                             'assertValidKey'
          3        SEND_VAR_EX                                                  !0
          4        DO_FCALL                                          0          
   58     5        ASSIGN                                                       !2, null
   59     6        FETCH_OBJ_R                                          ~5      'weakMap'
          7        INIT_METHOD_CALL                                             ~5, 'offsetExists'
          8        SEND_VAR_EX                                                  !0
          9        DO_FCALL                                          0  $6      
         10      > JMPZ                                                         $6, ->18
   60    11    >   FETCH_OBJ_R                                          ~7      'weakMap'
         12        INIT_METHOD_CALL                                             ~7, 'offsetGet'
         13        SEND_VAR_EX                                                  !0
         14        DO_FCALL                                          0  $8      
         15        INIT_METHOD_CALL                                             $8, 'get'
         16        DO_FCALL                                          0  $9      
         17        ASSIGN                                                       !2, $9
   63    18    >   FETCH_OBJ_R                                          ~11     'weakMap'
         19        INIT_METHOD_CALL                                             ~11, 'offsetSet'
   64    20        SEND_VAR_EX                                                  !0
   65    21        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
   66    22        NEW                                                  $12     'WeakMapPhp83Value'
         23        CHECK_FUNC_ARG                                               
         24        FETCH_OBJ_FUNC_ARG                                   $13     'weakMap'
         25        SEND_FUNC_ARG                                                $13
         26        CHECK_FUNC_ARG                                               
         27        FETCH_OBJ_FUNC_ARG                                   $14     'destructedEarly'
         28        SEND_FUNC_ARG                                                $14
         29        SEND_VAR_EX                                                  !0
         30        SEND_VAR_EX                                                  !1
         31        DO_FCALL                                          0          
         32        SEND_VAR                                                     $12
   65    33        DO_FCALL                                          0  $16     
   66    34        SEND_VAR_NO_REF_EX                                           $16
   63    35        DO_FCALL                                          0          
   70    36        TYPE_CHECK                                      1020          !2
         37      > JMPZ                                                         ~18, ->40
   71    38    >   INIT_METHOD_CALL                                             !2, 'destroy'
         39        DO_FCALL                                          0          
   73    40    > > RETURN                                                       null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 17
filename:       /in/Wo4ZO
function name:  offsetUnset
number of ops:  26
compiled vars:  !0 = $object, !1 = $valueBefore
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   78     0  E >   RECV                                                 !0      
   80     1        INIT_METHOD_CALL                                             'assertValidKey'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
   82     4        ASSIGN                                                       !1, null
   83     5        FETCH_OBJ_R                                          ~4      'weakMap'
          6        INIT_METHOD_CALL                                             ~4, 'offsetExists'
          7        SEND_VAR_EX                                                  !0
          8        DO_FCALL                                          0  $5      
          9      > JMPZ                                                         $5, ->17
   84    10    >   FETCH_OBJ_R                                          ~6      'weakMap'
         11        INIT_METHOD_CALL                                             ~6, 'offsetGet'
         12        SEND_VAR_EX                                                  !0
         13        DO_FCALL                                          0  $7      
         14        INIT_METHOD_CALL                                             $7, 'get'
         15        DO_FCALL                                          0  $8      
         16        ASSIGN                                                       !1, $8
   87    17    >   FETCH_OBJ_R                                          ~10     'weakMap'
         18        INIT_METHOD_CALL                                             ~10, 'offsetUnset'
         19        SEND_VAR_EX                                                  !0
         20        DO_FCALL                                          0          
   89    21        TYPE_CHECK                                      1020          !1
         22      > JMPZ                                                         ~12, ->25
   90    23    >   INIT_METHOD_CALL                                             !1, 'destroy'
         24        DO_FCALL                                          0          
   92    25    > > RETURN                                                       null

End of function offsetunset

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  count
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   96     0  E >   FETCH_OBJ_R                                          ~0      'weakMap'
          1        INIT_METHOD_CALL                                             ~0, 'count'
          2        DO_FCALL                                          0  $1      
          3        VERIFY_RETURN_TYPE                                           $1
          4      > RETURN                                                       $1
   97     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function count

Function getiterator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 12
filename:       /in/Wo4ZO
function name:  getIterator
number of ops:  14
compiled vars:  !0 = $v, !1 = $object
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  102     0  E >   GENERATOR_CREATE                                             
  104     1        FETCH_OBJ_R                                          ~2      'weakMap'
          2        INIT_METHOD_CALL                                             ~2, 'getIterator'
          3        DO_FCALL                                          0  $3      
          4      > FE_RESET_R                                           $4      $3, ->12
          5    > > FE_FETCH_R                                           ~5      $4, !0, ->12
          6    >   ASSIGN                                                       !1, ~5
  105     7        INIT_METHOD_CALL                                             'offsetGet'
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0  $7      
         10        YIELD                                                        $7, !1
  104    11      > JMP                                                          ->5
         12    >   FE_FREE                                                      $4
  107    13      > GENERATOR_RETURN                                             

End of function getiterator

Function assertvalidkey:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  assertValidKey
number of ops:  15
compiled vars:  !0 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  109     0  E >   RECV                                                 !0      
  111     1        TYPE_CHECK                                        2          !0
          2      > JMPZ                                                         ~1, ->7
  112     3    >   NEW                                                  $2      'Error'
          4        SEND_VAL_EX                                                  'Cannot+append+to+WeakMap'
          5        DO_FCALL                                          0          
          6      > THROW                                             0          $2
  115     7    >   TYPE_CHECK                                      256  ~4      !0
          8        BOOL_NOT                                             ~5      ~4
          9      > JMPZ                                                         ~5, ->14
  116    10    >   NEW                                                  $6      'TypeError'
         11        SEND_VAL_EX                                                  'WeakMap+key+must+be+an+object'
         12        DO_FCALL                                          0          
         13      > THROW                                             0          $6
  118    14    > > RETURN                                                       null

End of function assertvalidkey

End of class WeakMapPhp83.

Class WeakMapPhp83Value:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  __construct
number of ops:  30
compiled vars:  !0 = $weakMap, !1 = $destructedEarly, !2 = $key, !3 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  147     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
  149     4        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
          5        SEND_VAR                                                     !0
          6        DO_FCALL                                          0  $5      
          7        ASSIGN_OBJ                                                   'weakMap'
          8        OP_DATA                                                      $5
  150     9        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
         10        SEND_VAR                                                     !1
         11        DO_FCALL                                          0  $7      
         12        ASSIGN_OBJ                                                   'weakMapDestructedEarly'
         13        OP_DATA                                                      $7
  151    14        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
         15        SEND_VAR                                                     !2
         16        DO_FCALL                                          0  $9      
         17        ASSIGN_OBJ                                                   'weakKey'
         18        OP_DATA                                                      $9
  152    19        ASSIGN_OBJ                                                   'value'
         20        OP_DATA                                                      !3
  155    21        NEW                                                  $12     'stdClass'
         22        DO_FCALL                                          0          
         23        ASSIGN_OBJ                                                   'cycleRef'
         24        OP_DATA                                                      $12
  156    25        FETCH_THIS                                           ~16     
         26        FETCH_OBJ_W                                          $14     'cycleRef'
         27        ASSIGN_OBJ                                                   $14, 'x'
         28        OP_DATA                                                      ~16
  157    29      > RETURN                                                       null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 47
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/Wo4ZO
function name:  __destruct
number of ops:  50
compiled vars:  !0 = $weakMap, !1 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  161     0  E >   FETCH_OBJ_R                                          ~2      'weakMapDestructedEarly'
          1        INIT_METHOD_CALL                                             ~2, 'get'
          2        DO_FCALL                                          0  $3      
          3        TYPE_CHECK                                        2          $3
          4      > JMPZ                                                         ~4, ->8
  162     5    >   INIT_METHOD_CALL                                             'destroy'
          6        DO_FCALL                                          0          
  164     7      > RETURN                                                       null
  167     8    >   FETCH_OBJ_R                                          ~6      'weakMap'
          9        INIT_METHOD_CALL                                             ~6, 'get'
         10        DO_FCALL                                          0  $7      
         11        ASSIGN                                                       !0, $7
  168    12        TYPE_CHECK                                        2          !0
         13      > JMPZ                                                         ~9, ->17
  169    14    >   INIT_METHOD_CALL                                             'destroy'
         15        DO_FCALL                                          0          
  171    16      > RETURN                                                       null
  174    17    >   FETCH_OBJ_R                                          ~11     'weakKey'
         18        INIT_METHOD_CALL                                             ~11, 'get'
         19        DO_FCALL                                          0  $12     
         20        ASSIGN                                                       !1, $12
  175    21        TYPE_CHECK                                      1020  ~14     !1
         22      > JMPZ_EX                                              ~14     ~14, ->27
         23    >   INIT_METHOD_CALL                                             !0, 'offsetExists'
         24        SEND_VAR_EX                                                  !1
         25        DO_FCALL                                          0  $15     
         26        BOOL                                                 ~14     $15
         27    > > JMPZ                                                         ~14, ->47
  177    28    >   INIT_METHOD_CALL                                             !0, 'offsetSet'
  178    29        SEND_VAR_EX                                                  !1
  179    30        INIT_STATIC_METHOD_CALL                                      'WeakReference', 'create'
  180    31        NEW                              self                $16     
         32        SEND_VAR_EX                                                  !0
         33        FETCH_OBJ_R                                          ~17     'weakMapDestructedEarly'
         34        INIT_METHOD_CALL                                             ~17, 'get'
         35        DO_FCALL                                          0  $18     
         36        SEND_VAR_NO_REF_EX                                           $18
         37        SEND_VAR_EX                                                  !1
         38        CHECK_FUNC_ARG                                               
         39        FETCH_OBJ_FUNC_ARG                                   $19     'value'
         40        SEND_FUNC_ARG                                                $19
         41        DO_FCALL                                          0          
         42        SEND_VAR                                                     $16
  179    43        DO_FCALL                                          0  $21     
  180    44        SEND_VAR_NO_REF_EX                                           $21
  177    45        DO_FCALL                                          0          
  175    46      > JMP                                                          ->49
  184    47    >   INIT_METHOD_CALL                                             'destroy'
         48        DO_FCALL                                          0          
  186    49    > > RETURN                                                       null

End of function __destruct

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  get
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  193     0  E >   FETCH_OBJ_R                                          ~0      'value'
          1      > RETURN                                                       ~0
  194     2*     > RETURN                                                       null

End of function get

Function destroy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wo4ZO
function name:  destroy
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  198     0  E >   ASSIGN_OBJ                                                   'value'
          1        OP_DATA                                                      null
  199     2        ASSIGN_OBJ                                                   'cycleRef'
          3        OP_DATA                                                      null
  200     4      > RETURN                                                       null

End of function destroy

End of class WeakMapPhp83Value.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
132.23 ms | 513 KiB | 9 Q