annotate graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCSafepointOp.java @ 10871:c3b09d69dfde

SPARC: fixes and more implementation; can now allocate objects
author twisti
date Wed, 24 Jul 2013 17:57:52 -0700
parents 7a8d6ba83a04
children 19a7856e3ab9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
1 /*
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
4 *
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
8 *
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
13 * accompanied this code).
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
14 *
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
18 *
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
21 * questions.
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
22 */
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
23 package com.oracle.graal.hotspot.sparc;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
24
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
25 import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
26 import static com.oracle.graal.sparc.SPARC.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
27 import static com.oracle.graal.phases.GraalOptions.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
28 import sun.misc.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
29
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
30 import com.oracle.graal.api.code.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
31 import com.oracle.graal.api.meta.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
32 import com.oracle.graal.asm.sparc.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
33 import com.oracle.graal.hotspot.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
34 import com.oracle.graal.lir.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
35 import com.oracle.graal.lir.sparc.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
36 import com.oracle.graal.lir.asm.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
37 import com.oracle.graal.nodes.spi.*;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
38
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
39 /**
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
40 * Emits a safepoint poll.
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
41 */
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
42 @Opcode("SAFEPOINT")
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
43 public class SPARCSafepointOp extends SPARCLIRInstruction {
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
44
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
45 private static final Unsafe unsafe = Unsafe.getUnsafe();
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
46
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
47 @State protected LIRFrameState state;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
48 @Temp({OperandFlag.REG}) private AllocatableValue temp;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
49
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
50 private final HotSpotVMConfig config;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
51
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
52 public SPARCSafepointOp(LIRFrameState state, HotSpotVMConfig config, LIRGeneratorTool tool) {
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
53 this.state = state;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
54 this.config = config;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
55 temp = tool.newVariable(tool.target().wordKind);
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
56 }
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
57
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
58 @Override
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
59 public void emitCode(TargetMethodAssembler tasm, SPARCMacroAssembler masm) {
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
60 final int pos = masm.codeBuffer.position();
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
61 final int offset = SafepointPollOffset.getValue() % unsafe.pageSize();
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
62 Register scratch = ((RegisterValue) temp).getRegister();
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10694
diff changeset
63 new Setx(config.safepointPollingAddress + offset, scratch).emit(masm);
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
64 tasm.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
65 new Ldx(new SPARCAddress(scratch, 0), g0).emit(masm);
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
66 }
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
diff changeset
67 }