Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

View: New views
11 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Steve Blackburn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ian,

Can explain to us what you were trying to do with r15318?   The commit  
message says "fix typos", I assume that was a mistake on your part  
because the commit doesn't seem to have a lot to do with typos.  A  
bunch of other things are going on in there which appear significant  
and that affect others:

1. A bunch of methods are now explicitly inlined.   I'm guessing  
you've done this to try to address the problems with compress that  
were due to an unrelated change (I noticed that after 15318 the  
longstanding compress bug, RVM-743, suddenly went away).  In any case,  
can you please explain what you've done and why.  If it is a targeted  
fix for RVM-743 it would be cool to understand why.  On a related  
note, Dave has been (justifiably) goading me to remove explicit  
inlines from MMTk for a long time now.   We really don't want to add  
new ones unless there's a strong story.

2. Write barriers appear to have had their parameters shuffled.  Some  
of us depend critically on this code, so it would be great if you  
could explain this change for the rest of us.

Thanks,

--Steve

On 31/01/2009, at 2:21 AM, captain5050@... wrote:

> Revision: 15318
>          http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15318&view=rev
> Author:   captain5050
> Date:     2009-01-30 15:21:00 +0000 (Fri, 30 Jan 2009)
>
> Log Message:
> -----------
> Fix typos
>
> Modified Paths:
> --------------
>    rvmroot/trunk/MMTk/src/org/mmtk/utility/Constants.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/Services.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMField.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/
> BaselineCompiler.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> Barriers.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> BaselineCompilerImpl.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> Barriers.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> BaselineCompilerImpl.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/
> ExpandRuntimeServices.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/
> MemoryManager.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Entrypoints.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/runtime/RuntimeEntrypoints.java
>    rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Statics.java
>
> Modified: rvmroot/trunk/MMTk/src/org/mmtk/utility/Constants.java
> ===================================================================
> --- rvmroot/trunk/MMTk/src/org/mmtk/utility/Constants.java
> 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/MMTk/src/org/mmtk/utility/Constants.java
> 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -74,7 +74,7 @@
>    *
>    * Java-specific sizes currently required by MMTk
>    *
> -   * TODO MMTk should really become independant of these Java types
> +   * TODO MMTk should really become independent of these Java types
>    */
>   byte LOG_BYTES_IN_SHORT = 1;
>   int BYTES_IN_SHORT = 1 << LOG_BYTES_IN_SHORT;
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/Services.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/Services.java 2009-01-30  
> 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/Services.java 2009-01-30  
> 15:21:00 UTC (rev 15318)
> @@ -17,6 +17,7 @@
> import org.jikesrvm.runtime.Entrypoints;
> import org.jikesrvm.runtime.Magic;
> import org.jikesrvm.scheduler.Synchronization;
> +import org.vmmagic.pragma.Inline;
> import org.vmmagic.pragma.Interruptible;
> import org.vmmagic.pragma.NoInline;
> import org.vmmagic.pragma.Uninterruptible;
> @@ -327,12 +328,14 @@
>
>   /**
>    * Sets an element of a object array without possibly losing  
> control.
> +   * NB doesn't perform checkstore or array index checking.
>    *
>    * @param dst the destination array
>    * @param index the index of the element to set
>    * @param value the new value for the element
>    */
>   @UninterruptibleNoWarn("Interruptible code not reachable at  
> runtime")
> +  @Inline
>   public static void setArrayUninterruptible(Object[] dst, int  
> index, Object value) {
>     if (VM.runningVM) {
>       if (MemoryManagerConstants.NEEDS_WRITE_BARRIER) {
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMField.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMField.java
> 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMField.java
> 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -391,13 +391,13 @@
>   public void setObjectValueUnchecked(Object obj, Object ref) {
>     if (isStatic()) {
>       if (MemoryManagerConstants.NEEDS_PUTSTATIC_WRITE_BARRIER && !
> isUntraced()) {
> -        MemoryManager.putstaticWriteBarrier(getOffset(), ref,  
> getId());
> +        MemoryManager.putstaticWriteBarrier(ref, getOffset(),  
> getId());
>       } else {
>         Statics.setSlotContents(getOffset(), ref);
>       }
>     } else {
>       if (MemoryManagerConstants.NEEDS_WRITE_BARRIER && !
> isUntraced()) {
> -        MemoryManager.putfieldWriteBarrier(obj, getOffset(), ref,  
> getId());
> +        MemoryManager.putfieldWriteBarrier(obj, ref, getOffset(),  
> getId());
>       } else {
>         Magic.setObjectAtOffset(obj, getOffset(), ref);
>       }
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/
> BaselineCompiler.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/
> BaselineCompiler.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/
> BaselineCompiler.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -102,7 +102,7 @@
>     // of method to print option so extra classes needed to process
>     // matching will be loaded and compiled upfront. Thus avoiding  
> getting
>     // stuck looping by just asking if we have a match in the middle  
> of
> -    // compilation. Pick an obsure string for the check.
> +    // compilation. Pick an obscure string for the check.
>     if (options.hasMETHOD_TO_PRINT() &&  
> options.fuzzyMatchMETHOD_TO_PRINT("???")) {
>       VM.sysWrite("??? is not a sensible string to specify for  
> method name");
>     }
> @@ -204,8 +204,8 @@
>     /* reference map and stackheights were computed using original  
> bytecodes
>      * and possibly new operand words
>      * recompute the stack height, but keep the operand words of the  
> code
> -     * generation consistant with reference map
> -     * TODO: revist this code as part of OSR redesign
> +     * generation consistent with reference map
> +     * TODO: revisit this code as part of OSR redesign
>      */
>     // Phase 2: OSR setup\
>     boolean edge_counters = options.EDGE_COUNTERS;
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> Barriers.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> Barriers.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> Barriers.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -19,6 +19,7 @@
> import org.jikesrvm.runtime.Entrypoints;
> import org.jikesrvm.runtime.Magic;
> import org.vmmagic.unboxed.Offset;
> +import org.vmmagic.pragma.Inline;
>
> /**
>  * Class called from baseline compiler to generate architecture  
> specific
> @@ -28,64 +29,57 @@
> class Barriers implements BaselineConstants {
>
>   /**
> -   * Generate code to perform an array store barrier
> +   * Generate code to perform an array store barrier. On entry the  
> stack holds:
> +   * arrayRef, index, value.
>    *
>    * @param asm the assembler to generate the code in
>    * @param ref the register holding the array reference
>    * @param index the register holding index into the array
>    * @param value the register holding the value to store
>    */
> -  static void compileArrayStoreBarrier(Assembler asm, GPR ref, GPR  
> index, GPR value) {
> -    asm.emitPUSH_Reg(ref);
> -    asm.emitPUSH_Reg(index);
> -    asm.emitPUSH_Reg(value);
> +  static void compileArrayStoreBarrier(Assembler asm) {
>     BaselineCompilerImpl.genParameterRegisterLoad(asm, 3);
> -    
> asm
> .emitCALL_Abs
> (Magic
> .getTocPointer
> ().plus(Entrypoints.arrayStoreWriteBarrierMethod.getOffset()));
> +    
> asm
> .emitCALL_Abs
> (Magic.getTocPointer().plus(Entrypoints.aastoreMethod.getOffset()));
>   }
>
>   /**
> -   * Generate code to perform a putfield barrier
> +   * Generate code to perform a putfield barrier. On entry the  
> stack holds:
> +   * object, value.
>    *
>    * @param asm the assembler to generate the code in
> -   * @param ref the register holding the array reference
>    * @param offset the register holding the offset of the field
> -   * @param value the register holding the value to store
> +   * @param locationMetadata meta-data about the location
>    */
> -  static void compilePutfieldBarrier(Assembler asm, GPR ref, GPR  
> offset, GPR value, int locationMetadata) {
> -    BaselineCompilerImpl.genNullCheck(asm, ref);
> -    asm.emitPUSH_Reg(ref);
> +  @Inline
> +  static void compilePutfieldBarrier(Assembler asm, GPR offset, int  
> locationMetadata) {
>     asm.emitPUSH_Reg(offset);
> -    asm.emitPUSH_Reg(value);
>     asm.emitPUSH_Imm(locationMetadata);
>     BaselineCompilerImpl.genParameterRegisterLoad(asm, 4);
> +    BaselineCompilerImpl.genNullCheck(asm, T0);
>      
> asm
> .emitCALL_Abs
> (Magic
> .getTocPointer
> ().plus(Entrypoints.putfieldWriteBarrierMethod.getOffset()));
> -   }
> +  }
>
>   /**
> -   * Generate code to perform a putfield barrier when the field is  
> at a known offset
> +   * Generate code to perform a putfield barrier when the field is  
> at a known
> +   * offset. On entry the stack holds: object, value.
>    *
>    * @param asm the assembler to generate the code in
> -   * @param ref the register holding the array reference
>    * @param fieldOffset the offset of the field
> -   * @param value the register holding the value to store
> +   * @param locationMetadata meta-data about the location
>    */
> -  static void compilePutfieldBarrierImm(Assembler asm, GPR ref,  
> Offset fieldOffset, GPR value, int locationMetadata) {
> -    BaselineCompilerImpl.genNullCheck(asm, ref);
> -    asm.emitPUSH_Reg(ref);
> +  @Inline
> +  static void compilePutfieldBarrierImm(Assembler asm, Offset  
> fieldOffset, int locationMetadata) {
>     asm.emitPUSH_Imm(fieldOffset.toInt());
> -    asm.emitPUSH_Reg(value);
>     asm.emitPUSH_Imm(locationMetadata);
>     BaselineCompilerImpl.genParameterRegisterLoad(asm, 4);
> +    BaselineCompilerImpl.genNullCheck(asm, T0);
>      
> asm
> .emitCALL_Abs
> (Magic
> .getTocPointer
> ().plus(Entrypoints.putfieldWriteBarrierMethod.getOffset()));
>   }
>
>   static void compilePutstaticBarrier(Assembler asm, GPR reg, int  
> locationMetadata) {
>     //  on entry java stack contains ...|ref_to_store|
>     //  reg holds offset of field
> -    if(VM.VerifyAssertions) VM._assert(reg != S0);
> -    asm.emitPOP_Reg(S0);   // S0 = ref_to_store
>     asm.emitPUSH_Reg(reg); // offset
> -    asm.emitPUSH_Reg(S0);  // ref_to_store
>     asm.emitPUSH_Imm(locationMetadata);
>     BaselineCompilerImpl.genParameterRegisterLoad(asm, 3);
>      
> asm
> .emitCALL_Abs
> (Magic
> .getTocPointer
> ().plus(Entrypoints.putstaticWriteBarrierMethod.getOffset()));
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> BaselineCompilerImpl.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> BaselineCompilerImpl.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/
> BaselineCompilerImpl.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -702,23 +702,11 @@
>   @Override
>   protected final void emit_aastore() {
>     Barriers.compileModifyCheck(asm, 8);
> -    asm.emitPUSH_RegDisp(SP, TWO_SLOTS); // duplicate array ref
> -    asm.emitPUSH_RegDisp(SP, ONE_SLOT);  // duplicate object value
> -    genParameterRegisterLoad(asm, 2);    // pass 2 parameter
> -    // call checkstore(array ref, value)
> -    
> asm
> .emitCALL_Abs
> (Magic
> .getTocPointer().plus(Entrypoints.checkstoreMethod.getOffset()));
> -    asm.emitPOP_Reg(T1); // T1 is the value
> -    asm.emitPOP_Reg(T0); // T0 is array index
> -    asm.emitPOP_Reg(S0); // S0 is array ref
> -    genBoundsCheck(asm, T0, S0); // T0 is index, S0 is address of  
> array
>     if (MemoryManagerConstants.NEEDS_WRITE_BARRIER) {
> -      Barriers.compileArrayStoreBarrier(asm, S0, T0, T1);
> +      Barriers.compileArrayStoreBarrier(asm);
>     } else {
> -      if (VM.BuildFor32Addr) {
> -        asm.emitMOV_RegIdx_Reg(S0, T0, Assembler.WORD, NO_SLOT,  
> T1); // [S0 + T0<<2] <- T1
> -      } else {
> -        asm.emitMOV_RegIdx_Reg_Quad(S0, T0, Assembler.LONG,  
> NO_SLOT, T1); // [S0 + T0<<3] <- T1
> -      }
> +      genParameterRegisterLoad(asm, 3);
> +      
> asm
> .emitCALL_Abs
> (Magic.getTocPointer().plus(Entrypoints.aastoreMethod.getOffset()));
>     }
>   }
>
> @@ -2863,11 +2851,11 @@
>     emitDynamicLinkingSequence(asm, T0, fieldRef, true);
>     if (fieldType.isReferenceType()) {
>       // 32/64bit reference store
> -      asm.emitPOP_Reg(T1);  // T1 is the value to be stored
> -      asm.emitPOP_Reg(S0);  // S0 is the object reference
>       if (MemoryManagerConstants.NEEDS_WRITE_BARRIER) {
> -        Barriers.compilePutfieldBarrier(asm, S0, T0, T1,  
> fieldRef.getId());
> +        Barriers.compilePutfieldBarrier(asm, T0, fieldRef.getId());
>       } else {
> +        asm.emitPOP_Reg(T1);  // T1 is the value to be stored
> +        asm.emitPOP_Reg(S0);  // S0 is the object reference
>         if (VM.BuildFor32Addr) {
>           asm.emitMOV_RegIdx_Reg(S0, T0, Assembler.BYTE, NO_SLOT,  
> T1); // [S0+T0] <- T1
>         } else {
> @@ -2934,11 +2922,11 @@
>     Barriers.compileModifyCheck(asm, 4);
>     if (field.isReferenceType()) {
>       // 32/64bit reference store
> -      asm.emitPOP_Reg(T0);  // T0 is the value to be stored
> -      asm.emitPOP_Reg(S0);  // S0 is the object reference
>       if (MemoryManagerConstants.NEEDS_WRITE_BARRIER && !
> field.isUntraced()) {
> -        Barriers.compilePutfieldBarrierImm(asm, S0, fieldOffset,  
> T0, fieldRef.getId());
> +        Barriers.compilePutfieldBarrierImm(asm, fieldOffset,  
> fieldRef.getId());
>       } else {
> +        asm.emitPOP_Reg(T0);  // T0 is the value to be stored
> +        asm.emitPOP_Reg(S0);  // S0 is the object reference
>         // [S0+fieldOffset] <- T0
>         if (VM.BuildFor32Addr) {
>           asm.emitMOV_RegDisp_Reg(S0, fieldOffset, T0);
> @@ -4017,7 +4005,7 @@
>
>   /**
>    * Copy parameters from operand stack into registers.
> -   * Assumption: parameters are layed out on the stack in order
> +   * Assumption: parameters are laid out on the stack in order
>    * with SP pointing to the last parameter.
>    * Also, this method is called before the generation of a "helper"  
> method call.
>    * Assumption: no floating-point parameters.
> @@ -4133,7 +4121,7 @@
>    * Store parameters into local space of the callee's stackframe.
>    * Taken: srcOffset - offset from frame pointer of first parameter  
> in caller's stackframe.
>    * Assumption: although some parameters may be passed in registers,
> -   * space for all parameters is layed out in order on the caller's  
> stackframe.
> +   * space for all parameters is laid out in order on the caller's  
> stackframe.
>    */
>   private void genParameterCopy(Offset srcOffset) {
>     int gpr = 0;  // number of general purpose registers unloaded
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> Barriers.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> Barriers.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> Barriers.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -24,23 +24,26 @@
>  */
> class Barriers implements BaselineConstants {
>
> -  // on entry T0, T1, and T2 already contain the appropriate values
> +  // on entry java stack contains ...|array_ref|index|value|
>   static void compileArrayStoreBarrier(BaselineCompilerImpl comp) {
>     Assembler asm = comp.asm;
> -    asm.emitLAddrToc(S0,  
> Entrypoints.arrayStoreWriteBarrierMethod.getOffset());
> -    asm.emitMTCTR(S0);
> -    asm.emitBCCTRL();  //  
> MemoryManager.arrayStoreWriteBarrier(Object ref, int index, Object  
> value)
> +    asm.emitLAddrToc(T0, Entrypoints.aastoreMethod.getOffset());
> +    asm.emitMTCTR(T0);
> +    comp.peekAddr(T0, 2); // T0 is array ref
> +    comp.peekInt(T1, 1);  // T1 is the index
> +    comp.peekAddr(T2, 0); // T2 is value to store
> +    asm.emitBCCTRL();   // aastore(arrayref, index, value)
>   }
>
>   //  on entry java stack contains ...|target_ref|ref_to_store|
> -  // T1 already contains the offset of the field on entry
> +  // T2 already contains the offset of the field on entry
>   static void compilePutfieldBarrier(BaselineCompilerImpl comp, int  
> locationMetadata) {
>     Assembler asm = comp.asm;
>     asm.emitLAddrToc(S0,  
> Entrypoints.putfieldWriteBarrierMethod.getOffset());
>     asm.emitMTCTR(S0);
>     comp.peekAddr(T0, 1);               // object base
>     asm.emitNullCheck(T0);
> -    comp.peekAddr(T2, 0);               // value to store
> +    comp.peekAddr(T1, 0);               // value to store
>     asm.emitLVAL(T3, locationMetadata);
>     asm.emitBCCTRL(); //  
> MemoryManager.putfieldWriteBarrier(T0,T1,T2,T3)
>   }
> @@ -52,21 +55,21 @@
>     asm.emitMTCTR(S0);
>     comp.peekAddr(T0, 1);                 // object base
>     asm.emitNullCheck(T0);
> -    asm.emitLVALAddr(T1, fieldOffset);       // offset
> -    comp.peekAddr(T2, 0);                 // value to store
> +    asm.emitLVALAddr(T2, fieldOffset);       // offset
> +    comp.peekAddr(T1, 0);                 // value to store
>     asm.emitLVAL(T3, locationMetadata);
>     asm.emitBCCTRL();  //  
> MemoryManager.putfieldWriteBarrier(T0,T1,T2,T3)
>   }
>
>   //  on entry java stack contains ...|ref_to_store|
> -  // T0 already contains the offset of the field on entry
> +  // T1 already contains the offset of the field on entry
>   static void compilePutstaticBarrier(BaselineCompilerImpl comp, int  
> locationMetadata) {
>     Assembler asm = comp.asm;
>     asm.emitLAddrToc(S0,  
> Entrypoints.putstaticWriteBarrierMethod.getOffset());
>     asm.emitMTCTR(S0);
> -    comp.peekAddr(T1, 0);                 // value to store
> +    comp.peekAddr(T0, 0);                 // value to store
>     asm.emitLVAL(T2, locationMetadata);
> -    asm.emitBCCTRL(); // MemoryManager.putstaticWriteBarrier(T0,T1)
> +    asm.emitBCCTRL(); //  
> MemoryManager.putstaticWriteBarrier(T0,T1,T2)
>   }
>
>   //  on entry java stack contains ...|ref_to_store|
> @@ -74,10 +77,10 @@
>     Assembler asm = comp.asm;
>     asm.emitLAddrToc(S0,  
> Entrypoints.putstaticWriteBarrierMethod.getOffset());
>     asm.emitMTCTR(S0);
> -    asm.emitLVALAddr(T0, fieldOffset);    // offset
> -    comp.peekAddr(T1, 0);                 // value to store
> +    asm.emitLVALAddr(T1, fieldOffset);    // offset
> +    comp.peekAddr(T0, 0);                 // value to store
>     asm.emitLVAL(T2, locationMetadata);
> -    asm.emitBCCTRL();  // MemoryManager.putstaticWriteBarrier(T0,T1)
> +    asm.emitBCCTRL();  //  
> MemoryManager.putstaticWriteBarrier(T0,T1,T2)
>   }
>
>   // on entry T0, T1 already contain the appropriate values
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> BaselineCompilerImpl.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> BaselineCompilerImpl.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/
> BaselineCompilerImpl.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -1061,18 +1061,16 @@
>    */
>   @Override
>   protected final void emit_aastore() {
> -    asm.emitLAddrToc(T0, Entrypoints.checkstoreMethod.getOffset());
> -    asm.emitMTCTR(T0);
> -    peekAddr(T1, 0);    // T1 is value to store
> -    peekAddr(T0, 2);    // T0 is array ref
> -    asm.emitBCCTRL();   // checkstore(arrayref, value)
> -    popAddr(T2);        // T2 is value to store
> -    genBoundsCheck();
>     if (MemoryManagerConstants.NEEDS_WRITE_BARRIER) {
>       Barriers.compileArrayStoreBarrier(this);
> +      discardSlots(3);
>     } else {
> -      asm.emitSLWI(T1, T1, LOG_BYTES_IN_ADDRESS);  // convert index  
> to offset
> -      asm.emitSTAddrX(T2, T0, T1);  // store ref value in array
> +      asm.emitLAddrToc(T0, Entrypoints.aastoreMethod.getOffset());
> +      asm.emitMTCTR(T0);
> +      popAddr(T2);    // T2 is value to store
> +      popInt(T1);     // T1 is the index
> +      popAddr(T0);    // T0 is array ref
> +      asm.emitBCCTRL();   // aastore(arrayref, index, value)
>     }
>   }
>
> @@ -2535,26 +2533,26 @@
>    * @param fieldRef the referenced field
>    */
>   protected final void emit_unresolved_putstatic(FieldReference  
> fieldRef) {
> -    emitDynamicLinkingSequence(T0, fieldRef, true);
> +    emitDynamicLinkingSequence(T1, fieldRef, true);
>     if (MemoryManagerConstants.NEEDS_PUTSTATIC_WRITE_BARRIER && !
> fieldRef.getFieldContentsType().isPrimitiveType()) {
>       Barriers.compilePutstaticBarrier(this, fieldRef.getId()); //  
> NOTE: offset is in T0 from emitDynamicLinkingSequence
>       discardSlots(1);
>       return;
>     }
>     if (fieldRef.getSize() <= BYTES_IN_INT) { // field is one word
> -      popInt(T1);
> -      asm.emitSTWX(T1, T0, JTOC);
> +      popInt(T0);
> +      asm.emitSTWX(T0, T1, JTOC);
>     } else { // field is two words (double or long (or address on  
> PPC64))
>       if (VM.VerifyAssertions) VM._assert(fieldRef.getSize() ==  
> BYTES_IN_LONG);
>       if (VM.BuildFor64Addr) {
>         if (fieldRef.getNumberOfStackSlots() == 1) {    //address  
> only 1 stackslot!!!
> -          popAddr(T1);
> -          asm.emitSTDX(T1, T0, JTOC);
> +          popAddr(T0);
> +          asm.emitSTDX(T0, T1, JTOC);
>           return;
>         }
>       }
>       popDouble(F0);
> -      asm.emitSTFDX(F0, T0, JTOC);
> +      asm.emitSTFDX(F0, T1, JTOC);
>     }
>   }
>
> @@ -2692,51 +2690,51 @@
>    */
>   protected final void emit_unresolved_putfield(FieldReference  
> fieldRef) {
>     TypeReference fieldType = fieldRef.getFieldContentsType();
> -    // T1 = field offset from emitDynamicLinkingSequence()
> -    emitDynamicLinkingSequence(T1, fieldRef, true);
> +    // T2 = field offset from emitDynamicLinkingSequence()
> +    emitDynamicLinkingSequence(T2, fieldRef, true);
>     if (fieldType.isReferenceType()) {
>       // 32/64bit reference store
>       if (MemoryManagerConstants.NEEDS_WRITE_BARRIER) {
> -        // NOTE: offset is in T1 from emitDynamicLinkingSequence
> +        // NOTE: offset is in T2 from emitDynamicLinkingSequence
>         Barriers.compilePutfieldBarrier(this, fieldRef.getId());
>         discardSlots(2);
>       } else {
>         popAddr(T0);                // T0 = address value
> -        popAddr(T2);                // T2 = object reference
> -        if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T2);
> -        asm.emitSTAddrX(T0, T2, T1);
> +        popAddr(T1);                // T1 = object reference
> +        if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T1);
> +        asm.emitSTAddrX(T0, T1, T2);
>       }
>     } else if (fieldType.isWordType()) {
>       // 32/64bit word store
>       popAddr(T0);                // T0 = value
> -      popAddr(T2);                // T2 = object reference
> -      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T2);
> -      asm.emitSTAddrX(T0, T2, T1);
> +      popAddr(T1);                // T1 = object reference
> +      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T1);
> +      asm.emitSTAddrX(T0, T1, T2);
>     } else if (fieldType.isBooleanType() || fieldType.isByteType()) {
>       // 8bit store
>       popInt(T0); // T0 = value
> -      popAddr(T2); // T2 = object reference
> -      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T2);
> -      asm.emitSTBX(T0, T2, T1);
> +      popAddr(T1); // T1 = object reference
> +      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T1);
> +      asm.emitSTBX(T0, T1, T2);
>     } else if (fieldType.isShortType() || fieldType.isCharType()) {
>       // 16bit store
>       popInt(T0); // T0 = value
> -      popAddr(T2); // T2 = object reference
> -      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T2);
> -      asm.emitSTHX(T0, T2, T1);
> +      popAddr(T1); // T1 = object reference
> +      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T1);
> +      asm.emitSTHX(T0, T1, T2);
>     } else if (fieldType.isIntType() || fieldType.isFloatType()) {
>       // 32bit store
>       popInt(T0); // T0 = value
> -      popAddr(T2); // T2 = object reference
> +      popAddr(T1); // T1 = object reference
>       if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T2);
> -      asm.emitSTWX(T0, T2, T1);
> +      asm.emitSTWX(T0, T1, T2);
>     } else {
>       // 64bit store
>       if (VM.VerifyAssertions) VM._assert(fieldType.isLongType() ||  
> fieldType.isDoubleType());
>       popDouble(F0);     // F0 = doubleword value
> -      popAddr(T2);       // T2 = object reference
> -      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T2);
> -      asm.emitSTFDX(F0, T2, T1);
> +      popAddr(T1);       // T1 = object reference
> +      if (VM.ExplicitlyGuardLowMemory) asm.emitNullCheck(T1);
> +      asm.emitSTFDX(F0, T1, T2);
>     }
>   }
>
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/
> ExpandRuntimeServices.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/
> ExpandRuntimeServices.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/
> ExpandRuntimeServices.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -427,8 +427,8 @@
>                                  MethodOperand.STATIC(target),
>                                  PutField.getClearGuard(inst),
>                                  PutField.getRef(inst).copy(),
> +                                 PutField.getValue(inst).copy(),
>                                  PutField.getOffset(inst).copy(),
> -                                 PutField.getValue(inst).copy(),
>                                  IRTools.IC(fieldRef.getId()));
>                 wb.bcIndex = RUNTIME_SERVICES_BCI;
>                 wb.position = inst.position;
> @@ -482,8 +482,8 @@
>                                null,
>                                IRTools.AC(target.getOffset()),
>                                MethodOperand.STATIC(target),
> +                               PutStatic.getValue(inst).copy(),
>                                PutStatic.getOffset(inst).copy(),
> -                               PutStatic.getValue(inst).copy(),
>                                IRTools.IC(field.getId()));
>               wb.bcIndex = RUNTIME_SERVICES_BCI;
>               wb.position = inst.position;
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/
> MemoryManager.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/
> MemoryManager.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/
> MemoryManager.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -178,13 +178,13 @@
>    * Write barrier for putfield operations.
>    *
>    * @param ref the object which is the subject of the putfield
> +   * @param value the new value for the field
>    * @param offset the offset of the field to be modified
> -   * @param value the new value for the field
>    * @param locationMetadata an int that encodes the source location  
> being modified
>    */
>   @Inline
>   @Entrypoint
> -  public static void putfieldWriteBarrier(Object ref, Offset  
> offset, Object value, int locationMetadata) {
> +  public static void putfieldWriteBarrier(Object ref, Object value,  
> Offset offset, int locationMetadata) {
>     ObjectReference src = ObjectReference.fromObject(ref);
>     Selected.Mutator.get().writeBarrier(src,
>                                         src.toAddress().plus(offset),
> @@ -217,13 +217,13 @@
>   /**
>    * Write barrier for putstatic operations.
>    *
> +   * @param value the new value for the field
>    * @param offset the offset of the field to be modified
> -   * @param value the new value for the field
>    * @param locationMetadata an int that encodes the source location  
> being modified
>    */
>   @Inline
>   @Entrypoint
> -  public static void putstaticWriteBarrier(Offset offset, Object  
> value, int locationMetadata) {
> +  public static void putstaticWriteBarrier(Object value, Offset  
> offset, int locationMetadata) {
>     ObjectReference src = ObjectReference.fromObject(Magic.getJTOC());
>     Selected.Mutator.get().writeBarrier(src,
>                                         src.toAddress().plus(offset),
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Entrypoints.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Entrypoints.java
> 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Entrypoints.java
> 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -51,6 +51,8 @@
>       getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class,  
> "checkcast", "(Ljava/lang/Object;I)V");
>   public static final NormalMethod checkstoreMethod =
>       getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class,  
> "checkstore", "(Ljava/lang/Object;Ljava/lang/Object;)V");
> +  public static final NormalMethod aastoreMethod =
> +      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class,  
> "aastore", "([Ljava/lang/Object;ILjava/lang/Object;)V");
>   public static final NormalMethod athrowMethod =
>       getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class,  
> "athrow", "(Ljava/lang/Throwable;)V");
>
> @@ -258,9 +260,9 @@
>   public static final NormalMethod arrayStoreWriteBarrierMethod =
>       getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class,  
> "arrayStoreWriteBarrier", "(Ljava/lang/Object;ILjava/lang/Object;)V");
>   public static final NormalMethod putfieldWriteBarrierMethod =
> -      getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class,  
> "putfieldWriteBarrier", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/
> Offset;Ljava/lang/Object;I)V");
> +      getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class,  
> "putfieldWriteBarrier", "(Ljava/lang/Object;Ljava/lang/Object;Lorg/
> vmmagic/unboxed/Offset;I)V");
>   public static final NormalMethod putstaticWriteBarrierMethod =
> -      getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class,  
> "putstaticWriteBarrier", "(Lorg/vmmagic/unboxed/Offset;Ljava/lang/
> Object;I)V");
> +      getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class,  
> "putstaticWriteBarrier", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/
> Offset;I)V");
>
>   public static final NormalMethod arrayLoadReadBarrierMethod =
>       getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class,  
> "arrayLoadReadBarrier", "(Ljava/lang/Object;I)Ljava/lang/Object;");
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/runtime/
> RuntimeEntrypoints.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/runtime/
> RuntimeEntrypoints.java 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/runtime/
> RuntimeEntrypoints.java 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -16,6 +16,7 @@
> import org.jikesrvm.ArchitectureSpecific.Registers;
> import org.jikesrvm.VM;
> import org.jikesrvm.Constants;
> +import org.jikesrvm.Services;
> import org.jikesrvm.classloader.RVMArray;
> import org.jikesrvm.classloader.RVMClass;
> import org.jikesrvm.classloader.DynamicTypeCheck;
> @@ -165,9 +166,24 @@
>   }
>
>   /**
> +   * Perform aastore bytecode
> +   */
> +  @Entrypoint
> +  static void aastore(Object[] arrayRef, int index, Object value)  
> throws ArrayStoreException, ArrayIndexOutOfBoundsException {
> +    checkstore(arrayRef, value);
> +    int nelts = ObjectModel.getArrayLength(arrayRef);
> +    if (index < nelts) {
> +      Services.setArrayUninterruptible(arrayRef, index, value);
> +    } else {
> +      throw new ArrayIndexOutOfBoundsException(index);
> +    }
> +  }
> +
> +  /**
>    * Throw exception iff array assignment is illegal.
>    */
>   @Entrypoint
> +  @Inline
>   static void checkstore(Object array, Object arrayElement) throws  
> ArrayStoreException {
>     if (arrayElement == null) {
>       return; // null may be assigned to any type
>
> Modified: rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Statics.java
> ===================================================================
> --- rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Statics.java
> 2009-01-30 05:45:18 UTC (rev 15317)
> +++ rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Statics.java
> 2009-01-30 15:21:00 UTC (rev 15318)
> @@ -619,7 +619,7 @@
>     // VM. We suppress the warning as we know the error can't happen.
>
>     if (VM.runningVM &&  
> MemoryManagerConstants.NEEDS_PUTSTATIC_WRITE_BARRIER) {
> -      MemoryManager.putstaticWriteBarrier(offset, object, 0);
> +      MemoryManager.putstaticWriteBarrier(object, offset, 0);
>     } else {
>       setSlotContents(offset, Magic.objectAsAddress(object).toWord());
>     }
>
>
> This was sent by the SourceForge.net collaborative development  
> platform, the world's largest Open Source development site.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Jikesrvm-commits mailing list
> Jikesrvm-commits@...
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by David P Grove :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve Blackburn <Steve.Blackburn@...> wrote on 02/03/2009 06:36:32 PM:
>
> Can explain to us what you were trying to do with r15318?   The commit  
> message says "fix typos", I assume that was a mistake on your part  
> because the commit doesn't seem to have a lot to do with typos.  A  
> bunch of other things are going on in there which appear significant  
> and that affect others:

I'll leave it to Ian to explain the content of the commit, but I can confirm that he meant to do two commits, one to fix a few typos and the second to make the more interesting change.  We tried to fix the commit log message after the fact, but sf svn doesn't allow the necessary operation.


--dave

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core


Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Steve Blackburn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 04/02/2009, at 1:14 PM, David P Grove wrote:

I'll leave it to Ian to explain the content of the commit, but I can confirm that he meant to do two commits, one to fix a few typos and the second to make the more interesting change.  We tried to fix the commit log message after the fact, but sf svn doesn't allow the necessary operation.

No worries.  We've all made errors when committing.  This one would have gone under the radar except that I stumbled on it while tracking down the compress regression which seemed to "magically" disappear.   I guess for future reference, depending on the importance of the changes, the best thing to do would either be to simply reply to the list with that commit on the subject line (so that the reply comes up when searching on the commit id), or if it was significant, just back out and recommit as intended.

In this case I was just trying to get to the bottom of the compress regression and was a bit baffled when it narrowed down to this commit.   Even after reading through the commit I couldn't easily figure out why it "fixed" the compress regression.   It disturbs me when performance changes significantly for no clear reason, so having some clue as to what's going on here would be helpful, and I was speculating that that was what Ian may have been trying to address (which is why I sought clarification).

The issue with the barriers is that the changes amount to a change in an API which some people rely on heavily, so while it may make sense to change it, it really should be discussed first.

--Steve


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Ian Rogers (nabble) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/2/4 David P Grove <groved@...>:

> Steve Blackburn <Steve.Blackburn@...> wrote on 02/03/2009 06:36:32
> PM:
>>
>> Can explain to us what you were trying to do with r15318?   The commit
>> message says "fix typos", I assume that was a mistake on your part
>> because the commit doesn't seem to have a lot to do with typos.  A
>> bunch of other things are going on in there which appear significant
>> and that affect others:
>
> I'll leave it to Ian to explain the content of the commit, but I can confirm
> that he meant to do two commits, one to fix a few typos and the second to
> make the more interesting change.  We tried to fix the commit log message
> after the fact, but sf svn doesn't allow the necessary operation.
>
> --dave

Hi Steve,

the more interesting part of the commit were the changes to the
barrier code. This is a speedup primarily on Intel baseline code. I'll
take each barrier in turn:

aastore:
previously: the aastore would emit a call to checkstore and then a
call to the aastore barrier
now: a single aastore helper can inline both of these calls and
therefore we pay only 1 call. Another consequence of this is the
baseline compiler emits less code (which should make it faster).

putfield/putstatic:
previously: the arguments to the barrier routines in MemoryManager
were in a different order to the values on the JVM's operand stack, to
call the barrier the parameters were shuffled
now: the order of operands on the barrier routines now match, we no
longer need to shuffle parameters losing around 2 instructions (long 4
byte instructions) per baseline barrier call.

Regards,
Ian

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Ian Rogers (nabble) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/2/4 Steve Blackburn <Steve.Blackburn@...>:

> On 04/02/2009, at 1:14 PM, David P Grove wrote:
>
> I'll leave it to Ian to explain the content of the commit, but I can confirm
> that he meant to do two commits, one to fix a few typos and the second to
> make the more interesting change.  We tried to fix the commit log message
> after the fact, but sf svn doesn't allow the necessary operation.
>
> No worries.  We've all made errors when committing.  This one would have
> gone under the radar except that I stumbled on it while tracking down the
> compress regression which seemed to "magically" disappear.   I guess for
> future reference, depending on the importance of the changes, the best thing
> to do would either be to simply reply to the list with that commit on the
> subject line (so that the reply comes up when searching on the commit id),
> or if it was significant, just back out and recommit as intended.
> In this case I was just trying to get to the bottom of the compress
> regression and was a bit baffled when it narrowed down to this commit.

What is the compress regression?

> Even after reading through the commit I couldn't easily figure out why it
> "fixed" the compress regression.   It disturbs me when performance changes
> significantly for no clear reason, so having some clue as to what's going on
> here would be helpful, and I was speculating that that was what Ian may have
> been trying to address (which is why I sought clarification).

I've been trying to get the barrier code into shape but no one commit
should have moved performance back. I think the major issue is that
we've had a week or so of misleading performance results from
Habanero.

> The issue with the barriers is that the changes amount to a change in an API
> which some people rely on heavily, so while it may make sense to change it,
> it really should be discussed first.

I thought the MemoryManager API was analogous to RuntimeEntrypoints,
entry points for the compiler and not something that people should be
deliberately coding against.

Ian

> --Steve
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Jikesrvm-core mailing list
> Jikesrvm-core@...
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-core
>
>

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Steve Blackburn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Ian,

> This is a speedup primarily on Intel baseline code.

Have you had the opportunity to measure the performance effect of  
these changes?

I can see (below) what motivated you to pursue these changes, but my  
experience (and I have to tell you I have recently spent a *lot* of  
time on barrier performance) is that intuition is generally not a good  
guide for these issues.  The only way to know is to map out a few  
logical alternatives and then measure each of them thoroughly *and*  
measure them on different platforms.  We found that the performance of  
different barrier alternatives changed significantly depending on the  
platform (out of order / in order, IA32/PPC) and also on whether the  
builds were built with profiling or not, etc.

Changes to code like this (which is performance-critical and is  
important to other people) should be discussed first.   Whether the  
particular ideas are ultimately deemed good or not, it is important to  
discuss them with others (and evaluate them) beforehand.

Cheers,

--Steve

> aastore:
> previously: the aastore would emit a call to checkstore and then a
> call to the aastore barrier
> now: a single aastore helper can inline both of these calls and
> therefore we pay only 1 call. Another consequence of this is the
> baseline compiler emits less code (which should make it faster).
>
> putfield/putstatic:
> previously: the arguments to the barrier routines in MemoryManager
> were in a different order to the values on the JVM's operand stack, to
> call the barrier the parameters were shuffled
> now: the order of operands on the barrier routines now match, we no
> longer need to shuffle parameters losing around 2 instructions (long 4
> byte instructions) per baseline barrier call.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Steve Blackburn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 04/02/2009, at 7:27 PM, Ian Rogers wrote:
In this case I was just trying to get to the bottom of the compress
regression and was a bit baffled when it narrowed down to this commit.

What is the compress regression?

RVM-743

Even after reading through the commit I couldn't easily figure out why it
"fixed" the compress regression.   It disturbs me when performance changes
significantly for no clear reason, so having some clue as to what's going on
here would be helpful, and I was speculating that that was what Ian may have
been trying to address (which is why I sought clarification).

I've been trying to get the barrier code into shape but no one commit
should have moved performance back. I think the major issue is that
we've had a week or so of misleading performance results from
Habanero.

I think you've misunderstood.

a. There was a documented regression, RVM-743, which goes back to r15240 (a month ago), long before the habanero slowdown (which was at 15301, 5 days ago).  r15240 had an unintended effect on space efficiency.  You increased the heap size for compress by 1MB (r15255) but that did not fix the OOME's completely, which indicates that the bloat was at least 1MB.

b. The OOME's on compress stopped abruptly with r15318.  I started reading through r15318 to work out why it affected RVM-743 and I wondered whether you had been trying to fix RVM-743 in r15318.  I was puzzled, so I asked :-)  Apparently not.

The issue with the barriers is that the changes amount to a change in an API
which some people rely on heavily, so while it may make sense to change it,
it really should be discussed first.

I thought the MemoryManager API was analogous to RuntimeEntrypoints,
entry points for the compiler and not something that people should be
deliberately coding against.

Those of us who are working with barriers often find ourselves coding against the interface you've changed.  I can say this because it happens that I'm doing so right now.   It also happens that Daniel and Fil are doing completely unrelated work for new concurrent GC barriers that is also affected by this.

--Steve

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Ian Rogers (nabble) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/2/4 Steve Blackburn <Steve.Blackburn@...>:

> On 04/02/2009, at 7:27 PM, Ian Rogers wrote:
>
> In this case I was just trying to get to the bottom of the compress
>
> regression and was a bit baffled when it narrowed down to this commit.
>
> What is the compress regression?
>
> RVM-743
>
> Even after reading through the commit I couldn't easily figure out why it
>
> "fixed" the compress regression.   It disturbs me when performance changes
>
> significantly for no clear reason, so having some clue as to what's going on
>
> here would be helpful, and I was speculating that that was what Ian may have
>
> been trying to address (which is why I sought clarification).
>
> I've been trying to get the barrier code into shape but no one commit
> should have moved performance back. I think the major issue is that
> we've had a week or so of misleading performance results from
> Habanero.
>
> I think you've misunderstood.
> a. There was a documented regression, RVM-743, which goes back to r15240 (a
> month ago), long before the habanero slowdown (which was at 15301, 5 days
> ago).  r15240 had an unintended effect on space efficiency.  You increased
> the heap size for compress by 1MB (r15255) but that did not fix the OOME's
> completely, which indicates that the bloat was at least 1MB.

So this doesn't make sense. r15240 changed an encoding of:

MOV REG, [ESP+0]

to

MOV REG, [ESP]

4 bytes as apposed to 3 bytes. It also tried to reduce the code for
accessing the stack so that rather than:

if (VM.BuildFor32Addr)
 // do 32bit load from stack
else
 // do 64bit load from stack

we did a single call to a helper (that then contained the
if-then-else). Whilst their would have been code associated with the
helper routine it wouldn't equate to 1MB.

> b. The OOME's on compress stopped abruptly with r15318.  I started reading
> through r15318 to work out why it affected RVM-743 and I wondered whether
> you had been trying to fix RVM-743 in r15318.  I was puzzled, so I asked :-)
>  Apparently not.

For the tight GCs we're sporadically getting OOMEs on more benchmarks
than just compress. The problem is that rather than throw an OOME to
the application we should kill the compilation thread. Perhaps there
should be a call into the VM to ask the VM release any memory it has,
and then retry the application allocation before we throw the OOME. In
the current thread model just using the Thread.stop logic would be
enough to kill the compiler threads.

Unfortunately I can't repeat RVM-743.

> The issue with the barriers is that the changes amount to a change in an API
>
> which some people rely on heavily, so while it may make sense to change it,
>
> it really should be discussed first.
>
> I thought the MemoryManager API was analogous to RuntimeEntrypoints,
> entry points for the compiler and not something that people should be
> deliberately coding against.
>
> Those of us who are working with barriers often find ourselves coding
> against the interface you've changed.  I can say this because it happens
> that I'm doing so right now.   It also happens that Daniel and Fil are doing
> completely unrelated work for new concurrent GC barriers that is also
> affected by this.
> --Steve

I don't understand, why are people coding against an entry point for
the compiler? The code this calls I can see. I have got significant
speed up from code related to the changes to the Barrier code, but I
am not releasing it yet (and it's specifically for work using BaseBase
- although I've seen speed ups in the region of 3% for opt builds). I
wanted to commit back changes to the API as the current API is
inconsistent (in the case of aastore - the use of helper routines is
to avoid problems associated with not inlining in the baseline
compiler, calling 2 helpers is unnecessary and doubling the problem of
not inlining) and sub-optimal (in the case of putfield/putstatic -
every barrier was causing the stack to be reshuffled as parameters to
the entry point method didn't match the operand stack - this looked
like cruft from the initial Intel port, on PPC the values are passed
through registers so the ordering is arbitrary, on Intel it is more
expensive as we pass values through the stack and registers).

Currently (I think this is a long standing issue) we are compiling
barriers with the opt compiler in a sub-optimal manner, hence RVM-755.
I propose fixing the compiler to handle this and Dave proposes an
invasive change to MMTk. There is an associated patch to fix this,
r15297, in the quarantine branch that it'd be nice to move to the
trunk. The performance advantage will be minimal, but register
pressure when we generate barriers will be reduced, as will the opt
compiler overhead for a barrier.

Ian

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Steve Blackburn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ian,

On 04/02/2009, at 11:18 PM, Ian Rogers wrote:
>
> So this doesn't make sense. r15240 changed an encoding of:

[...snip...]

> we did a single call to a helper (that then contained the
> if-then-else). Whilst their would have been code associated with the
> helper routine it wouldn't equate to 1MB.

Sure.  The point was that something in that commit caused compress to  
reliably OOME whereas it had not before.   Increasing the heap by 1MB  
did not resolve it.   This says to me that something about that commit  
caused at least a 1MB increase in the memory pressure for compress.    
I have no idea why.  My POV is that if we suddenly get a regression,  
we should try to understand why, hence RVM-743.

>> b. The OOME's on compress stopped abruptly with r15318.  I started  
>> reading
>> through r15318 to work out why it affected RVM-743 and I wondered  
>> whether
>> you had been trying to fix RVM-743 in r15318.  I was puzzled, so I  
>> asked :-)
>> Apparently not.
>
> For the tight GCs we're sporadically getting OOMEs on more benchmarks
> than just compress.

Sure.  However, prior to the above commit we had not seen any on  
compress.

> The problem is that rather than throw an OOME to
> the application we should kill the compilation thread. Perhaps there
> should be a call into the VM to ask the VM release any memory it has,
> and then retry the application allocation before we throw the OOME. In
> the current thread model just using the Thread.stop logic would be
> enough to kill the compiler threads.

That's fine.  I agree we need to handle the OOME's better.

However, it is orthogonal to the point I'm making.  My point is that  
something in that commit increased the memory pressure on compress by  
at least 1MB, and that in and of itself should be a concern until we  
understand it.

> Unfortunately I can't repeat RVM-743.

Not sure what you mean.  You saw the problem and you increased the  
heap size.  Until you increased the heap size compress-GC3 was failing  
with an OOME 100% of the time (I believe it was 100%).

> I don't understand, why are people coding against an entry point for
> the compiler? The code this calls I can see.

Because they are extending the semantics.   In my case this is for  
arraylets.  For Daniel and Fil for more general use barriers.

> I have got significant
> speed up from code related to the changes to the Barrier code, but I
> am not releasing it yet (and it's specifically for work using BaseBase
> - although I've seen speed ups in the region of 3% for opt builds).

Wait.  My question was: did you observe any performance gain for the  
changes you have already committed?

If not, then you really need to clearly motivate the change properly  
before committing.

> I propose fixing the compiler to handle this and Dave proposes an
> invasive change to MMTk.

Dave?  What change are you proposing?

--Steve



------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by Ian Rogers (nabble) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/2/4 Steve Blackburn <Steve.Blackburn@...>:

> Hi Ian,
>
> On 04/02/2009, at 11:18 PM, Ian Rogers wrote:
>>
>> So this doesn't make sense. r15240 changed an encoding of:
>
> [...snip...]
>
>> we did a single call to a helper (that then contained the
>> if-then-else). Whilst their would have been code associated with the
>> helper routine it wouldn't equate to 1MB.
>
> Sure.  The point was that something in that commit caused compress to
> reliably OOME whereas it had not before.   Increasing the heap by 1MB
> did not resolve it.   This says to me that something about that commit
> caused at least a 1MB increase in the memory pressure for compress.
> I have no idea why.  My POV is that if we suddenly get a regression,
> we should try to understand why, hence RVM-743.
>
>>> b. The OOME's on compress stopped abruptly with r15318.  I started
>>> reading
>>> through r15318 to work out why it affected RVM-743 and I wondered
>>> whether
>>> you had been trying to fix RVM-743 in r15318.  I was puzzled, so I
>>> asked :-)
>>> Apparently not.
>>
>> For the tight GCs we're sporadically getting OOMEs on more benchmarks
>> than just compress.
>
> Sure.  However, prior to the above commit we had not seen any on
> compress.
>
>> The problem is that rather than throw an OOME to
>> the application we should kill the compilation thread. Perhaps there
>> should be a call into the VM to ask the VM release any memory it has,
>> and then retry the application allocation before we throw the OOME. In
>> the current thread model just using the Thread.stop logic would be
>> enough to kill the compiler threads.
>
> That's fine.  I agree we need to handle the OOME's better.
>
> However, it is orthogonal to the point I'm making.  My point is that
> something in that commit increased the memory pressure on compress by
> at least 1MB, and that in and of itself should be a concern until we
> understand it.
>
>> Unfortunately I can't repeat RVM-743.
>
> Not sure what you mean.  You saw the problem and you increased the
> heap size.  Until you increased the heap size compress-GC3 was failing
> with an OOME 100% of the time (I believe it was 100%).

I mean that if I check out the RVM and repeatedly run compress with
the smaller heap size I don't get OOMEs. The problem is something to
do with the balance of habanero, the RVM and the adaptive optimization
system.

>> I don't understand, why are people coding against an entry point for
>> the compiler? The code this calls I can see.
>
> Because they are extending the semantics.   In my case this is for
> arraylets.  For Daniel and Fil for more general use barriers.

Is there a JIRA for arraylets? In any case the code in question is now
easier to maintain for arraylets as you don't need to do any hand
coding (instead this is done in the helper routine) that is making use
of existing magic code (which unfortunately needs porting for
arraylets - but I couldn't save you that one).

>> I have got significant
>> speed up from code related to the changes to the Barrier code, but I
>> am not releasing it yet (and it's specifically for work using BaseBase
>> - although I've seen speed ups in the region of 3% for opt builds).
>
> Wait.  My question was: did you observe any performance gain for the
> changes you have already committed?
>
> If not, then you really need to clearly motivate the change properly
> before committing.

I think the performance reports are speaking for themselves. In
general generating less code and smaller code is a good thing.

>> I propose fixing the compiler to handle this and Dave proposes an
>> invasive change to MMTk.
>
> Dave?  What change are you proposing?
>
> --Steve

It's probably worth following this up through JIRA:
http://jira.codehaus.org/browse/RVM-755

Ian

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core

Re: [rvm-core] [rvm-commits] SF.net SVN: jikesrvm:[15318] rvmroot/trunk

by David P Grove :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve Blackburn <Steve.Blackburn@...> wrote on 02/04/2009 07:47:21 AM:
>
> > I propose fixing the compiler to handle this and Dave proposes an
> > invasive change to MMTk.
>
> Dave?  What change are you proposing?

I'm objecting to letting the opt compiler copy propagate physical registers as I think it has some potential for introducing bugs in code that is using Magic to manipulate the processor register.  The problem is that MMTk gets hold of the PR register through a series of function calls.  By the time we inline all of those, we are left with an assignment of PR to a temporary variable (the return value from the inlined function).  Ian is right that if we allow copy propagation to be applied to this IR, then we will get better code.

My reluctance to do this optimization is that the opt compiler will also copy propagate in cases where the programmer has explicitly assigned PR to a local variable because they want to hold on to a particular value in that register and use it later.  

It is awkward for the opt compiler to be able to distinguish between code where the programmer is explicitly putting PR in a local variable vs. where it is only in a local variable as a result of inlining.

The invasive change is that I'd prefer to force the Magic programmer to invoke the magic to get the PR everywhere they want it in the inline sequence instead of wrapping layers of function calls.

To be clear, I'm not saying this change is a good idea (or one that we should do), but having been burned badly in the past by the opt compiler trying to be to smart and optimize code sequences that arise from VM magic I would like us to not enable any such optimization unless we really understand and document what implications it has for the correct and bug free use of magic.

I'm also putting this mail in the tracker...

--dave

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Jikesrvm-core mailing list
Jikesrvm-core@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-core