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 */ 013package org.jikesrvm.osr.bytecodes; 014 015import static org.jikesrvm.classloader.BytecodeConstants.JBC_astore; 016 017/** 018 * BC_RefStore: {@code astore}, {@code astore_<i>} 019 */ 020public class RefStore extends PseudoBytecode { 021 private int bsize; 022 private byte[] codes; 023 private final int lnum; 024 025 public RefStore(int local) { 026 this.lnum = local; 027 028 if (local <= 255) { 029 bsize = 2; 030 codes = makeOUcode(JBC_astore, local); 031 } else { 032 bsize = 4; 033 codes = makeWOUUcode(JBC_astore, local); 034 } 035 } 036 037 @Override 038 public byte[] getBytes() { 039 return codes; 040 } 041 042 @Override 043 public int getSize() { 044 return bsize; 045 } 046 047 @Override 048 public int stackChanges() { 049 return -1; 050 } 051 052 @Override 053 public String toString() { 054 return "astore " + this.lnum; 055 } 056}