Skip to content

Commit

Permalink
fix layouted to laid out
Browse files Browse the repository at this point in the history
  • Loading branch information
wirthi committed Nov 27, 2024
1 parent 9fbd75d commit b0b2902
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ private Object displacementAnnotation(JavaConstant constant) {
if (SubstrateUtil.HOSTED) {
/*
* AOT compilation during image generation happens before the image heap objects are
* layouted. So the offset of the constant is not known yet during compilation time,
* laid out. So the offset of the constant is not known yet during compilation time,
* and instead needs to be patched in later. We annotate the machine code with the
* constant that needs to be patched in.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public static Object addressDisplacementAnnotation(JavaConstant constant) {
if (SubstrateUtil.HOSTED) {
/*
* AOT compilation during image generation happens before the image heap objects are
* layouted. So the offset of the constant is not known yet during compilation time, and
* laid out. So the offset of the constant is not known yet during compilation time, and
* instead needs to be patched in later. We annotate the machine code with the constant
* that needs to be patched in.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static CGlobalDataFeature singleton() {
return ImageSingletons.lookup(CGlobalDataFeature.class);
}

private boolean isLayouted() {
private boolean isLaidOut() {
return totalSize != -1;
}

Expand Down Expand Up @@ -187,7 +187,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec

public CGlobalDataInfo registerAsAccessedOrGet(CGlobalData<?> obj) {
CGlobalDataImpl<?> data = (CGlobalDataImpl<?>) obj;
VMError.guarantee(!isLayouted() || map.containsKey(data), "CGlobalData instance must have been discovered/registered before or during analysis");
VMError.guarantee(!isLaidOut() || map.containsKey(data), "CGlobalData instance must have been discovered/registered before or during analysis");
return map.computeIfAbsent((CGlobalDataImpl<?>) obj,
o -> {
CGlobalDataInfo cGlobalDataInfo = new CGlobalDataInfo(data);
Expand Down Expand Up @@ -260,7 +260,7 @@ private static CGlobalDataInfo assignCGlobalDataSize(Map.Entry<CGlobalDataImpl<?
}

private void layout() {
assert !isLayouted() : "Already layouted";
assert !isLaidOut() : "Already laid out";
final int wordSize = ConfigurationValues.getTarget().wordSize;
/*
* Put larger blobs at the end so that offsets are reasonable (<24bit imm) for smaller
Expand All @@ -275,11 +275,11 @@ private void layout() {
int nextOffset = currentOffset + info.getSize();
return (nextOffset + (wordSize - 1)) & ~(wordSize - 1); // align
}, Integer::sum);
assert isLayouted();
assert isLaidOut();
}

public int getSize() {
assert isLayouted() : "Not layouted yet";
assert isLaidOut() : "Not laid out yet";
return totalSize;
}

Expand All @@ -288,7 +288,7 @@ public interface SymbolConsumer {
}

public void writeData(RelocatableBuffer buffer, SymbolConsumer createSymbol, SymbolConsumer createSymbolReference) {
assert isLayouted() : "Not layouted yet";
assert isLaidOut() : "Not laid out yet";
ByteBuffer bufferBytes = buffer.getByteBuffer();
int start = bufferBytes.position();
assert IntStream.range(start, start + totalSize).allMatch(i -> bufferBytes.get(i) == 0) : "Buffer must be zero-initialized";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public Map getMap() {
}

public final class FilterDiagramCache extends DiagramCacheValue<List<Filter>> {
public final Map<LayoutSettingBean, LayoutDiagramCache> layoutedDiagramMap = new HashMap<>();
public final Map<LayoutSettingBean, LayoutDiagramCache> laidOutDiagramMap = new HashMap<>();

protected FilterDiagramCache(Diagram referent, Reference<List<Filter>> key, DiagramCacheBase parent) {
super(referent, key, parent);
Expand All @@ -224,7 +224,7 @@ protected FilterDiagramCache(Diagram referent, Reference<List<Filter>> key, Diag
@Override
public synchronized Diagram getDiagram(DiagramViewModel model, Consumer<Diagram> diagramReadyCallback) {
LayoutSettingBean layoutSetting = model.getLayoutSetting();
LayoutDiagramCache layoutDiagramCache = layoutedDiagramMap.get(layoutSetting);
LayoutDiagramCache layoutDiagramCache = laidOutDiagramMap.get(layoutSetting);
Diagram tmp = null;
if (layoutDiagramCache != null) {
tmp = layoutDiagramCache.get();
Expand All @@ -241,16 +241,16 @@ public synchronized Diagram getDiagram(DiagramViewModel model, Consumer<Diagram>
@Override
public synchronized DiagramCacheBase makeCache(DiagramViewModel model, Diagram baseDiagram) {
LayoutSettingBean layoutSetting = model.getLayoutSetting();
LayoutDiagramCache layoutDiagramCache = layoutedDiagramMap.get(layoutSetting);
LayoutDiagramCache layoutDiagramCache = laidOutDiagramMap.get(layoutSetting);
Diagram tmp = null;
if (layoutDiagramCache != null) {
tmp = layoutDiagramCache.get();
}
if (tmp != null && tmp.getSize() == null) {
// size of Diagram is null, so we have cached only extracted Diagrams after this stub.
LOG.log(Level.FINE, "Exchanging stub Diagram: {0} for its layouted counterpart: {1}", new Object[]{tmp, baseDiagram});
LOG.log(Level.FINE, "Exchanging stub Diagram: {0} for its laid out counterpart: {1}", new Object[]{tmp, baseDiagram});
LayoutDiagramCache layoutDiagramCacheNew = new LayoutDiagramCache(baseDiagram, new WeakReference<>(layoutSetting), this);
layoutedDiagramMap.put(layoutSetting, layoutDiagramCacheNew);
laidOutDiagramMap.put(layoutSetting, layoutDiagramCacheNew);
for (ExtractedDiagramCache c : layoutDiagramCache.extractedDiagramMap.values()) {
Set<Integer> key = c.key.get();
Diagram d = c.get();
Expand All @@ -260,7 +260,7 @@ public synchronized DiagramCacheBase makeCache(DiagramViewModel model, Diagram b
}
layoutDiagramCache = layoutDiagramCacheNew;
} else if (tmp == null) {
layoutedDiagramMap.put(layoutSetting, layoutDiagramCache = new LayoutDiagramCache(baseDiagram, new WeakReference<>(layoutSetting), this));
laidOutDiagramMap.put(layoutSetting, layoutDiagramCache = new LayoutDiagramCache(baseDiagram, new WeakReference<>(layoutSetting), this));
}
return layoutDiagramCache;
}
Expand All @@ -272,7 +272,7 @@ public Phase nextPhase(DiagramViewModel model) {

@Override
public Map getMap() {
return layoutedDiagramMap;
return laidOutDiagramMap;
}
}

Expand All @@ -289,7 +289,7 @@ public synchronized Diagram getDiagram(DiagramViewModel model, Consumer<Diagram>
if (hidNodes.isEmpty()) {
Diagram fin = get();
assert fin != null;
assert fin.getSize() != null : "Diagram wasn't layouted, but would be returned as finished.";
assert fin.getSize() != null : "Diagram wasn't laid out, but would be returned as finished.";
LOG.log(Level.FINE, "Loaded cached unextracted Diagram: {0}.", fin);
return fin;
}
Expand Down
2 changes: 1 addition & 1 deletion visualizer/Modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ organized into stages:

- base diagram,
- filtered diagram (including scripts),
- layouted diagram,
- laid out diagram,
- extracted diagram

Output of each stage is weakly cached, with respect to the settings / applied function; this allows to e.g. quickly change extraction, since
Expand Down

0 comments on commit b0b2902

Please sign in to comment.