view graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/ObjectStoreTest.java @ 10769:395d34c10e26

HSAIL backend changes Contributed-by: Tom Deneau <tom.deneau@amd.com> * stackslot mapping was incorrect when combinations of 32-bit and 64-bit stores were generated. StackSlot alignment in HSAILTargetDescription set to 8. * compressedOops support in various heap size configurations (with or without either of shift or heap base). So we don't need XX:-UseCompressedOops anymore. * some support for unsigned shifts, long shifts, logical ops for long datatype. * a new GraalOption, InlineEverything. Some HSAIL targets are not able to handle HSAIL function calls yet, plus we are still working on emitting HSAIL function calls in the compiler. * hack for emitForeignCall special cases of createOutOfBoundsException or createNullPointerException. (We just emit a comment. Real exception handling still pending). These nodes came about when we more aggressively inlined, although this has not been explained yet. * support HSAILAddressValues as operands for arithmetic ops. Use HSAIL lda instruction to get address into a register. Used in particular for USHR for card-marking. * Added some new junit tests. (some ported from their lambda versions) * StaticNBodyCallTest which would fail with default inlining (since we don't yet generate HSAIL calls). It uses junit.assumeTrue and tests whether InlineEverything is set. It (and also some lambda-based junit tests not part of this webrev) do pass nicely when InlineEverything is set true. * tests for storing an object, which test being able to handle the card-marking logic, as well as the encoding and decoding of a compressed oop. * some 2D matrix tests that showed a problem before the stackslot change above. (have a mixture of 32-bit and 64-bit stackslot spills)
author Doug Simon <doug.simon@oracle.com>
date Mon, 15 Jul 2013 18:22:25 +0200
parents
children 64dcb92ee75a
line wrap: on
line source

/*
 * Copyright (c) 2009, 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.compiler.hsail.test;

import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester;
import org.junit.Test;

/**
 * Tests the storing of objects into an array.
 */
public class ObjectStoreTest extends GraalKernelTester {

    static final int NUM = 20;

    @Result public Integer[] outIntegerArray = new Integer[NUM];
    public Integer[] inIntegerArray = new Integer[NUM];

    void setupArrays() {
        for (int i = 0; i < NUM; i++) {
            inIntegerArray[i] = new Integer(i);
            outIntegerArray[i] = null;
        }
    }

    public void run(int gid) {
        outIntegerArray[gid] = inIntegerArray[gid];
    }

    @Override
    public void runTest() {
        setupArrays();

        dispatchMethodKernel(NUM);
    }

    @Test
    public void test() {
        testGeneratedHsail();
    }

}