diff --git a/Android.mk b/Android.mk index 2c32bf7..be9c7fa 100644 --- a/Android.mk +++ b/Android.mk @@ -45,10 +45,4 @@ LIBART_COMPILER_SRC_FILES += \ optimizing/artist/api/modules/module.cc \ optimizing/artist/api/modules/module_manager.cc \ optimizing/artist/api/io/verbose_printer.cc \ - optimizing/artist/api/io/filesystem_helper.cc \ - optimizing/artist/internal/modules/logtimization/logtimization_artist.cc \ - optimizing/artist/internal/modules/logtimization/logtimization_module.cc \ - optimizing/artist/internal/modules/trace/trace_artist.cc \ - optimizing/artist/internal/modules/trace/trace_module.cc \ - optimizing/artist/internal/modules/trace/trace_codelib.cc \ - + optimizing/artist/api/io/filesystem_helper.cc diff --git a/api/modules/module.h b/api/modules/module.h index e0c2a65..289cf2d 100644 --- a/api/modules/module.h +++ b/api/modules/module.h @@ -82,6 +82,10 @@ class Module { bool _enabled = true; }; + // the types of the class factories + typedef shared_ptr create_t(shared_ptr fshelper); + typedef ModuleId get_id_t(); + } // namespace art #endif // ART_API_MODULES_MODULE_H_ diff --git a/internal/modules/logtimization/logtimization_artist.cc b/internal/modules/logtimization/logtimization_artist.cc deleted file mode 100644 index c18e5bd..0000000 --- a/internal/modules/logtimization/logtimization_artist.cc +++ /dev/null @@ -1,77 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * @author "Sebastian Weisgerber " - * - */ - -#include "runtime.h" - -#include "logtimization_artist.h" -#include "optimizing/artist/api/env/codelib_environment.h" -#include "optimizing/artist/api/io/artist_log.h" - - -using std::string; -using std::vector; -using std::shared_ptr; - -namespace art { - -HLogtimization::HLogtimization(const MethodInfo& method_info, -#ifdef BUILD_MARSHMALLOW - bool is_in_ssa_form, -#endif - const char* pass_name, - OptimizingCompilerStats* stats) - : HArtist(method_info -#ifdef BUILD_MARSHMALLOW - , is_in_ssa_form -#endif - , pass_name, stats) {} - -HLogtimization::~HLogtimization() = default; - -void HLogtimization::RunPass() { - CHECK(graph_ != nullptr); - VLOG(artist) << "<##########################################################>"; - - const DexFile& dexFile = graph_->GetDexFile(); - const string& dexFilePath = dexFile.GetLocation(); - const string methodSignature = PrettyMethod(graph_->GetMethodIdx(), dexFile); - - VLOG(artist) << "Method: " << methodSignature << " (Dexfile: " << dexFilePath << ")"; - VLOG(artist) << dexFile; - const auto class_count = dexFile.NumClassDefs(); - const auto field_count = dexFile.NumFieldIds(); - const auto method_count = dexFile.NumMethodIds(); - const auto proto_count = dexFile.NumProtoIds(); - const auto string_count = dexFile.NumStringIds(); - const auto type_count = dexFile.NumTypeIds(); - - VLOG(artist) << "C: " << class_count << " " - << "F: " << field_count << " " - << "M: " << method_count << " " - << "P: " << proto_count << " " - << "S: " << string_count << " " - << "T: " << type_count; - - VLOG(artist) << ""; -} - -} // namespace art diff --git a/internal/modules/logtimization/logtimization_artist.h b/internal/modules/logtimization/logtimization_artist.h deleted file mode 100644 index 858bec6..0000000 --- a/internal/modules/logtimization/logtimization_artist.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * @author "Sebastian Weisgerber " - * - */ - -#ifndef ART_INTERNAL_MODULES_LOGTIMIZATION_LOGTIMIZATION_ARTIST_H_ -#define ART_INTERNAL_MODULES_LOGTIMIZATION_LOGTIMIZATION_ARTIST_H_ - -#include "optimizing/artist/api/modules/artist.h" - -using std::string; -using std::vector; -using std::shared_ptr; - -namespace art { - -class HGraph; -class HInstruction; -class DexCompilationUnit; -class OptimizingCompilerStats; - -class HLogtimization : public HArtist { - public: - explicit HLogtimization(const MethodInfo& method_info, -#ifdef BUILD_MARSHMALLOW - bool is_in_ssa_form = true, -#endif - const char* pass_name = "ArtistLogtimization", - OptimizingCompilerStats* stats = nullptr); - - ~HLogtimization() OVERRIDE; - - void RunPass() OVERRIDE; -}; - -} // namespace art - -#endif // ART_INTERNAL_MODULES_LOGTIMIZATION_LOGTIMIZATION_ARTIST_H_ diff --git a/internal/modules/logtimization/logtimization_module.cc b/internal/modules/logtimization/logtimization_module.cc deleted file mode 100644 index 523bb47..0000000 --- a/internal/modules/logtimization/logtimization_module.cc +++ /dev/null @@ -1,51 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * - */ - -#include "logtimization_module.h" -#include "logtimization_artist.h" -#include "optimizing/artist/api/filtering/method_name_filters.h" - -using std::make_shared; - -namespace art { - -HArtist* LogtimizationModule::createPass(const MethodInfo& method_info) const { - return new (method_info.GetGraph()->GetArena()) HLogtimization(method_info); -} - -shared_ptr LogtimizationModule::createCodeLib() const { - return nullptr; -} - -/* (Arbitrary) restriction of compile-time output to "onCreate" methods (Activities, Applications, ...) to reduce - * logcat spamming. - */ -unique_ptr LogtimizationModule::getMethodFilter() const { - const vector whiteListSignatures = { - ".onCreate(" - }; - auto whiteListFilter = unique_ptr(new MethodNameWhitelist(whiteListSignatures, false, true)); - return whiteListFilter; -} - -LogtimizationModule::LogtimizationModule(shared_ptr fs) : Module(fs) {} - -} // namespace art diff --git a/internal/modules/logtimization/logtimization_module.h b/internal/modules/logtimization/logtimization_module.h deleted file mode 100644 index 707c00c..0000000 --- a/internal/modules/logtimization/logtimization_module.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * - */ - -#ifndef ART_INTERNAL_MODULES_LOGTIMIZATION_LOGTIMIZATION_MODULE_H_ -#define ART_INTERNAL_MODULES_LOGTIMIZATION_LOGTIMIZATION_MODULE_H_ - -#include "optimizing/artist/api/modules/module.h" - -namespace art { - -class LogtimizationModule : public Module { - HArtist* createPass(const MethodInfo& method_info) const OVERRIDE; - shared_ptr createCodeLib() const OVERRIDE; - - - public: - explicit LogtimizationModule(shared_ptr fs); - - unique_ptr getMethodFilter() const OVERRIDE; -}; - -} // namespace art - -#endif // ART_INTERNAL_MODULES_LOGTIMIZATION_LOGTIMIZATION_MODULE_H_ diff --git a/internal/modules/trace/trace_artist.cc b/internal/modules/trace/trace_artist.cc deleted file mode 100644 index eb53c42..0000000 --- a/internal/modules/trace/trace_artist.cc +++ /dev/null @@ -1,60 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * @author "Sebastian Weisgerber " - * - */ - -#include - -#include "trace_artist.h" -#include "trace_codelib.h" -#include "optimizing/artist/api/io/artist_log.h" -#include "optimizing/artist/internal/injection/injection_visitor.h" -#include "optimizing/artist/api/env/java_env.h" -#include "class_linker-inl.h" - -#include "optimizing/artist/api/injection/primitives.h" - -#include "optimizing/artist/api/io/verbose_printer.h" - -using std::string; -using std::vector; -using std::shared_ptr; -using std::make_shared; - - -namespace art { - -vector> HTraceArtist::ProvideInjections() const { - VLOG(artistd) << "HTraceArtist::ProvideInjections()"; - - vector> params; - vector> targets; - auto target = make_shared(Target::GENERIC_TARGET, InjectionTarget::METHOD_END); -// const Target target(".onCreate(", InjectionTarget::METHOD_START); - targets.push_back(target); - - auto injection = make_shared(TraceCodeLib::TRACELOG, params, targets); - - vector> results; - results.push_back(injection); - return results; -} - -} // namespace art diff --git a/internal/modules/trace/trace_artist.h b/internal/modules/trace/trace_artist.h deleted file mode 100644 index 272f9c7..0000000 --- a/internal/modules/trace/trace_artist.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * @author "Sebastian Weisgerber " - * - */ - -#ifndef ART_INTERNAL_MODULES_TRACE_TRACE_ARTIST_H_ -#define ART_INTERNAL_MODULES_TRACE_TRACE_ARTIST_H_ - -#include "optimizing/artist/api/injection/injection_artist.h" - -namespace art { - -class HTraceArtist : public HInjectionArtist { - public: - explicit HTraceArtist( - const MethodInfo& method_info, -#ifdef BUILD_MARSHMALLOW - bool is_in_ssa_form = true, -#endif - const char* pass_name = "TraceArtist" - , OptimizingCompilerStats* stats = nullptr) - : HInjectionArtist(method_info -#ifdef BUILD_MARSHMALLOW - , is_in_ssa_form -#endif - , pass_name - , stats) { - // Nothing - } - - virtual vector> ProvideInjections() const OVERRIDE; -}; - -} // namespace art - -#endif // ART_INTERNAL_MODULES_TRACE_TRACE_ARTIST_H_ diff --git a/internal/modules/trace/trace_codelib.cc b/internal/modules/trace/trace_codelib.cc deleted file mode 100644 index dc02be9..0000000 --- a/internal/modules/trace/trace_codelib.cc +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * @author "Sebastian Weisgerber " - * - */ - -#include "trace_codelib.h" - -namespace art { - -const std::string TraceCodeLib::TRACELOG("Lsaarland/cispa/artist/codelib/CodeLib;traceLog()V"); - -unordered_set& TraceCodeLib::getMethods() const { - static unordered_set methods({TRACELOG}); - return methods; -} -string& TraceCodeLib::getInstanceField() const { - static string instanceField = "Lsaarland/cispa/artist/codelib/CodeLib;INSTANCE"; - return instanceField; -} -string& TraceCodeLib::getCodeClass() const { - static string codeClass = "Lsaarland/cispa/artist/codelib/CodeLib;"; - return codeClass; -} - -} // namespace art diff --git a/internal/modules/trace/trace_codelib.h b/internal/modules/trace/trace_codelib.h deleted file mode 100644 index e440850..0000000 --- a/internal/modules/trace/trace_codelib.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * @author "Sebastian Weisgerber " - * - */ - -#ifndef ART_INTERNAL_MODULES_TRACE_TRACE_CODELIB_H_ -#define ART_INTERNAL_MODULES_TRACE_TRACE_CODELIB_H_ - -#include -#include -#include "optimizing/artist/api/modules/codelib.h" - -using std::string; -using std::unordered_set; - -namespace art { - -class TraceCodeLib : public CodeLib { - public: - static const string TRACELOG; - - public: - TraceCodeLib() = default; - TraceCodeLib(const TraceCodeLib& other) = default; - TraceCodeLib(TraceCodeLib&& other) = default; - - ~TraceCodeLib() override = default; - - TraceCodeLib& operator=(const TraceCodeLib&) = default; - TraceCodeLib& operator=(TraceCodeLib&&) = default; - - unordered_set& getMethods() const override; - string& getInstanceField() const override; - string& getCodeClass() const override; -}; // class TraceCodeLib - -} // namespace art - -#endif // ART_INTERNAL_MODULES_TRACE_TRACE_CODELIB_H_ diff --git a/internal/modules/trace/trace_module.cc b/internal/modules/trace/trace_module.cc deleted file mode 100644 index c627a46..0000000 --- a/internal/modules/trace/trace_module.cc +++ /dev/null @@ -1,52 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * - */ - -#include "trace_module.h" -#include "trace_artist.h" -#include "trace_codelib.h" -#include "optimizing/artist/api/filtering/method_name_filters.h" - -using std::make_shared; -using std::unique_ptr; - -namespace art { - -HArtist* TraceModule::createPass(const MethodInfo& method_info) const { - return new (method_info.GetGraph()->GetArena()) HTraceArtist(method_info); -} - -shared_ptr TraceModule::createCodeLib() const { - return make_shared(); -} - -// skip android support lib ui methods since they bloat up the log -unique_ptr TraceModule::getMethodFilter() const { - const vector blackListDefinition = { - "android.support.", - }; - return unique_ptr(new MethodNameBlacklist(blackListDefinition)); -} - -TraceModule::TraceModule(shared_ptr fs) : Module(fs) {} - - - -} // namespace art diff --git a/internal/modules/trace/trace_module.h b/internal/modules/trace/trace_module.h deleted file mode 100644 index d85bd78..0000000 --- a/internal/modules/trace/trace_module.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * The ARTist Project (https://artist.cispa.saarland) - * - * Copyright (C) 2017 CISPA (https://cispa.saarland), Saarland University - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @author "Oliver Schranz " - * - */ - -#ifndef ART_INTERNAL_MODULES_TRACE_TRACE_MODULE_H_ -#define ART_INTERNAL_MODULES_TRACE_TRACE_MODULE_H_ - -#include "optimizing/artist/api/modules/module.h" - -namespace art { - -class TraceModule : public Module { - HArtist* createPass(const MethodInfo& method_info) const OVERRIDE; - shared_ptr createCodeLib() const OVERRIDE; - - public: - explicit TraceModule(shared_ptr fs); - unique_ptr getMethodFilter() const OVERRIDE; -}; - -} // namespace art - -#endif // ART_INTERNAL_MODULES_TRACE_TRACE_MODULE_H_