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: Sat Dec 30 20:50:48 CET 2006
    Subject: [cvs-checkins] MODIFIED: jop ...
    Top
    Date: 00/06/12 30:20:50

    Modified: jop/java/target/src/common/com/jopdesign/sys JVM.java
    Log:
    instanceof, checkcast


    Revision Changes Path
    1.20 jop/java/target/src/common/com/jopdesign/sys/JVM.java

    http://www.opencores.org/cvsweb.shtml/jop/java/target/src/common/com/jopdesign/sys/JVM.java.diff?r1=1.19&r2=1.20

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

    Index: JVM.java
    ===================================================================
    RCS file: /cvsroot/martin/jop/java/target/src/common/com/jopdesign/sys/JVM.java,v
    retrieving revision 1.19
    retrieving revision 1.20
    diff -u -b -r1.19 -r1.20
    --- JVM.java 28 Dec 2006 20:37:41 -0000 1.19
    +++ JVM.java 30 Dec 2006 19:50:48 -0000 1.20
    @@ -608,15 +608,50 @@
    JVMHelp.wr("catch not implemented!");
    return t;
    }
    - // private static void f_checkcast() { JVMHelp.noim();}
    +
    private static int f_checkcast(int objref, int cons) {
    -// TODO: implement it
    -//JVMHelp.wr("checkcast");
    -// ECM needs it...
    -//JVMHelp.noim();
    +
    + if (objref==0) {
    return objref;
    }
    - private static void f_instanceof() { JVMHelp.noim();}
    +
    + int p = Native.rdMem(objref+1); // handle indirection
    + p -= 4; // start of class info
    +
    + for (;;) {
    + if (p==cons) {
    + return 1;
    + } else {
    + p = Native.rdMem(p+2);
    + if (p==0) break; // we are at Object
    + }
    + }
    +
    + throw new ClassCastException();
    +
    +// return objref;
    + }
    + private static int f_instanceof(int objref, int cons) {
    +
    + // TODO: check if it works for interfaces
    + // TODO: simplify the code
    + if (objref==0) {
    + return 0;
    + }
    + int p = Native.rdMem(objref+1); // handle indirection
    + p -= 4; // start of class info
    +
    + for (;;) {
    + if (p==cons) {
    + return 1;
    + } else {
    + p = Native.rdMem(p+2);
    + if (p==0) break; // we are at Object
    + }
    + }
    +
    + return 0;
    + }


    private static int enterCnt;



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