26
#include "c1/c1_Compiler.hpp"
28
#include "ci/ciUtilities.hpp"
29
#include "compiler/compiler_globals.hpp"
30
#include "compiler/oopMap.hpp"
31
#include "gc/shared/barrierSet.hpp"
32
#include "gc/shared/barrierSetAssembler.hpp"
33
#include "gc/shared/barrierSetNMethod.hpp"
34
#include "gc/shared/cardTable.hpp"
35
#include "gc/shared/collectedHeap.hpp"
36
#include "gc/shared/gc_globals.hpp"
37
#include "gc/shared/tlab_globals.hpp"
39
#include "gc/x/xBarrierSetRuntime.hpp"
40
#include "gc/x/xThreadLocalData.hpp"
41
#include "gc/z/zBarrierSetRuntime.hpp"
42
#include "gc/z/zThreadLocalData.hpp"
44
#include "jvmci/jvmciCompilerToVM.hpp"
45
#include "jvmci/jvmciEnv.hpp"
46
#include "jvmci/vmStructs_jvmci.hpp"
47
#include "memory/universe.hpp"
48
#include "oops/compressedOops.hpp"
49
#include "oops/klass.inline.hpp"
50
#include "prims/jvmtiExport.hpp"
52
#include "opto/c2compiler.hpp"
54
#include "runtime/flags/jvmFlag.hpp"
55
#include "runtime/sharedRuntime.hpp"
56
#include "runtime/stubRoutines.hpp"
57
#include "utilities/resourceHash.hpp"
60
int CompilerToVM::Data::Klass_vtable_start_offset;
61
int CompilerToVM::Data::Klass_vtable_length_offset;
63
int CompilerToVM::Data::Method_extra_stack_entries;
65
address CompilerToVM::Data::SharedRuntime_ic_miss_stub;
66
address CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub;
67
address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack;
68
address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack_with_exception_in_tls;
69
address CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap;
70
address CompilerToVM::Data::SharedRuntime_polling_page_return_handler;
72
address CompilerToVM::Data::nmethod_entry_barrier;
73
int CompilerToVM::Data::thread_disarmed_guard_value_offset;
74
int CompilerToVM::Data::thread_address_bad_mask_offset;
76
address CompilerToVM::Data::ZBarrierSetRuntime_load_barrier_on_oop_field_preloaded;
77
address CompilerToVM::Data::ZBarrierSetRuntime_load_barrier_on_weak_oop_field_preloaded;
78
address CompilerToVM::Data::ZBarrierSetRuntime_load_barrier_on_phantom_oop_field_preloaded;
79
address CompilerToVM::Data::ZBarrierSetRuntime_weak_load_barrier_on_oop_field_preloaded;
80
address CompilerToVM::Data::ZBarrierSetRuntime_weak_load_barrier_on_weak_oop_field_preloaded;
81
address CompilerToVM::Data::ZBarrierSetRuntime_weak_load_barrier_on_phantom_oop_field_preloaded;
82
address CompilerToVM::Data::ZBarrierSetRuntime_load_barrier_on_oop_array;
83
address CompilerToVM::Data::ZBarrierSetRuntime_clone;
85
address CompilerToVM::Data::ZPointerVectorLoadBadMask_address;
86
address CompilerToVM::Data::ZPointerVectorStoreBadMask_address;
87
address CompilerToVM::Data::ZPointerVectorStoreGoodMask_address;
89
bool CompilerToVM::Data::continuations_enabled;
92
int CompilerToVM::Data::BarrierSetAssembler_nmethod_patching_type;
93
address CompilerToVM::Data::BarrierSetAssembler_patching_epoch_addr;
96
size_t CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve;
98
CollectedHeap* CompilerToVM::Data::Universe_collectedHeap;
99
int CompilerToVM::Data::Universe_base_vtable_size;
100
address CompilerToVM::Data::Universe_narrow_oop_base;
101
int CompilerToVM::Data::Universe_narrow_oop_shift;
102
address CompilerToVM::Data::Universe_narrow_klass_base;
103
int CompilerToVM::Data::Universe_narrow_klass_shift;
104
void* CompilerToVM::Data::Universe_non_oop_bits;
105
uintptr_t CompilerToVM::Data::Universe_verify_oop_mask;
106
uintptr_t CompilerToVM::Data::Universe_verify_oop_bits;
108
bool CompilerToVM::Data::_supports_inline_contig_alloc;
109
HeapWord** CompilerToVM::Data::_heap_end_addr;
110
HeapWord* volatile* CompilerToVM::Data::_heap_top_addr;
111
int CompilerToVM::Data::_max_oop_map_stack_offset;
112
int CompilerToVM::Data::_fields_annotations_base_offset;
114
CardTable::CardValue* CompilerToVM::Data::cardtable_start_address;
115
int CompilerToVM::Data::cardtable_shift;
118
int CompilerToVM::Data::L1_line_size;
121
size_t CompilerToVM::Data::vm_page_size;
123
int CompilerToVM::Data::sizeof_vtableEntry = sizeof(vtableEntry);
124
int CompilerToVM::Data::sizeof_ExceptionTableElement = sizeof(ExceptionTableElement);
125
int CompilerToVM::Data::sizeof_LocalVariableTableElement = sizeof(LocalVariableTableElement);
126
int CompilerToVM::Data::sizeof_ConstantPool = sizeof(ConstantPool);
127
int CompilerToVM::Data::sizeof_narrowKlass = sizeof(narrowKlass);
128
int CompilerToVM::Data::sizeof_arrayOopDesc = sizeof(arrayOopDesc);
129
int CompilerToVM::Data::sizeof_BasicLock = sizeof(BasicLock);
131
int CompilerToVM::Data::sizeof_ZStoreBarrierEntry = sizeof(ZStoreBarrierEntry);
134
address CompilerToVM::Data::dsin;
135
address CompilerToVM::Data::dcos;
136
address CompilerToVM::Data::dtan;
137
address CompilerToVM::Data::dexp;
138
address CompilerToVM::Data::dlog;
139
address CompilerToVM::Data::dlog10;
140
address CompilerToVM::Data::dpow;
142
address CompilerToVM::Data::symbol_init;
143
address CompilerToVM::Data::symbol_clinit;
145
int CompilerToVM::Data::data_section_item_alignment;
147
JVMTI_ONLY( int* CompilerToVM::Data::_should_notify_object_alloc; )
149
void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
150
Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
151
Klass_vtable_length_offset = in_bytes(Klass::vtable_length_offset());
153
Method_extra_stack_entries = Method::extra_stack_entries();
155
SharedRuntime_ic_miss_stub = SharedRuntime::get_ic_miss_stub();
156
SharedRuntime_handle_wrong_method_stub = SharedRuntime::get_handle_wrong_method_stub();
157
SharedRuntime_deopt_blob_unpack = SharedRuntime::deopt_blob()->unpack();
158
SharedRuntime_deopt_blob_unpack_with_exception_in_tls = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
159
SharedRuntime_deopt_blob_uncommon_trap = SharedRuntime::deopt_blob()->uncommon_trap();
160
SharedRuntime_polling_page_return_handler = SharedRuntime::polling_page_return_handler_blob()->entry_point();
162
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
163
if (bs_nm != nullptr) {
164
thread_disarmed_guard_value_offset = in_bytes(bs_nm->thread_disarmed_guard_value_offset());
165
nmethod_entry_barrier = StubRoutines::method_entry_barrier();
166
BarrierSetAssembler* bs_asm = BarrierSet::barrier_set()->barrier_set_assembler();
167
AARCH64_ONLY(BarrierSetAssembler_nmethod_patching_type = (int) bs_asm->nmethod_patching_type());
168
AARCH64_ONLY(BarrierSetAssembler_patching_epoch_addr = bs_asm->patching_epoch_addr());
174
ZPointerVectorLoadBadMask_address = (address) &ZPointerVectorLoadBadMask;
175
ZPointerVectorStoreBadMask_address = (address) &ZPointerVectorStoreBadMask;
176
ZPointerVectorStoreGoodMask_address = (address) &ZPointerVectorStoreGoodMask;
178
thread_address_bad_mask_offset = in_bytes(XThreadLocalData::address_bad_mask_offset());
181
ZBarrierSetRuntime_load_barrier_on_oop_field_preloaded = XBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr();
182
ZBarrierSetRuntime_load_barrier_on_weak_oop_field_preloaded = XBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded_addr();
183
ZBarrierSetRuntime_load_barrier_on_phantom_oop_field_preloaded = XBarrierSetRuntime::load_barrier_on_phantom_oop_field_preloaded_addr();
184
ZBarrierSetRuntime_weak_load_barrier_on_oop_field_preloaded = XBarrierSetRuntime::weak_load_barrier_on_oop_field_preloaded_addr();
185
ZBarrierSetRuntime_weak_load_barrier_on_weak_oop_field_preloaded = XBarrierSetRuntime::weak_load_barrier_on_weak_oop_field_preloaded_addr();
186
ZBarrierSetRuntime_weak_load_barrier_on_phantom_oop_field_preloaded = XBarrierSetRuntime::weak_load_barrier_on_phantom_oop_field_preloaded_addr();
187
ZBarrierSetRuntime_load_barrier_on_oop_array = XBarrierSetRuntime::load_barrier_on_oop_array_addr();
188
ZBarrierSetRuntime_clone = XBarrierSetRuntime::clone_addr();
193
continuations_enabled = Continuations::enabled();
195
ThreadLocalAllocBuffer_alignment_reserve = ThreadLocalAllocBuffer::alignment_reserve();
197
Universe_collectedHeap = Universe::heap();
198
Universe_base_vtable_size = Universe::base_vtable_size();
199
if (UseCompressedOops) {
200
Universe_narrow_oop_base = CompressedOops::base();
201
Universe_narrow_oop_shift = CompressedOops::shift();
203
Universe_narrow_oop_base = nullptr;
204
Universe_narrow_oop_shift = 0;
206
if (UseCompressedClassPointers) {
207
Universe_narrow_klass_base = CompressedKlassPointers::base();
208
Universe_narrow_klass_shift = CompressedKlassPointers::shift();
210
Universe_narrow_klass_base = nullptr;
211
Universe_narrow_klass_shift = 0;
213
Universe_non_oop_bits = Universe::non_oop_word();
214
Universe_verify_oop_mask = Universe::verify_oop_mask();
215
Universe_verify_oop_bits = Universe::verify_oop_bits();
217
_supports_inline_contig_alloc = false;
218
_heap_end_addr = (HeapWord**) -1;
219
_heap_top_addr = (HeapWord* volatile*) -1;
221
_max_oop_map_stack_offset = (OopMapValue::register_mask - VMRegImpl::stack2reg(0)->value()) * VMRegImpl::stack_slot_size;
222
int max_oop_map_stack_index = _max_oop_map_stack_offset / VMRegImpl::stack_slot_size;
223
assert(OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index)), "should be valid");
224
assert(!OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index + 1)), "should be invalid");
226
symbol_init = (address) vmSymbols::object_initializer_name();
227
symbol_clinit = (address) vmSymbols::class_initializer_name();
229
_fields_annotations_base_offset = Array<AnnotationArray*>::base_offset_in_bytes();
231
data_section_item_alignment = relocInfo::addr_unit();
233
JVMTI_ONLY( _should_notify_object_alloc = &JvmtiExport::_should_notify_object_alloc; )
235
BarrierSet* bs = BarrierSet::barrier_set();
236
if (bs->is_a(BarrierSet::CardTableBarrierSet)) {
237
CardTable::CardValue* base = ci_card_table_address();
238
assert(base != nullptr, "unexpected byte_map_base");
239
cardtable_start_address = base;
240
cardtable_shift = CardTable::card_shift();
243
cardtable_start_address = 0;
248
L1_line_size = VM_Version::L1_line_size();
251
vm_page_size = os::vm_page_size();
253
#define SET_TRIGFUNC(name) \
254
if (StubRoutines::name() != nullptr) { \
255
name = StubRoutines::name(); \
257
name = CAST_FROM_FN_PTR(address, SharedRuntime::name); \
264
SET_TRIGFUNC(dlog10);
271
static jboolean is_c1_supported(vmIntrinsics::ID id){
272
jboolean supported = false;
274
supported = (jboolean) Compiler::is_intrinsic_supported(id);
279
static jboolean is_c2_supported(vmIntrinsics::ID id){
280
jboolean supported = false;
282
supported = (jboolean) C2Compiler::is_intrinsic_supported(id);
287
JVMCIObjectArray CompilerToVM::initialize_intrinsics(JVMCI_TRAPS) {
288
int len = vmIntrinsics::number_of_intrinsics() - 1;
289
JVMCIObjectArray vmIntrinsics = JVMCIENV->new_VMIntrinsicMethod_array(len, JVMCI_CHECK_NULL);
291
vmSymbolID kls_sid = vmSymbolID::NO_SID;
293
#define VM_SYMBOL_TO_STRING(s) \
294
JVMCIENV->create_string(vmSymbols::symbol_at(VM_SYMBOL_ENUM_NAME(s)), JVMCI_CHECK_NULL)
295
#define VM_INTRINSIC_INFO(id, kls, name, sig, ignore_fcode) { \
296
vmSymbolID sid = VM_SYMBOL_ENUM_NAME(kls); \
297
if (kls_sid != sid) { \
298
kls_str = VM_SYMBOL_TO_STRING(kls); \
301
JVMCIObject name_str = VM_SYMBOL_TO_STRING(name); \
302
JVMCIObject sig_str = VM_SYMBOL_TO_STRING(sig); \
303
JVMCIObject vmIntrinsicMethod = JVMCIENV->new_VMIntrinsicMethod(kls_str, name_str, sig_str, (jint) vmIntrinsics::id, \
304
(jboolean) vmIntrinsics::is_intrinsic_available(vmIntrinsics::id), \
305
is_c1_supported(vmIntrinsics::id), \
306
is_c2_supported(vmIntrinsics::id), JVMCI_CHECK_NULL); \
307
JVMCIENV->put_object_at(vmIntrinsics, index++, vmIntrinsicMethod); \
311
VM_INTRINSICS_DO(VM_INTRINSIC_INFO, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE)
312
#undef VM_SYMBOL_TO_STRING
313
#undef VM_INTRINSIC_INFO
315
assert(index == len, "must be");
319
#define PREDEFINED_CONFIG_FLAGS(do_bool_flag, do_int_flag, do_intx_flag, do_uintx_flag) \
320
do_int_flag(AllocateInstancePrefetchLines) \
321
do_int_flag(AllocatePrefetchDistance) \
322
do_intx_flag(AllocatePrefetchInstr) \
323
do_int_flag(AllocatePrefetchLines) \
324
do_int_flag(AllocatePrefetchStepSize) \
325
do_int_flag(AllocatePrefetchStyle) \
326
do_intx_flag(BciProfileWidth) \
327
do_bool_flag(BootstrapJVMCI) \
328
do_bool_flag(CITime) \
329
do_bool_flag(CITimeEach) \
330
do_uintx_flag(CodeCacheSegmentSize) \
331
do_intx_flag(CodeEntryAlignment) \
332
do_int_flag(ContendedPaddingWidth) \
333
do_bool_flag(DontCompileHugeMethods) \
334
do_bool_flag(EagerJVMCI) \
335
do_bool_flag(EnableContended) \
336
do_bool_flag(FoldStableValues) \
337
do_bool_flag(ForceUnreachable) \
338
do_intx_flag(HugeMethodLimit) \
339
do_bool_flag(Inline) \
340
do_intx_flag(JVMCICounterSize) \
341
do_bool_flag(JVMCIPrintProperties) \
342
do_int_flag(ObjectAlignmentInBytes) \
343
do_bool_flag(PrintInlining) \
344
do_bool_flag(ReduceInitialCardMarks) \
345
do_bool_flag(RestrictContended) \
346
do_intx_flag(StackReservedPages) \
347
do_intx_flag(StackShadowPages) \
348
do_uintx_flag(TLABWasteIncrement) \
349
do_intx_flag(TypeProfileWidth) \
350
do_bool_flag(UseAESIntrinsics) \
351
X86_ONLY(do_int_flag(UseAVX)) \
352
do_bool_flag(UseCRC32Intrinsics) \
353
do_bool_flag(UseAdler32Intrinsics) \
354
do_bool_flag(UseCompressedClassPointers) \
355
do_bool_flag(UseCompressedOops) \
356
X86_ONLY(do_bool_flag(UseCountLeadingZerosInstruction)) \
357
X86_ONLY(do_bool_flag(UseCountTrailingZerosInstruction)) \
358
do_bool_flag(UseG1GC) \
359
do_bool_flag(UseParallelGC) \
360
do_bool_flag(UseSerialGC) \
361
do_bool_flag(UseZGC) \
362
do_bool_flag(UseEpsilonGC) \
363
COMPILER2_PRESENT(do_bool_flag(UseMontgomeryMultiplyIntrinsic)) \
364
COMPILER2_PRESENT(do_bool_flag(UseMontgomerySquareIntrinsic)) \
365
COMPILER2_PRESENT(do_bool_flag(UseMulAddIntrinsic)) \
366
COMPILER2_PRESENT(do_bool_flag(UseMultiplyToLenIntrinsic)) \
367
do_bool_flag(UsePopCountInstruction) \
368
do_bool_flag(UseSHA1Intrinsics) \
369
do_bool_flag(UseSHA256Intrinsics) \
370
do_bool_flag(UseSHA512Intrinsics) \
371
X86_ONLY(do_int_flag(UseSSE)) \
372
COMPILER2_PRESENT(do_bool_flag(UseSquareToLenIntrinsic)) \
373
do_bool_flag(UseTLAB) \
374
do_bool_flag(VerifyOops) \
376
#define BOXED_BOOLEAN(name, value) name = ((jboolean)(value) ? boxedTrue : boxedFalse)
377
#define BOXED_DOUBLE(name, value) do { jvalue p; p.d = (jdouble) (value); name = JVMCIENV->create_box(T_DOUBLE, &p, JVMCI_CHECK_NULL);} while(0)
378
#define BOXED_LONG(name, value) \
380
jvalue p; p.j = (jlong) (value); \
381
JVMCIObject* e = longs.get(p.j); \
382
if (e == nullptr) { \
383
JVMCIObject h = JVMCIENV->create_box(T_LONG, &p, JVMCI_CHECK_NULL); \
391
#define CSTRING_TO_JSTRING(name, value) \
394
if (value != nullptr) { \
395
JVMCIObject* e = strings.get(value); \
396
if (e == nullptr) { \
397
JVMCIObject h = JVMCIENV->create_string(value, JVMCI_CHECK_NULL); \
398
strings.put(value, h); \
406
jobjectArray readConfiguration0(JNIEnv *env, JVMCI_TRAPS) {
407
JavaThread* THREAD = JavaThread::current();
408
ResourceHashtable<jlong, JVMCIObject> longs;
409
ResourceHashtable<const char*, JVMCIObject,
410
256, AnyObj::RESOURCE_AREA, mtInternal,
411
&CompilerToVM::cstring_hash, &CompilerToVM::cstring_equals> strings;
414
prim.z = true; JVMCIObject boxedTrue = JVMCIENV->create_box(T_BOOLEAN, &prim, JVMCI_CHECK_NULL);
415
prim.z = false; JVMCIObject boxedFalse = JVMCIENV->create_box(T_BOOLEAN, &prim, JVMCI_CHECK_NULL);
417
CompilerToVM::Data::initialize(JVMCI_CHECK_NULL);
419
JVMCIENV->VMField_initialize(JVMCI_CHECK_NULL);
420
JVMCIENV->VMFlag_initialize(JVMCI_CHECK_NULL);
421
JVMCIENV->VMIntrinsicMethod_initialize(JVMCI_CHECK_NULL);
423
int len = JVMCIVMStructs::localHotSpotVMStructs_count();
424
JVMCIObjectArray vmFields = JVMCIENV->new_VMField_array(len, JVMCI_CHECK_NULL);
425
for (int i = 0; i < len ; i++) {
426
VMStructEntry vmField = JVMCIVMStructs::localHotSpotVMStructs[i];
427
const size_t name_buf_size = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 + 1 ;
428
char* name_buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, name_buf_size);
429
os::snprintf_checked(name_buf, name_buf_size, "%s::%s", vmField.typeName, vmField.fieldName);
430
CSTRING_TO_JSTRING(name, name_buf);
431
CSTRING_TO_JSTRING(type, vmField.typeString);
433
if (vmField.isStatic && vmField.typeString != nullptr) {
434
if (strcmp(vmField.typeString, "bool") == 0) {
435
BOXED_BOOLEAN(box, *(jbyte*) vmField.address);
436
assert(box.is_non_null(), "must have a box");
437
} else if (strcmp(vmField.typeString, "int") == 0 ||
438
strcmp(vmField.typeString, "jint") == 0 ||
439
strcmp(vmField.typeString, "uint") == 0 ||
440
strcmp(vmField.typeString, "uint32_t") == 0) {
441
BOXED_LONG(box, *(jint*) vmField.address);
442
assert(box.is_non_null(), "must have a box");
443
} else if (strcmp(vmField.typeString, "uint64_t") == 0) {
444
BOXED_LONG(box, *(uint64_t*) vmField.address);
445
assert(box.is_non_null(), "must have a box");
446
} else if (strcmp(vmField.typeString, "address") == 0 ||
447
strcmp(vmField.typeString, "intptr_t") == 0 ||
448
strcmp(vmField.typeString, "uintptr_t") == 0 ||
449
strcmp(vmField.typeString, "OopHandle") == 0 ||
450
strcmp(vmField.typeString, "size_t") == 0 ||
452
vmField.typeString[strlen(vmField.typeString) - 1] == '*') {
453
BOXED_LONG(box, *((address*) vmField.address));
454
assert(box.is_non_null(), "must have a box");
456
JVMCI_ERROR_NULL("VM field %s has unsupported type %s", name_buf, vmField.typeString);
459
JVMCIObject vmFieldObj = JVMCIENV->new_VMField(name, type, vmField.offset, (jlong) vmField.address, box, JVMCI_CHECK_NULL);
460
JVMCIENV->put_object_at(vmFields, i, vmFieldObj);
463
int ints_len = JVMCIVMStructs::localHotSpotVMIntConstants_count();
464
int longs_len = JVMCIVMStructs::localHotSpotVMLongConstants_count();
465
len = ints_len + longs_len;
466
JVMCIObjectArray vmConstants = JVMCIENV->new_Object_array(len * 2, JVMCI_CHECK_NULL);
468
for (int i = 0; i < ints_len ; i++) {
469
VMIntConstantEntry c = JVMCIVMStructs::localHotSpotVMIntConstants[i];
470
CSTRING_TO_JSTRING(name, c.name);
472
BOXED_LONG(value, c.value);
473
JVMCIENV->put_object_at(vmConstants, insert++, name);
474
JVMCIENV->put_object_at(vmConstants, insert++, value);
476
for (int i = 0; i < longs_len ; i++) {
477
VMLongConstantEntry c = JVMCIVMStructs::localHotSpotVMLongConstants[i];
478
CSTRING_TO_JSTRING(name, c.name);
480
BOXED_LONG(value, c.value);
481
JVMCIENV->put_object_at(vmConstants, insert++, name);
482
JVMCIENV->put_object_at(vmConstants, insert++, value);
484
assert(insert == len * 2, "must be");
486
len = JVMCIVMStructs::localHotSpotVMAddresses_count();
487
JVMCIObjectArray vmAddresses = JVMCIENV->new_Object_array(len * 2, JVMCI_CHECK_NULL);
488
for (int i = 0; i < len ; i++) {
489
VMAddressEntry a = JVMCIVMStructs::localHotSpotVMAddresses[i];
490
CSTRING_TO_JSTRING(name, a.name);
492
BOXED_LONG(value, a.value);
493
JVMCIENV->put_object_at(vmAddresses, i * 2, name);
494
JVMCIENV->put_object_at(vmAddresses, i * 2 + 1, value);
497
#define COUNT_FLAG(ignore) +1
499
#define CHECK_FLAG(type, name) { \
500
const JVMFlag* flag = JVMFlag::find_declared_flag(#name); \
501
assert(flag != nullptr, "No such flag named " #name); \
502
assert(flag->is_##type(), "JVMFlag " #name " is not of type " #type); \
505
#define CHECK_FLAG(type, name)
508
#define ADD_FLAG(type, name, convert) { \
509
CHECK_FLAG(type, name) \
510
CSTRING_TO_JSTRING(fname, #name); \
511
CSTRING_TO_JSTRING(ftype, #type); \
512
convert(value, name); \
513
JVMCIObject vmFlagObj = JVMCIENV->new_VMFlag(fname, ftype, value, JVMCI_CHECK_NULL); \
514
JVMCIENV->put_object_at(vmFlags, i++, vmFlagObj); \
516
#define ADD_BOOL_FLAG(name) ADD_FLAG(bool, name, BOXED_BOOLEAN)
517
#define ADD_INT_FLAG(name) ADD_FLAG(int, name, BOXED_LONG)
518
#define ADD_INTX_FLAG(name) ADD_FLAG(intx, name, BOXED_LONG)
519
#define ADD_UINTX_FLAG(name) ADD_FLAG(uintx, name, BOXED_LONG)
521
len = 0 + PREDEFINED_CONFIG_FLAGS(COUNT_FLAG, COUNT_FLAG, COUNT_FLAG, COUNT_FLAG);
522
JVMCIObjectArray vmFlags = JVMCIENV->new_VMFlag_array(len, JVMCI_CHECK_NULL);
525
PREDEFINED_CONFIG_FLAGS(ADD_BOOL_FLAG, ADD_INT_FLAG, ADD_INTX_FLAG, ADD_UINTX_FLAG)
527
JVMCIObjectArray vmIntrinsics = CompilerToVM::initialize_intrinsics(JVMCI_CHECK_NULL);
529
JVMCIObjectArray data = JVMCIENV->new_Object_array(5, JVMCI_CHECK_NULL);
530
JVMCIENV->put_object_at(data, 0, vmFields);
531
JVMCIENV->put_object_at(data, 1, vmConstants);
532
JVMCIENV->put_object_at(data, 2, vmAddresses);
533
JVMCIENV->put_object_at(data, 3, vmFlags);
534
JVMCIENV->put_object_at(data, 4, vmIntrinsics);
536
return JVMCIENV->get_jobjectArray(data);