Closed wisechengyi closed 7 years ago
Well that's super weird... looking
I'm not seeing the same issue. You're rebuilding redex
when you move to a different commit, right?
(that doesn't really make sense though because PeepholePassV2 was introduced a while ago)
Could you send me your config file, please?
I'm not seeing the same issue. You're rebuilding redex when you move to a different commit, right?
Yes. Did git clean -fdx
first then the build. The build was on mac. I will verify it on centos
Config is just https://github.com/facebook/redex/blob/master/config/default.config.
I've found the issue https://github.com/facebook/redex/blob/master/libredex/PassManager.cpp#L154 compares strings by their pointers. Fixing. Thanks for finding this.
Actually, it was already calling std::string::operator==(char*, std::string);
So I don't think this will fix it, but hey. It's worth a try:
diff --git a/libredex/PassManager.cpp b/libredex/PassManager.cpp
--- a/libredex/PassManager.cpp
+++ b/libredex/PassManager.cpp
@@ -40,7 +40,7 @@
if (config["redex"].isMember("passes")) {
auto passes = config["redex"]["passes"];
for (auto& pass : passes) {
- activate_pass(pass.asString().c_str(), config);
+ activate_pass(pass.asString(), config);
}
} else {
// If config isn't set up, run all registered passes.
@@ -58,7 +58,7 @@
if (config["redex"].isMember("passes")) {
auto passes = config["redex"]["passes"];
for (auto& pass : passes) {
- activate_pass(pass.asString().c_str(), config);
+ activate_pass(pass.asString(), config);
}
} else {
// If config isn't set up, run all registered passes.
@@ -149,7 +149,7 @@
}
}
-void PassManager::activate_pass(const char* name, const Json::Value& cfg) {
+void PassManager::activate_pass(const std::string& name, const Json::Value& cfg) {
for (auto pass : m_registered_passes) {
if (name == pass->name()) {
m_activated_passes.push_back(pass);
@@ -157,7 +157,7 @@
return;
}
}
- always_assert_log(false, "No pass named %s!", name);
+ always_assert_log(false, "No pass named %s!", name.c_str());
}
void PassManager::incr_metric(const std::string& key, int value) {
diff --git a/libredex/PassManager.h b/libredex/PassManager.h
--- a/libredex/PassManager.h
+++ b/libredex/PassManager.h
@@ -51,7 +51,7 @@
void set_testing_mode() { m_testing_mode = true; }
private:
- void activate_pass(const char* name, const Json::Value& cfg);
+ void activate_pass(const std::string& name, const Json::Value& cfg);
Json::Value m_config;
std::vector<Pass*> m_registered_passes;
operator overloading in c++. good times :)
Hi @justinjhendrick please see https://github.com/wisechengyi/redex_repro/tree/master/ubuntu/228 for repro
Readme is at top level. Thank you!
I can repro! YAY! finally
Alright, time to debug it, haha.
Great! It's possible to hit #192 once this is issue is fixed. Just heads up so you are not confused by a different exception message.
Okay. I've found the issue. Basically, the Makefile is out of date. When we add new files and directories, we need to add them to Makefile.am
. I'm going to rewrite the Makefile with ample use of find
so this won't happen again in the future.
Specifically, we created PeepholeV2 and forgot to add it here https://github.com/facebook/redex/blob/master/Makefile.am#L139
Thanks for the quick turn around! Not top priority, although the fix does not seem to be very maintainable going forward since all the files are hardcoded. We could potentially use something like https://github.com/wisechengyi/Particle-System/blob/master/418/mp4/Makefile#L14-L25 in the Makefile.
make allows for wildcards, but automake does not. In this commit I added a test running on our commits internally that should catch missing files in Makefile.am
At sha 15b6504b8b9d404f8f480e88136959f38fd3760e, if I added the following passes based on https://github.com/facebook/redex/blob/master/config/default.config, it will throw the following error:
error: