< prev index next >

src/hotspot/share/runtime/continuation.cpp

Print this page

405   st->print_cr("CONTINUATION: " PTR_FORMAT " done: %d",
406     continuation->identity_hash(), jdk_internal_vm_Continuation::done(continuation));
407   st->print_cr("CHUNKS:");
408   for (stackChunkOop chunk = cont.tail(); chunk != nullptr; chunk = chunk->parent()) {
409     st->print("* ");
410     chunk->print_on(true, st);
411   }
412 }
413 #endif // ASSERT
414 
415 
416 void continuations_init() { Continuations::init(); }
417 
418 void Continuations::init() {
419   Continuation::init();
420 }
421 
422 // While virtual threads are in Preview, there are some VM mechanisms we disable if continuations aren't used
423 // See NMethodSweeper::do_stack_scanning and nmethod::is_not_on_continuation_stack
424 bool Continuations::enabled() {
425   return VMContinuations && Arguments::enable_preview();

426 }
427 
428 // We initialize the _gc_epoch to 2, because previous_completed_gc_marking_cycle
429 // subtracts the value by 2, and the type is unsigned. We don't want underflow.
430 //
431 // Odd values mean that marking is in progress, and even values mean that no
432 // marking is currently active.
433 uint64_t Continuations::_gc_epoch = 2;
434 
435 uint64_t Continuations::gc_epoch() {
436   return _gc_epoch;
437 }
438 
439 bool Continuations::is_gc_marking_cycle_active() {
440   // Odd means that marking is active
441   return (_gc_epoch % 2) == 1;
442 }
443 
444 uint64_t Continuations::previous_completed_gc_marking_cycle() {
445   if (is_gc_marking_cycle_active()) {

405   st->print_cr("CONTINUATION: " PTR_FORMAT " done: %d",
406     continuation->identity_hash(), jdk_internal_vm_Continuation::done(continuation));
407   st->print_cr("CHUNKS:");
408   for (stackChunkOop chunk = cont.tail(); chunk != nullptr; chunk = chunk->parent()) {
409     st->print("* ");
410     chunk->print_on(true, st);
411   }
412 }
413 #endif // ASSERT
414 
415 
416 void continuations_init() { Continuations::init(); }
417 
418 void Continuations::init() {
419   Continuation::init();
420 }
421 
422 // While virtual threads are in Preview, there are some VM mechanisms we disable if continuations aren't used
423 // See NMethodSweeper::do_stack_scanning and nmethod::is_not_on_continuation_stack
424 bool Continuations::enabled() {
425   // return VMContinuations && Arguments::enable_preview();
426   return VMContinuations;
427 }
428 
429 // We initialize the _gc_epoch to 2, because previous_completed_gc_marking_cycle
430 // subtracts the value by 2, and the type is unsigned. We don't want underflow.
431 //
432 // Odd values mean that marking is in progress, and even values mean that no
433 // marking is currently active.
434 uint64_t Continuations::_gc_epoch = 2;
435 
436 uint64_t Continuations::gc_epoch() {
437   return _gc_epoch;
438 }
439 
440 bool Continuations::is_gc_marking_cycle_active() {
441   // Odd means that marking is active
442   return (_gc_epoch % 2) == 1;
443 }
444 
445 uint64_t Continuations::previous_completed_gc_marking_cycle() {
446   if (is_gc_marking_cycle_active()) {
< prev index next >