view graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java @ 7037:dd81042f4eb1

added unit tests for ResolvedJavaType replaced some CompilerToVM methods used by HotSpotResolvedJavaType with pure Java code
author Doug Simon <doug.simon@oracle.com>
date Tue, 27 Nov 2012 11:21:48 +0100
parents 41938af2b3d8
children 1baf7f1e3f23
line wrap: on
line source

/*
 * Copyright (c) 2011, 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;


/**
 * Used to communicate configuration details, runtime offsets, etc. to graal upon compileMethod.
 */
public final class HotSpotVMConfig extends CompilerObject {

    private static final long serialVersionUID = -4744897993263044184L;

    HotSpotVMConfig() {
    }

    // os information, register layout, code generation, ...
    public boolean windowsOs;
    public int codeEntryAlignment;
    public boolean verifyOops;
    public boolean useFastLocking;
    public boolean useFastNewObjectArray;
    public boolean useFastNewTypeArray;
    public boolean useTLAB;
    public boolean useBiasedLocking;

    // offsets, ...
    public int vmPageSize;
    public int stackShadowPages;

    /**
     * The offset of the mark word in an object's header.
     */
    public int markOffset;

    /**
     * The offset of the hub (i.e. Klass*) in an object's header.
     */
    public int hubOffset;

    /**
     * The offset of the _prototype_header field in a Klass.
     */
    public int prototypeMarkWordOffset;

    /**
     * The offset of the _subklass field in a Klass.
     */
    public int subklassOffset;

    /**
     * The offset of the _next_sibling field in a Klass.
     */
    public int nextSiblingOffset;

    /**
     * The offset of the array length word in an array object's header.
     */
    public int arrayLengthOffset;

    /**
     * The offset of the _length field in an Array metaspace object (see array.hpp).
     */
    public int metaspaceArrayLengthOffset;

    /**
     * The offset of the _data field in an Array metaspace object (see array.hpp).
     */
    public int metaspaceArrayBaseOffset;

    /**
     * The offset of the _super_check_offset field in a Klass.
     */
    public int superCheckOffsetOffset;

    /**
     * The offset of the _secondary_super_cache field in a Klass.
     */
    public int secondarySuperCacheOffset;

    /**
     * The offset of the _secondary_supers field in a Klass.
     */
    public int secondarySupersOffset;

    /**
     * The offset of the _init_state field in an instanceKlass.
     */
    public int klassStateOffset;

    /**
     * The value of instanceKlass::fully_initialized.
     */
    public int klassStateFullyInitialized;

    /**
     * The value of objArrayKlass::element_klass_offset().
     */
    public int arrayClassElementOffset;

    /**
     * The value of JavaThread::tlab_top_offset().
     */
    public int threadTlabTopOffset;

    /**
     * The value of JavaThread::tlab_end_offset().
     */
    public int threadTlabEndOffset;

    public int threadObjectOffset;

    /**
     * The value of markOopDesc::unlocked_value.
     */
    public int unlockedMask;

    /**
     * The value of markOopDesc::biased_lock_mask_in_place.
     */
    public int biasedLockMaskInPlace;

    /**
     * The value of markOopDesc::age_mask_in_place.
     */
    public int ageMaskInPlace;

    /**
     * The value of markOopDesc::epoch_mask_in_place.
     */
    public int epochMaskInPlace;

    /**
     * The value of markOopDesc::biased_lock_pattern.
     */
    public int biasedLockPattern;

    /**
     * Offset of _access_flags in metaspace Method object.
     */
    public int methodAccessFlagsOffset;

    /**
     * Offset of _max_locals in metaspace Method object.
     */
    public int methodMaxLocalsOffset;

    /**
     * Offset of _max_stack in metaspace Method object.
     */
    public int methodMaxStackOffset;

    /**
     * Value of extra_stack_entries() in method.hpp.
     */
    public int extraStackEntries;

    /**
     * Value of JVM_ACC_HAS_FINALIZER in accessFlags.hpp.
     */
    public int klassHasFinalizerFlag;

    public int threadExceptionOopOffset;
    public int threadExceptionPcOffset;
    public long cardtableStartAddress;
    public int cardtableShift;
    public long safepointPollingAddress;
    public boolean isPollingPageFar;

    /**
     * The offset of the _java_mirror field (of type {@link Class}) in a Klass.
     */
    public int classMirrorOffset;

    public int runtimeCallStackSize;

    /**
     * The offset of the _modifier_flags field in a Klass.
     */
    public int klassModifierFlagsOffset;

    /**
     * The offset of the _access_flags field in a Klass.
     */
    public int klassAccessFlagsOffset;

    /**
     * The offset of the injected klass field in a {@link Class}.
     */
    public int klassOffset;

    /**
     * The offset of the injected graal_mirror field in a {@link Class}.
     */
    public int graalMirrorInClassOffset;

    /**
     * The offset of the _method_data field in a metaspace Method.
     */
    public int methodDataOffset;

    public int nmethodEntryOffset;
    public int methodCompiledEntryOffset;
    public int basicLockSize;
    public int basicLockDisplacedHeaderOffset;

    // methodData information
    public int methodDataOopDataOffset;
    public int methodDataOopTrapHistoryOffset;
    public int dataLayoutHeaderSize;
    public int dataLayoutTagOffset;
    public int dataLayoutFlagsOffset;
    public int dataLayoutBCIOffset;
    public int dataLayoutCellsOffset;
    public int dataLayoutCellSize;
    public int bciProfileWidth;
    public int typeProfileWidth;

    // runtime stubs
    public long debugStub;
    public long instanceofStub;
    public long newInstanceStub;
    public long newTypeArrayStub;
    public long newObjectArrayStub;
    public long newMultiArrayStub;
    public long inlineCacheMissStub;
    public long handleExceptionStub;
    public long handleDeoptStub;
    public long fastMonitorEnterStub;
    public long fastMonitorExitStub;
    public long verifyOopStub;
    public long vmErrorStub;
    public long deoptimizeStub;
    public long unwindExceptionStub;
    public long osrMigrationEndStub;
    public long registerFinalizerStub;
    public long setDeoptInfoStub;
    public long createNullPointerExceptionStub;
    public long createOutOfBoundsExceptionStub;
    public long javaTimeMillisStub;
    public long javaTimeNanosStub;
    public long arithmeticFremStub;
    public long arithmeticDremStub;
    public long arithmeticSinStub;
    public long arithmeticCosStub;
    public long arithmeticTanStub;
    public long logPrimitiveStub;
    public long logObjectStub;
    public long logPrintfStub;

    public void check() {
        assert vmPageSize >= 16;
        assert codeEntryAlignment > 0;
        assert stackShadowPages > 0;
    }
}