Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/code/codeBlob.hpp
40931 views
1
/*
2
* Copyright (c) 1998, 2021, 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_CODE_CODEBLOB_HPP
26
#define SHARE_CODE_CODEBLOB_HPP
27
28
#include "asm/codeBuffer.hpp"
29
#include "compiler/compilerDefinitions.hpp"
30
#include "runtime/frame.hpp"
31
#include "runtime/handles.hpp"
32
#include "utilities/align.hpp"
33
#include "utilities/macros.hpp"
34
35
class ImmutableOopMap;
36
class ImmutableOopMapSet;
37
class OopMapSet;
38
39
// CodeBlob Types
40
// Used in the CodeCache to assign CodeBlobs to different CodeHeaps
41
struct CodeBlobType {
42
enum {
43
MethodNonProfiled = 0, // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
44
MethodProfiled = 1, // Execution level 2 and 3 (profiled) nmethods
45
NonNMethod = 2, // Non-nmethods like Buffers, Adapters and Runtime Stubs
46
All = 3, // All types (No code cache segmentation)
47
NumTypes = 4 // Number of CodeBlobTypes
48
};
49
};
50
51
// CodeBlob - superclass for all entries in the CodeCache.
52
//
53
// Subtypes are:
54
// CompiledMethod : Compiled Java methods (include method that calls to native code)
55
// nmethod : JIT Compiled Java methods
56
// RuntimeBlob : Non-compiled method code; generated glue code
57
// BufferBlob : Used for non-relocatable code such as interpreter, stubroutines, etc.
58
// AdapterBlob : Used to hold C2I/I2C adapters
59
// VtableBlob : Used for holding vtable chunks
60
// MethodHandlesAdapterBlob : Used to hold MethodHandles adapters
61
// OptimizedEntryBlob : Used for upcalls from native code
62
// RuntimeStub : Call to VM runtime methods
63
// SingletonBlob : Super-class for all blobs that exist in only one instance
64
// DeoptimizationBlob : Used for deoptimization
65
// ExceptionBlob : Used for stack unrolling
66
// SafepointBlob : Used to handle illegal instruction exceptions
67
// UncommonTrapBlob : Used to handle uncommon traps
68
//
69
//
70
// Layout : continuous in the CodeCache
71
// - header
72
// - relocation
73
// - content space
74
// - instruction space
75
// - data space
76
77
78
class CodeBlobLayout;
79
class OptimizedEntryBlob; // for as_optimized_entry_blob()
80
class JavaFrameAnchor; // for EntryBlob::jfa_for_frame
81
82
class CodeBlob {
83
friend class VMStructs;
84
friend class JVMCIVMStructs;
85
friend class CodeCacheDumper;
86
87
protected:
88
89
const CompilerType _type; // CompilerType
90
int _size; // total size of CodeBlob in bytes
91
int _header_size; // size of header (depends on subclass)
92
int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have
93
// not finished setting up their frame. Beware of pc's in
94
// that range. There is a similar range(s) on returns
95
// which we don't detect.
96
int _data_offset; // offset to where data region begins
97
int _frame_size; // size of stack frame
98
99
address _code_begin;
100
address _code_end;
101
address _content_begin; // address to where content region begins (this includes consts, insts, stubs)
102
// address _content_end - not required, for all CodeBlobs _code_end == _content_end for now
103
address _data_end;
104
address _relocation_begin;
105
address _relocation_end;
106
107
ImmutableOopMapSet* _oop_maps; // OopMap for this CodeBlob
108
bool _caller_must_gc_arguments;
109
110
const char* _name;
111
S390_ONLY(int _ctable_offset;)
112
113
NOT_PRODUCT(CodeStrings _strings;)
114
115
CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
116
CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments);
117
118
public:
119
// Only used by unit test.
120
CodeBlob()
121
: _type(compiler_none) {}
122
123
// Returns the space needed for CodeBlob
124
static unsigned int allocation_size(CodeBuffer* cb, int header_size);
125
static unsigned int align_code_offset(int offset);
126
127
// Deletion
128
virtual void flush();
129
130
// Typing
131
virtual bool is_buffer_blob() const { return false; }
132
virtual bool is_nmethod() const { return false; }
133
virtual bool is_runtime_stub() const { return false; }
134
virtual bool is_deoptimization_stub() const { return false; }
135
virtual bool is_uncommon_trap_stub() const { return false; }
136
virtual bool is_exception_stub() const { return false; }
137
virtual bool is_safepoint_stub() const { return false; }
138
virtual bool is_adapter_blob() const { return false; }
139
virtual bool is_vtable_blob() const { return false; }
140
virtual bool is_method_handles_adapter_blob() const { return false; }
141
virtual bool is_compiled() const { return false; }
142
virtual bool is_optimized_entry_blob() const { return false; }
143
144
inline bool is_compiled_by_c1() const { return _type == compiler_c1; };
145
inline bool is_compiled_by_c2() const { return _type == compiler_c2; };
146
inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
147
const char* compiler_name() const;
148
CompilerType compiler_type() const { return _type; }
149
150
// Casting
151
nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; }
152
nmethod* as_nmethod() { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
153
CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
154
CompiledMethod* as_compiled_method() { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
155
CodeBlob* as_codeblob_or_null() const { return (CodeBlob*) this; }
156
OptimizedEntryBlob* as_optimized_entry_blob() const { assert(is_optimized_entry_blob(), "must be entry blob"); return (OptimizedEntryBlob*) this; }
157
158
// Boundaries
159
address header_begin() const { return (address) this; }
160
relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
161
relocInfo* relocation_end() const { return (relocInfo*) _relocation_end; }
162
address content_begin() const { return _content_begin; }
163
address content_end() const { return _code_end; } // _code_end == _content_end is true for all types of blobs for now, it is also checked in the constructor
164
address code_begin() const { return _code_begin; }
165
address code_end() const { return _code_end; }
166
address data_end() const { return _data_end; }
167
168
// This field holds the beginning of the const section in the old code buffer.
169
// It is needed to fix relocations of pc-relative loads when resizing the
170
// the constant pool or moving it.
171
S390_ONLY(address ctable_begin() const { return header_begin() + _ctable_offset; })
172
void set_ctable_begin(address ctable) { S390_ONLY(_ctable_offset = ctable - header_begin();) }
173
174
// Sizes
175
int size() const { return _size; }
176
int header_size() const { return _header_size; }
177
int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); }
178
int content_size() const { return content_end() - content_begin(); }
179
int code_size() const { return code_end() - code_begin(); }
180
// Only used from CodeCache::free_unused_tail() after the Interpreter blob was trimmed
181
void adjust_size(size_t used) {
182
_size = (int)used;
183
_data_offset = (int)used;
184
_code_end = (address)this + used;
185
_data_end = (address)this + used;
186
}
187
188
// Containment
189
bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); }
190
bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); }
191
bool contains(address addr) const { return content_begin() <= addr && addr < content_end(); }
192
bool is_frame_complete_at(address addr) const { return _frame_complete_offset != CodeOffsets::frame_never_safe &&
193
code_contains(addr) && addr >= code_begin() + _frame_complete_offset; }
194
int frame_complete_offset() const { return _frame_complete_offset; }
195
196
// CodeCache support: really only used by the nmethods, but in order to get
197
// asserts and certain bookkeeping to work in the CodeCache they are defined
198
// virtual here.
199
virtual bool is_zombie() const { return false; }
200
virtual bool is_locked_by_vm() const { return false; }
201
202
virtual bool is_unloaded() const { return false; }
203
virtual bool is_not_entrant() const { return false; }
204
205
// GC support
206
virtual bool is_alive() const = 0;
207
208
// OopMap for frame
209
ImmutableOopMapSet* oop_maps() const { return _oop_maps; }
210
void set_oop_maps(OopMapSet* p);
211
const ImmutableOopMap* oop_map_for_return_address(address return_address);
212
virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) = 0;
213
214
// Frame support. Sizes are in word units.
215
int frame_size() const { return _frame_size; }
216
void set_frame_size(int size) { _frame_size = size; }
217
218
// Returns true, if the next frame is responsible for GC'ing oops passed as arguments
219
bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; }
220
221
// Naming
222
const char* name() const { return _name; }
223
void set_name(const char* name) { _name = name; }
224
225
// Debugging
226
virtual void verify() = 0;
227
virtual void print() const;
228
virtual void print_on(outputStream* st) const;
229
virtual void print_value_on(outputStream* st) const;
230
void dump_for_addr(address addr, outputStream* st, bool verbose) const;
231
void print_code();
232
233
// Print the comment associated with offset on stream, if there is one
234
virtual void print_block_comment(outputStream* stream, address block_begin) const {
235
#ifndef PRODUCT
236
intptr_t offset = (intptr_t)(block_begin - code_begin());
237
_strings.print_block_comment(stream, offset);
238
#endif
239
}
240
241
#ifndef PRODUCT
242
void set_strings(CodeStrings& strings) {
243
_strings.copy(strings);
244
}
245
#endif
246
};
247
248
class CodeBlobLayout : public StackObj {
249
private:
250
int _size;
251
int _header_size;
252
int _relocation_size;
253
int _content_offset;
254
int _code_offset;
255
int _data_offset;
256
address _code_begin;
257
address _code_end;
258
address _content_begin;
259
address _content_end;
260
address _data_end;
261
address _relocation_begin;
262
address _relocation_end;
263
264
public:
265
CodeBlobLayout(address code_begin, address code_end, address content_begin, address content_end, address data_end, address relocation_begin, address relocation_end) :
266
_size(0),
267
_header_size(0),
268
_relocation_size(0),
269
_content_offset(0),
270
_code_offset(0),
271
_data_offset(0),
272
_code_begin(code_begin),
273
_code_end(code_end),
274
_content_begin(content_begin),
275
_content_end(content_end),
276
_data_end(data_end),
277
_relocation_begin(relocation_begin),
278
_relocation_end(relocation_end)
279
{
280
}
281
282
CodeBlobLayout(const address start, int size, int header_size, int relocation_size, int data_offset) :
283
_size(size),
284
_header_size(header_size),
285
_relocation_size(relocation_size),
286
_content_offset(CodeBlob::align_code_offset(_header_size + _relocation_size)),
287
_code_offset(_content_offset),
288
_data_offset(data_offset)
289
{
290
assert(is_aligned(_relocation_size, oopSize), "unaligned size");
291
292
_code_begin = (address) start + _code_offset;
293
_code_end = (address) start + _data_offset;
294
295
_content_begin = (address) start + _content_offset;
296
_content_end = (address) start + _data_offset;
297
298
_data_end = (address) start + _size;
299
_relocation_begin = (address) start + _header_size;
300
_relocation_end = _relocation_begin + _relocation_size;
301
}
302
303
CodeBlobLayout(const address start, int size, int header_size, const CodeBuffer* cb) :
304
_size(size),
305
_header_size(header_size),
306
_relocation_size(align_up(cb->total_relocation_size(), oopSize)),
307
_content_offset(CodeBlob::align_code_offset(_header_size + _relocation_size)),
308
_code_offset(_content_offset + cb->total_offset_of(cb->insts())),
309
_data_offset(_content_offset + align_up(cb->total_content_size(), oopSize))
310
{
311
assert(is_aligned(_relocation_size, oopSize), "unaligned size");
312
313
_code_begin = (address) start + _code_offset;
314
_code_end = (address) start + _data_offset;
315
316
_content_begin = (address) start + _content_offset;
317
_content_end = (address) start + _data_offset;
318
319
_data_end = (address) start + _size;
320
_relocation_begin = (address) start + _header_size;
321
_relocation_end = _relocation_begin + _relocation_size;
322
}
323
324
int size() const { return _size; }
325
int header_size() const { return _header_size; }
326
int relocation_size() const { return _relocation_size; }
327
int content_offset() const { return _content_offset; }
328
int code_offset() const { return _code_offset; }
329
int data_offset() const { return _data_offset; }
330
address code_begin() const { return _code_begin; }
331
address code_end() const { return _code_end; }
332
address data_end() const { return _data_end; }
333
address relocation_begin() const { return _relocation_begin; }
334
address relocation_end() const { return _relocation_end; }
335
address content_begin() const { return _content_begin; }
336
address content_end() const { return _content_end; }
337
};
338
339
340
class RuntimeBlob : public CodeBlob {
341
friend class VMStructs;
342
public:
343
344
// Creation
345
// a) simple CodeBlob
346
// frame_complete is the offset from the beginning of the instructions
347
// to where the frame setup (from stackwalk viewpoint) is complete.
348
RuntimeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size);
349
350
// b) full CodeBlob
351
RuntimeBlob(
352
const char* name,
353
CodeBuffer* cb,
354
int header_size,
355
int size,
356
int frame_complete,
357
int frame_size,
358
OopMapSet* oop_maps,
359
bool caller_must_gc_arguments = false
360
);
361
362
// GC support
363
virtual bool is_alive() const = 0;
364
365
void verify();
366
367
// OopMap for frame
368
virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); }
369
370
// Debugging
371
virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
372
virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); }
373
374
// Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
375
static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = "");
376
};
377
378
class WhiteBox;
379
//----------------------------------------------------------------------------------------------------
380
// BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
381
382
class BufferBlob: public RuntimeBlob {
383
friend class VMStructs;
384
friend class AdapterBlob;
385
friend class VtableBlob;
386
friend class MethodHandlesAdapterBlob;
387
friend class OptimizedEntryBlob;
388
friend class WhiteBox;
389
390
private:
391
// Creation support
392
BufferBlob(const char* name, int size);
393
BufferBlob(const char* name, int size, CodeBuffer* cb);
394
395
// This ordinary operator delete is needed even though not used, so the
396
// below two-argument operator delete will be treated as a placement
397
// delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
398
void operator delete(void* p);
399
void* operator new(size_t s, unsigned size) throw();
400
401
public:
402
// Creation
403
static BufferBlob* create(const char* name, int buffer_size);
404
static BufferBlob* create(const char* name, CodeBuffer* cb);
405
406
static void free(BufferBlob* buf);
407
408
// Typing
409
virtual bool is_buffer_blob() const { return true; }
410
411
// GC/Verification support
412
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ }
413
bool is_alive() const { return true; }
414
415
void verify();
416
void print_on(outputStream* st) const;
417
void print_value_on(outputStream* st) const;
418
};
419
420
421
//----------------------------------------------------------------------------------------------------
422
// AdapterBlob: used to hold C2I/I2C adapters
423
424
class AdapterBlob: public BufferBlob {
425
private:
426
AdapterBlob(int size, CodeBuffer* cb);
427
428
public:
429
// Creation
430
static AdapterBlob* create(CodeBuffer* cb);
431
432
// Typing
433
virtual bool is_adapter_blob() const { return true; }
434
};
435
436
//---------------------------------------------------------------------------------------------------
437
class VtableBlob: public BufferBlob {
438
private:
439
VtableBlob(const char*, int);
440
441
void* operator new(size_t s, unsigned size) throw();
442
443
public:
444
// Creation
445
static VtableBlob* create(const char* name, int buffer_size);
446
447
// Typing
448
virtual bool is_vtable_blob() const { return true; }
449
};
450
451
//----------------------------------------------------------------------------------------------------
452
// MethodHandlesAdapterBlob: used to hold MethodHandles adapters
453
454
class MethodHandlesAdapterBlob: public BufferBlob {
455
private:
456
MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {}
457
458
public:
459
// Creation
460
static MethodHandlesAdapterBlob* create(int buffer_size);
461
462
// Typing
463
virtual bool is_method_handles_adapter_blob() const { return true; }
464
};
465
466
467
//----------------------------------------------------------------------------------------------------
468
// RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
469
470
class RuntimeStub: public RuntimeBlob {
471
friend class VMStructs;
472
private:
473
// Creation support
474
RuntimeStub(
475
const char* name,
476
CodeBuffer* cb,
477
int size,
478
int frame_complete,
479
int frame_size,
480
OopMapSet* oop_maps,
481
bool caller_must_gc_arguments
482
);
483
484
// This ordinary operator delete is needed even though not used, so the
485
// below two-argument operator delete will be treated as a placement
486
// delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
487
void operator delete(void* p);
488
void* operator new(size_t s, unsigned size) throw();
489
490
public:
491
// Creation
492
static RuntimeStub* new_runtime_stub(
493
const char* stub_name,
494
CodeBuffer* cb,
495
int frame_complete,
496
int frame_size,
497
OopMapSet* oop_maps,
498
bool caller_must_gc_arguments
499
);
500
501
// Typing
502
bool is_runtime_stub() const { return true; }
503
504
address entry_point() const { return code_begin(); }
505
506
// GC/Verification support
507
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ }
508
bool is_alive() const { return true; }
509
510
void verify();
511
void print_on(outputStream* st) const;
512
void print_value_on(outputStream* st) const;
513
};
514
515
516
//----------------------------------------------------------------------------------------------------
517
// Super-class for all blobs that exist in only one instance. Implements default behaviour.
518
519
class SingletonBlob: public RuntimeBlob {
520
friend class VMStructs;
521
522
protected:
523
// This ordinary operator delete is needed even though not used, so the
524
// below two-argument operator delete will be treated as a placement
525
// delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
526
void operator delete(void* p);
527
void* operator new(size_t s, unsigned size) throw();
528
529
public:
530
SingletonBlob(
531
const char* name,
532
CodeBuffer* cb,
533
int header_size,
534
int size,
535
int frame_size,
536
OopMapSet* oop_maps
537
)
538
: RuntimeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps)
539
{};
540
541
address entry_point() { return code_begin(); }
542
543
bool is_alive() const { return true; }
544
545
// GC/Verification support
546
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ }
547
void verify(); // does nothing
548
void print_on(outputStream* st) const;
549
void print_value_on(outputStream* st) const;
550
};
551
552
553
//----------------------------------------------------------------------------------------------------
554
// DeoptimizationBlob
555
556
class DeoptimizationBlob: public SingletonBlob {
557
friend class VMStructs;
558
friend class JVMCIVMStructs;
559
private:
560
int _unpack_offset;
561
int _unpack_with_exception;
562
int _unpack_with_reexecution;
563
564
int _unpack_with_exception_in_tls;
565
566
#if INCLUDE_JVMCI
567
// Offsets when JVMCI calls uncommon_trap.
568
int _uncommon_trap_offset;
569
int _implicit_exception_uncommon_trap_offset;
570
#endif
571
572
// Creation support
573
DeoptimizationBlob(
574
CodeBuffer* cb,
575
int size,
576
OopMapSet* oop_maps,
577
int unpack_offset,
578
int unpack_with_exception_offset,
579
int unpack_with_reexecution_offset,
580
int frame_size
581
);
582
583
public:
584
// Creation
585
static DeoptimizationBlob* create(
586
CodeBuffer* cb,
587
OopMapSet* oop_maps,
588
int unpack_offset,
589
int unpack_with_exception_offset,
590
int unpack_with_reexecution_offset,
591
int frame_size
592
);
593
594
// Typing
595
bool is_deoptimization_stub() const { return true; }
596
597
// GC for args
598
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
599
600
// Printing
601
void print_value_on(outputStream* st) const;
602
603
address unpack() const { return code_begin() + _unpack_offset; }
604
address unpack_with_exception() const { return code_begin() + _unpack_with_exception; }
605
address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; }
606
607
// Alternate entry point for C1 where the exception and issuing pc
608
// are in JavaThread::_exception_oop and JavaThread::_exception_pc
609
// instead of being in registers. This is needed because C1 doesn't
610
// model exception paths in a way that keeps these registers free so
611
// there may be live values in those registers during deopt.
612
void set_unpack_with_exception_in_tls_offset(int offset) {
613
_unpack_with_exception_in_tls = offset;
614
assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
615
}
616
address unpack_with_exception_in_tls() const { return code_begin() + _unpack_with_exception_in_tls; }
617
618
#if INCLUDE_JVMCI
619
// Offsets when JVMCI calls uncommon_trap.
620
void set_uncommon_trap_offset(int offset) {
621
_uncommon_trap_offset = offset;
622
assert(contains(code_begin() + _uncommon_trap_offset), "must be PC inside codeblob");
623
}
624
address uncommon_trap() const { return code_begin() + _uncommon_trap_offset; }
625
626
void set_implicit_exception_uncommon_trap_offset(int offset) {
627
_implicit_exception_uncommon_trap_offset = offset;
628
assert(contains(code_begin() + _implicit_exception_uncommon_trap_offset), "must be PC inside codeblob");
629
}
630
address implicit_exception_uncommon_trap() const { return code_begin() + _implicit_exception_uncommon_trap_offset; }
631
#endif // INCLUDE_JVMCI
632
};
633
634
635
//----------------------------------------------------------------------------------------------------
636
// UncommonTrapBlob (currently only used by Compiler 2)
637
638
#ifdef COMPILER2
639
640
class UncommonTrapBlob: public SingletonBlob {
641
friend class VMStructs;
642
private:
643
// Creation support
644
UncommonTrapBlob(
645
CodeBuffer* cb,
646
int size,
647
OopMapSet* oop_maps,
648
int frame_size
649
);
650
651
public:
652
// Creation
653
static UncommonTrapBlob* create(
654
CodeBuffer* cb,
655
OopMapSet* oop_maps,
656
int frame_size
657
);
658
659
// GC for args
660
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ }
661
662
// Typing
663
bool is_uncommon_trap_stub() const { return true; }
664
};
665
666
667
//----------------------------------------------------------------------------------------------------
668
// ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2)
669
670
class ExceptionBlob: public SingletonBlob {
671
friend class VMStructs;
672
private:
673
// Creation support
674
ExceptionBlob(
675
CodeBuffer* cb,
676
int size,
677
OopMapSet* oop_maps,
678
int frame_size
679
);
680
681
public:
682
// Creation
683
static ExceptionBlob* create(
684
CodeBuffer* cb,
685
OopMapSet* oop_maps,
686
int frame_size
687
);
688
689
// GC for args
690
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ }
691
692
// Typing
693
bool is_exception_stub() const { return true; }
694
};
695
#endif // COMPILER2
696
697
698
//----------------------------------------------------------------------------------------------------
699
// SafepointBlob: handles illegal_instruction exceptions during a safepoint
700
701
class SafepointBlob: public SingletonBlob {
702
friend class VMStructs;
703
private:
704
// Creation support
705
SafepointBlob(
706
CodeBuffer* cb,
707
int size,
708
OopMapSet* oop_maps,
709
int frame_size
710
);
711
712
public:
713
// Creation
714
static SafepointBlob* create(
715
CodeBuffer* cb,
716
OopMapSet* oop_maps,
717
int frame_size
718
);
719
720
// GC for args
721
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ }
722
723
// Typing
724
bool is_safepoint_stub() const { return true; }
725
};
726
727
//----------------------------------------------------------------------------------------------------
728
729
// For optimized upcall stubs
730
class OptimizedEntryBlob: public BufferBlob {
731
private:
732
intptr_t _exception_handler_offset;
733
jobject _receiver;
734
ByteSize _jfa_sp_offset;
735
736
OptimizedEntryBlob(const char* name, int size, CodeBuffer* cb, intptr_t exception_handler_offset,
737
jobject receiver, ByteSize jfa_sp_offset);
738
739
public:
740
// Creation
741
static OptimizedEntryBlob* create(const char* name, CodeBuffer* cb,
742
intptr_t exception_handler_offset, jobject receiver,
743
ByteSize jfa_sp_offset);
744
745
address exception_handler() { return code_begin() + _exception_handler_offset; }
746
jobject receiver() { return _receiver; }
747
ByteSize jfa_sp_offset() const { return _jfa_sp_offset; }
748
749
// defined in frame_ARCH.cpp
750
JavaFrameAnchor* jfa_for_frame(const frame& frame) const;
751
752
// Typing
753
virtual bool is_optimized_entry_blob() const override { return true; }
754
};
755
756
#endif // SHARE_CODE_CODEBLOB_HPP
757
758