Skip to content

Commit f740cd2

Browse files
chadrakoEvgeny Astigeevich
authored andcommitted
8316694: Implement relocation of nmethod within CodeCache
Reviewed-by: kvn, eosterlund, never, eastigeevich, bulasevich
1 parent 76dba20 commit f740cd2

File tree

26 files changed

+1591
-64
lines changed

26 files changed

+1591
-64
lines changed

src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ void Relocation::pd_set_call_destination(address x) {
9090

9191
void trampoline_stub_Relocation::pd_fix_owner_after_move() {
9292
NativeCall* call = nativeCall_at(owner());
93-
assert(call->raw_destination() == owner(), "destination should be empty");
9493
address trampoline = addr();
9594
address dest = nativeCallTrampolineStub_at(trampoline)->destination();
9695
if (!Assembler::reachable_from_branch_at(owner(), dest)) {

src/hotspot/share/code/codeBehaviours.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,24 @@
2323
*/
2424

2525
#include "code/codeBehaviours.hpp"
26+
#include "code/nmethod.hpp"
2627
#include "runtime/mutexLocker.hpp"
2728
#include "runtime/safepoint.hpp"
2829

2930
CompiledICProtectionBehaviour* CompiledICProtectionBehaviour::_current = nullptr;
3031

31-
bool DefaultICProtectionBehaviour::lock(nmethod* method) {
32-
if (is_safe(method)) {
32+
bool DefaultICProtectionBehaviour::lock(nmethod* nm) {
33+
if (is_safe(nm)) {
3334
return false;
3435
}
3536
CompiledIC_lock->lock_without_safepoint_check();
3637
return true;
3738
}
3839

39-
void DefaultICProtectionBehaviour::unlock(nmethod* method) {
40+
void DefaultICProtectionBehaviour::unlock(nmethod* nm) {
4041
CompiledIC_lock->unlock();
4142
}
4243

43-
bool DefaultICProtectionBehaviour::is_safe(nmethod* method) {
44-
return SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->owned_by_self();
44+
bool DefaultICProtectionBehaviour::is_safe(nmethod* nm) {
45+
return SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->owned_by_self() || (NMethodState_lock->owned_by_self() && nm->is_not_installed());
4546
}

src/hotspot/share/code/codeBehaviours.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ class CompiledICProtectionBehaviour {
3333
static CompiledICProtectionBehaviour* _current;
3434

3535
public:
36-
virtual bool lock(nmethod* method) = 0;
37-
virtual void unlock(nmethod* method) = 0;
38-
virtual bool is_safe(nmethod* method) = 0;
36+
virtual bool lock(nmethod* nm) = 0;
37+
virtual void unlock(nmethod* nm) = 0;
38+
virtual bool is_safe(nmethod* nm) = 0;
3939

4040
static CompiledICProtectionBehaviour* current() { return _current; }
4141
static void set_current(CompiledICProtectionBehaviour* current) { _current = current; }
4242
};
4343

4444
class DefaultICProtectionBehaviour: public CompiledICProtectionBehaviour, public CHeapObj<mtInternal> {
45-
virtual bool lock(nmethod* method);
46-
virtual void unlock(nmethod* method);
47-
virtual bool is_safe(nmethod* method);
45+
virtual bool lock(nmethod* nm);
46+
virtual void unlock(nmethod* nm);
47+
virtual bool is_safe(nmethod* nm);
4848
};
4949

5050
#endif // SHARE_CODE_CODEBEHAVIOURS_HPP

src/hotspot/share/code/codeCache.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class CodeCache : AllStatic {
259259
static bool heap_available(CodeBlobType code_blob_type);
260260

261261
// Returns the CodeBlobType for the given nmethod
262-
static CodeBlobType get_code_blob_type(nmethod* nm) {
262+
static CodeBlobType get_code_blob_type(const nmethod* nm) {
263263
return get_code_heap(nm)->code_blob_type();
264264
}
265265

src/hotspot/share/code/compiledIC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ CompiledICLocker::~CompiledICLocker() {
5555
}
5656
}
5757

58-
bool CompiledICLocker::is_safe(nmethod* method) {
59-
return CompiledICProtectionBehaviour::current()->is_safe(method);
58+
bool CompiledICLocker::is_safe(nmethod* nm) {
59+
return CompiledICProtectionBehaviour::current()->is_safe(nm);
6060
}
6161

6262
bool CompiledICLocker::is_safe(address code) {

src/hotspot/share/code/compiledIC.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CompiledICLocker: public StackObj {
5050
public:
5151
CompiledICLocker(nmethod* method);
5252
~CompiledICLocker();
53-
static bool is_safe(nmethod* method);
53+
static bool is_safe(nmethod* nm);
5454
static bool is_safe(address code);
5555
};
5656

0 commit comments

Comments
 (0)