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_fstore;
016
017/**
018 * BC_FloatStore: {@code fstore}, {@code fstore_<i>}
019 */
020public class FloatStore extends PseudoBytecode {
021  private int bsize;
022  private byte[] codes;
023  private final int lnum;
024
025  public FloatStore(int local) {
026    this.lnum = local;
027    if (local <= 255) {
028      bsize = 2;
029      codes = makeOUcode(JBC_fstore, local);
030    } else {
031      bsize = 4;
032      codes = makeWOUUcode(JBC_fstore, 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 "FloatStore " + lnum;
054  }
055}