hotspot/src/share/vm/oops/klassVtable.cpp
changeset 28373 26fdc99d32f8
parent 25504 69de8357bc53
child 28731 f7339cba0a6a
equal deleted inserted replaced
28372:ce0aad4b8c44 28373:26fdc99d32f8
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    98     // array classes don't have their superclass set correctly during
    98     // array classes don't have their superclass set correctly during
    99     // bootstrapping
    99     // bootstrapping
   100     vtable_length = Universe::base_vtable_size();
   100     vtable_length = Universe::base_vtable_size();
   101   }
   101   }
   102 
   102 
   103   if (super == NULL && !Universe::is_bootstrapping() &&
   103   if (super == NULL && vtable_length != Universe::base_vtable_size()) {
   104       vtable_length != Universe::base_vtable_size()) {
   104     if (Universe::is_bootstrapping()) {
   105     // Someone is attempting to redefine java.lang.Object incorrectly.  The
   105       // Someone is attempting to override java.lang.Object incorrectly on the
   106     // only way this should happen is from
   106       // bootclasspath.  The JVM cannot recover from this error including throwing
   107     // SystemDictionary::resolve_from_stream(), which will detect this later
   107       // an exception
   108     // and throw a security exception.  So don't assert here to let
   108       vm_exit_during_initialization("Incompatible definition of java.lang.Object");
   109     // the exception occur.
   109     } else {
   110     vtable_length = Universe::base_vtable_size();
   110       // Someone is attempting to redefine java.lang.Object incorrectly.  The
   111   }
   111       // only way this should happen is from
   112   assert(super != NULL || vtable_length == Universe::base_vtable_size(),
   112       // SystemDictionary::resolve_from_stream(), which will detect this later
   113          "bad vtable size for class Object");
   113       // and throw a security exception.  So don't assert here to let
       
   114       // the exception occur.
       
   115       vtable_length = Universe::base_vtable_size();
       
   116     }
       
   117   }
   114   assert(vtable_length % vtableEntry::size() == 0, "bad vtable length");
   118   assert(vtable_length % vtableEntry::size() == 0, "bad vtable length");
   115   assert(vtable_length >= Universe::base_vtable_size(), "vtable too small");
   119   assert(vtable_length >= Universe::base_vtable_size(), "vtable too small");
   116 
   120 
   117   *vtable_length_ret = vtable_length;
   121   *vtable_length_ret = vtable_length;
   118 }
   122 }