161277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver/*
261277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * Copyright 2013, Google Inc.
361277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * All rights reserved.
461277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver *
561277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * Redistribution and use in source and binary forms, with or without
661277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * modification, are permitted provided that the following conditions are
761277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * met:
861277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver *
961277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver *     * Redistributions of source code must retain the above copyright
1061277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * notice, this list of conditions and the following disclaimer.
1161277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver *     * Redistributions in binary form must reproduce the above
1261277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * copyright notice, this list of conditions and the following disclaimer
1361277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * in the documentation and/or other materials provided with the
1461277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * distribution.
1561277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver *     * Neither the name of Google Inc. nor the names of its
1661277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * contributors may be used to endorse or promote products derived from
1761277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * this software without specific prior written permission.
1861277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver *
1961277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2061277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2161277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2261277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2361277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2461277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2561277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2661277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2761277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2861277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2961277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3061277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver */
3161277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
3261277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruverpackage org.jf.dexlib2.dexbacked.instruction;
3361277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
3461277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruverimport org.jf.dexlib2.Opcode;
3561277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruverimport org.jf.dexlib2.dexbacked.DexBackedDexFile;
3661277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruverimport org.jf.dexlib2.iface.instruction.formats.Instruction3rms;
3761277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
3861277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruverimport javax.annotation.Nonnull;
3961277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
4061277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruverpublic class DexBackedInstruction3rms extends DexBackedInstruction implements Instruction3rms {
4161277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    public DexBackedInstruction3rms(@Nonnull DexBackedDexFile dexFile,
4261277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver                                    @Nonnull Opcode opcode,
4361277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver                                    int instructionStart) {
4461277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver        super(dexFile, opcode, instructionStart);
4561277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    }
4661277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
4761277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    @Override public int getRegisterCount() {
4861277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver        return dexFile.readUbyte(instructionStart + 1);
4961277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    }
5061277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
5161277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    @Override
5261277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    public int getStartRegister() {
5361277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver        return dexFile.readUshort(instructionStart + 4);
5461277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    }
5561277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver
5661277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    @Override
5761277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    public int getVtableIndex() {
5861277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver        return dexFile.readUshort(instructionStart + 2);
5961277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver    }
6061277b50b39015efe38c9cc5c79b31f6dd35c1f6Ben Gruver}
61