4665b068d4
This diff renames the Tracelet -> RegionDesc conversion mode to "legacy" (since it's going away eventually) and changes "tracelet" to use the new region selection mode. It attempts to select a region that will be the same length as what Translator::analyze would come up with, using HhbcTranslator for all of the type flow logic. It generates longer tracelets in some cases due to more precise type information. Once this new mode is no longer a perf regression it can become the new default, replacing all the code in Translator::analyze and the "legacy" region mode. This version doesn't support inlining or tracking of known Func*s; those will come in later diffs.
44 linhas
1.7 KiB
C++
44 linhas
1.7 KiB
C++
/*
|
|
+----------------------------------------------------------------------+
|
|
| HipHop for PHP |
|
|
+----------------------------------------------------------------------+
|
|
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
|
+----------------------------------------------------------------------+
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
| available through the world-wide-web at the following url: |
|
|
| http://www.php.net/license/3_01.txt |
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
+----------------------------------------------------------------------+
|
|
*/
|
|
|
|
#include "hphp/runtime/vm/jit/region-selection.h"
|
|
#include "hphp/runtime/base/smart_containers.h"
|
|
|
|
namespace HPHP { namespace JIT {
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
/*
|
|
* A dummy (debugging) region selector that just uses a single HHBC
|
|
* opcode as the region, and guards on everything.
|
|
*/
|
|
RegionDescPtr regionOneBC(const RegionContext& ctx) {
|
|
auto ret = smart::make_unique<RegionDesc>();
|
|
auto blk = smart::make_unique<RegionDesc::Block>(ctx.func, ctx.bcOffset, 1);
|
|
|
|
for (auto& live : ctx.liveTypes) {
|
|
blk->addPredicted(SrcKey{ctx.func, ctx.bcOffset},
|
|
{live.location, live.type});
|
|
}
|
|
|
|
ret->blocks.emplace_back(std::move(blk));
|
|
return ret;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
}}
|