scheduling of compilation task
rgougol at email.sjsu.edu
rgougol at email.sjsu.edu
Mon Dec 3 11:41:38 PST 2007
Interesting, It seems we are working in similar fields. But I am starter so I cc
this message to the group maybe the main developer help you more if you have not
asked them yet. Here are the resouces I have. I do not want to publish my own
draft yet since it is not complete but I will be happy to answer your questions
if I can.
http://libra.msra.cn/paperdetail.aspx?id=1904842&query=operating+system
Compilation Scheduling for the Java Virtual Machine(2005)
Robert Chun Azeem S. Jiva
Conference: Int. Conf. on Programming Languages and Compilers - PLC
http://java.sun.com/javase/technologies/hotspot/index.jsp
The Java HotSpot Performance Engine Architecture. White paper available at
http://java.sun.com/products/hotspot/whitepaper.html, June 2007.
Tim Lindholm, Frank Yellin. The JavaTM Virtual Machine Specification, Second
Edition
Dever, S., Goldman, S. & Russel, K. New Compiler Optimizations in Java
HotSpot Virtual Machine. Sun Microsystem, Inc. 2006 JavaOne conference. TS-
3412.
Tom Rodriguez, Ken Russell. Client Compiler for the Java HotSpot Virtual
Machine Technology and Application. Sun Microsyst ms,Inc.
Quoting Chmielewski Andreas <dipl.andreas at googlemail.com>:
> Hello,
>
> thanks for your answer. Do u know any source i can read something about
> hotspot? I know that the code-sources are public but its still a pain to
> read and especially to understand the technique they are using.
>
> In particular my intention to write thru that mailing list was to find out
> if there are any papers about the scheduling technique of hotspot.Maybe my
> question is not very clear so i wanna describe u that one:
>
> Lets guess we just have a fixed threshold decides when we do compile a
> method. We start our application, after some time we get many compilation
> tasks and now we try to compile them all at the same moment. As u can
> imagine the application slows down (especially if the code generator doesn´t
> work very fast). That problem gets reinforced by using a less powerful pc
> (especially on a small embbeded device). If we are running with a
> Round-Robin-Scheduler that kind of problem won´t have an important effect
> cause every thread gets sufficient time. But what do we do if we run on a
> fixed-priority-preemptive-Scheduler. Maybe we even don´t get enough time if
> the compilation thread runs on very low priority (1). More worse it is if we
> work on a higher priority (like 10). We may slow down the application
> dramatically if we have many compilation tasks. Both strategies are bad :)
>
> I didn´t asked here for any solutions ( i know i need to find them :) ) for
> that kind of problem but I have asked for where i can get any information
> about this.
>
> If u like to know what kind of solution i have found right now and how it
> performs, fell free to ask me :) I just need also different solutions for
> the draft of my diploma thesis.
>
> kindly regards
>
> Andreas
>
>
>
> 2007/11/26, rgougol at email.sjsu.edu <rgougol at email.sjsu.edu >:
> >
> >
> > As far as I am concerned, Java HotSpot uses fixed thresholds for
> > triggering the
> > JIT profiling and compiling. HotSpot queues the compilation tasks in a
> > first-in-first-served order. HotSpot adds the number of times a method is
> > called
> > to the number of times code blocks inside the method looped and the
> > compare the
> > sum to the interpretation limit. The thresholds are though different
> > for the
> > variant modes (client server), tiers (in multi-layer compilation is
> > enabled, and
> > platforms. I guess you may want to take a look at the following source
> > files and
> > lines of code:
> >
> > hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp /home/user/sizefactor-@@
> > -540,15
> > +540,18 @@
> > __ andl(rax, InvocationCounter::count_mask_value); // mask out the
> > status bits
> >
> > __ movl(invocation_counter, rcx); // save invocation
> > count
> > __ addl(rcx, rax); // add both counters
> >
> > // profile_method is non-null only for interpreted method so
> > // profile_method != NULL == !native_call
> > // BytecodeInterpreter only calls for native so code is elided.
> >
> > __ cmp32(rcx,
> >
> > ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit));
> > __ jcc(Assembler::aboveEqual, *overflow);
> >
> >
> > hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
> > 334,7
> > __ andl(rax, InvocationCounter::count_mask_value); // mask out the
> > status bits
> >
> > __ movl(invocation_counter, rcx); // save invocation
> > count
> > __ addl(rcx, rax); // add both counters
> >
> > // profile_method is non-null only for interpreted method so
> > // profile_method != NULL == !native_call
> > @@ -342,18 +342,24 @@
> >
> > if (ProfileInterpreter && profile_method != NULL) {
> > // Test to see if we should create a method data oop
> > __ cmp32(rcx,
> >
> > ExternalAddress((address)&InvocationCounter::InterpreterProfileLimit));
> > __ jcc(Assembler::less, *profile_method_continue);
> >
> > // if no method data exists, go to profile_method
> > __ test_method_data_pointer(rax, *profile_method);
> > }
> >
> > __ cmp32(rcx,
> >
> > ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit));
> > __ jcc(Assembler::aboveEqual, *overflow);
> > }
> >
> >
> >
> > openjdk/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
> > /home/user/sizefactor-
> > @@ -1543,14 +1543,15 @@
> > __ increment(rax, InvocationCounter::count_increment); // increment
> > counter
> > __ movl(Address(rcx, be_offset), rax); // store counter
> >
> > __ movl(rax, Address(rcx, inv_offset)); // load invocation counter
> > __ andl(rax, InvocationCounter::count_mask_value); // and the
> > status bits
> > __ addl(rax, Address(rcx, be_offset)); // add both counters
> > if (ProfileInterpreter) {
> > // Test to see if we should create a method data oop
> > __ cmp32(rax,
> > ExternalAddress((address)
> > &InvocationCounter::InterpreterProfileLimit));
> > __ jcc(Assembler::less, dispatch);
> >
> > // if no method data exists, go to profile method
> > @@ -1558,8 +1559,9 @@
> >
> > if (UseOnStackReplacement) {
> > // check for overflow against rbx, which is the MDO taken count
> > __ cmp32(rbx,
> > ExternalAddress((address)
> >
> >
> > /openjdk/hotspot/src/share/vm/runtime/globals.hpp 2007-10-12 03:46:
> > 16.000000000
> > -0400
> > +++ /home/user/sizefactor-openjdk/hotspot/src/share/vm/runtime/globals.hpp
> >
> > 2007-10-31 02:02:28.000000000 -0400
> > @@ -2946,6 +2946,9 @@
> > product_pd(intx,
> > CompileThreshold, \
> > "number of interpreted method invocations before
> > (re-)compiling") \
> >
> > \
> >
> > src/share/vm/compiler/compileBroker.cpp
> >
> > @@ -430,8 +430,6 @@
> > void CompileQueue::add(CompileTask* task) {
> > assert(lock()->owned_by_self(), "must own lock");
> >
> > task->set_next(NULL);
> >
> > if (_last == NULL) {
> > // The compile queue is empty.
> > assert(_first == NULL, "queue is empty");
> > @@ -440,8 +438,31 @@
> > } else {
> > // Append the task to the queue.
> > assert(_last->next() == NULL, "not last");
> > _last->set_next(task);
> > _last = task;
> >
> >
> >
> > Quoting Chmielewski Andreas <dipl.andreas at googlemail.com >:
> >
> > > Hello,
> > >
> > > i am a student currently working on a diploma thesis for which i develop
> > a
> > > simple JitProfiler/JitCompiler (PPC architecture) for a realtime
> > Java-VM.
> > > That VM is using a fixed priority preemptive Scheduler. To ensure the
> > > realtime capability, the compilation task is running on the lowest
> > priority.
> > >
> > >
> > > As I have seen in some tests the compilation task won´t get enough cpu
> > time
> > > for his work cause its running on lowest priority. So a different more
> > > aggressive strategy was needed. Therefore i have implemented a self
> > > contained Scheduler for the jit compilation task. This ensures that the
> > > compilation task will get at least a little bit of time for his work by
> > > increasing the priority to 10 (still below realtime priorities). As far
> > as
> > > it works fine now. But i got / still have some small problems ....
> > >
> > >
> > > So in particular i would like to ask here if there is somebody who can
> > > provide me with information about the scheduling of Hotspot or different
> > > compilers.
> > >
> > >
> > > If there are any questions feel free to write an email to me :) I would
> > be
> > > very thankful getting useful information :)
> > >
> > >
> > > Regards
> > >
> > >
> > > Andreas
> > >
> >
> >
> >
>
More information about the hotspot-compiler-dev
mailing list