src/share/vm/prims/jvmtiThreadState.hpp

changeset 4037
da91efe96a93
parent 3900
d2a62e0f25eb
child 4165
fb19af007ffc
     1.1 --- a/src/share/vm/prims/jvmtiThreadState.hpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/prims/jvmtiThreadState.hpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 2012, 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 @@ -249,8 +249,8 @@
    1.11    //   The jclass is always pointing to the mirror of _the_class.
    1.12    //   ~28 JVM_* functions called by the verifier for the information
    1.13    //   about CP entries and klass structure should check the jvmtiThreadState
    1.14 -  //   info about equivalent klass versions and use it to replace a klassOop
    1.15 -  //   of _the_class with a klassOop of _scratch_class. The function
    1.16 +  //   info about equivalent klass versions and use it to replace a Klass*
    1.17 +  //   of _the_class with a Klass* of _scratch_class. The function
    1.18    //   class_to_verify_considering_redefinition() must be called for it.
    1.19    //
    1.20    //   Note again, that this redirection happens only for the verifier thread.
    1.21 @@ -274,7 +274,7 @@
    1.22    inline void clear_class_versions_map() { set_class_versions_map(NULL, NULL); }
    1.23  
    1.24    static inline
    1.25 -  klassOop class_to_verify_considering_redefinition(klassOop klass,
    1.26 +  Klass* class_to_verify_considering_redefinition(Klass* klass,
    1.27                                                      JavaThread *thread) {
    1.28      JvmtiThreadState *state = thread->jvmti_thread_state();
    1.29      if (state != NULL && state->_the_class_for_redefinition_verification != NULL) {
    1.30 @@ -400,16 +400,22 @@
    1.31  class RedefineVerifyMark : public StackObj {
    1.32   private:
    1.33    JvmtiThreadState *_state;
    1.34 +  KlassHandle       _scratch_class;
    1.35 +  Handle            _scratch_mirror;
    1.36  
    1.37   public:
    1.38    RedefineVerifyMark(KlassHandle *the_class, KlassHandle *scratch_class,
    1.39 -                     JvmtiThreadState *state) : _state(state)
    1.40 +                     JvmtiThreadState *state) : _state(state), _scratch_class(*scratch_class)
    1.41    {
    1.42      _state->set_class_versions_map(the_class, scratch_class);
    1.43 +    _scratch_mirror = Handle(_scratch_class->java_mirror());
    1.44      (*scratch_class)->set_java_mirror((*the_class)->java_mirror());
    1.45    }
    1.46  
    1.47    ~RedefineVerifyMark() {
    1.48 +    // Restore the scratch class's mirror, so when scratch_class is removed
    1.49 +    // the correct mirror pointing to it can be cleared.
    1.50 +    _scratch_class->set_java_mirror(_scratch_mirror());
    1.51      _state->clear_class_versions_map();
    1.52    }
    1.53  };

mercurial