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     * artificial instruction, load a PC on the stack.
018     */
019    public class LoadRetAddrConst extends PseudoBytecode {
020      private static final int bsize = 6;
021      private int bcindex;
022    
023      public LoadRetAddrConst(int off) {
024        this.bcindex = off;
025      }
026    
027      @Override
028      public byte[] getBytes() {
029        byte[] codes = initBytes(bsize, PSEUDO_LoadRetAddrConst);
030        int2bytes(codes, 2, bcindex);
031        return codes;
032      }
033    
034      @Override
035      public int getSize() {
036        return bsize;
037      }
038    
039      public int getOffset() {
040        return bcindex;
041      }
042    
043      @Override
044      public int stackChanges() {
045        return +1;
046      }
047    
048      public void patch(int off) {
049        this.bcindex = off;
050      }
051    
052      @Override
053      public String toString() {
054        return "LoadRetAddrConst " + bcindex;
055      }
056    }