Charj: Merged changes.
authorJonathan Lifflander <jliffl2@illinois.edu>
Wed, 30 Jun 2010 22:24:13 +0000 (17:24 -0500)
committerJonathan Lifflander <jliffl2@illinois.edu>
Wed, 30 Jun 2010 22:24:13 +0000 (17:24 -0500)
Merge branch 'charm' of charmgit:charm into charm

Conflicts:
src/langs/charj/src/charj/translator/AstModifier.java
src/langs/charj/src/charj/translator/Charj.stg

1  2 
src/langs/charj/src/charj/translator/Charj.g
src/langs/charj/src/charj/translator/Charj.stg
src/langs/charj/src/charj/translator/CharjASTModifier.g
src/langs/charj/src/charj/translator/CharjASTModifier2.g
src/langs/charj/src/charj/translator/CharjEmitter.g
src/langs/charj/src/charj/translator/CharjSemantics.g
src/langs/charj/src/charj/translator/ClassSymbol.java
src/langs/charj/src/charj/translator/SymbolDefiner.g

index e4a1446771b983e26600e9c23e2990bca2e95a9e,17819e2b506985f9778badcf9d4c412cc81b3bde..53ebbb230ba5c141b01635db2557f2731ada640d
@@@ -18,8 -18,10 +18,9 @@@ options 
  tokens {
  
      ENTRY                   = 'entry'           ;
+     TRACED                  = 'traced'          ;
      PUBLIC                  = 'public'          ;
      PROTECTED               = 'protected'       ;
 -    ENTRY                   = 'entry'           ;
      PRIVATE                 = 'private'         ;
      ABSTRACT                = 'abstract'        ;
      NATIVE                  = 'native'          ;
index 14261faa318aa5048aad6463584738d33539d06d,03f2c79afa793d04598889693dd1fb9bf8be6355..ec65456fd49571984317f59733b63e50e79ef303
@@@ -146,10 -146,9 +146,12 @@@ class <ident> 
  <endif>
  
      <csds; separator="\n\n">
 -    
 +    <if(!hasDefaultCtor)>
 +    public: <ident>();
 +    <endif>
 +    protected: void constructorHelper();
+     static bool _trace_registered;
+     void _initTrace();
  };
  <endif>
  >>
@@@ -169,22 -168,22 +171,34 @@@ classDeclaration_cc_cont(pds, sym, iden
  <<
  <if(first(pds))>namespace <first(pds)>
  {
 -    <classDeclaration_cc_cont(pds = rest(pds), sym = sym, ident = ident, ext = ext, csds = csds)>
 +    <classDeclaration_cc_cont(pds = rest(pds), sym = sym, ident = ident, ext = ext, csds = csds, hasDefaultCtor = hasDefaultCtor)>
  } // namespace <first(pds)>
  <else>
+ #ifdef _CHARJ_TRACE_ALL_METHODS || _CHARJ_TRACE_TRACED_METHODS
+ #include \<trace-projections.h\>
+ #endif
  <csds; separator="\n\n">
  
 +<if(!hasDefaultCtor)>
 +<ident>::<ident>()
 +{
 +    constructorHelper();
 +}
 +<endif>
 +
 +void <ident>::constructorHelper()
 +{
 +
 +}
++
+ bool <sym.name>::_trace_registered = false;
+ void <sym.name>::_initTrace() {
+     #ifdef _CHARJ_TRACE_ALL_METHODS || _CHARJ_TRACE_TRACED_METHODS
+     if (_trace_registered) return;
+     <sym.traceInitializers; separator="\n">
+     _trace_registered = true;
+     #endif
+ }
  <endif>
  >>
  
@@@ -200,45 -199,22 +214,57 @@@ chareDeclaration_cc_cont(pds, sym, iden
  <<
  <if(first(pds))>namespace <first(pds)>
  {
 -    <chareDeclaration_cc_cont(pds = rest(pds), sym = sym, ident = ident, ext = ext, csds = csds)>
 +    <chareDeclaration_cc_cont(pds = rest(pds), sym = sym, ident = ident, ext = ext, csds = csds, pupers = pupers, pupInits = pupInits, hasDefaultCtor = hasDefaultCtor, needsMigration = needsMigration, inits = inits)>
  } // namespace <first(pds)>
  <else>
+ #ifdef _CHARJ_TRACE_ALL_METHODS || _CHARJ_TRACE_TRACED_METHODS
+ #include \<trace-projections.h\>
+ #endif
  <csds; separator="\n\n">
  
 +<if(pupInits)>
 +void <ident>::pupInitMethod() 
 +{
 +    <pupInits; separator="\n">
 +}
 +<endif>
 +
 +void <ident>::pup(PUP::er &p) 
 +{
 +<if(pupInits)>
 +    pupInitMethod();
 +
 +<endif>
 +    <pupers; separator="\n">
 +}
 +
 +<if(!hasDefaultCtor)>
 +<ident>::<ident>()
 +{
 +    constructorHelper();
 +}
 +<endif>
 +
 +void <ident>::constructorHelper()
 +{
 +    <inits; separator="\n">
 +}
 +
 +<if(needsMigration)>
 +<ident>::<ident>(CkMigrateMessage *m)
 +{
 +    constructorHelper();
 +}
 +<endif>
++
+ bool <sym.name>::_trace_registered = false;
+ void <sym.name>::_initTrace() {
+     #ifdef _CHARJ_TRACE_ALL_METHODS || _CHARJ_TRACE_TRACED_METHODS
+     if (_trace_registered) return;
+     <sym.traceInitializers; separator="\n">
+     _trace_registered = true;
+     #endif
+ }
  <endif>
  >>
  
@@@ -260,17 -236,9 +286,19 @@@ chareDeclaration_h_cont(pds, sym, ident
  <if(ext)>/* superclass: <ext> */<endif>
  class <ident>: public CBase_<ident> {
      <csds; separator="\n">
 -
 +    <if(needsPupInit)>
 +    private: void pupInitMethod();
 +    <endif>
 +    public: void pup(PUP::er& p);
 +    <if(!hasDefaultCtor)>
 +    public: <ident>();
 +    <endif>
 +    protected: void constructorHelper();
 +    <if(needsMigration)>
 +    public: <ident>(CkMigrateMessage*);
 +    <endif>
+     static bool _trace_registered;
+     void _initTrace();
  };
  <endif>
  >>
index c34570a6a379a4bd8ce0e6c0e2e5f9cd2802199d,24b8b6028b65800cc30ed530bc444b8aa964a68a..853521905c8ae488058c4e779e995ad264add981
@@@ -180,31 -190,11 +180,32 @@@ boun
      :   ^(EXTENDS_BOUND_LIST type+)
      ;
  
 -modifierList
 -    :   ^(MODIFIER_LIST modifier+)
 -        {
 -            astmod.arrangeModifiers($MODIFIER_LIST.tree);
 -        }
 +modifierList returns [boolean isEntry]
 +    :   ^(MODIFIER_LIST (localModifier | (am+=accessModifier) | charjModifier {if ($charjModifier.isEntry) {$isEntry = true;}} | otherModifier)*)
 +        -> {$am == null}? ^(MODIFIER_LIST ^(ACCESS_MODIFIER_LIST 'private') ^(LOCAL_MODIFIER_LIST localModifier*) ^(CHARJ_MODIFIER_LIST charjModifier*) ^(OTHER_MODIFIER_LIST otherModifier*))
 +        -> ^(MODIFIER_LIST ^(ACCESS_MODIFIER_LIST accessModifier*) ^(LOCAL_MODIFIER_LIST localModifier*) ^(CHARJ_MODIFIER_LIST charjModifier*) ^(OTHER_MODIFIER_LIST otherModifier*)) 
 +    ;
 +
 +localModifier
 +    :   FINAL
 +    |   STATIC
 +    |   VOLATILE
 +    ;
 +
 +accessModifier
 +    :   PUBLIC
 +    |   PROTECTED
 +    |   PRIVATE
 +    ;
 +
 +charjModifier returns [boolean isEntry] 
 +    :   ENTRY { $isEntry = true; }
++    |   TRACED
 +    ;
 +
 +otherModifier
 +    :   ABSTRACT
 +    |   NATIVE
      ;
  
  modifier
index 50ae66689c1b1b2929fe86c22b03192e59aa922d,a9fe462699c1d88aebf6210b575515b2954c4235..affae75ff738a04253c657abd52eaa838f0fbc7b
@@@ -181,15 -181,15 +181,11 @@@ scope ScopeStack
      |   ^(CONSTRUCTOR_DECL m=modifierList? g=genericTypeParameterList? IDENT f=formalParameterList 
              b=block)
          {
--            if (astmod.isMigrationCtor($CONSTRUCTOR_DECL)) currentClass.migrationCtor = $CONSTRUCTOR_DECL;
--            if (currentClass != null) {
--                currentClass.constructor = $classScopeDeclaration.start;
--            }
++
          }
      |   ^(ENTRY_CONSTRUCTOR_DECL m=modifierList? g=genericTypeParameterList? IDENT f=formalParameterList 
              b=block)
          {
--            if (astmod.isMigrationCtor($ENTRY_CONSTRUCTOR_DECL)) currentClass.migrationCtor = $ENTRY_CONSTRUCTOR_DECL;
          }
      ;
  
@@@ -220,11 -220,11 +216,6 @@@ variableDeclarator[boolean localdef
  variableDeclaratorId[boolean localdef] returns [String ident]
      :   ^(IDENT domainExpression?
          { 
--            if (currentClass != null && !localdef) {
--                currentClass.initializers.add($variableDeclaratorId.start);
--            }
--
--            $ident = $IDENT.text;
          } )
      ;
  
@@@ -563,9 -564,9 +555,6 @@@ arrayTypeDeclarato
  newExpression
      :   ^(NEW_EXPRESSION arguments? domainExpression)
          {
--            if (currentClass != null) {
--                currentClass.initializers.add($newExpression.start);
--            }
          }
      |   ^(NEW type arguments)
      ;
index e1ca96ffd844944ad42ec3680d6668502fe16db4,6d1e06e083b57fe5377d82caffb792c7a0d77aa9..eca92cc18c05c9d89254901e2bc931a78d1dc12b
@@@ -101,9 -109,9 +109,6 @@@ boolean entry = false
      |   ^((CONSTRUCTOR_DECL
            | ENTRY_CONSTRUCTOR_DECL {
                  entry = true;
--                if (astmod.isMigrationCtor($ENTRY_CONSTRUCTOR_DECL)) {
--                    currentClass.migrationCtor = $ENTRY_CONSTRUCTOR_DECL;
--                }
              })
              (^(MODIFIER_LIST .*))?
              (^(GENERIC_TYPE_PARAM_LIST .*))?