view graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/AMD64VerifyOopStubCallOp.java @ 5733:141b15521a39

use annotated fields for operands of LIR instructions
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 29 Jun 2012 18:33:48 -0700
parents a4765b93eb96
children
line wrap: on
line source

/*
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package com.oracle.graal.hotspot.target;

import static com.oracle.graal.api.code.ValueUtil.*;

import com.oracle.graal.api.meta.*;
import com.oracle.graal.hotspot.*;
import com.oracle.graal.lir.*;
import com.oracle.graal.lir.LIRInstruction.Opcode;
import com.oracle.graal.lir.amd64.*;
import com.oracle.graal.lir.asm.*;
import com.oracle.max.asm.target.amd64.*;

/**
 * A call to HotSpot's object pointer verification stub.
 */
@Opcode("VERIFY_OOP")
public class AMD64VerifyOopStubCallOp extends AMD64LIRInstruction {
    @Use protected Value object;
    @State protected LIRFrameState state;

    public AMD64VerifyOopStubCallOp(Value object, LIRFrameState state) {
        this.object = object;
        this.state = state;
    }

    @Override
    public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
        // r13: (in) object
        if (asRegister(object) != AMD64.r13) {
            masm.push(AMD64.r13);
            masm.movq(AMD64.r13, asRegister(object));
        }
        AMD64Call.directCall(tasm, masm, HotSpotGraalRuntime.getInstance().getConfig().verifyOopStub, state);
        if (asRegister(object) != AMD64.r13) {
            masm.pop(AMD64.r13);
        }
    }
}