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);
}
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);
}
Aggregations