001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.osr.bytecodes;
014    
015    
016    /**
017     * BC_RefStore: {@code astore}, {@code astore_<i>}
018     */
019    public class RefStore extends PseudoBytecode {
020      private int bsize;
021      private byte[] codes;
022      private int lnum;
023    
024      public RefStore(int local) {
025        this.lnum = local;
026    
027        if (local <= 255) {
028          bsize = 2;
029          codes = makeOUcode(JBC_astore, local);
030        } else {
031          bsize = 4;
032          codes = makeWOUUcode(JBC_astore, local);
033        }
034      }
035    
036      @Override
037      public byte[] getBytes() {
038        return codes;
039      }
040    
041      @Override
042      public int getSize() {
043        return bsize;
044      }
045    
046      @Override
047      public int stackChanges() {
048        return -1;
049      }
050    
051      @Override
052      public String toString() {
053        return "astore " + this.lnum;
054      }
055    }