private void addDirectRelocationWithAddend(RelocatableBuffer buffer, int index, DynamicHub target, long objectHeaderBits) { assert !spawnIsolates() || index >= readOnlyRelocatable.offsetInSection() && index < readOnlyRelocatable.offsetInSection(readOnlyRelocatable.getSize()); buffer.addDirectRelocationWithAddend(index, referenceSize(), objectHeaderBits, target); if (firstRelocatablePointerOffsetInSection == -1) { firstRelocatablePointerOffsetInSection = index; } }
private void addDirectRelocationWithoutAddend(RelocatableBuffer buffer, int index, int size, Object target) { assert !spawnIsolates() || index >= readOnlyRelocatable.offsetInSection() && index < readOnlyRelocatable.offsetInSection(readOnlyRelocatable.getSize()); buffer.addDirectRelocationWithoutAddend(index, size, target); if (firstRelocatablePointerOffsetInSection == -1) { firstRelocatablePointerOffsetInSection = index; } }
@Override public Path write(DebugContext debug, Path outputDirectory, Path tempDirectory, String imageName, BeforeImageWriteAccessImpl config) { Path imagePath = super.write(debug, outputDirectory, tempDirectory, imageName, config); writeHeaderFiles(outputDirectory, imageName, false); writeHeaderFiles(outputDirectory, imageName, true); return imagePath; } }
long allocate(ObjectInfo info) { Object object = info.getObject(); lastAllocatedObject = object; if (firstAllocatedObject == null) { firstAllocatedObject = object; } long position = size; incrementSize(info.getSize()); incrementCount(); return position; }
/** The start within a native image heap section (e.g., read-only or writable). */ public long getOffsetInSection() { return getPartition().offsetInSection(getOffsetInPartition()); }
void setReadOnlySection(final String sectionName, final long sectionOffset) { readOnlyPrimitive.setSection(sectionName, sectionOffset); readOnlyReference.setSection(sectionName, readOnlyPrimitive.offsetInSection(readOnlyPrimitive.getSize())); readOnlyRelocatable.setSection(sectionName, readOnlyReference.offsetInSection(readOnlyReference.getSize())); }
@SuppressWarnings("try") public void addInitialObjects() { addObjectsPhase.allow(); internStringsPhase.allow(); addObject(StaticFieldsSupport.getStaticPrimitiveFields(), false, "primitive static fields"); addStaticFields(); }
public RelocatableBuffer.Info addDirectRelocationWithAddend(int key, int relocationSize, Long explicitAddend, Object targetObject) { final RelocatableBuffer.Info info = infoFactory(ObjectFile.RelocationKind.DIRECT, relocationSize, explicitAddend, targetObject); final RelocatableBuffer.Info result = putInfo(key, info); return result; }
public static AbstractBootImage create(NativeImageKind k, HostedUniverse universe, HostedMetaAccess metaAccess, NativeLibraries nativeLibs, NativeImageHeap heap, NativeImageCodeCache codeCache, List<HostedMethod> entryPoints, HostedMethod mainEntryPoint, ClassLoader classLoader) { switch (k) { case SHARED_LIBRARY: return new SharedLibraryViaCCBootImage(universe, metaAccess, nativeLibs, heap, codeCache, entryPoints, mainEntryPoint, classLoader); default: return new ExecutableViaCCBootImage(k, universe, metaAccess, nativeLibs, heap, codeCache, entryPoints, mainEntryPoint, classLoader); } }
/** An index into a object in the native image heap. E.g., a field within an object. */ public long getIndexInSection(long index) { assert index >= 0 && index < getSize() : "Index: " + index + " out of bounds: [0 .. " + getSize() + ")."; return getOffsetInSection() + index; }
public String getFilename(String basename) { return getFilenamePrefix() + basename + getFilenameSuffix(); } }
public void processType(Class<?> clazz, String group, boolean addObject, ObjectFilter objectFilter, FieldFilter fieldFilter) { for (ObjectInfo info : objects) { if (clazz.isInstance(info.getObject())) { processObject(info, group, addObject, 1, objectFilter, fieldFilter); } } }
private static RelocatableBuffer bufferForPartition(final ObjectInfo info, final RelocatableBuffer roBuffer, final RelocatableBuffer rwBuffer) { VMError.guarantee(info != null, "[BootImageHeap.bufferForPartition: info is null]"); VMError.guarantee(info.getPartition() != null, "[BootImageHeap.bufferForPartition: info.partition is null]"); return info.getPartition().isWritable() ? rwBuffer : roBuffer; }
@Override public void registerPlugins(InvocationPlugins plugins, NodeIntrinsicPluginFactory.InjectionProvider injection) { plugins.register(new Plugin_NativeImageHeap_spawnIsolates(), com.oracle.svm.hosted.image.NativeImageHeap.class, "spawnIsolates"); plugins.register(new Plugin_NativeImageHeap_useHeapBase(), com.oracle.svm.hosted.image.NativeImageHeap.class, "useHeapBase"); } }
protected NativeTextSectionImpl(RelocatableBuffer relocatableBuffer, ObjectFile objectFile, NativeImageCodeCache codeCache) { // TODO: Do not separate the byte[] from the RelocatableBuffer. super(relocatableBuffer.getBytes()); this.textBuffer = relocatableBuffer; this.objectFile = objectFile; this.codeCache = codeCache; }
@Override public byte[] getOrDecideContent(Map<Element, LayoutDecisionMap> alreadyDecided, byte[] contentHint) { return getContent(); }
void addPostPad(long padSize) { postPadding += padSize; incrementSize(padSize); }
void disallow() { assert (value == PhaseValue.ALLOWED) : "Can not disallow while in phase " + value.toString(); value = PhaseValue.AFTER; }
public RelocatableBuffer.Info addPCRelativeRelocationWithAddend(int key, int relocationSize, Long explicitAddend, Object targetObject) { final RelocatableBuffer.Info info = infoFactory(ObjectFile.RelocationKind.PC_RELATIVE, relocationSize, explicitAddend, targetObject); final RelocatableBuffer.Info result = putInfo(key, info); return result; }
public RelocatableBuffer.Info addDirectRelocationWithoutAddend(int key, int relocationSize, Object targetObject) { final RelocatableBuffer.Info info = infoFactory(ObjectFile.RelocationKind.DIRECT, relocationSize, null, targetObject); final RelocatableBuffer.Info result = putInfo(key, info); return result; }