8223718: Checks in check_slot_type_no_lvt() should be always executed

Call check_slot_type_no_lvt() even if the LVT is present

Reviewed-by: kvn, gadams, amenkov
This commit is contained in:
Serguei Spitsyn 2019-05-30 15:55:16 -07:00
parent ec83d0304e
commit 110ead8bea
2 changed files with 25 additions and 17 deletions

View File

@ -749,10 +749,11 @@ bool VM_GetOrSetLocal::doit_prologue() {
}
}
if (!check_slot_type_no_lvt(_jvf)) {
return false;
}
if (method_oop->has_localvariable_table()) {
return check_slot_type_lvt(_jvf);
} else {
return check_slot_type_no_lvt(_jvf);
}
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,11 +67,12 @@ test_locals(jvmtiEnv *jvmti, jthread thr, jlocation location) {
}
print_LocalVariableEntry(&table[i]);
char sig = table[i].signature[0];
int slot = table[i].slot;
if (sig == 'Z' || sig == 'B' || sig == 'C' || sig == 'S') {
sig = 'I'; // covered by GetLocalInt
}
err = jvmti->GetLocalInt(thr, 0, table[i].slot, &intVal);
err = jvmti->GetLocalInt(thr, 0, slot, &intVal);
printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
if (err != JVMTI_ERROR_NONE && sig == 'I') {
printf("FAIL: GetLocalInt failed to get value of int\n");
@ -81,42 +82,48 @@ test_locals(jvmtiEnv *jvmti, jthread thr, jlocation location) {
result = STATUS_FAILED;
}
err = jvmti->GetLocalLong(thr, 0, table[i].slot, &longVal);
err = jvmti->GetLocalLong(thr, 0, slot, &longVal);
printf(" GetLocalLong: %s (%d)\n", TranslateError(err), err);
if (err != JVMTI_ERROR_NONE && sig == 'J') {
printf("FAIL: GetLocalLong failed to get value of long\n");
result = STATUS_FAILED;
} else if (err != JVMTI_ERROR_TYPE_MISMATCH && sig != 'J') {
printf("FAIL: GetLocalLong did not return JVMTI_ERROR_TYPE_MISMATCH for non-long\n");
} else if (err != JVMTI_ERROR_INVALID_SLOT &&
err != JVMTI_ERROR_TYPE_MISMATCH &&
sig != 'J') {
printf("FAIL: GetLocalLong did not return JVMTI_ERROR_INVALID_SLOT"
" nor JVMTI_ERROR_TYPE_MISMATCH for non-long\n");
result = STATUS_FAILED;
}
err = jvmti->GetLocalFloat(thr, 0, table[i].slot, &floatVal);
err = jvmti->GetLocalFloat(thr, 0, slot, &floatVal);
printf(" GetLocalFloat: %s (%d)\n", TranslateError(err), err);
if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'F') {
if (err != JVMTI_ERROR_NONE && sig == 'F') {
printf("FAIL: GetLocalFloat failed to get value of float\n");
result = STATUS_FAILED;
} else if (err != JVMTI_ERROR_TYPE_MISMATCH && table[i].signature[0] != 'F') {
} else if (err != JVMTI_ERROR_TYPE_MISMATCH && sig != 'F') {
printf("FAIL: GetLocalFloat did not return JVMTI_ERROR_TYPE_MISMATCH for non-float\n");
result = STATUS_FAILED;
}
err = jvmti->GetLocalDouble(thr, 0, table[i].slot, &doubleVal);
err = jvmti->GetLocalDouble(thr, 0, slot, &doubleVal);
printf(" GetLocalDouble: %s (%d)\n", TranslateError(err), err);
if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'D') {
if (err != JVMTI_ERROR_NONE && sig == 'D') {
printf("FAIL: GetLocalDouble failed to get value of double\n");
result = STATUS_FAILED;
} else if (err != JVMTI_ERROR_TYPE_MISMATCH && table[i].signature[0] != 'D') {
printf("FAIL: GetLocalDouble did not return JVMTI_ERROR_TYPE_MISMATCH for non-double\n");
} else if (err != JVMTI_ERROR_INVALID_SLOT &&
err != JVMTI_ERROR_TYPE_MISMATCH &&
sig != 'D') {
printf("FAIL: GetLocalDouble did not return JVMTI_ERROR_INVALID_SLOT"
" nor JVMTI_ERROR_TYPE_MISMATCH for non-double\n");
result = STATUS_FAILED;
}
err = jvmti->GetLocalObject(thr, 0, table[i].slot, &obj);
err = jvmti->GetLocalObject(thr, 0, slot, &obj);
printf(" GetLocalObject: %s (%d)\n", TranslateError(err), err);
if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'L') {
if (err != JVMTI_ERROR_NONE && sig == 'L') {
printf("FAIL: GetLocalObject failed to get value of object\n");
result = STATUS_FAILED;
} else if (err != JVMTI_ERROR_TYPE_MISMATCH && table[i].signature[0] != 'L') {
} else if (err != JVMTI_ERROR_TYPE_MISMATCH && sig != 'L') {
printf("FAIL: GetLocalObject did not return JVMTI_ERROR_TYPE_MISMATCH for non-object\n");
result = STATUS_FAILED;
}