распределение в json, еще нашел внесенный переходом баг с отображением массивов текущего файла.
This commit is contained in:
2025-05-18 18:12:30 +03:00
parent cba4425cd7
commit 41ce6527d5
9 changed files with 66 additions and 29 deletions

View File

@@ -3,7 +3,7 @@ import Common.Utils.Vector_;
import java.util.Vector;
public class Constants {
public static final int version = 1248;
public static final int version = 1249;
public static final int planner_version = 24;
public static final int testingMaxKernels = 64;
//--

View File

@@ -31,16 +31,19 @@ public class SPF_GetAllDeclaratedArrays extends SapforAnalysis {
}
@Override
public void unpack(String packed) throws Exception {
System.out.println("packed="+ Utils_.Brackets(packed));
ArraysJson arraysJson = Utils_.gson.fromJson(packed, ArraysJson.class);
System.out.println("size="+arraysJson.allArrays.size());
for (ProjectArray array: arraysJson.allArrays){
array.Init();
target.declaratedArrays.put(array.id, array);
// array.print();
//--
for (ArrayDecl decl: array.declPlaces){
DBProjectFile projectFile = target.db.files.get(decl.file);
projectFile.array_decls.add(decl);
}
}
for (DBProjectFile file : target.db.files.Data.values())
for (DBProjectFile file : target.db.files.Data.values()) {
file.ArrayGraphTitle = "Объявлений: " + file.array_decls.size();
}
target.UpdateArraysCount();
}
@Override

View File

@@ -1,10 +1,13 @@
package _VisualDVM.Passes.All;
import Common.Utils.Index;
import Common.Utils.Utils_;
import Common.Utils.Vector_;
import Common.Visual.Controls.PassControl;
import Common.Visual.UI;
import _VisualDVM.Global;
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
import _VisualDVM.ProjectData.SapforData.Regions.RegionsJson;
import java.util.Comparator;
import java.util.Vector;
@@ -23,12 +26,10 @@ public class SPF_GetArrayDistributionOnlyAnalysis extends SapforAnalysis {
}
@Override
protected void unpack(String packed) throws Exception {
String[] splited = packed.split("#");
Index idx = new Index();
int n = Integer.parseInt(splited[idx.Inc()]);
for (int i = 0; i < n; ++i) {
ParallelRegion p = new ParallelRegion(splited, idx);
target.parallelRegions.put(p.regionId, p);
RegionsJson regionsJson = Utils_.gson.fromJson(packed, RegionsJson.class);
for (ParallelRegion parallelRegion: regionsJson.allRegions){
parallelRegion.Init();
target.parallelRegions.put(parallelRegion.regionId, parallelRegion);
}
//отсортировать по имени шаблоны
target.templates.sort(Comparator.comparing(o -> o.name));

View File

@@ -1,8 +1,10 @@
package _VisualDVM.Passes.All;
import Common.Utils.Index;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
import _VisualDVM.ProjectData.SapforData.Regions.RegionsJson;
public class SPF_GetArrayDistributionOnlyRegions extends SapforAnalysis {
@Override
public String phase() {
@@ -10,12 +12,10 @@ public class SPF_GetArrayDistributionOnlyRegions extends SapforAnalysis {
}
@Override
protected void unpack(String packed) throws Exception {
String[] splited = packed.split("#");
Index idx = new Index();
int n = Integer.parseInt(splited[idx.Inc()]);
for (int i = 0; i < n; ++i) {
ParallelRegion p = new ParallelRegion(splited, idx);
target.parallelRegions.put(p.regionId, p);
RegionsJson regionsJson = Utils_.gson.fromJson(packed, RegionsJson.class);
for (ParallelRegion parallelRegion: regionsJson.allRegions){
parallelRegion.Init();
target.parallelRegions.put(parallelRegion.regionId, parallelRegion);
}
}
@Override

View File

@@ -41,10 +41,8 @@ public class AlignRule {
}
public void Init(){
//--
if (packedAlignArrayAddress !=null)
alignArray_address = new BigInteger(packedAlignArrayAddress);
if (packedAlignWithAddress !=null)
alignWith_address = new BigInteger(packedAlignWithAddress);
alignArray_address = new BigInteger(packedAlignArrayAddress);
alignWith_address = new BigInteger(packedAlignWithAddress);
//--
packedAlignArrayAddress = null;
packedAlignWithAddress = null;

View File

@@ -154,15 +154,18 @@ public class ProjectArray extends DBObject {
//короткое имя+ функция/модуль/комон+ размерность
UniqKey = shortName + locName + dimSize;
if (packedAddress != null) address = new BigInteger(packedAddress);
for (ArrayDecl arrayDecl : declPlaces)
for (ArrayDecl arrayDecl : declPlaces) {
arrayDecl.arrayName = shortName;
arrayDecl.file = Utils_.toW(arrayDecl.file);
arrayDecl.messages_presence = "OK";
}
//-- полей нет в json поэтому они null
regIDs = new Vector<>();
dimensions = new Vector<>();
links = new LinkedHashMap<>();
ac_current = new LinkedHashMap<>();
ac_new = new LinkedHashMap<>();
//--
//--FileForm
}
public static String fill_binary(int d, String binary) {
int delta = Math.abs(binary.length() - d);

View File

@@ -4,6 +4,7 @@ import Common.Utils.Index;
import Common.Utils.IntegerPairJson;
import Common.Utils.Pair;
import Common.Utils.Utils_;
import Common.Visual.UI;
import _VisualDVM.Global;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Arrays.AlignRule;
@@ -28,7 +29,7 @@ public class ParallelRegion extends DBObject {
@Expose
public Vector<AlignRule> alignRules;
//----
public Vector<String> rules = new Vector<>();
public Vector<String> rules;
public void genRules(LinkedHashMap<BigInteger, ProjectArray> Arrays) {
rules.clear();
int maxLen = 0;
@@ -124,12 +125,24 @@ public class ParallelRegion extends DBObject {
arraysMap = new LinkedHashMap<>();
lines = new LinkedHashMap<>();
fragments = new Vector<>();
rules=new Vector<>();
//--
if (packedRegionId != null)
regionId = new BigInteger(packedRegionId);
maxdim = 0;
for (ProjectArray array : packedArrays) {
array.Init();//имена и адреса.
arraysMap.put(array.address, array);
if (array.isTemplFlag==1){
maxdim = Math.max(maxdim, array.dimSize);
Global.mainModule.getProject().templates.add(array);
array.regIDs.add(regionId);
} else if (array.isLoopArrayFlag != 1) arrays_count++;
}
//---
for (AlignRule rule: alignRules) {
rule.Init();
rule.parent_region = this;
}
//---
for (FileRegionLinesJson fr : regionsLines) {
@@ -138,7 +151,22 @@ public class ParallelRegion extends DBObject {
fragments.add(fr.file + ": " + l.getKey() + "-" + l.getKey());
}
}
//--
//---
//--------------------------------------------------------------
lines_count = 0;
loops_count = 0;
fd_count = 0;
fc_count = 0;
for (String FKey : lines.keySet()) {
for (IntegerPairJson L : lines.get(FKey)) {
lines_count += (L.getValue() - L.getKey());
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
fc_count += f.FragmentFunctionCallsCount(L.getKey(), L.getValue());
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
}
}
//---
packedRegionId = null;
packedArrays.clear();
packedArrays = null;