Changes in / [23b6643f:aefcc3b]


Ignore:
Location:
src
Files:
2 deleted
34 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/GenType.cc

    r23b6643f raefcc3b  
    4242                virtual void visit( TypeInstType *typeInst );
    4343                virtual void visit( VarArgsType *varArgsType );
    44                 virtual void visit( ZeroType *zeroType );
    45                 virtual void visit( OneType *oneType );
    4644
    4745          private:
     
    202200        }
    203201
    204         void GenType::visit( ZeroType *zeroType ) {
    205                 // ideally these wouldn't hit codegen at all, but should be safe to make them ints
    206                 typeString = "int " + typeString;
    207                 handleQualifiers( zeroType );
    208         }
    209 
    210         void GenType::visit( OneType *oneType ) {
    211                 // ideally these wouldn't hit codegen at all, but should be safe to make them ints
    212                 typeString = "int " + typeString;
    213                 handleQualifiers( oneType );
    214         }
    215 
    216202        void GenType::handleQualifiers( Type *type ) {
    217203                if ( type->get_isConst() ) {
  • src/Makefile.in

    r23b6643f raefcc3b  
    164164        SynTree/driver_cfa_cpp-AttrType.$(OBJEXT) \
    165165        SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT) \
    166         SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) \
    167166        SynTree/driver_cfa_cpp-Constant.$(OBJEXT) \
    168167        SynTree/driver_cfa_cpp-Expression.$(OBJEXT) \
     
    389388        SynTree/ReferenceToType.cc SynTree/TupleType.cc \
    390389        SynTree/TypeofType.cc SynTree/AttrType.cc \
    391         SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
    392         SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
     390        SynTree/VarArgsType.cc SynTree/Constant.cc \
     391        SynTree/Expression.cc SynTree/TupleExpr.cc \
    393392        SynTree/CommaExpr.cc SynTree/TypeExpr.cc \
    394393        SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \
     
    711710SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
    712711        SynTree/$(DEPDIR)/$(am__dirstamp)
    713 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
    714         SynTree/$(DEPDIR)/$(am__dirstamp)
    715712SynTree/driver_cfa_cpp-Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
    716713        SynTree/$(DEPDIR)/$(am__dirstamp)
     
    874871        -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT)
    875872        -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
    876         -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT)
    877873        -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT)
    878874        -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
     
    979975@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@
    980976@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
    981 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@
    982977@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@
    983978@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po@am__quote@
     
    20482043@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    20492044@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi`
    2050 
    2051 SynTree/driver_cfa_cpp-ZeroOneType.o: SynTree/ZeroOneType.cc
    2052 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc
    2053 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po
    2054 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.o' libtool=no @AMDEPBACKSLASH@
    2055 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2056 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc
    2057 
    2058 SynTree/driver_cfa_cpp-ZeroOneType.obj: SynTree/ZeroOneType.cc
    2059 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi`
    2060 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po
    2061 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.obj' libtool=no @AMDEPBACKSLASH@
    2062 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2063 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi`
    20642045
    20652046SynTree/driver_cfa_cpp-Constant.o: SynTree/Constant.cc
  • src/ResolvExpr/AdjustExprType.cc

    r23b6643f raefcc3b  
    3737                virtual Type* mutate( TupleType *tupleType );
    3838                virtual Type* mutate( VarArgsType *varArgsType );
    39                 virtual Type* mutate( ZeroType *zeroType );
    40                 virtual Type* mutate( OneType *oneType );
    4139
    4240                const TypeEnvironment &env;
     
    119117                return varArgsType;
    120118        }
    121 
    122         Type *AdjustExprType::mutate( ZeroType *zeroType ) {
    123                 return zeroType;
    124         }
    125 
    126         Type *AdjustExprType::mutate( OneType *oneType ) {
    127                 return oneType;
    128         }
    129119} // namespace ResolvExpr
    130120
  • src/ResolvExpr/CommonType.cc

    r23b6643f raefcc3b  
    3939                virtual void visit( TupleType *tupleType );
    4040                virtual void visit( VarArgsType *varArgsType );
    41                 virtual void visit( ZeroType *zeroType );
    42                 virtual void visit( OneType *oneType );
    4341
    4442                template< typename RefType > void handleRefType( RefType *inst, Type *other );
     
    136134                                result = new BasicType( basicType->get_qualifiers() + otherBasic->get_qualifiers(), newType );
    137135                        } // if
    138                 } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
    139                         // use signed int in lieu of the enum/zero/one type
     136                } else if ( EnumInstType *enumInstType = dynamic_cast< EnumInstType * > ( type2 ) ) {
     137                        // use signed int in lieu of the enum type
    140138                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ];
    141                         if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= type2->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= type2->get_qualifiers() ) || widenSecond ) ) {
    142                                 result = new BasicType( basicType->get_qualifiers() + type2->get_qualifiers(), newType );
     139                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= enumInstType->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= enumInstType->get_qualifiers() ) || widenSecond ) ) {
     140                                result = new BasicType( basicType->get_qualifiers() + enumInstType->get_qualifiers(), newType );
    143141                        } // if
    144142                } // if
     
    173171                                otherPointer->get_base()->get_qualifiers() = tq2;
    174172                        } // if
    175                 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) {
    176                         result = pointerType->clone();
    177                         result->get_qualifiers() += type2->get_qualifiers();
    178173                } // if
    179174        }
     
    195190
    196191        void CommonType::visit( EnumInstType *enumInstType ) {
    197                 if ( dynamic_cast< BasicType * >( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
     192                if ( dynamic_cast< BasicType * >( type2 ) ) {
    198193                        // reuse BasicType, EnumInstType code by swapping type2 with enumInstType
    199194                        Type * temp = type2;
     
    235230        void CommonType::visit( VarArgsType *varArgsType ) {
    236231        }
    237 
    238         void CommonType::visit( ZeroType *zeroType ) {
    239                 if ( widenFirst ) {
    240                         if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< PointerType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) {
    241                                 if ( widenSecond || zeroType->get_qualifiers() <= type2->get_qualifiers() ) {
    242                                         result = type2->clone();
    243                                         result->get_qualifiers() += zeroType->get_qualifiers();
    244                                 }
    245                         }
    246                 }
    247         }
    248 
    249         void CommonType::visit( OneType *oneType ) {
    250                 if ( widenFirst ) {
    251                         if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) {
    252                                 if ( widenSecond || oneType->get_qualifiers() <= type2->get_qualifiers() ) {
    253                                         result = type2->clone();
    254                                         result->get_qualifiers() += oneType->get_qualifiers();
    255                                 }
    256                         }
    257                 }
    258         }
    259232} // namespace ResolvExpr
    260233
  • src/ResolvExpr/ConversionCost.cc

    r23b6643f raefcc3b  
    160160                        // xxx - not positive this is correct, but appears to allow casting int => enum
    161161                        cost = Cost( 1, 0, 0 );
    162                 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) {
    163                         cost = Cost( 1, 0, 0 );
    164                 } // if
     162    } // if
    165163        }
    166164
     
    177175                                } // if
    178176                        } // if
    179                 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) {
    180                         cost = Cost( 1, 0, 0 );
    181177                } // if
    182178        }
     
    260256                }
    261257        }
    262 
    263         void ConversionCost::visit(ZeroType *zeroType) {
    264                 if ( dynamic_cast< ZeroType* >( dest ) ) {
    265                         cost = Cost::zero;
    266                 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
    267                         // copied from visit(BasicType*) for signed int, but +1 for safe conversions
    268                         int tableResult = costMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ];
    269                         if ( tableResult == -1 ) {
    270                                 cost = Cost( 1, 0, 0 );
    271                         } else {
    272                                 cost = Cost( 0, 0, tableResult + 1 );
    273                         }
    274                 } else if ( dynamic_cast< PointerType* >( dest ) ) {
    275                         cost = Cost( 0, 0, 1 );
    276                 }
    277         }
    278 
    279         void ConversionCost::visit(OneType *oneType) {
    280                 if ( dynamic_cast< OneType* >( dest ) ) {
    281                         cost = Cost::zero;
    282                 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
    283                         // copied from visit(BasicType*) for signed int, but +1 for safe conversions
    284                         int tableResult = costMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ];
    285                         if ( tableResult == -1 ) {
    286                                 cost = Cost( 1, 0, 0 );
    287                         } else {
    288                                 cost = Cost( 0, 0, tableResult + 1 );
    289                         }
    290                 }
    291         }
    292258} // namespace ResolvExpr
    293259
  • src/ResolvExpr/ConversionCost.h

    r23b6643f raefcc3b  
    4141                virtual void visit(TupleType *tupleType);
    4242                virtual void visit(VarArgsType *varArgsType);
    43                 virtual void visit(ZeroType *zeroType);
    44                 virtual void visit(OneType *oneType);
    4543          protected:
    4644                Type *dest;
  • src/ResolvExpr/PtrsAssignable.cc

    r23b6643f raefcc3b  
    3939                virtual void visit( TupleType *tupleType );
    4040                virtual void visit( VarArgsType *varArgsType );
    41                 virtual void visit( ZeroType *zeroType );
    42                 virtual void visit( OneType *oneType );
    4341          private:
    4442                Type *dest;
     
    143141        void PtrsAssignable::visit( VarArgsType *varArgsType ) {
    144142        }
    145 
    146         void PtrsAssignable::visit( ZeroType *zeroType ) {
    147         }
    148        
    149         void PtrsAssignable::visit( OneType *oneType ) {
    150         }
    151        
    152143} // namespace ResolvExpr
    153144
  • src/ResolvExpr/PtrsCastable.cc

    r23b6643f raefcc3b  
    4040                virtual void visit(TupleType *tupleType);
    4141                virtual void visit(VarArgsType *varArgsType);
    42                 virtual void visit(ZeroType *zeroType);
    43                 virtual void visit(OneType *oneType);
    4442          private:
    4543                Type *dest;
     
    146144                result = objectCast( dest, env, indexer );
    147145        }
    148 
    149         void PtrsCastable::visit(ZeroType *zeroType) {
    150                 result = objectCast( dest, env, indexer );
    151         }
    152 
    153         void PtrsCastable::visit(OneType *oneType) {
    154                 result = objectCast( dest, env, indexer );
    155         }
    156146} // namespace ResolvExpr
    157147
  • src/ResolvExpr/RenameVars.cc

    r23b6643f raefcc3b  
    110110        }
    111111
    112         void RenameVars::visit( ZeroType *zeroType ) {
    113                 typeBefore( zeroType );
    114                 typeAfter( zeroType );
    115         }
    116 
    117         void RenameVars::visit( OneType *oneType ) {
    118                 typeBefore( oneType );
    119                 typeAfter( oneType );
    120         }
    121 
    122112        void RenameVars::typeBefore( Type *type ) {
    123113                if ( ! type->get_forall().empty() ) {
  • src/ResolvExpr/RenameVars.h

    r23b6643f raefcc3b  
    4444                virtual void visit( TupleType *tupleType );
    4545                virtual void visit( VarArgsType *varArgsType );
    46                 virtual void visit( ZeroType *zeroType );
    47                 virtual void visit( OneType *oneType );
    4846
    4947                void typeBefore( Type *type );
  • src/ResolvExpr/Resolver.cc

    r23b6643f raefcc3b  
    134134                        } else if ( BasicType *bt = dynamic_cast< BasicType * >( type ) ) {
    135135                                return bt->isInteger();
    136                         } else if ( dynamic_cast< ZeroType* >( type ) != nullptr || dynamic_cast< OneType* >( type ) != nullptr ) {
    137                                 return true;
    138136                        } else {
    139137                                return false;
     
    457455                        }
    458456                } else {
    459                         assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext )
    460                                 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) );
     457                        assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) );
    461458                        // basic types are handled here
    462459                        Visitor::visit( listInit );
  • src/ResolvExpr/Unify.cc

    r23b6643f raefcc3b  
    6060                virtual void visit(TupleType *tupleType);
    6161                virtual void visit(VarArgsType *varArgsType);
    62                 virtual void visit(ZeroType *zeroType);
    63                 virtual void visit(OneType *oneType);
    6462
    6563                template< typename RefType > void handleRefType( RefType *inst, Type *other );
     
    590588        }
    591589
    592         void Unify::visit(ZeroType *zeroType) {
    593                 result = dynamic_cast< ZeroType* >( type2 );
    594         }
    595 
    596         void Unify::visit(OneType *oneType) {
    597                 result = dynamic_cast< OneType* >( type2 );
    598         }
    599 
    600590        // xxx - compute once and store in the FunctionType?
    601591        Type * extractResultType( FunctionType * function ) {
     
    612602                }
    613603        }
     604
    614605} // namespace ResolvExpr
    615606
  • src/SymTab/FixFunction.cc

    r23b6643f raefcc3b  
    7777                return varArgsType;
    7878        }
    79 
    80         Type * FixFunction::mutate(ZeroType *zeroType) {
    81                 return zeroType;
    82         }
    83 
    84         Type * FixFunction::mutate(OneType *oneType) {
    85                 return oneType;
    86         }
    8779} // namespace SymTab
    8880
  • src/SymTab/FixFunction.h

    r23b6643f raefcc3b  
    4242                virtual Type* mutate(TupleType *tupleType);
    4343                virtual Type* mutate(VarArgsType *varArgsType);
    44                 virtual Type* mutate(ZeroType *zeroType);
    45                 virtual Type* mutate(OneType *oneType);
    4644 
    4745                bool isVoid;
  • src/SymTab/ImplementationType.cc

    r23b6643f raefcc3b  
    4141                virtual void visit(TupleType *tupleType);
    4242                virtual void visit(VarArgsType *varArgsType);
    43                 virtual void visit(ZeroType *zeroType);
    44                 virtual void visit(OneType *oneType);
    4543
    4644                Type *result;                   // synthesized
     
    122120        void ImplementationType::visit(VarArgsType *varArgsType) {
    123121        }
    124 
    125         void ImplementationType::visit(ZeroType *zeroType) {
    126         }
    127 
    128         void ImplementationType::visit(OneType *oneType) {
    129         }
    130122} // namespace SymTab
    131123
  • src/SymTab/Mangler.cc

    r23b6643f raefcc3b  
    229229                printQualifiers( varArgsType );
    230230                mangleName << "VARGS";
    231         }
    232 
    233         void Mangler::visit( ZeroType *zeroType ) {
    234                 mangleName << "Z";
    235         }
    236 
    237         void Mangler::visit( OneType *oneType ) {
    238                 mangleName << "O";
    239231        }
    240232
  • src/SymTab/Mangler.h

    r23b6643f raefcc3b  
    4646                virtual void visit( TupleType *tupleType );
    4747                virtual void visit( VarArgsType *varArgsType );
    48                 virtual void visit( ZeroType *zeroType );
    49                 virtual void visit( OneType *oneType );
    5048 
    5149                std::string get_mangleName() { return mangleName.str(); }
  • src/SymTab/TypeEquality.cc

    r23b6643f raefcc3b  
    4242                virtual void visit( TypeInstType *typeInst );
    4343                virtual void visit( VarArgsType *varArgsType );
    44                 virtual void visit( ZeroType *zeroType );
    45                 virtual void visit( OneType *oneType );
    4644
    4745                void handleQualifiers( Type * t );
     
    201199                }
    202200        }
    203 
    204         void TypeEquality::visit( ZeroType *zeroType ) {
    205                 handleQualifiers( zeroType );
    206                 if ( ! dynamic_cast< ZeroType * >( other ) ) {
    207                         result = false;
    208                 }
    209         }
    210 
    211         void TypeEquality::visit( OneType *oneType ) {
    212                 handleQualifiers( oneType );
    213                 if ( ! dynamic_cast< OneType * >( other ) ) {
    214                         result = false;
    215                 }
    216         }
    217201} // namespace SymTab
  • src/SynTree/Mutator.cc

    r23b6643f raefcc3b  
    480480}
    481481
    482 Type *Mutator::mutate( ZeroType *zeroType ) {
    483         mutateAll( zeroType->get_forall(), *this );
    484         return zeroType;
    485 }
    486 
    487 Type *Mutator::mutate( OneType *oneType ) {
    488         mutateAll( oneType->get_forall(), *this );
    489         return oneType;
    490 }
    491 
    492482Initializer *Mutator::mutate( SingleInit *singleInit ) {
    493483        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
  • src/SynTree/Mutator.h

    r23b6643f raefcc3b  
    9999        virtual Type* mutate( AttrType *attrType );
    100100        virtual Type* mutate( VarArgsType *varArgsType );
    101         virtual Type* mutate( ZeroType *zeroType );
    102         virtual Type* mutate( OneType *oneType );
    103101
    104102        virtual Initializer* mutate( SingleInit *singleInit );
  • src/SynTree/SynTree.h

    r23b6643f raefcc3b  
    106106class AttrType;
    107107class VarArgsType;
    108 class ZeroType;
    109 class OneType;
    110108
    111109class Initializer;
  • src/SynTree/Type.h

    r23b6643f raefcc3b  
    436436};
    437437
    438 /// Represents a zero constant
    439 class ZeroType : public Type {
    440   public:
    441         ZeroType();
    442         ZeroType( Type::Qualifiers tq );
    443 
    444         virtual ZeroType *clone() const { return new ZeroType( *this ); }
    445         virtual void accept( Visitor &v ) { v.visit( this ); }
    446         virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    447         virtual void print( std::ostream &os, int indent = 0 ) const;
    448 };
    449 
    450 /// Represents a one constant
    451 class OneType : public Type {
    452   public:
    453         OneType();
    454         OneType( Type::Qualifiers tq );
    455 
    456         virtual OneType *clone() const { return new OneType( *this ); }
    457         virtual void accept( Visitor &v ) { v.visit( this ); }
    458         virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    459         virtual void print( std::ostream &os, int indent = 0 ) const;
    460 };
    461 
    462438inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {
    463439        isConst &= other.isConst;
  • src/SynTree/TypeSubstitution.cc

    r23b6643f raefcc3b  
    179179}
    180180
    181 Type * TypeSubstitution::mutate( VoidType *voidType ) {
    182         return handleType( voidType );
     181Type * TypeSubstitution::mutate( VoidType *basicType ) {
     182        return handleType( basicType );
    183183}
    184184
     
    221221Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) {
    222222        return handleType( varArgsType );
    223 }
    224 
    225 Type * TypeSubstitution::mutate( ZeroType *zeroType ) {
    226         return handleType( zeroType );
    227 }
    228 
    229 Type * TypeSubstitution::mutate( OneType *oneType ) {
    230         return handleType( oneType );
    231223}
    232224
  • src/SynTree/TypeSubstitution.h

    r23b6643f raefcc3b  
    7676        virtual Type* mutate(TupleType *tupleType);
    7777        virtual Type* mutate(VarArgsType *varArgsType);
    78         virtual Type* mutate(ZeroType *zeroType);
    79         virtual Type* mutate(OneType *oneType);
    8078
    8179        // TODO: worry about traversing into a forall-qualified function type or type decl with assertions
  • src/SynTree/Visitor.cc

    r23b6643f raefcc3b  
    406406}
    407407
    408 void Visitor::visit( ZeroType *zeroType ) {
    409         acceptAll( zeroType->get_forall(), *this );
    410 }
    411 
    412 void Visitor::visit( OneType *oneType ) {
    413         acceptAll( oneType->get_forall(), *this );
    414 }
    415 
    416408void Visitor::visit( SingleInit *singleInit ) {
    417409        singleInit->get_value()->accept( *this );
  • src/SynTree/Visitor.h

    r23b6643f raefcc3b  
    9999        virtual void visit( AttrType *attrType );
    100100        virtual void visit( VarArgsType *varArgsType );
    101         virtual void visit( ZeroType *zeroType );
    102         virtual void visit( OneType *oneType );
    103101
    104102        virtual void visit( SingleInit *singleInit );
  • src/SynTree/module.mk

    r23b6643f raefcc3b  
    2626       SynTree/AttrType.cc \
    2727       SynTree/VarArgsType.cc \
    28        SynTree/ZeroOneType.cc \
    2928       SynTree/Constant.cc \
    3029       SynTree/Expression.cc \
  • src/examples/gc_no_raii/src/internal/card_table.h

    r23b6643f raefcc3b  
    1818};
    1919
    20 static inline void ?{}(card_table_t* this)
     20static inline void ctor_card(card_table_t* const this)
    2121{
    2222        this->count = 0;
    2323}
    2424
    25 static inline void ^?{}(card_table_t* this)
     25static inline void dtor_card(card_table_t* const this)
    2626{
    2727
  • src/examples/gc_no_raii/src/internal/memory_pool.c

    r23b6643f raefcc3b  
    1111const size_t gc_pool_header_size = (size_t)(  &(((gc_memory_pool*)NULL)->start_p) );
    1212
    13 void ?{}(gc_memory_pool* this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
     13void ctor(gc_memory_pool *const this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
    1414{
    1515        this->mirror = mirror;
     
    1717        this->type_code = type;
    1818
    19         this->cards = ( (card_table_t*)malloc(sizeof(card_table_t)) ){};
     19        card_table_t* new = (card_table_t*)malloc(sizeof(card_table_t));
     20        this->cards = new;
     21        ctor_card(this->cards);
    2022
    2123        this->end_p = ((uint8_t*)this) + size;
     
    2729}
    2830
    29 void ^?{}(gc_memory_pool* this)
     31void dtor(gc_memory_pool *const this)
    3032{
    31         ^(&this->cards){};
     33        dtor_card(this->cards);
    3234        free(this->cards);
    3335}
  • src/examples/gc_no_raii/src/internal/memory_pool.h

    r23b6643f raefcc3b  
    2727};
    2828
    29 void ?{}(       gc_memory_pool* this,
     29void ctor(      gc_memory_pool *const this,
    3030                size_t size,
    3131                gc_memory_pool* next,
     
    3434        );
    3535
    36 void ^?{}(gc_memory_pool* this);
     36void dtor(gc_memory_pool *const this);
    3737
    3838struct gc_pool_object_iterator
  • src/examples/gc_no_raii/src/internal/state.c

    r23b6643f raefcc3b  
    131131
    132132      this->from_space = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
    133       this->to_space   = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
    134 
    135       this->from_space{ POOL_SIZE_BYTES, old_from_space, this->to_space,   this->from_code };
    136       this->to_space  { POOL_SIZE_BYTES, old_to_space,   this->from_space, (~this->from_code) & 0x01 };
     133      this->to_space = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
     134
     135      ctor(this->from_space, POOL_SIZE_BYTES, old_from_space, this->to_space,   this->from_code);
     136      ctor(this->to_space,   POOL_SIZE_BYTES, old_to_space,   this->from_space, (~this->from_code) & 0x01);
    137137
    138138        this->total_space += gc_pool_size_used(this->from_space);
  • src/libcfa/containers/vector

    r23b6643f raefcc3b  
    2020}
    2121
     22#define DESTROY(x)
     23
    2224//------------------------------------------------------------------------------
    2325//Declaration
    2426trait allocator_c(otype T, otype allocator_t)
    2527{
    26         void realloc_storage(allocator_t*, size_t);
    27         T* data(allocator_t*);
     28        void ctor(allocator_t* const);
     29        void dtor(allocator_t* const);
     30        void realloc_storage(allocator_t* const, size_t);
     31        T* data(allocator_t* const);
    2832};
    29 
    30 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    31 struct vector;
    32 
    33 //------------------------------------------------------------------------------
    34 //Initialization
    35 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    36 void ?{}(vector(T, allocator_t)* this);
    37 
    38 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    39 void ?{}(vector(T, allocator_t)* this, vector(T, allocator_t) rhs);
    40 
    41 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    42 vector(T, allocator_t) ?=?(vector(T, allocator_t)* this, vector(T, allocator_t) rhs);
    43 
    44 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    45 void ^?{}(vector(T, allocator_t)* this);
    4633
    4734forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     
    5340
    5441//------------------------------------------------------------------------------
     42//Initialization
     43forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     44void ctor(vector(T, allocator_t) *const this);
     45
     46forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
     47void dtor(vector(T, allocator_t) *const this);
     48
     49//------------------------------------------------------------------------------
    5550//Capacity
    5651forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    57 static inline bool empty(vector(T, allocator_t)* this)
     52static inline bool empty(vector(T, allocator_t) *const this)
    5853{
    5954        return this->size == 0;
     
    6156
    6257forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    63 static inline size_t size(vector(T, allocator_t)* this)
     58static inline size_t size(vector(T, allocator_t) *const this)
    6459{
    6560        return this->size;
     
    6762
    6863forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    69 static inline void reserve(vector(T, allocator_t)* this, size_t size)
     64static inline void reserve(vector(T, allocator_t) *const this, size_t size)
    7065{
    7166        realloc_storage(&this->storage, this->size+1);
     
    7570//Element access
    7671forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    77 static inline T at(vector(T, allocator_t)* this, size_t index)
     72static inline T at(vector(T, allocator_t) *const this, size_t index)
    7873{
    7974        return data(&this->storage)[index];
     
    8176
    8277forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    83 static inline T ?[?](vector(T, allocator_t)* this, size_t index)
     78static inline T ?[?](vector(T, allocator_t) *const this, size_t index)
    8479{
    8580        return data(&this->storage)[index];
     
    8782
    8883forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    89 static inline T front(vector(T, allocator_t)* this)
     84static inline T front(vector(T, allocator_t) *const this)
    9085{
    9186        return data(&this->storage)[0];
     
    9388
    9489forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    95 static inline T back(vector(T, allocator_t)* this)
     90static inline T back(vector(T, allocator_t) *const this)
    9691{
    9792        return data(&this->storage)[this->size - 1];
     
    10196//Modifiers
    10297forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    103 void push_back(vector(T, allocator_t)* this, T value);
     98void push_back(vector(T, allocator_t) *const this, T value);
    10499
    105100forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    106 void pop_back(vector(T, allocator_t)* this);
     101void pop_back(vector(T, allocator_t) *const this);
    107102
    108103forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    109 void clear(vector(T, allocator_t)* this);
     104void clear(vector(T, allocator_t) *const this);
    110105
    111106//------------------------------------------------------------------------------
    112107//Iterators
    113108forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    114 static inline T* begin(vector(T, allocator_t)* this)
     109static inline T* begin(vector(T, allocator_t) *const this)
    115110{
    116111        return data(&this->storage);
     
    118113
    119114forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    120 static inline const T* cbegin(const vector(T, allocator_t)* this)
     115static inline const T* cbegin(const vector(T, allocator_t) *const this)
    121116{
    122117        return data(&this->storage);
     
    124119
    125120forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    126 static inline T* end(vector(T, allocator_t)* this)
     121static inline T* end(vector(T, allocator_t) *const this)
    127122{
    128123        return data(&this->storage) + this->size;
     
    130125
    131126forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    132 static inline const T* cend(const vector(T, allocator_t)* this)
     127static inline const T* cend(const vector(T, allocator_t) *const this)
    133128{
    134129        return data(&this->storage) + this->size;
     
    145140
    146141forall(otype T)
    147 void ?{}(heap_allocator(T)* this);
     142void ctor(heap_allocator(T) *const this);
    148143
    149144forall(otype T)
    150 void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);
     145void dtor(heap_allocator(T) *const this);
    151146
    152147forall(otype T)
    153 heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);
     148void realloc_storage(heap_allocator(T) *const this, size_t size);
    154149
    155150forall(otype T)
    156 void ^?{}(heap_allocator(T)* this);
    157 
    158 forall(otype T)
    159 void realloc_storage(heap_allocator(T)* this, size_t size);
    160 
    161 forall(otype T)
    162 static inline T* data(heap_allocator(T)* this)
     151static inline T* data(heap_allocator(T) *const this)
    163152{
    164153        return this->storage;
  • src/libcfa/containers/vector.c

    r23b6643f raefcc3b  
    1818#include <stdlib>
    1919
    20 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    21 void copy_internal(vector(T, allocator_t)* this, vector(T, allocator_t)* other);
    22 
    2320//------------------------------------------------------------------------------
    2421//Initialization
    2522forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    26 void ?{}(vector(T, allocator_t)* this)
     23void ctor(vector(T, allocator_t) *const this)
    2724{
    28         (&this->storage){};
     25        ctor(&this->storage);
    2926        this->size = 0;
    3027}
    3128
    3229forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    33 void ?{}(vector(T, allocator_t)* this, vector(T, allocator_t) rhs)
    34 {
    35         (&this->storage){ rhs.storage };
    36         copy_internal(this, &rhs);
    37 }
    38 
    39 // forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    40 // vector(T, allocator_t) ?=?(vector(T, allocator_t)* this, vector(T, allocator_t) rhs)
    41 // {
    42 //      (&this->storage){};
    43 //      copy_internal(this, &rhs);
    44 //      return *this;
    45 // }
    46 
    47 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    48 void ^?{}(vector(T, allocator_t)* this)
     30void dtor(vector(T, allocator_t) *const this)
    4931{
    5032        clear(this);
    51         ^(&this->storage){};
     33        dtor(&this->storage);
    5234}
    5335
     
    5537//Modifiers
    5638forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    57 void push_back(vector(T, allocator_t)* this, T value)
     39void push_back(vector(T, allocator_t) *const this, T value)
    5840{
    5941        realloc_storage(&this->storage, this->size+1);
     
    6345
    6446forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    65 void pop_back(vector(T, allocator_t)* this)
     47void pop_back(vector(T, allocator_t) *const this)
    6648{
    6749        this->size--;
    68         ^(&data(&this->storage)[this->size]){};
     50        DESTROY(data(&this->storage)[this->size]);
    6951}
    7052
    7153forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    72 void clear(vector(T, allocator_t)* this)
     54void clear(vector(T, allocator_t) *const this)
    7355{
    7456        for(size_t i = 0; i < this->size; i++)
    7557        {
    76                 ^(&data(&this->storage)[this->size]){};
     58                DESTROY(data(&this->storage)[this->size]);
    7759        }
    7860        this->size = 0;
     
    8062
    8163//------------------------------------------------------------------------------
    82 //Internal Helpers
    83 
    84 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    85 void copy_internal(vector(T, allocator_t)* this, vector(T, allocator_t)* other)
    86 {
    87         this->size = other->size;
    88         for(size_t i = 0; i < this->size; i++) {
    89                 (&data(&this->storage)[this->size]){ data(&other->storage)[other->size] };
    90         }
    91 }
    92 
    93 //------------------------------------------------------------------------------
    9464//Allocator
    9565forall(otype T)
    96 void ?{}(heap_allocator(T)* this)
     66void ctor(heap_allocator(T) *const this)
    9767{
    9868        this->storage = 0;
     
    10171
    10272forall(otype T)
    103 void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs)
    104 {
    105         this->capacity = rhs.capacity;
    106         this->storage = (T*)realloc((void*)this->storage, this->capacity * sizeof(T));
    107 }
    108 
    109 forall(otype T)
    110 heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs)
    111 {
    112         this->capacity = rhs.capacity;
    113         this->storage = (T*)realloc((void*)this->storage, this->capacity * sizeof(T));
    114         return *this;
    115 }
    116 
    117 forall(otype T)
    118 void ^?{}(heap_allocator(T)* this)
     73void dtor(heap_allocator(T) *const this)
    11974{
    12075        free(this->storage);
     
    12277
    12378forall(otype T)
    124 inline void realloc_storage(heap_allocator(T)* this, size_t size)
     79inline void realloc_storage(heap_allocator(T) *const this, size_t size)
    12580{
    12681        enum { GROWTH_RATE = 2 };
  • src/tests/libcfa_vector.c

    r23b6643f raefcc3b  
    1 //
     1// 
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 //
    7 // libcfa_vector.c --
    8 //
     6// 
     7// libcfa_vector.c -- 
     8// 
    99// Author           : Thierry Delisle
    1010// Created On       : Mon Jul  4 23:36:19 2016
     
    1212// Last Modified On : Tue Jul  5 15:08:05 2016
    1313// Update Count     : 26
    14 //
     14// 
    1515
    1616#include <fstream>
     
    2828int main() {
    2929        vector( int, heap_allocator(int) ) iv;
     30        ctor( &iv );
    3031
    3132        assert( empty( &iv ) );
Note: See TracChangeset for help on using the changeset viewer.