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: Fri Jan 18 23:45:10 CET 2008
    Subject: [cvs-checkins] MODIFIED: jop ...
    Top
    Date: 00/08/01 18:23:45

    Modified: jop/java/target/src/common/com/jopdesign/sys GC.java
    Log:
    - Changed some final constants to be also public.

    - Added one method to check if a handle is valid or not.




    Revision Changes Path
    1.51 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.50&r2=1.51

    (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.50
    retrieving revision 1.51
    diff -u -b -r1.50 -r1.51
    --- GC.java 18 Jan 2008 11:08:46 -0000 1.50
    +++ GC.java 18 Jan 2008 22:45:10 -0000 1.51
    @@ -57,9 +57,9 @@
    * !!! be carefule when changing the handle structure, it's
    * used in System.arraycopy() and probably in jvm.asm!!!
    */
    - static final int OFF_PTR = 0;
    - static final int OFF_MTAB_ALEN = 1;
    - static final int OFF_SIZE = 2;
    + public static final int OFF_PTR = 0;
    + public static final int OFF_MTAB_ALEN = 1;
    + public static final int OFF_SIZE = 2;
    public static final int OFF_TYPE = 3;

    // size != array length (think about long/double)
    @@ -68,8 +68,8 @@
    // our addition:
    // 1 reference
    // 0 a plain object
    - static final int IS_OBJ = 0;
    - static final int IS_REFARR = 1;
    + public static final int IS_OBJ = 0;
    + public static final int IS_REFARR = 1;

    /**
    * Free and Use list.
    @@ -630,6 +630,56 @@
    return semi_size*4;
    }

    + /**
    + * Check if a given value is a valid handle.
    + *
    + * This method traverse the list of handles (in use) to check
    + * if the handle provided belong to the list.
    + *
    + * It does *not* check the free handle list.
    + *
    + * One detail: the result may state that a handle to a
    + * (still unknown garbage) object is valid, in case
    + * the object is not reachable but still present
    + * on the use list.
    + * This happens in case the object becomes unreachable
    + * during execution, but GC has not reclaimed it yet.
    + * Anyway, it's still a valid object handle.
    + *
    + * @param handle the value to be checked.
    + * @return
    + */
    + public static final boolean isValidObjectHandle(int handle)
    + {
    + boolean isValid;
    + int handlePointer;
    +
    + // assume it's not valid and try to show otherwise
    + isValid = false;
    +
    + // synchronize on the GC lock
    + synchronized (mutex) {
    + // start on the first element of the list
    + handlePointer = useList;
    +
    + // traverse the list until the element is found or the list is over
    + while(handlePointer != 0)
    + {
    + if(handle == handlePointer)
    + {
    + // found it! hence, it's a valid handle. Stop the search.
    + isValid = true;
    + break;
    + }
    +
    + // not found yet. Let's go to the next element and try again.
    + handlePointer = Native.rdMem(handlePointer+OFF_NEXT);
    + }
    + }
    +
    + return isValid;
    + } + /************************************************************************************************/

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