Fully implement string interning.
Also, more const.
Change-Id: I09cae88d677e8e6e42d0fa9b5d1093c79d225e66
diff --git a/src/object.cc b/src/object.cc
index 6bc3021..b71707f 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -9,6 +9,7 @@
#include "class_loader.h"
#include "globals.h"
#include "heap.h"
+#include "intern_table.h"
#include "logging.h"
#include "dex_cache.h"
#include "dex_file.h"
@@ -304,7 +305,7 @@
return object->GetFieldObject(GetOffset());
}
-void Field::SetObj(Object* object, Object* new_value) const {
+void Field::SetObj(Object* object, const Object* new_value) const {
CHECK((object == NULL) == IsStatic());
if (IsStatic()) {
object = declaring_class_;
@@ -406,7 +407,7 @@
return GetObj(object);
}
-void Field::SetObject(Object* object, Object* l) const {
+void Field::SetObject(Object* object, const Object* l) const {
CHECK(GetType() == 'L' || GetType() == '[');
SetObj(object, l);
}
@@ -680,6 +681,10 @@
java_lang_String_ = NULL;
}
+const String* String::Intern() const {
+ return Runtime::Current()->GetInternTable()->InternWeak(this);
+}
+
Class* StackTraceElement::java_lang_StackTraceElement_ = NULL;
void StackTraceElement::SetClass(Class* java_lang_StackTraceElement) {