src/share/vm/classfile/stackMapFrame.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_8046233_7 Sdiff src/share/vm/classfile

src/share/vm/classfile/stackMapFrame.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  37                       _max_stack(max_stack), _verifier(v) {
  38   Thread* thr = v->thread();
  39   _locals = NEW_RESOURCE_ARRAY_IN_THREAD(thr, VerificationType, max_locals);
  40   _stack = NEW_RESOURCE_ARRAY_IN_THREAD(thr, VerificationType, max_stack);
  41   int32_t i;
  42   for(i = 0; i < max_locals; i++) {
  43     _locals[i] = VerificationType::bogus_type();
  44   }
  45   for(i = 0; i < max_stack; i++) {
  46     _stack[i] = VerificationType::bogus_type();
  47   }
  48 }
  49 
  50 StackMapFrame* StackMapFrame::frame_in_exception_handler(u1 flags) {
  51   Thread* thr = _verifier->thread();
  52   VerificationType* stack = NEW_RESOURCE_ARRAY_IN_THREAD(thr, VerificationType, 1);
  53   StackMapFrame* frame = new StackMapFrame(_offset, flags, _locals_size, 0, _max_locals, _max_stack, _locals, stack, _verifier);
  54   return frame;
  55 }
  56 
  57 bool StackMapFrame::has_new_object() const {


  58   int32_t i;
  59   for (i = 0; i < _max_locals; i++) {
  60     if (_locals[i].is_uninitialized()) {

  61       return true;
  62     }
  63   }
  64   for (i = 0; i < _stack_size; i++) {
  65     if (_stack[i].is_uninitialized()) {

  66       return true;
  67     }
  68   }
  69   return false;
  70 }
  71 
  72 void StackMapFrame::initialize_object(
  73     VerificationType old_object, VerificationType new_object) {
  74   int32_t i;
  75   for (i = 0; i < _max_locals; i++) {
  76     if (_locals[i].equals(old_object)) {
  77       _locals[i] = new_object;
  78     }
  79   }
  80   for (i = 0; i < _stack_size; i++) {
  81     if (_stack[i].equals(old_object)) {
  82       _stack[i] = new_object;
  83     }
  84   }
  85   if (old_object == VerificationType::uninitialized_this_type()) {


   1 /*
   2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  37                       _max_stack(max_stack), _verifier(v) {
  38   Thread* thr = v->thread();
  39   _locals = NEW_RESOURCE_ARRAY_IN_THREAD(thr, VerificationType, max_locals);
  40   _stack = NEW_RESOURCE_ARRAY_IN_THREAD(thr, VerificationType, max_stack);
  41   int32_t i;
  42   for(i = 0; i < max_locals; i++) {
  43     _locals[i] = VerificationType::bogus_type();
  44   }
  45   for(i = 0; i < max_stack; i++) {
  46     _stack[i] = VerificationType::bogus_type();
  47   }
  48 }
  49 
  50 StackMapFrame* StackMapFrame::frame_in_exception_handler(u1 flags) {
  51   Thread* thr = _verifier->thread();
  52   VerificationType* stack = NEW_RESOURCE_ARRAY_IN_THREAD(thr, VerificationType, 1);
  53   StackMapFrame* frame = new StackMapFrame(_offset, flags, _locals_size, 0, _max_locals, _max_stack, _locals, stack, _verifier);
  54   return frame;
  55 }
  56 
  57 // Return true if frame has an uninitialized (new) object that differs
  58 // from the target frame's object.
  59 bool StackMapFrame::has_unique_new_object(const StackMapFrame *target_frame) const {
  60   int32_t i;
  61   for (i = 0; i < _max_locals; i++) {
  62     if (_locals[i].is_uninitialized() &&
  63         !_locals[i].equals(target_frame->_locals[i])) {
  64       return true;
  65     }
  66   }
  67   for (i = 0; i < _stack_size; i++) {
  68     if (_stack[i].is_uninitialized() &&
  69         !_stack[i].equals(target_frame->_stack[i])) {
  70       return true;
  71     }
  72   }
  73   return false;
  74 }
  75 
  76 void StackMapFrame::initialize_object(
  77     VerificationType old_object, VerificationType new_object) {
  78   int32_t i;
  79   for (i = 0; i < _max_locals; i++) {
  80     if (_locals[i].equals(old_object)) {
  81       _locals[i] = new_object;
  82     }
  83   }
  84   for (i = 0; i < _stack_size; i++) {
  85     if (_stack[i].equals(old_object)) {
  86       _stack[i] = new_object;
  87     }
  88   }
  89   if (old_object == VerificationType::uninitialized_this_type()) {


src/share/vm/classfile/stackMapFrame.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File