summaryrefslogtreecommitdiff
path: root/runtime/noop_compiler_callbacks.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/noop_compiler_callbacks.h')
-rw-r--r--runtime/noop_compiler_callbacks.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/runtime/noop_compiler_callbacks.h b/runtime/noop_compiler_callbacks.h
index 34e15e71ad..557ed6ef6e 100644
--- a/runtime/noop_compiler_callbacks.h
+++ b/runtime/noop_compiler_callbacks.h
@@ -18,15 +18,21 @@
#define ART_RUNTIME_NOOP_COMPILER_CALLBACKS_H_
#include "base/macros.h"
+#include "class_linker.h"
#include "compiler_callbacks.h"
namespace art HIDDEN {
+// Used for tests and some tools that pretend to be a compiler (say, oatdump).
class NoopCompilerCallbacks final : public CompilerCallbacks {
public:
NoopCompilerCallbacks() : CompilerCallbacks(CompilerCallbacks::CallbackMode::kCompileApp) {}
~NoopCompilerCallbacks() {}
+ ClassLinker* CreateAotClassLinker(InternTable* intern_table) override {
+ return new PermissiveClassLinker(intern_table);
+ }
+
void AddUncompilableMethod([[maybe_unused]] MethodReference ref) override {}
void AddUncompilableClass([[maybe_unused]] ClassReference ref) override {}
void ClassRejected([[maybe_unused]] ClassReference ref) override {}
@@ -34,6 +40,28 @@ class NoopCompilerCallbacks final : public CompilerCallbacks {
verifier::VerifierDeps* GetVerifierDeps() const override { return nullptr; }
private:
+ // When we supply compiler callbacks, we need an appropriate `ClassLinker` that can
+ // handle `SdkChecker`-related calls that are unimplemented in the base `ClassLinker`.
+ class PermissiveClassLinker : public ClassLinker {
+ public:
+ explicit PermissiveClassLinker(InternTable* intern_table)
+ : ClassLinker(intern_table, /*fast_class_not_found_exceptions=*/ false) {}
+
+ bool DenyAccessBasedOnPublicSdk([[maybe_unused]] ArtMethod* art_method) const override
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ return false;
+ }
+ bool DenyAccessBasedOnPublicSdk([[maybe_unused]] ArtField* art_field) const override
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ return false;
+ }
+ bool DenyAccessBasedOnPublicSdk(
+ [[maybe_unused]] std::string_view type_descriptor) const override {
+ return false;
+ }
+ void SetEnablePublicSdkChecks([[maybe_unused]] bool enabled) override {}
+ };
+
DISALLOW_COPY_AND_ASSIGN(NoopCompilerCallbacks);
};