Skip to content

Commit b853eb7

Browse files
author
Rickard Bäckman
committed
8151956: Support non-continuous CodeBlobs in HotSpot
Reviewed-by: iveresov, thartmann, simonis
1 parent 67ff439 commit b853eb7

File tree

100 files changed

+2483
-1865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2483
-1865
lines changed

hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -221,21 +221,19 @@ bool frame::safe_for_sender(JavaThread *thread) {
221221
return jcw_safe;
222222
}
223223

224-
if (sender_blob->is_nmethod()) {
225-
nmethod* nm = sender_blob->as_nmethod_or_null();
226-
if (nm != NULL) {
227-
if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) ||
228-
nm->method()->is_method_handle_intrinsic()) {
229-
return false;
230-
}
231-
}
224+
CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
225+
if (nm != NULL) {
226+
if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) ||
227+
nm->method()->is_method_handle_intrinsic()) {
228+
return false;
229+
}
232230
}
233231

234232
// If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size
235233
// because the return address counts against the callee's frame.
236234

237235
if (sender_blob->frame_size() <= 0) {
238-
assert(!sender_blob->is_nmethod(), "should count return address at least");
236+
assert(!sender_blob->is_compiled(), "should count return address at least");
239237
return false;
240238
}
241239

@@ -244,7 +242,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
244242
// should not be anything but the call stub (already covered), the interpreter (already covered)
245243
// or an nmethod.
246244

247-
if (!sender_blob->is_nmethod()) {
245+
if (!sender_blob->is_compiled()) {
248246
return false;
249247
}
250248

@@ -286,7 +284,7 @@ void frame::patch_pc(Thread* thread, address pc) {
286284
assert(_pc == *pc_addr || pc == *pc_addr, "must be");
287285
*pc_addr = pc;
288286
_cb = CodeCache::find_blob(pc);
289-
address original_pc = nmethod::get_deopt_original_pc(this);
287+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
290288
if (original_pc != NULL) {
291289
assert(original_pc == _pc, "expected original PC to be stored before patching");
292290
_deopt_state = is_deoptimized;
@@ -371,7 +369,7 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const {
371369
// Verifies the calculated original PC of a deoptimization PC for the
372370
// given unextended SP.
373371
#ifdef ASSERT
374-
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
372+
void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) {
375373
frame fr;
376374

377375
// This is ugly but it's better than to change {get,set}_original_pc
@@ -391,12 +389,14 @@ void frame::adjust_unextended_sp() {
391389
// as any other call site. Therefore, no special action is needed when we are
392390
// returning to any of these call sites.
393391

394-
nmethod* sender_nm = (_cb == NULL) ? NULL : _cb->as_nmethod_or_null();
395-
if (sender_nm != NULL) {
396-
// If the sender PC is a deoptimization point, get the original PC.
397-
if (sender_nm->is_deopt_entry(_pc) ||
398-
sender_nm->is_deopt_mh_entry(_pc)) {
399-
DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp));
392+
if (_cb != NULL) {
393+
CompiledMethod* sender_cm = _cb->as_compiled_method_or_null();
394+
if (sender_cm != NULL) {
395+
// If the sender PC is a deoptimization point, get the original PC.
396+
if (sender_cm->is_deopt_entry(_pc) ||
397+
sender_cm->is_deopt_mh_entry(_pc)) {
398+
DEBUG_ONLY(verify_deopt_original_pc(sender_cm, _unextended_sp));
399+
}
400400
}
401401
}
402402
}

hotspot/src/cpu/aarch64/vm/frame_aarch64.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -124,7 +124,7 @@
124124

125125
#ifdef ASSERT
126126
// Used in frame::sender_for_{interpreter,compiled}_frame
127-
static void verify_deopt_original_pc( nmethod* nm, intptr_t* unextended_sp);
127+
static void verify_deopt_original_pc( CompiledMethod* nm, intptr_t* unextended_sp);
128128
#endif
129129

130130
public:

hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -55,7 +55,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
5555
_cb = CodeCache::find_blob(pc);
5656
adjust_unextended_sp();
5757

58-
address original_pc = nmethod::get_deopt_original_pc(this);
58+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
5959
if (original_pc != NULL) {
6060
_pc = original_pc;
6161
_deopt_state = is_deoptimized;
@@ -79,10 +79,10 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
7979
_cb = CodeCache::find_blob(pc);
8080
adjust_unextended_sp();
8181

82-
address original_pc = nmethod::get_deopt_original_pc(this);
82+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
8383
if (original_pc != NULL) {
8484
_pc = original_pc;
85-
assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod");
85+
assert(((CompiledMethod*)_cb)->insts_contains(_pc), "original PC must be in CompiledMethod");
8686
_deopt_state = is_deoptimized;
8787
} else {
8888
_deopt_state = not_deoptimized;
@@ -111,7 +111,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
111111
_cb = CodeCache::find_blob(_pc);
112112
adjust_unextended_sp();
113113

114-
address original_pc = nmethod::get_deopt_original_pc(this);
114+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
115115
if (original_pc != NULL) {
116116
_pc = original_pc;
117117
_deopt_state = is_deoptimized;

hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ address NativeCall::get_trampoline() {
9999

100100
address bl_destination
101101
= MacroAssembler::pd_call_destination(call_addr);
102-
if (code->content_contains(bl_destination) &&
102+
if (code->contains(bl_destination) &&
103103
is_NativeCallTrampolineStub_at(bl_destination))
104104
return bl_destination;
105105

hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -40,7 +40,7 @@ inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) {
4040

4141
_fp = (intptr_t*)own_abi()->callers_sp;
4242

43-
address original_pc = nmethod::get_deopt_original_pc(this);
43+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
4444
if (original_pc != NULL) {
4545
_pc = original_pc;
4646
_deopt_state = is_deoptimized;

hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ address NativeCall::get_trampoline() {
137137
return NULL;
138138

139139
address bl_destination = Assembler::bxx_destination(call_addr);
140-
if (code->content_contains(bl_destination) &&
140+
if (code->contains(bl_destination) &&
141141
is_NativeCallTrampolineStub_at(bl_destination))
142142
return bl_destination;
143143

hotspot/src/cpu/sparc/vm/frame_sparc.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -212,7 +212,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
212212
// ok. adapter blobs never have a frame complete and are never ok.
213213

214214
if (!_cb->is_frame_complete_at(_pc)) {
215-
if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
215+
if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
216216
return false;
217217
}
218218
}
@@ -304,7 +304,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
304304
// because you must allocate window space
305305

306306
if (sender_blob->frame_size() <= 0) {
307-
assert(!sender_blob->is_nmethod(), "should count return address at least");
307+
assert(!sender_blob->is_compiled(), "should count return address at least");
308308
return false;
309309
}
310310

@@ -315,7 +315,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
315315
// the stack unwalkable. pd_get_top_frame_for_signal_handler tries to recover from this by unwinding
316316
// that initial frame and retrying.
317317

318-
if (!sender_blob->is_nmethod()) {
318+
if (!sender_blob->is_compiled()) {
319319
return false;
320320
}
321321

@@ -358,9 +358,9 @@ void frame::init(intptr_t* sp, address pc, CodeBlob* cb) {
358358
}
359359
_deopt_state = unknown;
360360
#ifdef ASSERT
361-
if ( _cb != NULL && _cb->is_nmethod()) {
361+
if ( _cb != NULL && _cb->is_compiled()) {
362362
// Without a valid unextended_sp() we can't convert the pc to "original"
363-
assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
363+
assert(!((CompiledMethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
364364
}
365365
#endif // ASSERT
366366
}
@@ -393,7 +393,7 @@ frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpret
393393

394394
// Check for MethodHandle call sites.
395395
if (_cb != NULL) {
396-
nmethod* nm = _cb->as_nmethod_or_null();
396+
CompiledMethod* nm = _cb->as_compiled_method_or_null();
397397
if (nm != NULL) {
398398
if (nm->is_deopt_mh_entry(_pc) || nm->is_method_handle_return(_pc)) {
399399
_sp_adjustment_by_callee = (intptr_t*) ((intptr_t) sp[L7_mh_SP_save->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
@@ -413,7 +413,7 @@ frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpret
413413
// this lookup as get_deopt_original_pc() needs a correct value for
414414
// unextended_sp() which uses _sp_adjustment_by_callee.
415415
if (_pc != NULL) {
416-
address original_pc = nmethod::get_deopt_original_pc(this);
416+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
417417
if (original_pc != NULL) {
418418
_pc = original_pc;
419419
_deopt_state = is_deoptimized;
@@ -547,7 +547,7 @@ void frame::patch_pc(Thread* thread, address pc) {
547547
_cb = CodeCache::find_blob(pc);
548548
*O7_addr() = pc - pc_return_offset;
549549
_cb = CodeCache::find_blob(_pc);
550-
address original_pc = nmethod::get_deopt_original_pc(this);
550+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
551551
if (original_pc != NULL) {
552552
assert(original_pc == _pc, "expected original to be stored before patching");
553553
_deopt_state = is_deoptimized;

hotspot/src/cpu/x86/vm/frame_x86.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
9595
// ok. adapter blobs never have a frame complete and are never ok.
9696

9797
if (!_cb->is_frame_complete_at(_pc)) {
98-
if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
98+
if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
9999
return false;
100100
}
101101
}
@@ -220,21 +220,19 @@ bool frame::safe_for_sender(JavaThread *thread) {
220220
return jcw_safe;
221221
}
222222

223-
if (sender_blob->is_nmethod()) {
224-
nmethod* nm = sender_blob->as_nmethod_or_null();
225-
if (nm != NULL) {
226-
if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) ||
227-
nm->method()->is_method_handle_intrinsic()) {
228-
return false;
229-
}
223+
CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
224+
if (nm != NULL) {
225+
if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) ||
226+
nm->method()->is_method_handle_intrinsic()) {
227+
return false;
230228
}
231229
}
232230

233231
// If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size
234232
// because the return address counts against the callee's frame.
235233

236234
if (sender_blob->frame_size() <= 0) {
237-
assert(!sender_blob->is_nmethod(), "should count return address at least");
235+
assert(!sender_blob->is_compiled(), "should count return address at least");
238236
return false;
239237
}
240238

@@ -243,7 +241,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
243241
// should not be anything but the call stub (already covered), the interpreter (already covered)
244242
// or an nmethod.
245243

246-
if (!sender_blob->is_nmethod()) {
244+
if (!sender_blob->is_compiled()) {
247245
return false;
248246
}
249247

@@ -286,7 +284,7 @@ void frame::patch_pc(Thread* thread, address pc) {
286284
assert(_pc == *pc_addr || pc == *pc_addr, "must be");
287285
*pc_addr = pc;
288286
_cb = CodeCache::find_blob(pc);
289-
address original_pc = nmethod::get_deopt_original_pc(this);
287+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
290288
if (original_pc != NULL) {
291289
assert(original_pc == _pc, "expected original PC to be stored before patching");
292290
_deopt_state = is_deoptimized;
@@ -372,7 +370,7 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const {
372370
// Verifies the calculated original PC of a deoptimization PC for the
373371
// given unextended SP.
374372
#ifdef ASSERT
375-
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
373+
void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) {
376374
frame fr;
377375

378376
// This is ugly but it's better than to change {get,set}_original_pc
@@ -381,7 +379,7 @@ void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
381379
fr._unextended_sp = unextended_sp;
382380

383381
address original_pc = nm->get_original_pc(&fr);
384-
assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
382+
assert(nm->insts_contains(original_pc), "original PC must be in CompiledMethod");
385383
}
386384
#endif
387385

@@ -392,12 +390,14 @@ void frame::adjust_unextended_sp() {
392390
// as any other call site. Therefore, no special action is needed when we are
393391
// returning to any of these call sites.
394392

395-
nmethod* sender_nm = (_cb == NULL) ? NULL : _cb->as_nmethod_or_null();
396-
if (sender_nm != NULL) {
397-
// If the sender PC is a deoptimization point, get the original PC.
398-
if (sender_nm->is_deopt_entry(_pc) ||
399-
sender_nm->is_deopt_mh_entry(_pc)) {
400-
DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp));
393+
if (_cb != NULL) {
394+
CompiledMethod* sender_cm = _cb->as_compiled_method_or_null();
395+
if (sender_cm != NULL) {
396+
// If the sender PC is a deoptimization point, get the original PC.
397+
if (sender_cm->is_deopt_entry(_pc) ||
398+
sender_cm->is_deopt_mh_entry(_pc)) {
399+
DEBUG_ONLY(verify_deopt_original_pc(sender_cm, _unextended_sp));
400+
}
401401
}
402402
}
403403
}

hotspot/src/cpu/x86/vm/frame_x86.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124

125125
#ifdef ASSERT
126126
// Used in frame::sender_for_{interpreter,compiled}_frame
127-
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
127+
static void verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp);
128128
#endif
129129

130130
public:

hotspot/src/cpu/x86/vm/frame_x86.inline.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
5050
_cb = CodeCache::find_blob(pc);
5151
adjust_unextended_sp();
5252

53-
address original_pc = nmethod::get_deopt_original_pc(this);
53+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
5454
if (original_pc != NULL) {
5555
_pc = original_pc;
5656
_deopt_state = is_deoptimized;
@@ -72,10 +72,10 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address
7272
_cb = CodeCache::find_blob(pc);
7373
adjust_unextended_sp();
7474

75-
address original_pc = nmethod::get_deopt_original_pc(this);
75+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
7676
if (original_pc != NULL) {
7777
_pc = original_pc;
78-
assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod");
78+
assert(((CompiledMethod*)_cb)->insts_contains(_pc), "original PC must be in CompiledMethod");
7979
_deopt_state = is_deoptimized;
8080
} else {
8181
if (_cb->is_deoptimization_stub()) {
@@ -106,7 +106,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
106106
_cb = CodeCache::find_blob(_pc);
107107
adjust_unextended_sp();
108108

109-
address original_pc = nmethod::get_deopt_original_pc(this);
109+
address original_pc = CompiledMethod::get_deopt_original_pc(this);
110110
if (original_pc != NULL) {
111111
_pc = original_pc;
112112
_deopt_state = is_deoptimized;

0 commit comments

Comments
 (0)