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 2018/03/30 07:08:10 UTC

[royale-compiler] 02/02: try caching some other things to speed up the compiler

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

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

commit 52509ab663ffda8808eca6598eef59275e6ee37c
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Mar 30 00:01:44 2018 -0700

    try caching some other things to speed up the compiler
---
 .../internal/definitions/ClassDefinitionBase.java  | 56 ++++++++++++----------
 .../internal/definitions/DefinitionBase.java       |  8 +++-
 2 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
index de73e9b..de8cfe1 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
@@ -414,6 +414,8 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
         return new InterfaceDefinition.InterfaceIterator(this, project, null);
     }
 
+    private ArrayList<IDefinition> baseDefinitions = null;
+    
     @Override
     public boolean isInstanceOf(final ITypeDefinition type, ICompilerProject project)
     {
@@ -423,35 +425,41 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
 
         if (type instanceof IClassDefinition)
         {
-            // We're trying to determine whether this class
-            // is derived from a specified class ('type').
-            // Iterate the superclass chain looking for 'type'.
-            Iterator<IClassDefinition> iter = classIterator(project, false);
-            while (iter.hasNext())
-            {
-                IClassDefinition cls = iter.next();
-                if (cls == type)
-                    return true;
-            }
-            return false;
+        	if (baseDefinitions == null)
+        	{
+        		baseDefinitions = new ArrayList<IDefinition>();
+        		
+	            // We're trying to determine whether this class
+	            // is derived from a specified class ('type').
+	            // Iterate the superclass chain looking for 'type'.
+	            Iterator<IClassDefinition> iter = classIterator(project, false);
+	            while (iter.hasNext())
+	            {
+	                IClassDefinition cls = iter.next();
+	                baseDefinitions.add(cls);
+	            }
+        	}
         }
         else if (type instanceof IInterfaceDefinition)
         {
-            // We're trying to determine whether this class
-            // implements a specified interface ('type').
-            // Iterate all of the interfaces that this class implements,
-            // looking for 'type'.
-            Iterator<IInterfaceDefinition> iter = interfaceIterator(project);
-            while (iter.hasNext())
-            {
-                IInterfaceDefinition intf = iter.next();
-                if (intf == type)
-                    return true;
-            }
-            return false;
+        	if (baseDefinitions == null)
+        	{
+        		baseDefinitions = new ArrayList<IDefinition>();
+        		
+	            // We're trying to determine whether this class
+	            // implements a specified interface ('type').
+	            // Iterate all of the interfaces that this class implements,
+	            // looking for 'type'.
+	            Iterator<IInterfaceDefinition> iter = interfaceIterator(project);
+	            while (iter.hasNext())
+	            {
+	                IInterfaceDefinition intf = iter.next();
+	                baseDefinitions.add(intf);
+	            }
+        	}
         }
 
-        return false;
+    	return baseDefinitions.contains(type);
     }
 
     @Override
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
index 61fb92a..0626789 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
@@ -166,6 +166,8 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
 
     private int absoluteNameStart = 0;
     private int absoluteNameEnd = 0;
+    
+    private IDefinition parentDef = null;
 
     /**
      * Called by {@code MXMLScopeBuilder} when building definitions from
@@ -240,6 +242,9 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
     @Override
     public IDefinition getParent()
     {
+    	if (parentDef != null)
+    		return parentDef;
+    	
         IASScope scope = getContainingScope();
 
         // Walk up the scope chain until we find a scope that has
@@ -251,7 +256,8 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
         while ((scope != null) && (scope.getDefinition() == null))
             scope = scope.getContainingScope();
 
-        return scope != null ? scope.getDefinition() : null;
+        parentDef = scope != null ? scope.getDefinition() : null;
+        return parentDef;
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
aharui@apache.org.

Re: [royale-compiler] 02/02: try caching some other things to speed up the compiler

Posted by Carlos Rovira <ca...@apache.org>.
All is working now
thanks! :)

2018-03-30 17:58 GMT+02:00 Alex Harui <ah...@adobe.com.invalid>:

> Hi Piotr,
>
> The compiler build passed, but then it can't build the framework.  I'm
> looking into it.
>
> -Alex
>
> On 3/30/18, 2:22 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>
> >Hi Carlos,
> >
> >On builds.a.o build pass without the problem on develop [1]
> >
> >[1]
> >https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fbuilds.ap
> >ache.org%2Fjob%2Froyale-compiler%2F274%2F&data=02%7C01%7Caharui%
> 40adobe.co
> >m%7C9712013c0ced44c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C
> >0%7C0%7C636579985398096771&sdata=mPVbQW4vbz446Eim2YEizn8e9P4Dtx
> coLAUi%2B9E
> >L3og%3D&reserved=0
> >
> >Thanks,
> >Piotr
> >
> >2018-03-30 10:17 GMT+02:00 Carlos Rovira <ca...@apache.org>:
> >
> >> Hi Alex,
> >>
> >> the problem is only with the latest (caching) . The other one works ok.
> >> thanks
> >>
> >> 2018-03-30 10:06 GMT+02:00 Carlos Rovira <ca...@apache.org>:
> >>
> >> > Hi Alex,
> >> >
> >> > the two latest commits in compiler is making projects not compile (at
> >> > least in Jewel branch). I'll reset my index below this two commits
> >>until
> >> > you get that solved
> >> >
> >> > thanks
> >> >
> >> >
> >> >
> >> > 2018-03-30 9:08 GMT+02:00 <ah...@apache.org>:
> >> >
> >> >> This is an automated email from the ASF dual-hosted git repository.
> >> >>
> >> >> aharui pushed a commit to branch develop
> >> >> in repository
> >>https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fgitbox.a
> >>pache.org%2Frepos%2Fasf%2Froyale-compiler.git&data=02%
> 7C01%7Caharui%40ado
> >>be.com%7C9712013c0ced44c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178de
> c
> >>ee1%7C0%7C0%7C636579985398096771&sdata=PsiNItK10CLu0F9Hg3Hguj%
> 2F0nxTqBAkx
> >>E%2F5fnQl%2FPXQ%3D&reserved=0
> >> >>
> >> >> commit 52509ab663ffda8808eca6598eef59275e6ee37c
> >> >> Author: Alex Harui <ah...@apache.org>
> >> >> AuthorDate: Fri Mar 30 00:01:44 2018 -0700
> >> >>
> >> >>     try caching some other things to speed up the compiler
> >> >> ---
> >> >>  .../internal/definitions/ClassDefinitionBase.java  | 56
> >> >> ++++++++++++----------
> >> >>  .../internal/definitions/DefinitionBase.java       |  8 +++-
> >> >>  2 files changed, 39 insertions(+), 25 deletions(-)
> >> >>
> >> >> diff --git
> >>a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> >> /definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/a
> >> >> pache/royale/compiler/internal/definitions/ClassDefinitionBase.java
> >> >> index de73e9b..de8cfe1 100644
> >> >> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> >> /definitions/ClassDefinitionBase.java
> >> >> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
> >> >> /definitions/ClassDefinitionBase.java
> >> >> @@ -414,6 +414,8 @@ public abstract class ClassDefinitionBase extends
> >> >> TypeDefinitionBase implements
> >> >>          return new InterfaceDefinition.InterfaceIterator(this,
> >> project,
> >> >> null);
> >> >>      }
> >> >>
> >> >> +    private ArrayList<IDefinition> baseDefinitions = null;
> >> >> +
> >> >>      @Override
> >> >>      public boolean isInstanceOf(final ITypeDefinition type,
> >> >> ICompilerProject project)
> >> >>      {
> >> >> @@ -423,35 +425,41 @@ public abstract class ClassDefinitionBase
> >>extends
> >> >> TypeDefinitionBase implements
> >> >>
> >> >>          if (type instanceof IClassDefinition)
> >> >>          {
> >> >> -            // We're trying to determine whether this class
> >> >> -            // is derived from a specified class ('type').
> >> >> -            // Iterate the superclass chain looking for 'type'.
> >> >> -            Iterator<IClassDefinition> iter = classIterator(project,
> >> >> false);
> >> >> -            while (iter.hasNext())
> >> >> -            {
> >> >> -                IClassDefinition cls = iter.next();
> >> >> -                if (cls == type)
> >> >> -                    return true;
> >> >> -            }
> >> >> -            return false;
> >> >> +               if (baseDefinitions == null)
> >> >> +               {
> >> >> +                       baseDefinitions = new
> >>ArrayList<IDefinition>();
> >> >> +
> >> >> +                   // We're trying to determine whether this class
> >> >> +                   // is derived from a specified class ('type').
> >> >> +                   // Iterate the superclass chain looking for
> >>'type'.
> >> >> +                   Iterator<IClassDefinition> iter =
> >> >> classIterator(project, false);
> >> >> +                   while (iter.hasNext())
> >> >> +                   {
> >> >> +                       IClassDefinition cls = iter.next();
> >> >> +                       baseDefinitions.add(cls);
> >> >> +                   }
> >> >> +               }
> >> >>          }
> >> >>          else if (type instanceof IInterfaceDefinition)
> >> >>          {
> >> >> -            // We're trying to determine whether this class
> >> >> -            // implements a specified interface ('type').
> >> >> -            // Iterate all of the interfaces that this class
> >> implements,
> >> >> -            // looking for 'type'.
> >> >> -            Iterator<IInterfaceDefinition> iter =
> >> >> interfaceIterator(project);
> >> >> -            while (iter.hasNext())
> >> >> -            {
> >> >> -                IInterfaceDefinition intf = iter.next();
> >> >> -                if (intf == type)
> >> >> -                    return true;
> >> >> -            }
> >> >> -            return false;
> >> >> +               if (baseDefinitions == null)
> >> >> +               {
> >> >> +                       baseDefinitions = new
> >>ArrayList<IDefinition>();
> >> >> +
> >> >> +                   // We're trying to determine whether this class
> >> >> +                   // implements a specified interface ('type').
> >> >> +                   // Iterate all of the interfaces that this class
> >> >> implements,
> >> >> +                   // looking for 'type'.
> >> >> +                   Iterator<IInterfaceDefinition> iter =
> >> >> interfaceIterator(project);
> >> >> +                   while (iter.hasNext())
> >> >> +                   {
> >> >> +                       IInterfaceDefinition intf = iter.next();
> >> >> +                       baseDefinitions.add(intf);
> >> >> +                   }
> >> >> +               }
> >> >>          }
> >> >>
> >> >> -        return false;
> >> >> +       return baseDefinitions.contains(type);
> >> >>      }
> >> >>
> >> >>      @Override
> >> >> diff --git
> >>a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> >> /definitions/DefinitionBase.java b/compiler/src/main/java/org/a
> >> >> pache/royale/compiler/internal/definitions/DefinitionBase.java
> >> >> index 61fb92a..0626789 100644
> >> >> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> >> /definitions/DefinitionBase.java
> >> >> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
> >> >> /definitions/DefinitionBase.java
> >> >> @@ -166,6 +166,8 @@ public abstract class DefinitionBase implements
> >> >> IDocumentableDefinition, IDefini
> >> >>
> >> >>      private int absoluteNameStart = 0;
> >> >>      private int absoluteNameEnd = 0;
> >> >> +
> >> >> +    private IDefinition parentDef = null;
> >> >>
> >> >>      /**
> >> >>       * Called by {@code MXMLScopeBuilder} when building definitions
> >> from
> >> >> @@ -240,6 +242,9 @@ public abstract class DefinitionBase implements
> >> >> IDocumentableDefinition, IDefini
> >> >>      @Override
> >> >>      public IDefinition getParent()
> >> >>      {
> >> >> +       if (parentDef != null)
> >> >> +               return parentDef;
> >> >> +
> >> >>          IASScope scope = getContainingScope();
> >> >>
> >> >>          // Walk up the scope chain until we find a scope that has
> >> >> @@ -251,7 +256,8 @@ public abstract class DefinitionBase implements
> >> >> IDocumentableDefinition, IDefini
> >> >>          while ((scope != null) && (scope.getDefinition() == null))
> >> >>              scope = scope.getContainingScope();
> >> >>
> >> >> -        return scope != null ? scope.getDefinition() : null;
> >> >> +        parentDef = scope != null ? scope.getDefinition() : null;
> >> >> +        return parentDef;
> >> >>      }
> >> >>
> >> >>      @Override
> >> >>
> >> >> --
> >> >> To stop receiving notification emails like this one, please contact
> >> >> aharui@apache.org.
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Carlos Rovira
> >> >
> >>https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fabout.me%
> >>2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%
> 7C9712013c0ced44c5003408
> >>d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%
> 7C63657998539809677
> >>1&sdata=thDk0gFChf36B6RHmAYllwUHU4ss6HwoZnSfvLMIcxw%3D&reserved=0
> >> >
> >> >
> >>
> >>
> >> --
> >> Carlos Rovira
> >>
> >>https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fabout.me%
> >>2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%
> 7C9712013c0ced44c5003408
> >>d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%
> 7C63657998539809677
> >>1&sdata=thDk0gFChf36B6RHmAYllwUHU4ss6HwoZnSfvLMIcxw%3D&reserved=0
> >>
> >
> >
> >
> >--
> >
> >Piotr Zarzycki
> >
> >Patreon:
> >*https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fwww.patr
> >eon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%
> 7C9712013c0ced44
> >c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C6365799853
> >98096771&sdata=Jw4Ia%2FeSTkViNxiNN9AaVaOOYpEYTuxMBv
> dJpwfrXLw%3D&reserved=0
> ><https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fwww.patr
> >eon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%
> 7C9712013c0ced44
> >c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C6365799853
> >98096771&sdata=Jw4Ia%2FeSTkViNxiNN9AaVaOOYpEYTuxMBv
> dJpwfrXLw%3D&reserved=0
> >>*
>
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: [royale-compiler] 02/02: try caching some other things to speed up the compiler

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Hi Piotr,

The compiler build passed, but then it can't build the framework.  I'm
looking into it.

-Alex

On 3/30/18, 2:22 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:

>Hi Carlos,
>
>On builds.a.o build pass without the problem on develop [1]
>
>[1] 
>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbuilds.ap
>ache.org%2Fjob%2Froyale-compiler%2F274%2F&data=02%7C01%7Caharui%40adobe.co
>m%7C9712013c0ced44c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C
>0%7C0%7C636579985398096771&sdata=mPVbQW4vbz446Eim2YEizn8e9P4DtxcoLAUi%2B9E
>L3og%3D&reserved=0
>
>Thanks,
>Piotr
>
>2018-03-30 10:17 GMT+02:00 Carlos Rovira <ca...@apache.org>:
>
>> Hi Alex,
>>
>> the problem is only with the latest (caching) . The other one works ok.
>> thanks
>>
>> 2018-03-30 10:06 GMT+02:00 Carlos Rovira <ca...@apache.org>:
>>
>> > Hi Alex,
>> >
>> > the two latest commits in compiler is making projects not compile (at
>> > least in Jewel branch). I'll reset my index below this two commits
>>until
>> > you get that solved
>> >
>> > thanks
>> >
>> >
>> >
>> > 2018-03-30 9:08 GMT+02:00 <ah...@apache.org>:
>> >
>> >> This is an automated email from the ASF dual-hosted git repository.
>> >>
>> >> aharui pushed a commit to branch develop
>> >> in repository
>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a
>>pache.org%2Frepos%2Fasf%2Froyale-compiler.git&data=02%7C01%7Caharui%40ado
>>be.com%7C9712013c0ced44c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178dec
>>ee1%7C0%7C0%7C636579985398096771&sdata=PsiNItK10CLu0F9Hg3Hguj%2F0nxTqBAkx
>>E%2F5fnQl%2FPXQ%3D&reserved=0
>> >>
>> >> commit 52509ab663ffda8808eca6598eef59275e6ee37c
>> >> Author: Alex Harui <ah...@apache.org>
>> >> AuthorDate: Fri Mar 30 00:01:44 2018 -0700
>> >>
>> >>     try caching some other things to speed up the compiler
>> >> ---
>> >>  .../internal/definitions/ClassDefinitionBase.java  | 56
>> >> ++++++++++++----------
>> >>  .../internal/definitions/DefinitionBase.java       |  8 +++-
>> >>  2 files changed, 39 insertions(+), 25 deletions(-)
>> >>
>> >> diff --git 
>>a/compiler/src/main/java/org/apache/royale/compiler/internal
>> >> /definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/a
>> >> pache/royale/compiler/internal/definitions/ClassDefinitionBase.java
>> >> index de73e9b..de8cfe1 100644
>> >> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
>> >> /definitions/ClassDefinitionBase.java
>> >> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
>> >> /definitions/ClassDefinitionBase.java
>> >> @@ -414,6 +414,8 @@ public abstract class ClassDefinitionBase extends
>> >> TypeDefinitionBase implements
>> >>          return new InterfaceDefinition.InterfaceIterator(this,
>> project,
>> >> null);
>> >>      }
>> >>
>> >> +    private ArrayList<IDefinition> baseDefinitions = null;
>> >> +
>> >>      @Override
>> >>      public boolean isInstanceOf(final ITypeDefinition type,
>> >> ICompilerProject project)
>> >>      {
>> >> @@ -423,35 +425,41 @@ public abstract class ClassDefinitionBase
>>extends
>> >> TypeDefinitionBase implements
>> >>
>> >>          if (type instanceof IClassDefinition)
>> >>          {
>> >> -            // We're trying to determine whether this class
>> >> -            // is derived from a specified class ('type').
>> >> -            // Iterate the superclass chain looking for 'type'.
>> >> -            Iterator<IClassDefinition> iter = classIterator(project,
>> >> false);
>> >> -            while (iter.hasNext())
>> >> -            {
>> >> -                IClassDefinition cls = iter.next();
>> >> -                if (cls == type)
>> >> -                    return true;
>> >> -            }
>> >> -            return false;
>> >> +               if (baseDefinitions == null)
>> >> +               {
>> >> +                       baseDefinitions = new
>>ArrayList<IDefinition>();
>> >> +
>> >> +                   // We're trying to determine whether this class
>> >> +                   // is derived from a specified class ('type').
>> >> +                   // Iterate the superclass chain looking for
>>'type'.
>> >> +                   Iterator<IClassDefinition> iter =
>> >> classIterator(project, false);
>> >> +                   while (iter.hasNext())
>> >> +                   {
>> >> +                       IClassDefinition cls = iter.next();
>> >> +                       baseDefinitions.add(cls);
>> >> +                   }
>> >> +               }
>> >>          }
>> >>          else if (type instanceof IInterfaceDefinition)
>> >>          {
>> >> -            // We're trying to determine whether this class
>> >> -            // implements a specified interface ('type').
>> >> -            // Iterate all of the interfaces that this class
>> implements,
>> >> -            // looking for 'type'.
>> >> -            Iterator<IInterfaceDefinition> iter =
>> >> interfaceIterator(project);
>> >> -            while (iter.hasNext())
>> >> -            {
>> >> -                IInterfaceDefinition intf = iter.next();
>> >> -                if (intf == type)
>> >> -                    return true;
>> >> -            }
>> >> -            return false;
>> >> +               if (baseDefinitions == null)
>> >> +               {
>> >> +                       baseDefinitions = new
>>ArrayList<IDefinition>();
>> >> +
>> >> +                   // We're trying to determine whether this class
>> >> +                   // implements a specified interface ('type').
>> >> +                   // Iterate all of the interfaces that this class
>> >> implements,
>> >> +                   // looking for 'type'.
>> >> +                   Iterator<IInterfaceDefinition> iter =
>> >> interfaceIterator(project);
>> >> +                   while (iter.hasNext())
>> >> +                   {
>> >> +                       IInterfaceDefinition intf = iter.next();
>> >> +                       baseDefinitions.add(intf);
>> >> +                   }
>> >> +               }
>> >>          }
>> >>
>> >> -        return false;
>> >> +       return baseDefinitions.contains(type);
>> >>      }
>> >>
>> >>      @Override
>> >> diff --git 
>>a/compiler/src/main/java/org/apache/royale/compiler/internal
>> >> /definitions/DefinitionBase.java b/compiler/src/main/java/org/a
>> >> pache/royale/compiler/internal/definitions/DefinitionBase.java
>> >> index 61fb92a..0626789 100644
>> >> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
>> >> /definitions/DefinitionBase.java
>> >> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
>> >> /definitions/DefinitionBase.java
>> >> @@ -166,6 +166,8 @@ public abstract class DefinitionBase implements
>> >> IDocumentableDefinition, IDefini
>> >>
>> >>      private int absoluteNameStart = 0;
>> >>      private int absoluteNameEnd = 0;
>> >> +
>> >> +    private IDefinition parentDef = null;
>> >>
>> >>      /**
>> >>       * Called by {@code MXMLScopeBuilder} when building definitions
>> from
>> >> @@ -240,6 +242,9 @@ public abstract class DefinitionBase implements
>> >> IDocumentableDefinition, IDefini
>> >>      @Override
>> >>      public IDefinition getParent()
>> >>      {
>> >> +       if (parentDef != null)
>> >> +               return parentDef;
>> >> +
>> >>          IASScope scope = getContainingScope();
>> >>
>> >>          // Walk up the scope chain until we find a scope that has
>> >> @@ -251,7 +256,8 @@ public abstract class DefinitionBase implements
>> >> IDocumentableDefinition, IDefini
>> >>          while ((scope != null) && (scope.getDefinition() == null))
>> >>              scope = scope.getContainingScope();
>> >>
>> >> -        return scope != null ? scope.getDefinition() : null;
>> >> +        parentDef = scope != null ? scope.getDefinition() : null;
>> >> +        return parentDef;
>> >>      }
>> >>
>> >>      @Override
>> >>
>> >> --
>> >> To stop receiving notification emails like this one, please contact
>> >> aharui@apache.org.
>> >>
>> >
>> >
>> >
>> > --
>> > Carlos Rovira
>> > 
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%
>>2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C9712013c0ced44c5003408
>>d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63657998539809677
>>1&sdata=thDk0gFChf36B6RHmAYllwUHU4ss6HwoZnSfvLMIcxw%3D&reserved=0
>> >
>> >
>>
>>
>> --
>> Carlos Rovira
>> 
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%
>>2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C9712013c0ced44c5003408
>>d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63657998539809677
>>1&sdata=thDk0gFChf36B6RHmAYllwUHU4ss6HwoZnSfvLMIcxw%3D&reserved=0
>>
>
>
>
>-- 
>
>Piotr Zarzycki
>
>Patreon: 
>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr
>eon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C9712013c0ced44
>c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6365799853
>98096771&sdata=Jw4Ia%2FeSTkViNxiNN9AaVaOOYpEYTuxMBvdJpwfrXLw%3D&reserved=0
><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr
>eon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C9712013c0ced44
>c5003408d5961fbb1d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6365799853
>98096771&sdata=Jw4Ia%2FeSTkViNxiNN9AaVaOOYpEYTuxMBvdJpwfrXLw%3D&reserved=0
>>*


Re: [royale-compiler] 02/02: try caching some other things to speed up the compiler

Posted by Piotr Zarzycki <pi...@gmail.com>.
Hi Carlos,

On builds.a.o build pass without the problem on develop [1]

[1] https://builds.apache.org/job/royale-compiler/274/

Thanks,
Piotr

2018-03-30 10:17 GMT+02:00 Carlos Rovira <ca...@apache.org>:

> Hi Alex,
>
> the problem is only with the latest (caching) . The other one works ok.
> thanks
>
> 2018-03-30 10:06 GMT+02:00 Carlos Rovira <ca...@apache.org>:
>
> > Hi Alex,
> >
> > the two latest commits in compiler is making projects not compile (at
> > least in Jewel branch). I'll reset my index below this two commits until
> > you get that solved
> >
> > thanks
> >
> >
> >
> > 2018-03-30 9:08 GMT+02:00 <ah...@apache.org>:
> >
> >> This is an automated email from the ASF dual-hosted git repository.
> >>
> >> aharui pushed a commit to branch develop
> >> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
> >>
> >> commit 52509ab663ffda8808eca6598eef59275e6ee37c
> >> Author: Alex Harui <ah...@apache.org>
> >> AuthorDate: Fri Mar 30 00:01:44 2018 -0700
> >>
> >>     try caching some other things to speed up the compiler
> >> ---
> >>  .../internal/definitions/ClassDefinitionBase.java  | 56
> >> ++++++++++++----------
> >>  .../internal/definitions/DefinitionBase.java       |  8 +++-
> >>  2 files changed, 39 insertions(+), 25 deletions(-)
> >>
> >> diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> /definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/a
> >> pache/royale/compiler/internal/definitions/ClassDefinitionBase.java
> >> index de73e9b..de8cfe1 100644
> >> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> /definitions/ClassDefinitionBase.java
> >> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
> >> /definitions/ClassDefinitionBase.java
> >> @@ -414,6 +414,8 @@ public abstract class ClassDefinitionBase extends
> >> TypeDefinitionBase implements
> >>          return new InterfaceDefinition.InterfaceIterator(this,
> project,
> >> null);
> >>      }
> >>
> >> +    private ArrayList<IDefinition> baseDefinitions = null;
> >> +
> >>      @Override
> >>      public boolean isInstanceOf(final ITypeDefinition type,
> >> ICompilerProject project)
> >>      {
> >> @@ -423,35 +425,41 @@ public abstract class ClassDefinitionBase extends
> >> TypeDefinitionBase implements
> >>
> >>          if (type instanceof IClassDefinition)
> >>          {
> >> -            // We're trying to determine whether this class
> >> -            // is derived from a specified class ('type').
> >> -            // Iterate the superclass chain looking for 'type'.
> >> -            Iterator<IClassDefinition> iter = classIterator(project,
> >> false);
> >> -            while (iter.hasNext())
> >> -            {
> >> -                IClassDefinition cls = iter.next();
> >> -                if (cls == type)
> >> -                    return true;
> >> -            }
> >> -            return false;
> >> +               if (baseDefinitions == null)
> >> +               {
> >> +                       baseDefinitions = new ArrayList<IDefinition>();
> >> +
> >> +                   // We're trying to determine whether this class
> >> +                   // is derived from a specified class ('type').
> >> +                   // Iterate the superclass chain looking for 'type'.
> >> +                   Iterator<IClassDefinition> iter =
> >> classIterator(project, false);
> >> +                   while (iter.hasNext())
> >> +                   {
> >> +                       IClassDefinition cls = iter.next();
> >> +                       baseDefinitions.add(cls);
> >> +                   }
> >> +               }
> >>          }
> >>          else if (type instanceof IInterfaceDefinition)
> >>          {
> >> -            // We're trying to determine whether this class
> >> -            // implements a specified interface ('type').
> >> -            // Iterate all of the interfaces that this class
> implements,
> >> -            // looking for 'type'.
> >> -            Iterator<IInterfaceDefinition> iter =
> >> interfaceIterator(project);
> >> -            while (iter.hasNext())
> >> -            {
> >> -                IInterfaceDefinition intf = iter.next();
> >> -                if (intf == type)
> >> -                    return true;
> >> -            }
> >> -            return false;
> >> +               if (baseDefinitions == null)
> >> +               {
> >> +                       baseDefinitions = new ArrayList<IDefinition>();
> >> +
> >> +                   // We're trying to determine whether this class
> >> +                   // implements a specified interface ('type').
> >> +                   // Iterate all of the interfaces that this class
> >> implements,
> >> +                   // looking for 'type'.
> >> +                   Iterator<IInterfaceDefinition> iter =
> >> interfaceIterator(project);
> >> +                   while (iter.hasNext())
> >> +                   {
> >> +                       IInterfaceDefinition intf = iter.next();
> >> +                       baseDefinitions.add(intf);
> >> +                   }
> >> +               }
> >>          }
> >>
> >> -        return false;
> >> +       return baseDefinitions.contains(type);
> >>      }
> >>
> >>      @Override
> >> diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> /definitions/DefinitionBase.java b/compiler/src/main/java/org/a
> >> pache/royale/compiler/internal/definitions/DefinitionBase.java
> >> index 61fb92a..0626789 100644
> >> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
> >> /definitions/DefinitionBase.java
> >> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
> >> /definitions/DefinitionBase.java
> >> @@ -166,6 +166,8 @@ public abstract class DefinitionBase implements
> >> IDocumentableDefinition, IDefini
> >>
> >>      private int absoluteNameStart = 0;
> >>      private int absoluteNameEnd = 0;
> >> +
> >> +    private IDefinition parentDef = null;
> >>
> >>      /**
> >>       * Called by {@code MXMLScopeBuilder} when building definitions
> from
> >> @@ -240,6 +242,9 @@ public abstract class DefinitionBase implements
> >> IDocumentableDefinition, IDefini
> >>      @Override
> >>      public IDefinition getParent()
> >>      {
> >> +       if (parentDef != null)
> >> +               return parentDef;
> >> +
> >>          IASScope scope = getContainingScope();
> >>
> >>          // Walk up the scope chain until we find a scope that has
> >> @@ -251,7 +256,8 @@ public abstract class DefinitionBase implements
> >> IDocumentableDefinition, IDefini
> >>          while ((scope != null) && (scope.getDefinition() == null))
> >>              scope = scope.getContainingScope();
> >>
> >> -        return scope != null ? scope.getDefinition() : null;
> >> +        parentDef = scope != null ? scope.getDefinition() : null;
> >> +        return parentDef;
> >>      }
> >>
> >>      @Override
> >>
> >> --
> >> To stop receiving notification emails like this one, please contact
> >> aharui@apache.org.
> >>
> >
> >
> >
> > --
> > Carlos Rovira
> > http://about.me/carlosrovira
> >
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>



-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Re: [royale-compiler] 02/02: try caching some other things to speed up the compiler

Posted by Carlos Rovira <ca...@apache.org>.
Hi Alex,

the problem is only with the latest (caching) . The other one works ok.
thanks

2018-03-30 10:06 GMT+02:00 Carlos Rovira <ca...@apache.org>:

> Hi Alex,
>
> the two latest commits in compiler is making projects not compile (at
> least in Jewel branch). I'll reset my index below this two commits until
> you get that solved
>
> thanks
>
>
>
> 2018-03-30 9:08 GMT+02:00 <ah...@apache.org>:
>
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> aharui pushed a commit to branch develop
>> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
>>
>> commit 52509ab663ffda8808eca6598eef59275e6ee37c
>> Author: Alex Harui <ah...@apache.org>
>> AuthorDate: Fri Mar 30 00:01:44 2018 -0700
>>
>>     try caching some other things to speed up the compiler
>> ---
>>  .../internal/definitions/ClassDefinitionBase.java  | 56
>> ++++++++++++----------
>>  .../internal/definitions/DefinitionBase.java       |  8 +++-
>>  2 files changed, 39 insertions(+), 25 deletions(-)
>>
>> diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal
>> /definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/a
>> pache/royale/compiler/internal/definitions/ClassDefinitionBase.java
>> index de73e9b..de8cfe1 100644
>> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
>> /definitions/ClassDefinitionBase.java
>> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
>> /definitions/ClassDefinitionBase.java
>> @@ -414,6 +414,8 @@ public abstract class ClassDefinitionBase extends
>> TypeDefinitionBase implements
>>          return new InterfaceDefinition.InterfaceIterator(this, project,
>> null);
>>      }
>>
>> +    private ArrayList<IDefinition> baseDefinitions = null;
>> +
>>      @Override
>>      public boolean isInstanceOf(final ITypeDefinition type,
>> ICompilerProject project)
>>      {
>> @@ -423,35 +425,41 @@ public abstract class ClassDefinitionBase extends
>> TypeDefinitionBase implements
>>
>>          if (type instanceof IClassDefinition)
>>          {
>> -            // We're trying to determine whether this class
>> -            // is derived from a specified class ('type').
>> -            // Iterate the superclass chain looking for 'type'.
>> -            Iterator<IClassDefinition> iter = classIterator(project,
>> false);
>> -            while (iter.hasNext())
>> -            {
>> -                IClassDefinition cls = iter.next();
>> -                if (cls == type)
>> -                    return true;
>> -            }
>> -            return false;
>> +               if (baseDefinitions == null)
>> +               {
>> +                       baseDefinitions = new ArrayList<IDefinition>();
>> +
>> +                   // We're trying to determine whether this class
>> +                   // is derived from a specified class ('type').
>> +                   // Iterate the superclass chain looking for 'type'.
>> +                   Iterator<IClassDefinition> iter =
>> classIterator(project, false);
>> +                   while (iter.hasNext())
>> +                   {
>> +                       IClassDefinition cls = iter.next();
>> +                       baseDefinitions.add(cls);
>> +                   }
>> +               }
>>          }
>>          else if (type instanceof IInterfaceDefinition)
>>          {
>> -            // We're trying to determine whether this class
>> -            // implements a specified interface ('type').
>> -            // Iterate all of the interfaces that this class implements,
>> -            // looking for 'type'.
>> -            Iterator<IInterfaceDefinition> iter =
>> interfaceIterator(project);
>> -            while (iter.hasNext())
>> -            {
>> -                IInterfaceDefinition intf = iter.next();
>> -                if (intf == type)
>> -                    return true;
>> -            }
>> -            return false;
>> +               if (baseDefinitions == null)
>> +               {
>> +                       baseDefinitions = new ArrayList<IDefinition>();
>> +
>> +                   // We're trying to determine whether this class
>> +                   // implements a specified interface ('type').
>> +                   // Iterate all of the interfaces that this class
>> implements,
>> +                   // looking for 'type'.
>> +                   Iterator<IInterfaceDefinition> iter =
>> interfaceIterator(project);
>> +                   while (iter.hasNext())
>> +                   {
>> +                       IInterfaceDefinition intf = iter.next();
>> +                       baseDefinitions.add(intf);
>> +                   }
>> +               }
>>          }
>>
>> -        return false;
>> +       return baseDefinitions.contains(type);
>>      }
>>
>>      @Override
>> diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal
>> /definitions/DefinitionBase.java b/compiler/src/main/java/org/a
>> pache/royale/compiler/internal/definitions/DefinitionBase.java
>> index 61fb92a..0626789 100644
>> --- a/compiler/src/main/java/org/apache/royale/compiler/internal
>> /definitions/DefinitionBase.java
>> +++ b/compiler/src/main/java/org/apache/royale/compiler/internal
>> /definitions/DefinitionBase.java
>> @@ -166,6 +166,8 @@ public abstract class DefinitionBase implements
>> IDocumentableDefinition, IDefini
>>
>>      private int absoluteNameStart = 0;
>>      private int absoluteNameEnd = 0;
>> +
>> +    private IDefinition parentDef = null;
>>
>>      /**
>>       * Called by {@code MXMLScopeBuilder} when building definitions from
>> @@ -240,6 +242,9 @@ public abstract class DefinitionBase implements
>> IDocumentableDefinition, IDefini
>>      @Override
>>      public IDefinition getParent()
>>      {
>> +       if (parentDef != null)
>> +               return parentDef;
>> +
>>          IASScope scope = getContainingScope();
>>
>>          // Walk up the scope chain until we find a scope that has
>> @@ -251,7 +256,8 @@ public abstract class DefinitionBase implements
>> IDocumentableDefinition, IDefini
>>          while ((scope != null) && (scope.getDefinition() == null))
>>              scope = scope.getContainingScope();
>>
>> -        return scope != null ? scope.getDefinition() : null;
>> +        parentDef = scope != null ? scope.getDefinition() : null;
>> +        return parentDef;
>>      }
>>
>>      @Override
>>
>> --
>> To stop receiving notification emails like this one, please contact
>> aharui@apache.org.
>>
>
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: [royale-compiler] 02/02: try caching some other things to speed up the compiler

Posted by Carlos Rovira <ca...@apache.org>.
Hi Alex,

the two latest commits in compiler is making projects not compile (at least
in Jewel branch). I'll reset my index below this two commits until you get
that solved

thanks



2018-03-30 9:08 GMT+02:00 <ah...@apache.org>:

> This is an automated email from the ASF dual-hosted git repository.
>
> aharui pushed a commit to branch develop
> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
>
> commit 52509ab663ffda8808eca6598eef59275e6ee37c
> Author: Alex Harui <ah...@apache.org>
> AuthorDate: Fri Mar 30 00:01:44 2018 -0700
>
>     try caching some other things to speed up the compiler
> ---
>  .../internal/definitions/ClassDefinitionBase.java  | 56
> ++++++++++++----------
>  .../internal/definitions/DefinitionBase.java       |  8 +++-
>  2 files changed, 39 insertions(+), 25 deletions(-)
>
> diff --git a/compiler/src/main/java/org/apache/royale/compiler/
> internal/definitions/ClassDefinitionBase.java
> b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/
> ClassDefinitionBase.java
> index de73e9b..de8cfe1 100644
> --- a/compiler/src/main/java/org/apache/royale/compiler/
> internal/definitions/ClassDefinitionBase.java
> +++ b/compiler/src/main/java/org/apache/royale/compiler/
> internal/definitions/ClassDefinitionBase.java
> @@ -414,6 +414,8 @@ public abstract class ClassDefinitionBase extends
> TypeDefinitionBase implements
>          return new InterfaceDefinition.InterfaceIterator(this, project,
> null);
>      }
>
> +    private ArrayList<IDefinition> baseDefinitions = null;
> +
>      @Override
>      public boolean isInstanceOf(final ITypeDefinition type,
> ICompilerProject project)
>      {
> @@ -423,35 +425,41 @@ public abstract class ClassDefinitionBase extends
> TypeDefinitionBase implements
>
>          if (type instanceof IClassDefinition)
>          {
> -            // We're trying to determine whether this class
> -            // is derived from a specified class ('type').
> -            // Iterate the superclass chain looking for 'type'.
> -            Iterator<IClassDefinition> iter = classIterator(project,
> false);
> -            while (iter.hasNext())
> -            {
> -                IClassDefinition cls = iter.next();
> -                if (cls == type)
> -                    return true;
> -            }
> -            return false;
> +               if (baseDefinitions == null)
> +               {
> +                       baseDefinitions = new ArrayList<IDefinition>();
> +
> +                   // We're trying to determine whether this class
> +                   // is derived from a specified class ('type').
> +                   // Iterate the superclass chain looking for 'type'.
> +                   Iterator<IClassDefinition> iter =
> classIterator(project, false);
> +                   while (iter.hasNext())
> +                   {
> +                       IClassDefinition cls = iter.next();
> +                       baseDefinitions.add(cls);
> +                   }
> +               }
>          }
>          else if (type instanceof IInterfaceDefinition)
>          {
> -            // We're trying to determine whether this class
> -            // implements a specified interface ('type').
> -            // Iterate all of the interfaces that this class implements,
> -            // looking for 'type'.
> -            Iterator<IInterfaceDefinition> iter =
> interfaceIterator(project);
> -            while (iter.hasNext())
> -            {
> -                IInterfaceDefinition intf = iter.next();
> -                if (intf == type)
> -                    return true;
> -            }
> -            return false;
> +               if (baseDefinitions == null)
> +               {
> +                       baseDefinitions = new ArrayList<IDefinition>();
> +
> +                   // We're trying to determine whether this class
> +                   // implements a specified interface ('type').
> +                   // Iterate all of the interfaces that this class
> implements,
> +                   // looking for 'type'.
> +                   Iterator<IInterfaceDefinition> iter =
> interfaceIterator(project);
> +                   while (iter.hasNext())
> +                   {
> +                       IInterfaceDefinition intf = iter.next();
> +                       baseDefinitions.add(intf);
> +                   }
> +               }
>          }
>
> -        return false;
> +       return baseDefinitions.contains(type);
>      }
>
>      @Override
> diff --git a/compiler/src/main/java/org/apache/royale/compiler/
> internal/definitions/DefinitionBase.java b/compiler/src/main/java/org/
> apache/royale/compiler/internal/definitions/DefinitionBase.java
> index 61fb92a..0626789 100644
> --- a/compiler/src/main/java/org/apache/royale/compiler/
> internal/definitions/DefinitionBase.java
> +++ b/compiler/src/main/java/org/apache/royale/compiler/
> internal/definitions/DefinitionBase.java
> @@ -166,6 +166,8 @@ public abstract class DefinitionBase implements
> IDocumentableDefinition, IDefini
>
>      private int absoluteNameStart = 0;
>      private int absoluteNameEnd = 0;
> +
> +    private IDefinition parentDef = null;
>
>      /**
>       * Called by {@code MXMLScopeBuilder} when building definitions from
> @@ -240,6 +242,9 @@ public abstract class DefinitionBase implements
> IDocumentableDefinition, IDefini
>      @Override
>      public IDefinition getParent()
>      {
> +       if (parentDef != null)
> +               return parentDef;
> +
>          IASScope scope = getContainingScope();
>
>          // Walk up the scope chain until we find a scope that has
> @@ -251,7 +256,8 @@ public abstract class DefinitionBase implements
> IDocumentableDefinition, IDefini
>          while ((scope != null) && (scope.getDefinition() == null))
>              scope = scope.getContainingScope();
>
> -        return scope != null ? scope.getDefinition() : null;
> +        parentDef = scope != null ? scope.getDefinition() : null;
> +        return parentDef;
>      }
>
>      @Override
>
> --
> To stop receiving notification emails like this one, please contact
> aharui@apache.org.
>



-- 
Carlos Rovira
http://about.me/carlosrovira