8046233: VerifyError on backward branch

Tue, 05 Aug 2014 09:11:35 -0400

author
hseigel
date
Tue, 05 Aug 2014 09:11:35 -0400
changeset 6960
b2daaf70fab2
parent 6957
e0c6fadce66e
child 6961
edfa5ba8609e

8046233: VerifyError on backward branch
Summary: Remove check that causes the VerifyError
Reviewed-by: dholmes, coleenp, acorn

src/share/vm/classfile/stackMapFrame.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/stackMapFrame.hpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/stackMapTable.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/stackMapTable.hpp file | annotate | diff | comparison | revisions
test/runtime/7116786/Test7116786.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/stackMapFrame.cpp	Tue Jul 29 13:40:58 2014 -0700
     1.2 +++ b/src/share/vm/classfile/stackMapFrame.cpp	Tue Aug 05 09:11:35 2014 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -54,21 +54,6 @@
    1.11    return frame;
    1.12  }
    1.13  
    1.14 -bool StackMapFrame::has_new_object() const {
    1.15 -  int32_t i;
    1.16 -  for (i = 0; i < _max_locals; i++) {
    1.17 -    if (_locals[i].is_uninitialized()) {
    1.18 -      return true;
    1.19 -    }
    1.20 -  }
    1.21 -  for (i = 0; i < _stack_size; i++) {
    1.22 -    if (_stack[i].is_uninitialized()) {
    1.23 -      return true;
    1.24 -    }
    1.25 -  }
    1.26 -  return false;
    1.27 -}
    1.28 -
    1.29  void StackMapFrame::initialize_object(
    1.30      VerificationType old_object, VerificationType new_object) {
    1.31    int32_t i;
     2.1 --- a/src/share/vm/classfile/stackMapFrame.hpp	Tue Jul 29 13:40:58 2014 -0700
     2.2 +++ b/src/share/vm/classfile/stackMapFrame.hpp	Tue Aug 05 09:11:35 2014 -0400
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -155,10 +155,6 @@
    2.11      const methodHandle m, VerificationType thisKlass, TRAPS);
    2.12  
    2.13    // Search local variable type array and stack type array.
    2.14 -  // Return true if an uninitialized object is found.
    2.15 -  bool has_new_object() const;
    2.16 -
    2.17 -  // Search local variable type array and stack type array.
    2.18    // Set every element with type of old_object to new_object.
    2.19    void initialize_object(
    2.20      VerificationType old_object, VerificationType new_object);
     3.1 --- a/src/share/vm/classfile/stackMapTable.cpp	Tue Jul 29 13:40:58 2014 -0700
     3.2 +++ b/src/share/vm/classfile/stackMapTable.cpp	Tue Aug 05 09:11:35 2014 -0400
     3.3 @@ -130,19 +130,6 @@
     3.4    if (!match || (target < 0 || target >= _code_length)) {
     3.5      frame->verifier()->verify_error(ctx,
     3.6          "Inconsistent stackmap frames at branch target %d", target);
     3.7 -    return;
     3.8 -  }
     3.9 -  // check if uninitialized objects exist on backward branches
    3.10 -  check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
    3.11 -}
    3.12 -
    3.13 -void StackMapTable::check_new_object(
    3.14 -    const StackMapFrame* frame, int32_t target, TRAPS) const {
    3.15 -  if (frame->offset() > target && frame->has_new_object()) {
    3.16 -    frame->verifier()->verify_error(
    3.17 -        ErrorContext::bad_code(frame->offset()),
    3.18 -        "Uninitialized object exists on backward branch %d", target);
    3.19 -    return;
    3.20    }
    3.21  }
    3.22  
     4.1 --- a/src/share/vm/classfile/stackMapTable.hpp	Tue Jul 29 13:40:58 2014 -0700
     4.2 +++ b/src/share/vm/classfile/stackMapTable.hpp	Tue Aug 05 09:11:35 2014 -0400
     4.3 @@ -90,10 +90,6 @@
     4.4    // Returns the frame array index where the frame with offset is stored.
     4.5    int get_index_from_offset(int32_t offset) const;
     4.6  
     4.7 -  // Make sure that there's no uninitialized object exist on backward branch.
     4.8 -  void check_new_object(
     4.9 -    const StackMapFrame* frame, int32_t target, TRAPS) const;
    4.10 -
    4.11    void print_on(outputStream* str) const;
    4.12  };
    4.13  
     5.1 --- a/test/runtime/7116786/Test7116786.java	Tue Jul 29 13:40:58 2014 -0700
     5.2 +++ b/test/runtime/7116786/Test7116786.java	Tue Aug 05 09:11:35 2014 -0400
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -147,7 +147,8 @@
    5.11                   "no stackmap frame at jump location or bad jump",
    5.12                   "Inconsistent stackmap frames at branch target "),
    5.13  
    5.14 -        new Case("case15", "stackMapTable.cpp", true, "check_new_object",
    5.15 +        /* Backward jump with uninit is allowed starting with JDK 8 */
    5.16 +        new Case("case15", "stackMapTable.cpp", false, "check_new_object",
    5.17                   "backward jump with uninit",
    5.18                   "Uninitialized object exists on backward branch "),
    5.19  

mercurial