diff options
author | Ian Rogers <irogers@google.com> | 2014-01-06 12:55:46 -0800 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-02-06 23:20:27 -0800 |
commit | ef7d42fca18c16fbaf103822ad16f23246e2905d (patch) | |
tree | c67eea52a349c2ea7f2c3bdda8e73933c05531a8 /runtime/entrypoints/portable | |
parent | 822115a225185d2896607eb08d70ce5c7099adef (diff) | |
download | art-ef7d42fca18c16fbaf103822ad16f23246e2905d.zip art-ef7d42fca18c16fbaf103822ad16f23246e2905d.tar.gz art-ef7d42fca18c16fbaf103822ad16f23246e2905d.tar.bz2 |
Object model changes to support 64bit.
Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.
Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.
Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
Diffstat (limited to 'runtime/entrypoints/portable')
6 files changed, 35 insertions, 31 deletions
diff --git a/runtime/entrypoints/portable/portable_cast_entrypoints.cc b/runtime/entrypoints/portable/portable_cast_entrypoints.cc index d343c5d..a553a22 100644 --- a/runtime/entrypoints/portable/portable_cast_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_cast_entrypoints.cc @@ -20,16 +20,16 @@ namespace art { -extern "C" int32_t art_portable_is_assignable_from_code(const mirror::Class* dest_type, - const mirror::Class* src_type) +extern "C" int32_t art_portable_is_assignable_from_code(mirror::Class* dest_type, + mirror::Class* src_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(dest_type != NULL); DCHECK(src_type != NULL); return dest_type->IsAssignableFrom(src_type) ? 1 : 0; } -extern "C" void art_portable_check_cast_from_code(const mirror::Class* dest_type, - const mirror::Class* src_type) +extern "C" void art_portable_check_cast_from_code(mirror::Class* dest_type, + mirror::Class* src_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(dest_type->IsClass()) << PrettyClass(dest_type); DCHECK(src_type->IsClass()) << PrettyClass(src_type); @@ -38,8 +38,8 @@ extern "C" void art_portable_check_cast_from_code(const mirror::Class* dest_type } } -extern "C" void art_portable_check_put_array_element_from_code(const mirror::Object* element, - const mirror::Object* array) +extern "C" void art_portable_check_put_array_element_from_code(mirror::Object* element, + mirror::Object* array) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (element == NULL) { return; diff --git a/runtime/entrypoints/portable/portable_field_entrypoints.cc b/runtime/entrypoints/portable/portable_field_entrypoints.cc index 095e99e..0b54b9c 100644 --- a/runtime/entrypoints/portable/portable_field_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_field_entrypoints.cc @@ -65,13 +65,13 @@ extern "C" int32_t art_portable_set_obj_static_from_code(uint32_t field_idx, mirror::Object* new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { field->SetObj(field->GetDeclaringClass(), new_value); return 0; } field = FindFieldFromCode<StaticObjectWrite, true>(field_idx, referrer, Thread::Current(), - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { field->SetObj(field->GetDeclaringClass(), new_value); return 0; @@ -113,12 +113,12 @@ extern "C" mirror::Object* art_portable_get_obj_static_from_code(uint32_t field_ mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticObjectRead, - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { return field->GetObj(field->GetDeclaringClass()); } field = FindFieldFromCode<StaticObjectRead, true>(field_idx, referrer, Thread::Current(), - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { return field->GetObj(field->GetDeclaringClass()); } @@ -167,13 +167,13 @@ extern "C" int32_t art_portable_set_obj_instance_from_code(uint32_t field_idx, mirror::Object* new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { field->SetObj(obj, new_value); return 0; } field = FindFieldFromCode<InstanceObjectWrite, true>(field_idx, referrer, Thread::Current(), - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { field->SetObj(obj, new_value); return 0; @@ -218,12 +218,12 @@ extern "C" mirror::Object* art_portable_get_obj_instance_from_code(uint32_t fiel mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { return field->GetObj(obj); } field = FindFieldFromCode<InstanceObjectRead, true>(field_idx, referrer, Thread::Current(), - sizeof(mirror::Object*)); + sizeof(mirror::HeapReference<mirror::Object>)); if (LIKELY(field != NULL)) { return field->GetObj(obj); } diff --git a/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc b/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc index 8cf4eed..1005d0e 100644 --- a/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc @@ -44,7 +44,7 @@ extern "C" void art_portable_fill_array_data_from_code(mirror::ArtMethod* method return; // Error } uint32_t size_in_bytes = payload->element_count * payload->element_width; - memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes); + memcpy(array->GetRawData(payload->element_width, 0), payload->data, size_in_bytes); } } // namespace art diff --git a/runtime/entrypoints/portable/portable_invoke_entrypoints.cc b/runtime/entrypoints/portable/portable_invoke_entrypoints.cc index 47ccbb1..d34b097 100644 --- a/runtime/entrypoints/portable/portable_invoke_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_invoke_entrypoints.cc @@ -34,7 +34,7 @@ mirror::ArtMethod* FindMethodHelper(uint32_t method_idx, mirror::Object* this_ob } } DCHECK(!thread->IsExceptionPending()); - const void* code = method->GetEntryPointFromCompiledCode(); + const void* code = method->GetEntryPointFromPortableCompiledCode(); // When we return, the caller will branch to this address, so it had better not be 0! if (UNLIKELY(code == NULL)) { diff --git a/runtime/entrypoints/portable/portable_throw_entrypoints.cc b/runtime/entrypoints/portable/portable_throw_entrypoints.cc index 2a0df9b..1fdb832 100644 --- a/runtime/entrypoints/portable/portable_throw_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_throw_entrypoints.cc @@ -75,7 +75,7 @@ extern "C" int32_t art_portable_find_catch_block_from_code(mirror::ArtMethod* cu ThrowLocation throw_location; mirror::Throwable* exception = self->GetException(&throw_location); // Check for special deoptimization exception. - if (UNLIKELY(reinterpret_cast<int32_t>(exception) == -1)) { + if (UNLIKELY(reinterpret_cast<intptr_t>(exception) == -1)) { return -1; } mirror::Class* exception_type = exception->GetClass(); diff --git a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc index 2162dcc..55fd301 100644 --- a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc @@ -47,6 +47,11 @@ class PortableArgumentVisitor { #define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 0 #define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 0 #define PORTABLE_STACK_ARG_SKIP 4 +#elif defined(__x86_64__) +// TODO: implement and check these. +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 16 +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 96 +#define PORTABLE_STACK_ARG_SKIP 0 #else #error "Unsupported architecture" #define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 0 @@ -387,43 +392,42 @@ extern "C" const void* artPortableResolutionTrampoline(mirror::ArtMethod* called // Incompatible class change should have been handled in resolve method. CHECK(!called->CheckIncompatibleClassChange(invoke_type)); } - const void* code = NULL; + const void* code = nullptr; if (LIKELY(!thread->IsExceptionPending())) { // Ensure that the called method's class is initialized. SirtRef<mirror::Class> called_class(thread, called->GetDeclaringClass()); linker->EnsureInitialized(called_class, true, true); if (LIKELY(called_class->IsInitialized())) { - code = called->GetEntryPointFromCompiledCode(); + code = called->GetEntryPointFromPortableCompiledCode(); // TODO: remove this after we solve the link issue. - { // for lazy link. - if (code == NULL) { - code = linker->GetOatCodeFor(called); - } + if (code == nullptr) { + bool have_portable_code; + code = linker->GetPortableOatCodeFor(called, &have_portable_code); } } else if (called_class->IsInitializing()) { if (invoke_type == kStatic) { // Class is still initializing, go to oat and grab code (trampoline must be left in place // until class is initialized to stop races between threads). - code = linker->GetOatCodeFor(called); + bool have_portable_code; + code = linker->GetPortableOatCodeFor(called, &have_portable_code); } else { // No trampoline for non-static methods. - code = called->GetEntryPointFromCompiledCode(); + code = called->GetEntryPointFromPortableCompiledCode(); // TODO: remove this after we solve the link issue. - { // for lazy link. - if (code == NULL) { - code = linker->GetOatCodeFor(called); - } + if (code == nullptr) { + bool have_portable_code; + code = linker->GetPortableOatCodeFor(called, &have_portable_code); } } } else { DCHECK(called_class->IsErroneous()); } } - if (LIKELY(code != NULL)) { + if (LIKELY(code != nullptr)) { // Expect class to at least be initializing. DCHECK(called->GetDeclaringClass()->IsInitializing()); // Don't want infinite recursion. - DCHECK(code != GetResolutionTrampoline(linker)); + DCHECK(code != GetPortableResolutionTrampoline(linker)); // Set up entry into main method *called_addr = called; } |