diff -r 9931d138b808 src/hotspot/share/gc/epsilon/epsilonArguments.cpp --- a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp Mon May 07 16:41:38 2018 +0200 +++ b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp Fri May 11 15:03:17 2018 +0200 @@ -61,6 +61,18 @@ } } #endif + + if (EpsilonEraseAndRewindCauseIHaveBeenChangingMyMind) { + if (!UnlockCrazyBonkersVMOptions) { + vm_exit_during_initialization("Oops", "Not enough insanity on the command line, use -XX:+UnlockCrazyBonkersVMOptions to unlock"); + } + } + + log_warning(gc)("Dude, are you seriously running binaries from Twitter links? Dude."); + log_info(gc)("**********************************************************************************"); + log_info(gc)("* SPECIAL ONE-TIME OFFER ONLY: *"); + log_info(gc)("* Scratch your display here to unlock special JVM cheat codes: [XXXXXXXXXXXXXXX] *"); + log_info(gc)("**********************************************************************************"); } CollectedHeap* EpsilonArguments::create_heap() { diff -r 9931d138b808 src/hotspot/share/gc/epsilon/epsilonHeap.cpp --- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Mon May 07 16:41:38 2018 +0200 +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Fri May 11 15:03:17 2018 +0200 @@ -199,8 +199,19 @@ } void EpsilonHeap::collect(GCCause::Cause cause) { - log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause)); _monitoring_support->update_counters(); + if (EpsilonEraseAndRewindCauseIHaveBeenChangingMyMind) { + if (_recorded_top == NULL) { + log_info(gc)("First GC request, allocation cursor is recorded at " SIZE_FORMAT "M", _space->used() / M); + _recorded_top = _space->top(); + } else { + size_t before = _space->used(); + _space->set_top(_recorded_top); + log_info(gc)("GC request, rewinding allocations: " SIZE_FORMAT "M -> " SIZE_FORMAT "M", before / M, _space->used() / M); + } + } else { + log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause)); + } } void EpsilonHeap::do_full_collection(bool clear_all_soft_refs) { diff -r 9931d138b808 src/hotspot/share/gc/epsilon/epsilonHeap.hpp --- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp Mon May 07 16:41:38 2018 +0200 +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp Fri May 11 15:03:17 2018 +0200 @@ -48,10 +48,13 @@ size_t _step_counter_update; size_t _step_heap_print; + HeapWord* _recorded_top; + public: static EpsilonHeap* heap(); EpsilonHeap(EpsilonCollectorPolicy* p) : + _recorded_top(NULL), _policy(p), _memory_manager("Epsilon Heap", "") {}; diff -r 9931d138b808 src/hotspot/share/gc/epsilon/epsilon_globals.hpp --- a/src/hotspot/share/gc/epsilon/epsilon_globals.hpp Mon May 07 16:41:38 2018 +0200 +++ b/src/hotspot/share/gc/epsilon/epsilon_globals.hpp Fri May 11 15:03:17 2018 +0200 @@ -72,6 +72,13 @@ experimental(size_t, EpsilonMinHeapExpand, 128 * M, \ "Min expansion step for heap. Larger value improves performance " \ "at the potential expense of memory waste.") \ - range(1, max_intx) + range(1, max_intx) \ + \ + product(bool, UnlockCrazyBonkersVMOptions, false, \ + "Unlock the options suggested by Twitter reviewers.") \ + \ + product(bool, EpsilonEraseAndRewindCauseIHaveBeenChangingMyMind, false, \ + "Rewind allocation cursor to preset position.") \ + \ #endif // SHARE_VM_GC_EPSILON_GLOBALS_HPP