src/share/vm/prims/jvmtiRedefineClasses.hpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2006, 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  *
  23  */
  24 











  25 // Introduction:
  26 //
  27 // The RedefineClasses() API is used to change the definition of one or
  28 // more classes. While the API supports redefining more than one class
  29 // in a single call, in general, the API is discussed in the context of
  30 // changing the definition of a single current class to a single new
  31 // class. For clarity, the current class is will always be called
  32 // "the_class" and the new class will always be called "scratch_class".
  33 //
  34 // The name "the_class" is used because there is only one structure
  35 // that represents a specific class; redefinition does not replace the
  36 // structure, but instead replaces parts of the structure. The name
  37 // "scratch_class" is used because the structure that represents the
  38 // new definition of a specific class is simply used to carry around
  39 // the parts of the new definition until they are used to replace the
  40 // appropriate parts in the_class. Once redefinition of a class is
  41 // complete, scratch_class is thrown away.
  42 //
  43 //
  44 // Implementation Overview:


 470   static void check_class(klassOop k_oop, oop initiating_loader, TRAPS) PRODUCT_RETURN;
 471 
 472   static void dump_methods()   PRODUCT_RETURN;
 473 
 474  public:
 475   VM_RedefineClasses(jint class_count,
 476                      const jvmtiClassDefinition *class_defs,
 477                      JvmtiClassLoadKind class_load_kind);
 478   VMOp_Type type() const { return VMOp_RedefineClasses; }
 479   bool doit_prologue();
 480   void doit();
 481   void doit_epilogue();
 482 
 483   bool allow_nested_vm_operations() const        { return true; }
 484   jvmtiError check_error()                       { return _res; }
 485 
 486   // Modifiable test must be shared between IsModifiableClass query
 487   // and redefine implementation
 488   static bool is_modifiable_class(oop klass_mirror);
 489 };


   1 /*
   2  * Copyright (c) 2003, 2010, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP
  26 #define SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP
  27 
  28 #include "jvmtifiles/jvmtiEnv.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "oops/objArrayKlass.hpp"
  32 #include "oops/objArrayOop.hpp"
  33 #include "prims/jvmtiRedefineClassesTrace.hpp"
  34 #include "runtime/vm_operations.hpp"
  35 
  36 // Introduction:
  37 //
  38 // The RedefineClasses() API is used to change the definition of one or
  39 // more classes. While the API supports redefining more than one class
  40 // in a single call, in general, the API is discussed in the context of
  41 // changing the definition of a single current class to a single new
  42 // class. For clarity, the current class is will always be called
  43 // "the_class" and the new class will always be called "scratch_class".
  44 //
  45 // The name "the_class" is used because there is only one structure
  46 // that represents a specific class; redefinition does not replace the
  47 // structure, but instead replaces parts of the structure. The name
  48 // "scratch_class" is used because the structure that represents the
  49 // new definition of a specific class is simply used to carry around
  50 // the parts of the new definition until they are used to replace the
  51 // appropriate parts in the_class. Once redefinition of a class is
  52 // complete, scratch_class is thrown away.
  53 //
  54 //
  55 // Implementation Overview:


 481   static void check_class(klassOop k_oop, oop initiating_loader, TRAPS) PRODUCT_RETURN;
 482 
 483   static void dump_methods()   PRODUCT_RETURN;
 484 
 485  public:
 486   VM_RedefineClasses(jint class_count,
 487                      const jvmtiClassDefinition *class_defs,
 488                      JvmtiClassLoadKind class_load_kind);
 489   VMOp_Type type() const { return VMOp_RedefineClasses; }
 490   bool doit_prologue();
 491   void doit();
 492   void doit_epilogue();
 493 
 494   bool allow_nested_vm_operations() const        { return true; }
 495   jvmtiError check_error()                       { return _res; }
 496 
 497   // Modifiable test must be shared between IsModifiableClass query
 498   // and redefine implementation
 499   static bool is_modifiable_class(oop klass_mirror);
 500 };
 501 
 502 #endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP