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_IntStore : {@code istore_<?>}, {@code istore}
018     * <pre>
019     *      Local number            Instruction
020     *      [0, 3]                  istore_&lt;i&gt;
021     *      other                   istore, wide istore
022     * </pre>
023     */
024    public class IntStore extends PseudoBytecode {
025      private int bsize;
026      private byte[] codes;
027      private int lnum;
028    
029      public IntStore(int local) {
030        this.lnum = local;
031        if (local <= 255) {
032          bsize = 2;
033          codes = makeOUcode(JBC_istore, local);
034        } else {
035          bsize = 4;
036          codes = makeWOUUcode(JBC_istore, local);
037        }
038      }
039    
040      @Override
041      public byte[] getBytes() {
042        return codes;
043      }
044    
045      @Override
046      public int getSize() {
047        return bsize;
048      }
049    
050      @Override
051      public int stackChanges() {
052        return -1;
053      }
054    
055      @Override
056      public String toString() {
057        return "istore " + lnum;
058      }
059    }