runtime: Add lambda box/unbox object equality

A lambda that is boxed with box-lambda is now stored as a weak reference
in a global runtime table (lambda::BoxTable). Repeatedly boxing the same
lambda closure value will always return the same java.lang.Object back.

Since there is no way to observe the address of an object, a GC can
happen and clean up the table of any dead boxed lambdas, which can also
shrink the table to prevent the memory use from growing too much.

(Note that a lambda closure is immutable, so hashing over it is
guaranteed safe.)

Change-Id: I786c1323ff14eed937936b303d511875f9642524
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 806292f..55adaf1 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -53,6 +53,10 @@
   class JitOptions;
 }  // namespace jit
 
+namespace lambda {
+  class BoxTable;
+}  // namespace lambda
+
 namespace mirror {
   class ClassLoader;
   class Array;
@@ -532,6 +536,10 @@
     return experimental_lambdas_;
   }
 
+  lambda::BoxTable* GetLambdaBoxTable() const {
+    return lambda_box_table_.get();
+  }
+
   // Create the JIT and instrumentation and code cache.
   void CreateJit();
 
@@ -646,6 +654,8 @@
   std::unique_ptr<jit::Jit> jit_;
   std::unique_ptr<jit::JitOptions> jit_options_;
 
+  std::unique_ptr<lambda::BoxTable> lambda_box_table_;
+
   // Fault message, printed when we get a SIGSEGV.
   Mutex fault_message_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
   std::string fault_message_ GUARDED_BY(fault_message_lock_);