|
25 | 25 | #include "AsyncCallbackHandler.hpp"
|
26 | 26 | #include "ClassLoaderIterator.hpp"
|
27 | 27 | #include "ConfigurationDelegate.hpp"
|
| 28 | +#if JAVA_SPEC_VERSION >= 24 |
| 29 | +#include "ContinuationSlotIterator.hpp" |
| 30 | +#endif /* JAVA_SPEC_VERSION >= 24 */ |
28 | 31 | #include "FinalizeListManager.hpp"
|
29 | 32 | #include "Heap.hpp"
|
30 | 33 | #include "HeapRegionDescriptorStandard.hpp"
|
|
35 | 38 | #include "VMInterface.hpp"
|
36 | 39 | #include "VMThreadListIterator.hpp"
|
37 | 40 |
|
| 41 | +void |
| 42 | +MM_ConcurrentMarkingDelegate::doSlot(MM_EnvironmentBase *env, omrobjectptr_t *slotPtr) |
| 43 | +{ |
| 44 | + _markingScheme->markObject(env, *slotPtr); |
| 45 | +} |
| 46 | + |
| 47 | +#if JAVA_SPEC_VERSION >= 24 |
| 48 | +void |
| 49 | +MM_ConcurrentMarkingDelegate::doContinuationSlot(MM_EnvironmentBase *env, omrobjectptr_t *slotPtr, GC_ContinuationSlotIterator *continuationSlotIterator) |
| 50 | +{ |
| 51 | + if (_markingScheme->isHeapObject(*slotPtr) && !env->getExtensions()->heap->objectIsInGap(*slotPtr)) { |
| 52 | + doSlot(env, slotPtr); |
| 53 | + } else if (NULL != *slotPtr) { |
| 54 | + Assert_MM_true(GC_ContinuationSlotIterator::state_monitor_records == continuationSlotIterator->getState()); |
| 55 | + } |
| 56 | +} |
| 57 | +#endif /* JAVA_SPEC_VERSION >= 24 */ |
| 58 | + |
| 59 | +void |
| 60 | +MM_ConcurrentMarkingDelegate::doStackSlot(MM_EnvironmentBase *env, omrobjectptr_t *slotPtr, J9StackWalkState *walkState, const void *stackLocation) |
| 61 | +{ |
| 62 | + omrobjectptr_t object = *slotPtr; |
| 63 | + if (_markingScheme->isHeapObject(object) && !env->getExtensions()->heap->objectIsInGap(object)) { |
| 64 | + doSlot(env, slotPtr); |
| 65 | + } |
| 66 | +} |
38 | 67 | /**
|
39 | 68 | * Concurrents stack slot iterator.
|
40 | 69 | * Called for each slot in a threads active stack frames which contains a object reference.
|
|
48 | 77 | concurrentStackSlotIterator(J9JavaVM *javaVM, omrobjectptr_t *objectIndirect, void *localData, J9StackWalkState *walkState, const void *stackLocation)
|
49 | 78 | {
|
50 | 79 | MM_ConcurrentMarkingDelegate::markSchemeStackIteratorData *data = (MM_ConcurrentMarkingDelegate::markSchemeStackIteratorData *)localData;
|
51 |
| - |
52 |
| - omrobjectptr_t object = *objectIndirect; |
53 |
| - if (data->env->getExtensions()->heap->objectIsInGap(object)) { |
54 |
| - /* CMVC 136483: Ensure that the object is not in the gap of a split heap (stack-allocated object) since we can't mark that part of the address space */ |
55 |
| - Assert_MM_validStackSlot(MM_StackSlotValidator(MM_StackSlotValidator::NOT_ON_HEAP, object, stackLocation, walkState).validate(data->env)); |
56 |
| - } else if (data->markingScheme->isHeapObject(object)) { |
57 |
| - /* heap object - validate and mark */ |
58 |
| - Assert_MM_validStackSlot(MM_StackSlotValidator(0, object, stackLocation, walkState).validate(data->env)); |
59 |
| - data->markingScheme->markObject(data->env, object); |
60 |
| - } else if (NULL != object) { |
61 |
| - /* stack object - just validate */ |
62 |
| - Assert_MM_validStackSlot(MM_StackSlotValidator(MM_StackSlotValidator::NOT_ON_HEAP, object, stackLocation, walkState).validate(data->env)); |
63 |
| - } |
| 80 | + data->concurrentMarkingDelegate->doStackSlot(data->env, objectIndirect, walkState, stackLocation); |
64 | 81 | }
|
65 | 82 |
|
66 | 83 | bool
|
@@ -150,14 +167,21 @@ MM_ConcurrentMarkingDelegate::scanThreadRoots(MM_EnvironmentBase *env)
|
150 | 167 | }
|
151 | 168 |
|
152 | 169 | markSchemeStackIteratorData localData;
|
153 |
| - localData.markingScheme = _markingScheme; |
| 170 | + localData.concurrentMarkingDelegate = this; |
154 | 171 | localData.env = env;
|
155 | 172 | /* In a case this thread is a carrier thread, and a virtual thread is mounted, we will scan virtual thread's stack. */
|
156 | 173 | GC_VMThreadStackSlotIterator::scanSlots(vmThread, vmThread, (void *)&localData, concurrentStackSlotIterator, true, false);
|
157 | 174 |
|
158 | 175 | #if JAVA_SPEC_VERSION >= 19
|
159 | 176 | if (NULL != vmThread->currentContinuation) {
|
160 | 177 | GC_VMThreadStackSlotIterator::scanSlots(vmThread, vmThread, vmThread->currentContinuation, (void *)&localData, concurrentStackSlotIterator, true, false);
|
| 178 | +#if JAVA_SPEC_VERSION >= 24 |
| 179 | + GC_ContinuationSlotIterator continuationSlotIterator(vmThread, vmThread->currentContinuation); |
| 180 | + |
| 181 | + while (J9Object **slot = continuationSlotIterator.nextSlot()) { |
| 182 | + doContinuationSlot(env, slot, &continuationSlotIterator); |
| 183 | + } |
| 184 | +#endif /* JAVA_SPEC_VERSION >= 24 */ |
161 | 185 | }
|
162 | 186 | #endif /* JAVA_SPEC_VERSION >= 19 */
|
163 | 187 |
|
|
0 commit comments