Skip to content

Commit

Permalink
Fixes for new api (imports) and other ARTist upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
schrnz committed Jun 10, 2018
1 parent 28a73cd commit 0f95c93
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 1,
"package_name": "saarland.cispa.artist.modules.logtimization",
"name": "Logtimization Module",
"description": "This module logs during instrumentation.",
"description": "This module logs during instrumentation bur does not change the target code.",
"author": "Sebastian Weisgerber <[email protected]>, Oliver Schranz <[email protected]>, Parthipan Ramesh <[email protected]>",
"version": 1
}
8 changes: 4 additions & 4 deletions src/instrumentation_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@

#include <runtime.h>

#include <artist/env/codelib_environment.h>
#include <artist/artist_log.h>
#include <artist/api/env/codelib_environment.h>
#include <artist/api/io/artist_log.h>

#include "instrumentation_pass.h"

using std::string;
using std::vector;
using std::shared_ptr;

using art::DexFile;


HLogtimization::HLogtimization(const MethodInfo& method_info,
#ifdef BUILD_MARSHMALLOW
Expand All @@ -47,7 +47,7 @@ HLogtimization::HLogtimization(const MethodInfo& method_info,

HLogtimization::~HLogtimization() = default;

void HLogtimization::RunModule() {
void HLogtimization::RunPass() {
CHECK(graph_ != nullptr);
VLOG(artist) << "<##########################################################>";

Expand Down
9 changes: 3 additions & 6 deletions src/instrumentation_pass.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@
#ifndef ART_MODULES_LOGTIMIZATION_LOGTIMIZATION_ARTIST_H_
#define ART_MODULES_LOGTIMIZATION_LOGTIMIZATION_ARTIST_H_

#include <artist/artist.h>
#include <artist/api/modules/artist.h>
#include <optimization.h>
#include <driver/dex_compilation_unit.h>

using std::string;
using std::vector;
using std::shared_ptr;

using art::HArtist;
using art::MethodInfo;
using art::DexCompilationUnit;
using art::OptimizingCompilerStats;
using namespace art;

class HLogtimization : public HArtist {
public:
Expand All @@ -47,7 +44,7 @@ class HLogtimization : public HArtist {

~HLogtimization() OVERRIDE;

void RunModule() OVERRIDE;
void RunPass() OVERRIDE;
};

#endif // ART_MODULES_LOGTIMIZATION_LOGTIMIZATION_ARTIST_H_
23 changes: 15 additions & 8 deletions src/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@
*
*/

#include <artist/filtering/method_name_filters.h>
#include <artist/api/filtering/method_name_filters.h>

#include "module.h"
#include "instrumentation_pass.h"

using std::make_shared;

using art::WhitelistFilter;
LogtimizationModule::LogtimizationModule(const shared_ptr<const FilesystemHelper> fs) : Module(fs) {}

shared_ptr<HArtist> LogtimizationModule::createPass(const MethodInfo& method_info) const {
return make_shared<HLogtimization>(method_info);
HArtist * LogtimizationModule::createPass(const MethodInfo& method_info) const {
return new (method_info.GetGraph()->GetArena()) HLogtimization(method_info);
}

/*
* No codelib needed since we do not inject any method calls but only print to logcat at compile-time.
*/
shared_ptr<const CodeLib> LogtimizationModule::createCodeLib() const {
return nullptr;
}
Expand All @@ -41,11 +44,15 @@ shared_ptr<const CodeLib> LogtimizationModule::createCodeLib() const {
*/
unique_ptr<Filter> LogtimizationModule::getMethodFilter() const {
const vector<const string> onCreate = {".onCreate("};
return unique_ptr<Filter>(new WhitelistFilter(onCreate, false, true));
return unique_ptr<Filter>(new MethodNameWhitelist(onCreate, false, true));
}

// the class factories
// the module factory
extern "C" shared_ptr <Module> create(shared_ptr<const FilesystemHelper> fshelper) {
return make_shared<LogtimizationModule>(fshelper);
}

extern "C" shared_ptr <art::Module> create() {
return make_shared<LogtimizationModule>();
extern "C" ModuleId get_id() {
return "saarland.cispa.artist.modules.logtimization";
}

12 changes: 5 additions & 7 deletions src/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@
#ifndef ART_MODULES_LOGTIMIZATION_LOGTIMIZATION_MODULE_H_
#define ART_MODULES_LOGTIMIZATION_LOGTIMIZATION_MODULE_H_

#include <artist/modules/module.h>
#include <artist/api/modules/module.h>

using art::Module;
using art::MethodInfo;
using art::HArtist;
using art::CodeLib;
using art::Filter;
using namespace art;

class LogtimizationModule : public Module {
shared_ptr<HArtist> createPass(const MethodInfo& method_info) const OVERRIDE;
HArtist* createPass(const MethodInfo& method_info) const OVERRIDE;
shared_ptr<const CodeLib> createCodeLib() const OVERRIDE;


public:
explicit LogtimizationModule(const shared_ptr<const FilesystemHelper> fs);

unique_ptr<Filter> getMethodFilter() const OVERRIDE;
};

Expand Down

0 comments on commit 0f95c93

Please sign in to comment.