no message
This commit is contained in:
@@ -83,12 +83,12 @@ public class SPF_GetGraphFunctionPositions extends SilentSapforPass {
|
||||
res.add(name);
|
||||
if (depth > 0) {
|
||||
if (out) {
|
||||
for (FuncCall call : target.allFunctions.get(name).calls)
|
||||
for (FuncCall call : target.allFunctions.get(name).callsFrom)
|
||||
getNeighbors_r(res, call.funcName, depth - 1, in, true);
|
||||
}
|
||||
if (in) {
|
||||
for (FuncInfo parent : target.allFunctions.values()) {
|
||||
for (FuncCall call : parent.calls) {
|
||||
for (FuncCall call : parent.callsFrom) {
|
||||
if (call.funcName.equals(name)) {
|
||||
getNeighbors_r(res, parent.funcName, depth - 1, true, out);
|
||||
}
|
||||
@@ -102,12 +102,12 @@ public class SPF_GetGraphFunctionPositions extends SilentSapforPass {
|
||||
if (!res.contains(name)) {
|
||||
res.add(name);
|
||||
if (out) {
|
||||
for (FuncCall call : target.allFunctions.get(name).calls)
|
||||
for (FuncCall call : target.allFunctions.get(name).callsFrom)
|
||||
getNeighborsNoDepth_r(res, call.funcName, in, true);
|
||||
}
|
||||
if (in) {
|
||||
for (FuncInfo parent : target.allFunctions.values()) {
|
||||
for (FuncCall call : parent.calls) {
|
||||
for (FuncCall call : parent.callsFrom) {
|
||||
if (call.funcName.equals(name)) {
|
||||
getNeighborsNoDepth_r(res, parent.funcName, true, out);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class SPF_GetGraphFunctionPositions extends SilentSapforPass {
|
||||
//теперь добавить ребер.
|
||||
for (String funcName : target.functionsGraph.vertexMap.keySet()) {
|
||||
FuncInfo fi = target.allFunctions.get(funcName);
|
||||
for (FuncCall fc : fi.calls) {
|
||||
for (FuncCall fc : fi.callsFrom) {
|
||||
if (target.functionsGraph.vertexMap.containsKey(fc.funcName))
|
||||
target.functionsGraph.addEdge(
|
||||
funcName,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
@@ -48,7 +49,6 @@ public class SPF_GetGraphFunctions extends SapforAnalysis {
|
||||
@Override
|
||||
protected void unpack(String packed) throws Exception {
|
||||
LinkedHashMap<String, FuncInfo> declarated_functions = new LinkedHashMap<>();
|
||||
//--
|
||||
FunctionsJson functionsJson = Utils_.gson.fromJson(packed, FunctionsJson.class);
|
||||
for (FileFunctionsJson fileFunctionsJson : functionsJson.allFunctions) {
|
||||
fileFunctionsJson.file = Utils_.toW(fileFunctionsJson.file);
|
||||
@@ -65,7 +65,7 @@ public class SPF_GetGraphFunctions extends SapforAnalysis {
|
||||
//------
|
||||
LinkedHashMap<String, FuncInfo> special_functions = new LinkedHashMap<>();
|
||||
for (FuncInfo funcInfo : declarated_functions.values()) {
|
||||
for (FuncCall funcCall : funcInfo.calls) {
|
||||
for (FuncCall funcCall : funcInfo.callsFrom) {
|
||||
if (!declarated_functions.containsKey(funcCall.funcName) && (
|
||||
!special_functions.containsKey(funcCall.funcName)
|
||||
)) {
|
||||
|
||||
@@ -18,8 +18,8 @@ public class SPF_InlineProcedures extends SapforTransformation {
|
||||
Vector<String> Result = new Vector<>();
|
||||
for (FuncInfo fi : target.allFunctions.values()) {
|
||||
Vector<FuncCall> selected_children = new Vector<>();
|
||||
for (String calls_file : fi.own_calls.keySet()) {
|
||||
for (FuncCall call : fi.own_calls.get(calls_file)) {
|
||||
for (String calls_file : fi.ownCalls.keySet()) {
|
||||
for (FuncCall call : fi.ownCalls.get(calls_file)) {
|
||||
if (call.isSelected())
|
||||
selected_children.add(call);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(CallGraphTitle);
|
||||
for (FuncInfo fi : function_decls.values()) {
|
||||
DefaultMutableTreeNode node = new DefaultMutableTreeNode(fi);
|
||||
for (FuncCall fc : fi.calls)
|
||||
for (FuncCall fc : fi.callsFrom)
|
||||
node.add(new DefaultMutableTreeNode(fc));
|
||||
root.add(node);
|
||||
}
|
||||
@@ -347,7 +347,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
public int FragmentFunctionCallsCount(int first, int second) {
|
||||
int res = 0;
|
||||
for (FuncInfo fi : function_decls.values())
|
||||
for (FuncCall fc : fi.calls) {
|
||||
for (FuncCall fc : fi.callsFrom) {
|
||||
if ((fc.line >= first) && (fc.line <= second))
|
||||
res++;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
public FuncCall find_current_func_call() {
|
||||
//-------------
|
||||
for (FuncInfo fi : function_decls.values()) {
|
||||
for (FuncCall fc : fi.calls) {
|
||||
for (FuncCall fc : fi.callsFrom) {
|
||||
if ((fc.line == form.getEditor().getCurrentLine()) &&
|
||||
!Global.mainModule.getSapfor().isIntrinsic(fc.funcName)
|
||||
) {
|
||||
@@ -369,7 +369,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
}
|
||||
public FuncCall find_func_call(String funcName) {
|
||||
for (FuncInfo fi : function_decls.values()) {
|
||||
for (FuncCall fc : fi.calls) {
|
||||
for (FuncCall fc : fi.callsFrom) {
|
||||
if (fc.funcName.equalsIgnoreCase(funcName) &&
|
||||
(fc.line == form.getEditor().getCurrentLine()
|
||||
)) {
|
||||
@@ -502,8 +502,9 @@ public class DBProjectFile extends ProjectFile {
|
||||
funcInfo.type = FunctionType.Default;
|
||||
}
|
||||
//--
|
||||
funcInfo.ownCalls = new LinkedHashMap<>();
|
||||
function_decls.put(funcInfo.funcName, funcInfo);
|
||||
call_count+=funcInfo.calls.size();
|
||||
call_count+=funcInfo.callsFrom.size();
|
||||
}
|
||||
//--
|
||||
CallGraphTitle = "Объявлений : " + function_decls.size() + "; Вызовов : " + call_count;
|
||||
|
||||
@@ -773,13 +773,13 @@ public class db_project_info extends DBObject {
|
||||
inline_root.add(node);
|
||||
//-
|
||||
for (FuncInfo decl2 : allFunctions.values()) {
|
||||
for (FuncCall call : decl2.calls) {
|
||||
for (FuncCall call : decl2.callsFrom) {
|
||||
if (call.funcName.equals(decl1.funcName)) {
|
||||
if (!decl1.own_calls.containsKey(call.file))
|
||||
decl1.own_calls.put(call.file, new Vector<>());
|
||||
if (!decl1.ownCalls.containsKey(call.file))
|
||||
decl1.ownCalls.put(call.file, new Vector<>());
|
||||
if (decl1.needToInline==1) call.Select(true);
|
||||
call.canBeInlined = (decl1.doNotInline==1)?0:1;
|
||||
decl1.own_calls.get(call.file).add(call);
|
||||
decl1.ownCalls.get(call.file).add(call);
|
||||
node.add(new DefaultMutableTreeNode(call));
|
||||
}
|
||||
}
|
||||
@@ -792,7 +792,7 @@ public class db_project_info extends DBObject {
|
||||
//особый случай.
|
||||
main_functionH = new FuncCallH(main_function);
|
||||
DefaultMutableTreeNode main_node = new DefaultMutableTreeNode(main_functionH);
|
||||
for (FuncCall call : main_function.calls) {
|
||||
for (FuncCall call : main_function.callsFrom) {
|
||||
Vector<String> chain = new Vector<>();
|
||||
chain.add(main_functionH.funcName);
|
||||
// UI.Info("start new chain");
|
||||
@@ -812,7 +812,7 @@ public class db_project_info extends DBObject {
|
||||
DefaultMutableTreeNode res = null;
|
||||
FuncInfo funcInfo = allFunctions.get(funcCall.funcName);
|
||||
res = new DefaultMutableTreeNode(funcCallH);
|
||||
for (FuncCall call : funcInfo.calls) {
|
||||
for (FuncCall call : funcInfo.callsFrom) {
|
||||
if (!chain.contains(call.funcName)) {
|
||||
DefaultMutableTreeNode node = BuildInlineGraph2_r(call, chain);
|
||||
if (node != null) {
|
||||
|
||||
@@ -11,10 +11,8 @@ public class FuncCall extends FileObjectWithMessages{
|
||||
//JSON------------------------------------------
|
||||
@Expose
|
||||
public String funcName = "";
|
||||
@Expose
|
||||
public int canBeInlined = 0;
|
||||
@Expose
|
||||
public int parentLineOffset = 0;// line объявления - line
|
||||
public int parentLineOffset = 0;// line объявления - line вычислять?
|
||||
//END OF JSON------------------------------------
|
||||
@Description("IGNORE")
|
||||
private boolean selected = false;
|
||||
|
||||
@@ -29,9 +29,11 @@ public class FuncInfo extends FileObjectWithMessages {
|
||||
|
||||
public FunctionType type = FunctionType.Default;
|
||||
//вызовы функций в теле этой функции
|
||||
public Vector<FuncCall> calls = new Vector<>();
|
||||
@Expose
|
||||
public Vector<FuncCall> callsFrom = new Vector<>();
|
||||
//----
|
||||
//вызовы этой самой функции, рассортированные по файлам.
|
||||
public LinkedHashMap<String, Vector<FuncCall>> own_calls = new LinkedHashMap<>();
|
||||
public LinkedHashMap<String, Vector<FuncCall>> ownCalls = new LinkedHashMap<>();
|
||||
//Узел фуннкции при отрисовке графа процедур.
|
||||
//Нужен для сохранения всех позиций графа.
|
||||
public mxCell functionsGraphCell = null;
|
||||
@@ -56,8 +58,8 @@ public class FuncInfo extends FileObjectWithMessages {
|
||||
return Utils_.getIcon("/icons/Function.png");
|
||||
}
|
||||
public void SelectAllChildren(boolean select) {
|
||||
for (String file_name : own_calls.keySet())
|
||||
for (FuncCall fc : own_calls.get(file_name))
|
||||
for (String file_name : ownCalls.keySet())
|
||||
for (FuncCall fc : ownCalls.get(file_name))
|
||||
fc.Select(select);
|
||||
}
|
||||
public boolean isDeclared() {
|
||||
|
||||
Reference in New Issue
Block a user