equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2011, 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. |
694 |
694 |
695 // Locks an nmethod so its code will not get removed, even if it is a zombie/not_entrant method |
695 // Locks an nmethod so its code will not get removed, even if it is a zombie/not_entrant method |
696 class nmethodLocker : public StackObj { |
696 class nmethodLocker : public StackObj { |
697 nmethod* _nm; |
697 nmethod* _nm; |
698 |
698 |
|
699 public: |
|
700 |
699 static void lock_nmethod(nmethod* nm); // note: nm can be NULL |
701 static void lock_nmethod(nmethod* nm); // note: nm can be NULL |
700 static void unlock_nmethod(nmethod* nm); // (ditto) |
702 static void unlock_nmethod(nmethod* nm); // (ditto) |
701 |
703 |
702 public: |
|
703 nmethodLocker(address pc); // derive nm from pc |
704 nmethodLocker(address pc); // derive nm from pc |
704 nmethodLocker(nmethod *nm) { _nm = nm; lock_nmethod(_nm); } |
705 nmethodLocker(nmethod *nm) { _nm = nm; lock_nmethod(_nm); } |
705 nmethodLocker() { _nm = NULL; } |
706 nmethodLocker() { _nm = NULL; } |
706 ~nmethodLocker() { unlock_nmethod(_nm); } |
707 ~nmethodLocker() { unlock_nmethod(_nm); } |
707 |
708 |