Mercurial > hg > arm32-8
changeset 6992:4097d13b5370
Don't save locals at a return.
author | aph |
---|---|
date | Wed, 22 Apr 2015 05:06:37 +0100 |
parents | f58402e1ca87 |
children | ea5a42a6a655 |
files | make/solaris/makefiles/gcc.make src/cpu/zero/vm/asm_helper.cpp src/cpu/zero/vm/thumb2.cpp src/os/linux/vm/os_linux.cpp src/share/vm/gc_implementation/shared/markSweep.cpp src/share/vm/gc_implementation/shared/markSweep.inline.hpp src/share/vm/interpreter/bytecodeInterpreter.cpp src/share/vm/runtime/frame.cpp src/share/vm/runtime/vmThread.cpp |
diffstat | 9 files changed, 81 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/make/solaris/makefiles/gcc.make Tue May 29 11:06:21 2012 -0400 +++ b/make/solaris/makefiles/gcc.make Wed Apr 22 05:06:37 2015 +0100 @@ -124,7 +124,7 @@ CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) # The flags to use for an Optimized g++ build -OPT_CFLAGS += -O3 +OPT_CFLAGS += -O0 # Hotspot uses very unstrict aliasing turn this optimization off OPT_CFLAGS += -fno-strict-aliasing
--- a/src/cpu/zero/vm/asm_helper.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/cpu/zero/vm/asm_helper.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -403,6 +403,8 @@ return thread->pending_exception(); } +extern "C" void ps(); + extern "C" oop Helper_SafePoint(JavaThread *thread) { { @@ -412,6 +414,15 @@ return thread->pending_exception(); } +extern "C" oop Helper_SafePoint2(JavaThread *thread) +{ + { + HandleMarkCleaner __hmc(thread); + } + SafepointSynchronize::block(thread); + return thread->pending_exception(); +} + extern "C" void Helper_RaiseArrayBoundException(JavaThread *thread, int index) { char message[jintAsStringSize];
--- a/src/cpu/zero/vm/thumb2.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/cpu/zero/vm/thumb2.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -3447,13 +3447,15 @@ jstack->depth = 0; } +// SAVE_STACK and RESTORE_STACK save the stack state so that it's +// possible to do a stack flush to memory and restore that stack state +// to the same registers. #define SAVE_STACK(JSTACK) \ unsigned saved_stack_elements[JSTACK->depth]; \ unsigned saved_stack_depth; \ memcpy(saved_stack_elements, JSTACK->stack, \ JSTACK->depth * sizeof saved_stack_elements[0]); \ saved_stack_depth = JSTACK->depth; - #define RESTORE_STACK(JSTACK, CODEBUF) \ Thumb2_Pop_Multiple(CODEBUF, saved_stack_elements, saved_stack_depth); \ memcpy(JSTACK->stack, saved_stack_elements, \ @@ -4217,7 +4219,7 @@ // // n.b. for a return there is no need save or restore locals - bool is_return = offset == 0; + bool is_return = offset == 0; // This is some kind of return bytecode int r_tmp = Thumb2_Tmp(jinfo, 0); unsigned dest; @@ -4261,23 +4263,19 @@ SAVE_STACK(jinfo->jstack); Thumb2_Flush(jinfo); + // We don't save or restore locals if we're returning. + if (! is_return) + Thumb2_save_locals(jinfo, stackdepth); + // now the safepoint polling code itself - - // We save the locals at a return bytecode even though we aren't - // going to restore them: we do so because otherwise there's a - // risk that the GC might scan garbage. - Thumb2_save_locals(jinfo, stackdepth); - mov_imm(jinfo->codebuf, ARM_R1, bci+CONSTMETHOD_CODEOFFSET); add_imm(jinfo->codebuf, ARM_R2, ISTATE_REG(jinfo), ISTATE_OFFSET(jinfo, stackdepth, 0)); bl(jinfo->codebuf, handlers[H_SAFEPOINT]); - // We don't restore the locals if we're returning. if (! is_return) Thumb2_restore_locals(jinfo, stackdepth); - // But we always restore the register state of the stack. RESTORE_STACK(jinfo->jstack, jinfo->codebuf); if (offset < 0) {
--- a/src/os/linux/vm/os_linux.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/os/linux/vm/os_linux.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -4791,8 +4791,11 @@ Linux::fast_thread_clock_init(); // Allocate a single page and mark it as readable for safepoint polling - address polling_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" ); + julong foo = (julong) ::mmap(NULL, 65536, PROT_READ, + MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0); + address polling_page = (address)(foo & -65536L); + if ((julong)polling_page < foo) + polling_page += 65536; os::set_polling_page( polling_page );
--- a/src/share/vm/gc_implementation/shared/markSweep.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/share/vm/gc_implementation/shared/markSweep.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -36,6 +36,11 @@ uint MarkSweep::_total_invocations = 0; + +void *arse[2]; + +void sa(void*a, void *b) { arse[0] = a; arse [1] = b; } + Stack<oop, mtGC> MarkSweep::_marking_stack; Stack<ObjArrayTask, mtGC> MarkSweep::_objarray_stack;
--- a/src/share/vm/gc_implementation/shared/markSweep.inline.hpp Tue May 29 11:06:21 2012 -0400 +++ b/src/share/vm/gc_implementation/shared/markSweep.inline.hpp Wed Apr 22 05:06:37 2015 +0100 @@ -57,9 +57,15 @@ MarkSweep::mark_and_push(&op); } +extern "C" void *arse[2]; + +extern "C" void sa(void*a, void *b); + template <class T> inline void MarkSweep::follow_root(T* p) { assert(!Universe::heap()->is_in_reserved(p), "roots shouldn't be things within the heap"); + if (arse[0] <= (void *)p && arse[1] >= (void *)p) + fprintf(stderr, "Whip\n"); T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
--- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -1645,7 +1645,13 @@ CASE(_freturn): { // Allow a safepoint before returning to frame manager. - SAFEPOINT; + if ( SafepointSynchronize::is_synchronizing()) { + { + /* zap freed handles rather than GC'ing them */ + HandleMarkCleaner __hmc(THREAD); + } + CALL_VM(SafepointSynchronize::block(THREAD), handle_exception); + } goto handle_return; }
--- a/src/share/vm/runtime/frame.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/share/vm/runtime/frame.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -796,6 +796,9 @@ } if (in_stack) { _f->do_oop(addr); + } else { + fprintf(stderr, "Arse! %p\n", + _fr->interpreter_frame_tos_address()); } } }
--- a/src/share/vm/runtime/vmThread.cpp Tue May 29 11:06:21 2012 -0400 +++ b/src/share/vm/runtime/vmThread.cpp Wed Apr 22 05:06:37 2015 +0100 @@ -248,6 +248,39 @@ } } +class BangerThread : NamedThread +{ +public: + + static BangerThread *the_thread; + + static void create() { + the_thread = new BangerThread(); + os::create_thread (the_thread, os::watcher_thread); + Thread::start(the_thread); + } + + BangerThread() : NamedThread() { + set_name("banger"); + } + + void run() { + struct timespec req; + req.tv_nsec = 0.5e9; + req.tv_sec = 0; + + for (;;) + { + nanosleep(&req, NULL); + // VM_ForceSafepoint op; + // VMThread::execute(&op); + Universe::heap()->collect(GCCause::_java_lang_system_gc); + } + } +}; + +BangerThread *BangerThread::the_thread; + void VMThread::run() { assert(this == vm_thread(), "check"); @@ -272,6 +305,8 @@ // possible to set the VM thread priority higher than any Java thread. os::set_native_priority( this, prio ); + BangerThread::create(); + // Wait for VM_Operations until termination this->loop();