forked from eclipse-omr/omr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
559 lines (492 loc) · 13.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
###############################################################################
# Copyright IBM Corp. and others 2017
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
# distribution and is available at https://www.eclipse.org/legal/epl-2.0/
# or the Apache License, Version 2.0 which accompanies this distribution and
# is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# This Source Code may also be made available under the following
# Secondary Licenses when the conditions for such availability set
# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
# General Public License, version 2 with the GNU Classpath
# Exception [1] and GNU General Public License, version 2 with the
# OpenJDK Assembly Exception [2].
#
# [1] https://www.gnu.org/software/classpath/license.html
# [2] https://openjdk.org/legal/assembly-exception.html
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
###############################################################################
omr_assert(TEST OMR_GC)
omr_assert(
TEST OMR_GC_GLUE_TARGET
MESSAGE "OMR_GC_GLUE_TARGET must be set."
)
omr_add_hookgen(
INPUT include/omrmm.hdf
PUBLIC_DIR "${omr_BINARY_DIR}"
TARGETS omrgc_hookgen
)
omr_add_hookgen(
INPUT base/omrmmprivate.hdf
TARGETS omrgc_hookgen
)
add_custom_target(omrgc_hookgen
DEPENDS
"${omr_BINARY_DIR}/mmomrhook.h"
"${CMAKE_CURRENT_BINARY_DIR}/mmprivatehook.h"
)
add_tracegen(base/j9mm.tdf)
add_tracegen(base/omrmm.tdf)
add_tracegen(verbose/j9vgc.tdf)
# Ideally We would handle the tracegen stuff like the hookgen stuff above
# But for whatever reason that breaks the ninja builds
omr_add_library(omrgc_tracegen OBJECT
${CMAKE_CURRENT_BINARY_DIR}/ut_j9mm.c
${CMAKE_CURRENT_BINARY_DIR}/ut_omrmm.c
${CMAKE_CURRENT_BINARY_DIR}/ut_j9vgc.c
)
target_include_directories(omrgc_tracegen
PUBLIC
$<TARGET_PROPERTY:omr_base,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(omrgc_tracegen
PUBLIC
$<TARGET_PROPERTY:omr_base,INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(omrgc_tracegen
PUBLIC
$<TARGET_PROPERTY:omr_base,INTERFACE_COMPILE_OPTIONS>
)
set(omrgc_sources
base/AddressOrderedListPopulator.cpp
base/AllocationContext.cpp
base/AllocationInterfaceGeneric.cpp
base/BaseVirtual.cpp
base/BumpAllocatedListPopulator.cpp
base/CardTable.cpp
base/Collector.cpp
base/Configuration.cpp
base/EmptyListPopulator.cpp
base/EnvironmentBase.cpp
base/Forge.cpp
base/GCCode.cpp
base/GCExtensionsBase.cpp
base/GlobalAllocationManager.cpp
base/GlobalCollector.cpp
base/Heap.cpp
base/HeapMap.cpp
base/HeapMapIterator.cpp
base/HeapMemorySubSpaceIterator.cpp
base/HeapRegionDescriptor.cpp
base/HeapRegionIterator.cpp
base/HeapRegionManager.cpp
base/HeapRegionManagerTarok.cpp
base/HeapVirtualMemory.cpp
base/LightweightNonReentrantLock.cpp
base/LightweightNonReentrantRWLock.cpp
base/MarkedObjectPopulator.cpp
base/MarkingScheme.cpp
base/MarkMap.cpp
base/MarkMapSegmentChunkIterator.cpp
base/MainGCThread.cpp
base/Math.cpp
base/MemoryManager.cpp
base/MemoryPool.cpp
base/MemoryPoolAddressOrderedList.cpp
base/MemoryPoolAddressOrderedListBase.cpp
base/MemoryPoolBumpPointer.cpp
base/MemoryPoolLargeObjects.cpp
base/MemoryPoolSplitAddressOrderedList.cpp
base/MemoryPoolSplitAddressOrderedListBase.cpp
base/MemorySpace.cpp
base/MemorySubSpace.cpp
base/MemorySubSpaceChildIterator.cpp
base/MemorySubSpaceFlat.cpp
base/MemorySubSpaceGeneric.cpp
base/MemorySubSpacePoolIterator.cpp
base/MemorySubSpaceRegionIterator.cpp
base/MemorySubSpaceUniSpace.cpp
base/ModronAssertions.cpp
base/NUMAManager.cpp
base/NonVirtualMemory.cpp
base/OMRVMInterface.cpp
base/OMRVMThreadInterface.cpp
base/ObjectAllocationInterface.cpp
base/ObjectHeapBufferedIterator.cpp
base/ObjectHeapIteratorAddressOrderedList.cpp
base/Packet.cpp
base/PacketList.cpp
base/ParallelDispatcher.cpp
base/ParallelHeapWalker.cpp
base/ParallelObjectHeapIterator.cpp
base/ParallelMarkTask.cpp
base/ParallelTask.cpp
base/PhysicalArena.cpp
base/PhysicalArenaRegionBased.cpp
base/PhysicalArenaVirtualMemory.cpp
base/PhysicalSubArena.cpp
base/PhysicalSubArenaRegionBased.cpp
base/PhysicalSubArenaVirtualMemory.cpp
base/PhysicalSubArenaVirtualMemoryFlat.cpp
base/ReferenceChainWalkerMarkMap.cpp
base/RegionPool.cpp
base/RegionPoolGeneric.cpp
base/SparseAddressOrderedFixedSizeDataPool.cpp
base/SparseVirtualMemory.cpp
base/StartupManager.cpp
base/SweepHeapSectioning.cpp
base/SweepPoolManager.cpp
base/SweepPoolManagerAddressOrderedList.cpp
base/SweepPoolManagerAddressOrderedListBase.cpp
base/SweepPoolManagerHybrid.cpp
base/SweepPoolManagerSplitAddressOrderedList.cpp
base/SweepPoolState.cpp
base/TLHAllocationInterface.cpp
base/TLHAllocationSupport.cpp
base/Task.cpp
base/VirtualMemory.cpp
base/WorkPacketOverflow.cpp
base/WorkPackets.cpp
base/WorkStack.cpp
base/gcspinlock.cpp
base/gcutils.cpp
base/modronapicore.cpp
startup/mminitcore.cpp
startup/omrgcalloc.cpp
startup/omrgcstartup.cpp
stats/AllocationStats.cpp
stats/CardCleaningStats.cpp
stats/ClassUnloadStats.cpp
stats/CPUUtilStats.cpp
stats/FreeEntrySizeClassStats.cpp
stats/HeapResizeStats.cpp
stats/LargeObjectAllocateStats.cpp
stats/MarkStats.cpp
stats/MetronomeStats.cpp
stats/RootScannerStats.cpp
stats/ScavengerStats.cpp # TODO only compile if scavenger or VLHGC. Is this actually used by VLHGC?
stats/SweepStats.cpp
structs/ForwardedHeader.cpp
structs/HashTableIterator.cpp
structs/OMRVMThreadListIterator.cpp
structs/PoolIterator.cpp
structs/SublistFragment.cpp
structs/SublistIterator.cpp
structs/SublistPool.cpp
structs/SublistPuddle.cpp
structs/SublistSlotIterator.cpp
# verbose/j9vgc.tdf
verbose/VerboseBuffer.cpp
verbose/VerboseHandlerOutput.cpp
verbose/VerboseManager.cpp
verbose/VerboseWriter.cpp
verbose/VerboseWriterChain.cpp
verbose/VerboseWriterFileLogging.cpp
verbose/VerboseWriterFileLoggingBuffered.cpp
verbose/VerboseWriterFileLoggingSynchronous.cpp
verbose/VerboseWriterHook.cpp
verbose/VerboseWriterStreamOutput.cpp
verbose/handler_standard/VerboseHandlerOutputStandard.cpp
$<TARGET_OBJECTS:omrgc_tracegen>
)
omr_add_library(omrgc STATIC
${omrgc_sources}
)
target_enable_ddr(omrgc EARLY_SOURCE_EVAL)
ddr_set_add_targets(omrddr omrgc)
ddr_add_headers(omrgc
base/HeapMap.hpp
include/omrmodroncore.h
structs/ForwardedHeader.hpp
)
if(OMR_GC_OBJECT_MAP)
set(objmap_sources
base/ObjectMap.cpp
)
target_sources(omrgc
PRIVATE
${objmap_sources}
)
endif()
if(OMR_GC_MODRON_STANDARD)
set(modronstandard_sources
base/standard/ConfigurationFlat.cpp
base/standard/ConfigurationStandard.cpp
base/standard/CopyScanCacheChunk.cpp
base/standard/CopyScanCacheChunkInHeap.cpp
base/standard/EnvironmentStandard.cpp
base/standard/HeapMemoryPoolIterator.cpp
base/standard/HeapRegionDescriptorStandard.cpp
base/standard/HeapRegionManagerStandard.cpp
base/standard/HeapWalker.cpp
base/standard/OverflowStandard.cpp
base/standard/ParallelGlobalGC.cpp
base/standard/ParallelSweepScheme.cpp
base/standard/SweepHeapSectioningSegmented.cpp
base/standard/WorkPacketsStandard.cpp
)
target_sources(omrgc
PRIVATE
${modronstandard_sources}
)
if(OMR_GC_MODRON_COMPACTION)
set(modroncompaction_sources
base/standard/CompactFixHeapForWalkTask.cpp
base/standard/CompactScheme.cpp
base/standard/ParallelCompactTask.cpp
stats/CompactStats.cpp
)
target_sources(omrgc
PRIVATE
${modroncompaction_sources}
)
endif()
if(OMR_GC_MODRON_CONCURRENT_MARK)
set(modronconcurrentmark_sources
base/standard/ConcurrentCardTable.cpp
base/standard/ConcurrentCardTableForWC.cpp
base/standard/ConcurrentClearNewMarkBitsTask.cpp
base/standard/ConcurrentCompleteTracingTask.cpp
base/standard/ConcurrentFinalCleanCardsTask.cpp
base/standard/ConcurrentGC.cpp
base/standard/ConcurrentGCIncrementalUpdate.cpp
base/standard/ConcurrentGCSATB.cpp
base/standard/ConcurrentOverflow.cpp
base/standard/ConcurrentPrepareCardTableTask.cpp
base/standard/ConcurrentSafepointCallback.cpp
base/standard/RememberedSetSATB.cpp
base/standard/WorkPacketsConcurrent.cpp
base/standard/WorkPacketsSATB.cpp
stats/ConcurrentGCStats.cpp
)
target_sources(omrgc
PRIVATE
${modronconcurrentmark_sources}
)
if(OMR_GC_MODRON_SCAVENGER)
set(mcm_modronscavenger_sources
base/standard/ConcurrentScanRememberedSetTask.cpp
)
target_sources(omrgc
PRIVATE
${mcm_modronscavenger_sources}
)
endif()
endif()
if(OMR_GC_CONCURRENT_SWEEP)
set(concurrentsweep_sources
base/standard/ConcurrentSweepScheme.cpp
)
target_sources(omrgc
PRIVATE
${concurrentsweep_sources}
)
endif()
if(OMR_GC_MODRON_SCAVENGER)
set(modronscavenger_sources
base/HeapSplit.cpp # TODO delete as this should not be used anymore!
base/MemorySubSpaceGenerational.cpp
base/MemorySubSpaceSemiSpace.cpp
base/standard/ConfigurationGenerational.cpp
base/standard/CopyScanCacheList.cpp
base/standard/ParallelScavengeTask.cpp
base/standard/PhysicalSubArenaVirtualMemorySemiSpace.cpp
base/standard/RSOverflow.cpp
base/standard/Scavenger.cpp
stats/ScavengerCopyScanRatio.cpp
)
target_sources(omrgc
PRIVATE
${modronscavenger_sources}
)
if(OMR_GC_CONCURRENT_SCAVENGER)
set(ms_concurrentscavenger_sources
base/standard/ConcurrentScavengeTask.cpp
)
target_sources(omrgc
PRIVATE
${ms_concurrentscavenger_sources}
)
endif()
endif()
endif()
if(OMR_GC_SEGREGATED_HEAP)
set(segregatedheap_sources
base/segregated/AllocationContextSegregated.cpp
base/segregated/ConfigurationSegregated.cpp
base/segregated/GlobalAllocationManagerSegregated.cpp
base/segregated/HeapRegionDescriptorSegregated.cpp
base/segregated/LockingFreeHeapRegionList.cpp
base/segregated/LockingHeapRegionQueue.cpp
base/segregated/MemoryPoolAggregatedCellList.cpp
base/segregated/MemoryPoolSegregated.cpp
base/segregated/MemorySubSpaceSegregated.cpp
base/segregated/ObjectHeapIteratorSegregated.cpp
base/segregated/OverflowSegregated.cpp
base/segregated/RegionPoolSegregated.cpp
base/segregated/SegregatedAllocationInterface.cpp
base/segregated/SegregatedAllocationTracker.cpp
base/segregated/SegregatedGC.cpp
base/segregated/SegregatedListPopulator.cpp
base/segregated/SegregatedMarkingScheme.cpp
base/segregated/SegregatedSweepTask.cpp
base/segregated/SizeClasses.cpp
base/segregated/SweepSchemeSegregated.cpp
base/segregated/WorkPacketsSegregated.cpp
)
target_sources(omrgc
PRIVATE
${segregatedheap_sources}
)
ddr_add_headers(omrgc base/segregated/RegionPoolSegregated.hpp)
endif()
if(OMR_GC_VLHGC)
set(vlhgc_sources
base/vlhgc/HeapRegionStateTable.cpp
)
target_sources(omrgc
PRIVATE
${vlhgc_sources}
)
set(vlhgc_include
base/vlhgc
)
target_include_directories(omrgc
PUBLIC
${vlhgc_include}
)
endif()
add_dependencies(omrgc omrgc_hookgen)
set(gc_include_public
.
${CMAKE_CURRENT_BINARY_DIR} #Ideally this should be private, but the glue pulls this in
base
base/segregated
base/standard
include
startup
stats
structs
verbose
verbose/handler_standard
)
target_include_directories(omrgc
PUBLIC
${gc_include_public}
INTERFACE
$<TARGET_PROPERTY:${OMR_GC_GLUE_TARGET},INTERFACE_INCLUDE_DIRECTORIES>
)
set(gc_link_libraries_public
omr_base
)
set(gc_link_libraries_private
omrutil
omrcore
${OMR_THREAD_LIB}
${OMR_PORT_LIB}
${OMR_HOOK_LIB}
)
target_link_libraries(omrgc
PUBLIC
${gc_link_libraries_public}
PRIVATE
${OMR_GC_GLUE_TARGET}
${gc_link_libraries_private}
)
set_target_properties(omrgc omrgc_hookgen omrgc_tracegen PROPERTIES FOLDER gc)
if(OMR_MIXED_REFERENCES_MODE_STATIC)
target_compile_definitions(omrgc PUBLIC -DOMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES=1)
omr_assert(
TEST OMR_GC_GLUE_FULL_TARGET
MESSAGE "OMR_GC_GLUE_TARGET must be set."
)
omr_add_library(omrgc_full STATIC
${omrgc_sources}
)
if(OMR_GC_OBJECT_MAP)
target_sources(omrgc_full
PRIVATE
${objmap_sources}
)
endif()
if(OMR_GC_MODRON_STANDARD)
target_sources(omrgc_full
PRIVATE
${modronstandard_sources}
)
if(OMR_GC_MODRON_COMPACTION)
target_sources(omrgc_full
PRIVATE
${modroncompaction_sources}
)
endif()
if(OMR_GC_MODRON_CONCURRENT_MARK)
target_sources(omrgc_full
PRIVATE
${modronconcurrentmark_sources}
)
if(OMR_GC_MODRON_SCAVENGER)
target_sources(omrgc_full
PRIVATE
${mcm_modronscavenger_sources}
)
endif()
endif()
if(OMR_GC_CONCURRENT_SWEEP)
target_sources(omrgc_full
PRIVATE
${concurrentsweep_sources}
)
endif()
if(OMR_GC_MODRON_SCAVENGER)
target_sources(omrgc_full
PRIVATE
${modronscavenger_sources}
)
if(OMR_GC_CONCURRENT_SCAVENGER)
target_sources(omrgc_full
PRIVATE
${ms_concurrentscavenger_sources}
)
endif()
endif()
endif()
if(OMR_GC_SEGREGATED_HEAP)
target_sources(omrgc_full
PRIVATE
${segregatedheap_sources}
)
endif()
if(OMR_GC_VLHGC)
target_sources(omrgc_full
PRIVATE
${vlhgc_sources}
)
target_include_directories(omrgc_full
PUBLIC
${vlhgc_include}
)
endif()
add_dependencies(omrgc_full omrgc_hookgen)
target_include_directories(omrgc_full
PUBLIC
${gc_include_public}
INTERFACE
$<TARGET_PROPERTY:${OMR_GC_GLUE_FULL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries(omrgc_full
PUBLIC
${gc_link_libraries_public}
PRIVATE
${OMR_GC_GLUE_FULL_TARGET}
${gc_link_libraries_private}
)
set_target_properties(omrgc_full omrgc_hookgen omrgc_tracegen PROPERTIES FOLDER gc)
target_compile_definitions(omrgc_full PUBLIC -DOMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES=0)
endif()
if(OMR_GC_API)
add_subdirectory(api)
endif(OMR_GC_API)