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
  • Find Resources
  • 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: Sat Aug 19 20:40:17 CEST 2006
    Subject: [cvs-checkins] MODIFIED: jop ...
    Top
    Date: 00/06/08 19:20:40

    Modified: jop/java/target/src/jdk/java/lang System.java
    Log:
    added arraycopy()


    Revision Changes Path
    1.5 jop/java/target/src/jdk/java/lang/System.java

    http://www.opencores.org/cvsweb.shtml/jop/java/target/src/jdk/java/lang/System.java.diff?r1=1.4&r2=1.5

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

    Index: System.java
    ===================================================================
    RCS file: /cvsroot/martin/jop/java/target/src/jdk/java/lang/System.java,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -b -r1.4 -r1.5
    --- System.java 25 Jun 2005 19:28:00 -0000 1.4
    +++ System.java 19 Aug 2006 18:40:17 -0000 1.5
    @@ -31,4 +31,60 @@
    public static void exit(int i) {
    Startup.exit();
    }
    +
    + public static void arraycopy(Object src, int srcOffset, Object dst,
    + int dstOffset, int length) {
    +
    + long srcEnd, dstEnd;
    +
    + if ((src == null) || (dst == null)) {
    + throw new NullPointerException();
    + }
    +
    + srcEnd = length + srcOffset;
    + dstEnd = length + dstOffset;
    +
    + int srcHandle = Native.toInt(src);
    + int dstHandle = Native.toInt(dst);
    +
    + // the type field from the handle - see GC.java
    + int src_type = Native.rdMem(srcHandle+3);
    + int dst_type = Native.rdMem(dstHandle+3);
    +
    + // 0 means it's a plain object
    + if (src_type==0 || dst_type==0) {
    + throw new ArrayStoreException();
    + }
    + // should be the same, right?
    + if (src_type!=dst_type) {
    + throw new ArrayStoreException();
    + }
    + // TODO: should we check the object types?
    +
    + // TODO: synchronized with GC
    + synchronized (GC.getMutex()) {
    + int srcPtr = Native.rdMem(srcHandle);
    + int dstPtr = Native.rdMem(dstHandle);
    +
    + int srcLen = Native.rdMem(srcPtr-1);
    + int dstLen = Native.rdMem(dstPtr-1);
    + if ((srcOffset < 0) || (dstOffset < 0) || (length < 0)
    + || (srcEnd > srcLen) || (dstEnd > dstLen))
    + throw new IndexOutOfBoundsException();
    +
    + if (src==dst && srcOffset<dstOffset) {
    + for (int i=length-1; i>=0; --i) {
    + Native.wrMem(Native.rdMem(srcPtr + srcOffset + i), dstPtr
    + + dstOffset + i);
    + }
    + } else {
    + for (int i = 0; i < length; i++) {
    + Native.wrMem(Native.rdMem(srcPtr + srcOffset + i), dstPtr
    + + dstOffset + i);
    + }
    + }
    + }
    + }
    +
    +
    }



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