no message

This commit is contained in:
2025-01-16 20:42:55 +03:00
parent 095c0bad9a
commit 72e4fbdf31
4 changed files with 59 additions and 54 deletions

5
.idea/workspace.xml generated
View File

@@ -8,10 +8,9 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/GlobalDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/GlobalDatabase.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/SapforProfileSetting/UI/SapforProfileSettingsForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/GlobalData/SapforProfileSetting/UI/SapforProfileSettingsForm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/ApplyProfile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/ApplyProfile.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/SapforProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/SapforProperties.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/SapforProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/SapforProperties.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/ProjectMenuBar/ProjectSettingsMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/ProjectMenuBar/ProjectSettingsMenu.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -111,35 +111,23 @@ public class GlobalDatabase extends VisualiserDatabase {
} }
} }
//-- //--
public LinkedHashMap<String, String> getSapforSettingsForProfile() {
/*
LinkedHashMap<SettingName, String> res = new LinkedHashMap<>();
for (DBSetting setting : settings.getSettingsByOwner(ComponentType.SapforOptions))
if (setting.Visible)
res.put(setting.Name, setting.Value);
*/
return null;
}
//проверить, есть ли профиль с таким же набором настроек. //проверить, есть ли профиль с таким же набором настроек.
public SapforProfile checkProfileForCurrentSettings() { public SapforProfile checkProfileForCurrentSettings() {
/*
LinkedHashMap<SettingName, String> current_values = getSapforSettingsForProfile(); LinkedHashMap<String, String> current_values = Global.mainModule.getProject().sapforProperties.toMap();
for (SapforProfile profile : sapforProfiles.Data.values()) { for (SapforProfile profile : sapforProfiles.Data.values()) {
//--получить все настройки профиля //--получить все настройки профиля
LinkedHashMap<SettingName, String> profileValues = new LinkedHashMap<>(); LinkedHashMap<String, String> profileValues = new LinkedHashMap<>();
for (SapforProfileSetting setting : sapforProfilesSettings.Data.values()) for (SapforProfileSetting setting : sapforProfilesSettings.Data.values())
if (setting.sapforprofile_id == profile.id) profileValues.put(setting.name, setting.value); if (setting.sapforprofile_id == profile.id) profileValues.put(setting.name, setting.value);
//-- //--
if (current_values.equals(profileValues)) return profile; if (current_values.equals(profileValues)) return profile;
} }
*/
return null; return null;
} }
public void insertProfileSettings(SapforProfile profile) throws Exception { public void insertProfileSettings(SapforProfile profile) throws Exception {
/* LinkedHashMap<String, String> current_values = Global.mainModule.getProject().sapforProperties.toMap();
LinkedHashMap<SettingName, String> current_values = getSapforSettingsForProfile(); for (String name : current_values.keySet()) {
for (SettingName name : current_values.keySet()) {
//-- //--
SapforProfileSetting sapforProfileSetting = new SapforProfileSetting(); SapforProfileSetting sapforProfileSetting = new SapforProfileSetting();
sapforProfileSetting.name = name; sapforProfileSetting.name = name;
@@ -148,7 +136,6 @@ public class GlobalDatabase extends VisualiserDatabase {
//-- //--
Insert(sapforProfileSetting); Insert(sapforProfileSetting);
} }
*/
} }
public void saveCurrentProfile(String name_in) throws Exception { public void saveCurrentProfile(String name_in) throws Exception {
if (checkProfileForCurrentSettings() == null) { if (checkProfileForCurrentSettings() == null) {

View File

@@ -12,22 +12,14 @@ import com.google.gson.annotations.Expose;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.LinkedHashMap;
import java.util.Vector; import java.util.Vector;
public class SapforProperties extends Properties { public class SapforProperties extends Properties {
//побочные настройки визулизатора
@Expose
public boolean Precompilation = true;
@Expose
public boolean SaveModifications = true; // сохранять исходную версию
@Expose
public int GCOVLimit = 10;
@Expose
public String DVMConvertationOptions = " ";
//настройки для компонента SAPFOR //настройки для компонента SAPFOR
@Expose @Expose
public boolean STATIC_SHADOW_ANALYSIS = false; public boolean STATIC_SHADOW_ANALYSIS = false;
@Expose @Expose
public boolean STATIC_PRIVATE_ANALYSIS = true; public boolean STATIC_PRIVATE_ANALYSIS = true;//выключено
@Expose @Expose
public boolean FREE_FORM = false; public boolean FREE_FORM = false;
@Expose @Expose
@@ -35,7 +27,7 @@ public class SapforProperties extends Properties {
@Expose @Expose
public boolean KEEP_SPF_DIRECTIVES = false; public boolean KEEP_SPF_DIRECTIVES = false;
@Expose @Expose
public boolean PARALLELIZE_FREE_LOOPS = false; public boolean PARALLELIZE_FREE_LOOPS = false; //выключено
@Expose @Expose
public int MAX_SHADOW_WIDTH = 50; public int MAX_SHADOW_WIDTH = 50;
@Expose @Expose
@@ -57,7 +49,16 @@ public class SapforProperties extends Properties {
@Expose @Expose
public boolean KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS = false; public boolean KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS = false;
@Expose @Expose
public boolean PARSE_FOR_INLINE = false; public boolean PARSE_FOR_INLINE = false; //не видимая
//побочные настройки визулизатора
@Expose
public boolean Precompilation = true;
@Expose
public boolean SaveModifications = true; // сохранять исходную версию
@Expose
public int GCOVLimit = 10;
@Expose
public String DVMConvertationOptions = " ";
public String pack() { public String pack() {
Vector<String> res = new Vector_<String>( Vector<String> res = new Vector_<String>(
STATIC_SHADOW_ANALYSIS ? "1" : "0", STATIC_SHADOW_ANALYSIS ? "1" : "0",
@@ -166,31 +167,29 @@ public class SapforProperties extends Properties {
public boolean controlAction(String fieldName, JMenuItem control) { public boolean controlAction(String fieldName, JMenuItem control) {
return (Global.mainModule.getPass(PassCode.UpdateSapforProperty).Do(fieldName)); return (Global.mainModule.getPass(PassCode.UpdateSapforProperty).Do(fieldName));
} }
public String getSummary(){ public String getSummary() {
Vector<String> res = new Vector<>(); Vector<String> res = new Vector<>();
for (Field field: this.getClass().getFields()){ for (Field field : this.getClass().getFields()) {
try { try {
res.add(getFieldDescription(field.getName()) + "=" + field.get(this)); res.add(getFieldDescription(field.getName()) + "=" + field.get(this));
} } catch (Exception ex) {
catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
} }
return String.join("\n", res); return String.join("\n", res);
} }
public void applyPatch(VisualiserSettingsJson settings){ public void applyPatch(VisualiserSettingsJson settings) {
Vector<String> changedFields = new Vector<>(); Vector<String> changedFields = new Vector<>();
try { try {
for (VisualiserSettingJson setting : settings.array) { for (VisualiserSettingJson setting : settings.array) {
System.out.println(setting.name+"="+ Utils_.Brackets(setting.value)); System.out.println(setting.name + "=" + Utils_.Brackets(setting.value));
Field field = null; Field field = null;
try { try {
field = getClass().getField(setting.name); field = getClass().getField(setting.name);
} } catch (Exception ex) {
catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
if (field!=null) { if (field != null) {
if (field.getName().equals(setting.name)) { if (field.getName().equals(setting.name)) {
changedFields.add(setting.name); changedFields.add(setting.name);
switch (setting.name) { switch (setting.name) {
@@ -216,28 +215,26 @@ public class SapforProperties extends Properties {
} }
if (!changedFields.isEmpty()) { if (!changedFields.isEmpty()) {
this.Update(); this.Update();
for (String fieldName: changedFields){ for (String fieldName : changedFields) {
Mark(fieldName, getMenuItem(fieldName)); Mark(fieldName, getMenuItem(fieldName));
} }
} }
} } catch (Exception ex) {
catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
public void applyProfile(Vector<SapforProfileSetting> settings){ public void applyProfile(Vector<SapforProfileSetting> settings) {
Vector<String> changedFields = new Vector<>(); Vector<String> changedFields = new Vector<>();
try { try {
for (SapforProfileSetting setting : settings) { for (SapforProfileSetting setting : settings) {
System.out.println(setting.name+"="+ Utils_.Brackets(setting.value)); System.out.println(setting.name + "=" + Utils_.Brackets(setting.value));
Field field = null; Field field = null;
try { try {
field = getClass().getField(setting.name); field = getClass().getField(setting.name);
} } catch (Exception ex) {
catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
if (field!=null) { if (field != null) {
if (field.getName().equals(setting.name)) { if (field.getName().equals(setting.name)) {
changedFields.add(setting.name); changedFields.add(setting.name);
switch (setting.name) { switch (setting.name) {
@@ -263,13 +260,36 @@ public class SapforProperties extends Properties {
} }
if (!changedFields.isEmpty()) { if (!changedFields.isEmpty()) {
this.Update(); this.Update();
for (String fieldName: changedFields){ for (String fieldName : changedFields) {
Mark(fieldName, getMenuItem(fieldName)); Mark(fieldName, getMenuItem(fieldName));
} }
} }
} } catch (Exception ex) {
catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
public LinkedHashMap<String, String> toMap() {
LinkedHashMap<String, String> res = new LinkedHashMap<>();
Vector<String> forbidden = new Vector_<String>(
// "Precompilation",
// "SaveModifications",
// "GCOVLimit",
// "DVMConvertationOptions",
"PARSE_FOR_INLINE",
"STATIC_PRIVATE_ANALYSIS",
"PARALLELIZE_FREE_LOOPS"
);
try {
for (Field field : getClass().getFields()) {
if (!forbidden.contains(field.getName())) {
Object value = field.get(this);
String value_ = (value instanceof Boolean) ? ((boolean) value ? "1" : "0") : value.toString();
res.put(field.getName(), value_);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return res;
}
} }

View File

@@ -36,7 +36,6 @@ public class ProjectSettingsMenu extends VisualiserMenu {
add(new PropertiesSubmenu("Анализ", null, add(new PropertiesSubmenu("Анализ", null,
Global.mainModule.getProject().sapforProperties, Global.mainModule.getProject().sapforProperties,
"Precompilation", "Precompilation",
"STATIC_SHADOW_ANALYSIS",
"KEEP_DVM_DIRECTIVES", "KEEP_DVM_DIRECTIVES",
"IGNORE_IO_SAPFOR", "IGNORE_IO_SAPFOR",
"MPI_PROGRAM", "MPI_PROGRAM",