LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cvs-checkins > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: cvs at opencores.org<cvs@o...>
    Date: Wed Jan 30 20:33:44 CET 2008
    Subject: [cvs-checkins] MODIFIED: jop ...
    Top
    Date: 00/08/01 30:20:33

    Modified: jop/java/target/src/common/com/jopdesign/sys GC.java
    Log:
    - Created a new method to provide support for a write barrier.



    Method created:

    690: public static final void writeBarrier(int handle, int index)




    Revision Changes Path
    1.52 jop/java/target/src/common/com/jopdesign/sys/GC.java

    http://www.opencores.org/cvsweb.shtml/jop/java/target/src/common/com/jopdesign/sys/GC.java.diff?r1=1.51&r2=1.52

    (In the diff below, changes in quantity of whitespace are not shown.)

    Index: GC.java
    ===================================================================
    RCS file: /cvsroot/paulo/jop/java/target/src/common/com/jopdesign/sys/GC.java,v
    retrieving revision 1.51
    retrieving revision 1.52
    diff -u -b -r1.51 -r1.52
    --- GC.java 18 Jan 2008 22:45:10 -0000 1.51
    +++ GC.java 30 Jan 2008 19:33:44 -0000 1.52
    @@ -680,6 +680,90 @@
    return isValid;
    }

    + /**
    + * Write barrier for an object field. May be used with regular objects
    + * and reference arrays.
    + *
    + * @param handle the object handle
    + * @param index the field index
    + */
    + public static final void writeBarrier(int handle, int index)
    + {
    + boolean shouldExecuteBarrier = false;
    + int gcInfo;
    +
    +// log("WriteBarrier: snapshot-at-beginning.");
    +
    + if (handle == 0)
    + {
    + throw new NullPointerException();
    + }
    +
    + synchronized (GC.mutex)
    + {
    + // ignore objects with size zero (is this correct?)
    + if(Native.rdMem(handle) == 0)
    + {
    +// log("ignore objects with size zero");
    + return;
    + }
    +
    + // get information on the object type.
    + int type = Native.rdMem(handle + GC.OFF_TYPE);
    +
    + // if it's an object or reference array, execute the barrier
    + if(type == GC.IS_REFARR)
    + {
    +// log("Reference array.");
    + shouldExecuteBarrier = true;
    + }
    +
    + if(type == GC.IS_OBJ)
    + {
    +// log("Regular object.");
    + // get the object GC info from the class structure.
    + gcInfo = Native.rdMem(handle + GC.OFF_MTAB_ALEN) + Const.MTAB2GC_INFO;
    +
    + // if the correct bit is set for the field, it may hold a reference.
    + // then, execute the write barrier.
    + if((gcInfo & (0x01 << index)) != 0)
    + {
    +// log("Field can hold a reference. Execute barrier!");
    + shouldExecuteBarrier = true;
    + }
    + }
    +
    + // execute the write barrier, if necessary.
    + if(shouldExecuteBarrier)
    + {
    + // handle indirection
    + handle = Native.rdMem(handle);
    + // snapshot-at-beginning barrier
    + int oldVal = Native.rdMem(handle+index);
    +
    +// log("Old val: ", oldVal);
    +// if(oldVal != 0)
    +// {
    +// log("Current space: ", Native.rdMem(oldVal+GC.OFF_SPACE));
    +// }
    +// else
    +// {
    +// log("Current space: NULL object."); +// } +// log("toSpace: ", GC.toSpace); + + if (oldVal!=0 && Native.rdMem(oldVal+GC.OFF_SPACE)!=GC.toSpace) { +// log("Executing write barrier for old handle: ", handle); + GC.push(oldVal); + } + } +// else +// { +// log("Should not execute the barrier."); +// } + } + } + /************************************************************************************************/

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.