More threads work.

Adds stubs (and sometimes implementations) for dalvik.system.VMStack and
java.lang.Thread native methods. There was a bug in the dalvik
thread priority setting code, where the current thread and the passed-in
thread were confused.

I've also pulled Mutex and ThreadList out into their own files, and
moved some functionality around (with the aim of having more stuff
private, especially locks).

Change-Id: Ieb0f22669cac3df44ca34f7868f8e7d4dfa09ab6
diff --git a/src/intern_table.cc b/src/intern_table.cc
index 8a4e87e..41c1b2a 100644
--- a/src/intern_table.cc
+++ b/src/intern_table.cc
@@ -7,12 +7,7 @@
 
 namespace art {
 
-InternTable::InternTable() {
-  intern_table_lock_ = Mutex::Create("InternTable::Lock");
-}
-
-InternTable::~InternTable() {
-  delete intern_table_lock_;
+InternTable::InternTable() : intern_table_lock_("InternTable lock") {
 }
 
 size_t InternTable::Size() const {
@@ -30,7 +25,7 @@
 }
 
 const String* InternTable::Lookup(Table& table, const String* s, uint32_t hash_code) {
-  // Requires the intern_table_lock_.
+  intern_table_lock_.AssertHeld();
   typedef Table::const_iterator It; // TODO: C++0x auto
   for (It it = table.find(hash_code), end = table.end(); it != end; ++it) {
     const String* existing_string = it->second;
@@ -42,7 +37,7 @@
 }
 
 const String* InternTable::Insert(Table& table, const String* s, uint32_t hash_code) {
-  // Requires the intern_table_lock_.
+  intern_table_lock_.AssertHeld();
   table.insert(std::make_pair(hash_code, s));
   return s;
 }
@@ -53,7 +48,7 @@
 }
 
 void InternTable::Remove(Table& table, const String* s, uint32_t hash_code) {
-  // Requires the intern_table_lock_.
+  intern_table_lock_.AssertHeld();
   typedef Table::const_iterator It; // TODO: C++0x auto
   for (It it = table.find(hash_code), end = table.end(); it != end; ++it) {
     if (it->second == s) {