summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-25 23:00:37 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-25 23:00:37 +0000
commit2ca48e808039314f0dae64ff3fe25e7ec2978f68 (patch)
tree8bc36e85084b7b3a065f52d29a846e3c311909cc
parent6ae87d237bb691019f8d593dfc92633d793f7017 (diff)
parenta2e21c3712f89fcaaa83ca5f56fd849b8ee77f0c (diff)
downloadart-android14-d1-s7-release.tar.gz
Change-Id: Ia8972cc578882cdc483c073ce959dcdf689310c2
-rw-r--r--libartpalette/Android.bp2
-rw-r--r--runtime/art_method.h2
-rw-r--r--runtime/class_linker.cc1
-rw-r--r--runtime/runtime_image.cc9
-rw-r--r--test/845-data-image/src-art/IfaceWithSayHi.java21
-rw-r--r--test/845-data-image/src-art/IfaceWithSayHiAtRuntime.java18
-rw-r--r--test/845-data-image/src-art/Main.java4
-rw-r--r--test/845-data-image/src2/IfaceWithSayHiAtRuntime.java21
8 files changed, 73 insertions, 5 deletions
diff --git a/libartpalette/Android.bp b/libartpalette/Android.bp
index e6aae64b64..6e7415e7b1 100644
--- a/libartpalette/Android.bp
+++ b/libartpalette/Android.bp
@@ -52,7 +52,7 @@ art_cc_library {
// libdexfile hence depends on the source instead.
// TODO(b/172480617): Alternatively, clean up when we no longer need to
// support both prebuilts and sources present simultaneously.
- "//prebuilts/module_sdk/art/current/host-exports",
+ "//prebuilts/module_sdk/art:__subpackages__",
],
header_libs: [
"libbase_headers",
diff --git a/runtime/art_method.h b/runtime/art_method.h
index dce4066d0d..b5d6ee7365 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -865,6 +865,7 @@ class ArtMethod final {
uint32_t access_flags = GetAccessFlags();
return !IsNative(access_flags) &&
!IsAbstract(access_flags) &&
+ !IsDefaultConflicting(access_flags) &&
!IsRuntimeMethod() &&
!IsProxyMethod();
}
@@ -1104,6 +1105,7 @@ class ArtMethod final {
// - conflict method: ImtConflictTable,
// - abstract/interface method: the single-implementation if any,
// - proxy method: the original interface method or constructor,
+ // - default conflict method: null
// - other methods: during AOT the code item offset, at runtime a pointer
// to the code item.
void* data_;
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index ecb2fcf472..c4a3165e82 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7999,6 +7999,7 @@ void ClassLinker::LinkMethodsHelper<kPointerSize>::ReallocMethods(ObjPtr<mirror:
constexpr uint32_t kSetFlags = kAccDefault | kAccAbstract | kAccCopied;
constexpr uint32_t kMaskFlags = ~(kAccSkipAccessChecks | kAccSingleImplementation);
new_method.SetAccessFlags((access_flags | kSetFlags) & kMaskFlags);
+ new_method.SetDataPtrSize(nullptr, kPointerSize);
DCHECK(new_method.IsDefaultConflicting());
DCHECK(!new_method.IsAbstract());
// The actual method might or might not be marked abstract since we just copied it from
diff --git a/runtime/runtime_image.cc b/runtime/runtime_image.cc
index f41d4c97f4..fa475f552b 100644
--- a/runtime/runtime_image.cc
+++ b/runtime/runtime_image.cc
@@ -953,10 +953,11 @@ class RuntimeImageHelper {
? StubType::kJNIDlsymLookupCriticalTrampoline
: StubType::kJNIDlsymLookupTrampoline;
copy->SetEntryPointFromJni(header.GetOatAddress(stub_type));
- } else if (method->IsInvokable()) {
- DCHECK(method->HasCodeItem()) << method->PrettyMethod();
- ptrdiff_t code_item_offset = reinterpret_cast<const uint8_t*>(method->GetCodeItem()) -
- method->GetDexFile()->DataBegin();
+ } else if (method->HasCodeItem()) {
+ const uint8_t* code_item = reinterpret_cast<const uint8_t*>(method->GetCodeItem());
+ DCHECK_GE(code_item, method->GetDexFile()->DataBegin());
+ uint32_t code_item_offset = dchecked_integral_cast<uint32_t>(
+ code_item - method->GetDexFile()->DataBegin());;
copy->SetDataPtrSize(
reinterpret_cast<const void*>(code_item_offset), kRuntimePointerSize);
}
diff --git a/test/845-data-image/src-art/IfaceWithSayHi.java b/test/845-data-image/src-art/IfaceWithSayHi.java
new file mode 100644
index 0000000000..2fcbd4e131
--- /dev/null
+++ b/test/845-data-image/src-art/IfaceWithSayHi.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface IfaceWithSayHi {
+ public default String sayHi() {
+ return "Hi";
+ }
+}
diff --git a/test/845-data-image/src-art/IfaceWithSayHiAtRuntime.java b/test/845-data-image/src-art/IfaceWithSayHiAtRuntime.java
new file mode 100644
index 0000000000..23b93940bd
--- /dev/null
+++ b/test/845-data-image/src-art/IfaceWithSayHiAtRuntime.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface IfaceWithSayHiAtRuntime {
+}
diff --git a/test/845-data-image/src-art/Main.java b/test/845-data-image/src-art/Main.java
index e74a6d69a0..36cc9d0bca 100644
--- a/test/845-data-image/src-art/Main.java
+++ b/test/845-data-image/src-art/Main.java
@@ -108,6 +108,9 @@ interface Itf2 {
class Itf2Impl implements Itf2 {
}
+class ClassWithDefaultConflict implements IfaceWithSayHi, IfaceWithSayHiAtRuntime {
+}
+
public class Main implements Itf {
static String myString = "MyString";
@@ -220,6 +223,7 @@ public class Main implements Itf {
public static Itf2 itf2 = new Itf2Impl();
public static ClassWithStatics statics = new ClassWithStatics();
public static ClassWithStaticType staticType = new ClassWithStaticType();
+ public static ClassWithDefaultConflict defaultConflict = new ClassWithDefaultConflict();
public static void runClassTests() {
// Test Class.getName, app images expect all strings to have hash codes.
diff --git a/test/845-data-image/src2/IfaceWithSayHiAtRuntime.java b/test/845-data-image/src2/IfaceWithSayHiAtRuntime.java
new file mode 100644
index 0000000000..9c3a339462
--- /dev/null
+++ b/test/845-data-image/src2/IfaceWithSayHiAtRuntime.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface IfaceWithSayHiAtRuntime {
+ public default String sayHi() {
+ return "hello";
+ }
+}