From a0e180632411f7fe0edf454e571c42209ee7b540 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 13 Apr 2012 15:59:59 -0700 Subject: Add a SafeMap equivalent to std::map but without the error-prone operator[]. Change-Id: Iae5ba2091c55a34dbd1005cf3d25fce2a8d5c1f9 --- src/compiler.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/compiler.h') diff --git a/src/compiler.h b/src/compiler.h index cb6023b53d..9b8a3ab731 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -17,7 +17,6 @@ #ifndef ART_SRC_COMPILER_H_ #define ART_SRC_COMPILER_H_ -#include #include #include #include @@ -32,6 +31,7 @@ #include "oat_file.h" #include "object.h" #include "runtime.h" +#include "safe_map.h" namespace art { @@ -92,6 +92,7 @@ class Compiler { CompiledMethod* GetCompiledMethod(MethodReference ref) const; const CompiledInvokeStub* FindInvokeStub(bool is_static, const char* shorty) const; + const CompiledInvokeStub* FindInvokeStub(const std::string& key) const; // Callbacks from OAT/ART compiler to see what runtime checks must be generated @@ -274,25 +275,24 @@ class Compiler { void SetGcMapsDexFile(const ClassLoader* class_loader, const DexFile& dex_file); void SetGcMapsMethod(const DexFile& dex_file, Method* method); - void InsertInvokeStub(bool is_static, const char* shorty, - const CompiledInvokeStub* compiled_invoke_stub); + void InsertInvokeStub(const std::string& key, const CompiledInvokeStub* compiled_invoke_stub); std::vector code_to_patch_; std::vector methods_to_patch_; InstructionSet instruction_set_; - typedef std::map ClassTable; + typedef SafeMap ClassTable; // All class references that this compiler has compiled mutable Mutex compiled_classes_lock_; ClassTable compiled_classes_; - typedef std::map MethodTable; + typedef SafeMap MethodTable; // All method references that this compiler has compiled mutable Mutex compiled_methods_lock_; MethodTable compiled_methods_; - typedef std::map InvokeStubTable; + typedef SafeMap InvokeStubTable; // Invocation stubs created to allow invocation of the compiled methods mutable Mutex compiled_invoke_stubs_lock_; InvokeStubTable compiled_invoke_stubs_; -- cgit v1.2.3-59-g8ed1b