You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/06/04 19:50:13 UTC

[royale-compiler] 01/03: diagnostics

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch release_practice
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 153682b648b8b0c551d68d1c17ce04a4f24bf344
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Jun 4 11:03:01 2019 -0700

    diagnostics
---
 .../royale/abc/semantics/ControlFlowGraph.java      | 21 +++++++++++++++++++++
 .../apache/royale/abc/semantics/MethodBodyInfo.java |  7 +++++++
 2 files changed, 28 insertions(+)

diff --git a/compiler/src/main/java/org/apache/royale/abc/semantics/ControlFlowGraph.java b/compiler/src/main/java/org/apache/royale/abc/semantics/ControlFlowGraph.java
index de0c42b..a23816b 100644
--- a/compiler/src/main/java/org/apache/royale/abc/semantics/ControlFlowGraph.java
+++ b/compiler/src/main/java/org/apache/royale/abc/semantics/ControlFlowGraph.java
@@ -304,6 +304,27 @@ public class ControlFlowGraph implements IFlowgraph
      */
     public void traverseGraph(IFlowGraphVisitor visitor)
     {
+    	if (mbi.getMethodInfo() != null &&
+    			mbi.getMethodInfo().getMethodName() != null &&
+    			mbi.getMethodInfo().getMethodName().contentEquals("dispatchEvent") &&
+    			mbi.getMethodInfo().getParamNames().contains("event1"))
+    	{
+    		Iterator<IBasicBlock> blocks = this.blocksInControlFlowOrder().iterator();
+    		int blockCount = 0;
+    		while (blocks.hasNext())
+    		{
+    			blockCount++;
+    			blocks.next();
+    		}
+    		IBasicBlock[] blocklist = new IBasicBlock[blockCount];
+    		blocks = this.blocksInControlFlowOrder().iterator();
+    		blockCount = 0;
+    		while (blocks.hasNext())
+    		{
+    			blocklist[blockCount++] = blocks.next();
+    		}    		
+    		System.out.println("blockCount is: " + blockCount);
+    	}
         for (IBasicBlock b : this.blocksInControlFlowOrder())
         {
             if (visitor.visitBlock(b))
diff --git a/compiler/src/main/java/org/apache/royale/abc/semantics/MethodBodyInfo.java b/compiler/src/main/java/org/apache/royale/abc/semantics/MethodBodyInfo.java
index fcf53d4..540c132 100644
--- a/compiler/src/main/java/org/apache/royale/abc/semantics/MethodBodyInfo.java
+++ b/compiler/src/main/java/org/apache/royale/abc/semantics/MethodBodyInfo.java
@@ -219,6 +219,13 @@ public class MethodBodyInfo
         FrameCountVisitor counts = new FrameCountVisitor(this, diagnosticsVisitor, this.initial_scope);
         getCfg().traverseGraph(counts);
 
+        if (this.getMethodInfo().getMethodName() != null &&
+        		this.getMethodInfo().getMethodName().contentEquals("dispatchEvent") &&
+        		this.getMethodInfo().getParamNames() != null &&
+        		this.getMethodInfo().getParamNames().contains("event1"))
+        {
+        	System.out.println("ComputedFrameCounts: " + counts.max_scope + " " + this.max_scope );
+        }
         // Grrr..  TODO when we tighten up the max_stack,
         // max_scope, etc for code we read out of the flex
         // framework we seem to break that code.