Пример #1
0
 public function performDeadCodeElimination()
 {
     // Build the connections between caller and receiver ("mark").
     $registry = new OA_FunctionRegistry();
     foreach ($this->functionObjects as $functionObject) {
         $registry->registerNormalFunction($functionObject->getName(), $functionObject);
     }
     foreach ($this->classObjects as $classObject) {
         $classObject->registerAllFunctions($registry);
     }
     OA_SymbolTableBuilder::_markAllCalls($registry, $this->functionCallObjects);
     foreach ($this->classObjects as $classObject) {
         $exportedCalls = $classObject->getAllExportedCalls();
         OA_SymbolTableBuilder::_markAllCalls($registry, $exportedCalls);
     }
     // Now delete all dead receivers ("sweep").
     foreach ($this->functionObjects as $functionObject) {
         $functionObject->cleanIfDead();
     }
     foreach ($this->classObjects as $classObject) {
         $classObject->cleanDeadFunctions();
     }
 }