-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust verifier behavior in the presence of unresolved class.
Make filled-new-array not set its type as conflict if we fail to verify assignability. Instead, rely on the assignability check to either hard fail or record that there is an unresolved type check. Test: 847-filled-new-array Bug: 269228249 Change-Id: Iaede8e243d2c833d75e6befea5a4452ac70f7293
- Loading branch information
Nicolas Geoffray
committed
Feb 16, 2023
1 parent
03baeff
commit ba4ab8e
Showing
5 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Regression test for the verifier which used to hard fail when using | ||
filled-new-array with an unresolved type. We now accept it, and a | ||
NoClassDefFoundError will be thrown at runtime. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 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. | ||
|
||
.class LMain; | ||
.super Ljava/lang/Object; | ||
|
||
.method public static main([Ljava/lang/String;)V | ||
.registers 1 | ||
:try_start | ||
new-instance v0, LMissingClass; | ||
invoke-direct {v0}, LMissingClass;-><init>()V | ||
# The verifier used to fail on this instruction used to type v0 as a conflict, | ||
# because LSuperMissingClass was unresolved. This lead to the `move-result-object` | ||
# below to make the class hard fail. | ||
filled-new-array {v0}, [LSuperMissingClass; | ||
move-result-object v0 | ||
invoke-static {v0}, LMain;->doCall([LSuperMissingClass;)V | ||
# Throw a NPE to signal we don't expect to enter here. | ||
const/4 v0, 0 | ||
throw v0 | ||
:try_end | ||
.catch Ljava/lang/NoClassDefFoundError; {:try_start .. :try_end} :catch_0 | ||
:catch_0 | ||
# NoClassDefFoundError expected | ||
return-void | ||
.end method | ||
|
||
.method public static doCall([LSuperMissingClass;)V | ||
.registers 1 | ||
return-void | ||
.end method |