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_dstore;
016
017/**
018 * BC_DoubleStore: {@code dstore}, {@code dstore_<i>}
019 */
020
021public class DoubleStore extends PseudoBytecode {
022  private int bsize;
023  private byte[] codes;
024  private final int lnum;
025
026  public DoubleStore(int local) {
027    this.lnum = local;
028    if (local <= 255) {
029      bsize = 2;
030      codes = makeOUcode(JBC_dstore, local);
031    } else {
032      bsize = 4;
033      codes = makeWOUUcode(JBC_dstore, 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 -2;
050  }
051
052  @Override
053  public String toString() {
054    return "dstore " + lnum;
055  }
056}