Search in sources :

Example 1 with VMThreadLocalSTSupport

use of com.oracle.svm.core.threadlocal.VMThreadLocalSTSupport in project graal by oracle.

the class VMThreadSTFeature method duringSetup.

@Override
public void duringSetup(DuringSetupAccess config) {
    ImageSingletons.add(VMThreadLocalSTSupport.class, new VMThreadLocalSTSupport());
    config.registerObjectReplacer(threadLocalCollector);
}
Also used : VMThreadLocalSTSupport(com.oracle.svm.core.threadlocal.VMThreadLocalSTSupport)

Example 2 with VMThreadLocalSTSupport

use of com.oracle.svm.core.threadlocal.VMThreadLocalSTSupport in project graal by oracle.

the class VMThreadSTFeature method beforeCompilation.

@Override
public void beforeCompilation(BeforeCompilationAccess config) {
    List<VMThreadLocalInfo> sortedThreadLocalInfos = threadLocalCollector.sortThreadLocals(config);
    ObjectLayout layout = ConfigurationValues.getObjectLayout();
    int nextObject = 0;
    int nextPrimitive = 0;
    for (VMThreadLocalInfo info : sortedThreadLocalInfos) {
        if (info.isObject) {
            info.offset = layout.getArrayElementOffset(JavaKind.Object, nextObject);
            nextObject += 1;
        } else {
            assert nextPrimitive % Math.min(8, info.sizeInBytes) == 0 : "alignment mismatch: " + info.sizeInBytes + ", " + nextPrimitive;
            info.offset = layout.getArrayElementOffset(JavaKind.Byte, nextPrimitive);
            nextPrimitive += info.sizeInBytes;
        }
    }
    VMThreadLocalSTSupport support = ImageSingletons.lookup(VMThreadLocalSTSupport.class);
    support.objectThreadLocals = new Object[nextObject];
    support.primitiveThreadLocals = new byte[nextPrimitive];
    /* Remember the final sorted list. */
    VMThreadLocalInfos.setInfos(sortedThreadLocalInfos);
}
Also used : VMThreadLocalSTSupport(com.oracle.svm.core.threadlocal.VMThreadLocalSTSupport) ObjectLayout(com.oracle.svm.core.config.ObjectLayout) VMThreadLocalInfo(com.oracle.svm.core.threadlocal.VMThreadLocalInfo)

Aggregations

VMThreadLocalSTSupport (com.oracle.svm.core.threadlocal.VMThreadLocalSTSupport)2 ObjectLayout (com.oracle.svm.core.config.ObjectLayout)1 VMThreadLocalInfo (com.oracle.svm.core.threadlocal.VMThreadLocalInfo)1