#include <stdint.h>#include <stdlib.h>#include <dirent.h>#include <errno.h>#include <fstream>#include <iostream>#include <string>#include <sstream>#include <map>#include "Options.hxx"#include "UocInfo.hxx"#include "AST.hxx"#include "Type.hxx"#include "inter-pass.hxx"#include "Instantiate.hxx"Go to the source code of this file.
Defines | |
| #define | STRICTLYEQUALS(x) strictlyEqualsA(x) |
| #define | NAMKARAN(ast, name) |
| #define | UNIFIED_ENVS GC_NULL |
| #define | RANDT_DROP(expr, mess, env) |
| #define | RANDT_COMMIT(expr, mess, env) |
Typedefs | |
| typedef map< shared_ptr< AST >, shared_ptr< AST > > | AstMap |
Functions | |
| static void | importSymBindings (shared_ptr< ASTEnvironment > fromEnv, shared_ptr< ASTEnvironment > toEnv) |
| static void | importTSBindings (shared_ptr< TSEnvironment > fromEnv, shared_ptr< TSEnvironment > toEnv) |
| static void | importInstBindings (shared_ptr< InstEnvironment > fromEnv, shared_ptr< InstEnvironment > toEnv) |
| void | UpdateMegaEnvs (shared_ptr< UocInfo > uoc) |
| static string | getInstName (shared_ptr< const AST > def, shared_ptr< Type > typ) |
| void | InstMangle (shared_ptr< AST > def) |
| static string | uniqName (const string name, const shared_ptr< AST > def) |
| static void | name2fqn (shared_ptr< AST > ast) |
| static shared_ptr< AST > | typeAsAst (shared_ptr< Type > t, const LexLoc &loc) |
| static void | clearConstraints (shared_ptr< AST > ast) |
| static shared_ptr< AST > | substitute (shared_ptr< AST > ast, shared_ptr< AST > from, shared_ptr< AST > to) |
| static shared_ptr< AST > | tvarSub (shared_ptr< AST > ast, shared_ptr< AST > tv, shared_ptr< Type > typ) |
| static shared_ptr< AST > | tvarInst (shared_ptr< AST > ast, shared_ptr< AST > scope, AstMap &newBinds) |
| static void | coerce (ostream &errStream, shared_ptr< Type > t, bool maybeOnly=false) |
| static shared_ptr< AST > | buildNewDeclaration (shared_ptr< AST > def, shared_ptr< Type > typ) |
| static shared_ptr< AST > | getIDFromInstantiation (shared_ptr< AST > oldDefID, shared_ptr< AST > newDef) |
| static void | propagate_type_annotations (shared_ptr< AST > ast) |
| static shared_ptr< AST > | getOuterLet (shared_ptr< AST > ast) |
| static shared_ptr< AST > | getInnerLet (shared_ptr< AST > ast) |
| static shared_ptr< AST > | getDefToInstantiate (ostream &errStream, shared_ptr< UocInfo > unifiedUOC, shared_ptr< AST > def, shared_ptr< Type > typ) |
| #define NAMKARAN | ( | ast, | |||
| name | ) |
Value:
do { \ ast->s = name; \ ast->flags |= IDENT_MANGLED; \ } while (0);
Definition at line 453 of file Instantiate.cxx.
Referenced by buildNewDeclaration(), InstMangle(), polyinst(), Specialize(), and substitute().
| #define RANDT_COMMIT | ( | expr, | |||
| mess, | |||||
| env | ) |
Value:
do { \ assert(RandTexpr(errStream, expr, \ POLY_SYM_FLAGS, POLY_TYP_FLAGS, \ mess, true, env)); \ } while (0);
Definition at line 556 of file Instantiate.cxx.
| #define RANDT_DROP | ( | expr, | |||
| mess, | |||||
| env | ) |
Value:
do { \ assert(RandTexpr(errStream, expr, \ POLY_SYM_FLAGS, POLY_TYP_FLAGS, \ mess, false, env)); \ } while (0);
Definition at line 550 of file Instantiate.cxx.
| #define STRICTLYEQUALS | ( | x | ) | strictlyEqualsA(x) |
Definition at line 62 of file Instantiate.cxx.
| #define UNIFIED_ENVS GC_NULL |
Definition at line 547 of file Instantiate.cxx.
Definition at line 65 of file Instantiate.cxx.
| static shared_ptr<AST> buildNewDeclaration | ( | shared_ptr< AST > | def, | |
| shared_ptr< Type > | typ | |||
| ) | [static] |
Definition at line 763 of file Instantiate.cxx.
References assert(), at_constraints, at_constructors, at_declares, at_declstruct, at_declunion, at_defexception, at_define, at_fields, at_proclaim, at_recdef, at_tvlist, DEBUG, decl(), DEF_IS_EXTERNAL, boost::GC_NULL, getInstName(), AST::make(), NAMKARAN, and typeAsAst().
| static void clearConstraints | ( | shared_ptr< AST > | ast | ) | [static] |
Definition at line 577 of file Instantiate.cxx.
References assert(), at_constraints, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_let, at_letrec, at_proclaim, and at_recdef.
Referenced by clearConstraints(), and Specialize().
| static void coerce | ( | ostream & | errStream, | |
| shared_ptr< Type > | t, | |||
| bool | maybeOnly = false | |||
| ) | [static] |
Definition at line 742 of file Instantiate.cxx.
References DEBUG, Options::debugTvP, and Trail::make().
| static shared_ptr<AST> getDefToInstantiate | ( | ostream & | errStream, | |
| shared_ptr< UocInfo > | unifiedUOC, | |||
| shared_ptr< AST > | def, | |||
| shared_ptr< Type > | typ | |||
| ) | [static] |
Definition at line 973 of file Instantiate.cxx.
References assert(), at_ident, at_typeAnnotation, and DEBUG.
| static shared_ptr<AST> getIDFromInstantiation | ( | shared_ptr< AST > | oldDefID, | |
| shared_ptr< AST > | newDef | |||
| ) | [static] |
Definition at line 817 of file Instantiate.cxx.
References assert(), at_defunion, and boost::GC_NULL.
Definition at line 912 of file Instantiate.cxx.
References assert(), at_let, at_letrec, and getOuterLet().
Definition at line 431 of file Instantiate.cxx.
References DEBUG.
Referenced by buildNewDeclaration(), and InstMangle().
Definition at line 879 of file Instantiate.cxx.
References assert(), at_ident, at_let, at_letbinding, at_letbindings, at_letrec, and boost::GC_NULL.
Referenced by getInnerLet().
| static void importInstBindings | ( | shared_ptr< InstEnvironment > | fromEnv, | |
| shared_ptr< InstEnvironment > | toEnv | |||
| ) | [static] |
Definition at line 254 of file Instantiate.cxx.
References assert(), BF_PRIVATE, DEBUG, and if().
Referenced by UpdateMegaEnvs().
| static void importSymBindings | ( | shared_ptr< ASTEnvironment > | fromEnv, | |
| shared_ptr< ASTEnvironment > | toEnv | |||
| ) | [static] |
Definition at line 210 of file Instantiate.cxx.
References BF_COMPLETE, BF_PRIVATE, BF_REBIND, DEBUG, if(), and nm.
Referenced by UpdateMegaEnvs().
| static void importTSBindings | ( | shared_ptr< TSEnvironment > | fromEnv, | |
| shared_ptr< TSEnvironment > | toEnv | |||
| ) | [static] |
Definition at line 231 of file Instantiate.cxx.
References BF_COMPLETE, BF_PRIVATE, BF_REBIND, DEBUG, if(), and nm.
Referenced by UpdateMegaEnvs().
| void InstMangle | ( | shared_ptr< AST > | def | ) |
Definition at line 460 of file Instantiate.cxx.
References getInstName(), and NAMKARAN.
Referenced by ssa().
| static void name2fqn | ( | shared_ptr< AST > | ast | ) | [static] |
Definition at line 481 of file Instantiate.cxx.
References assert(), at_declares, at_field, at_fqCtr, at_ident, at_methdecl, at_module, at_sel_ctr, at_select, and IDENT_MANGLED.
Referenced by typeAsAst().
| static void propagate_type_annotations | ( | shared_ptr< AST > | ast | ) | [static] |
Definition at line 841 of file Instantiate.cxx.
References at_argVec, at_byRefType, at_let, at_letrec, COMP_BYREF, AST::make(), and typeAsAst().
| static shared_ptr<AST> substitute | ( | shared_ptr< AST > | ast, | |
| shared_ptr< AST > | from, | |||
| shared_ptr< AST > | to | |||
| ) | [static] |
Definition at line 627 of file Instantiate.cxx.
References at_ident, at_typeapp, IDENT_MANGLED, and NAMKARAN.
Referenced by Specialize(), and substitute().
| static shared_ptr<AST> tvarInst | ( | shared_ptr< AST > | ast, | |
| shared_ptr< AST > | scope, | |||
| AstMap & | newBinds | |||
| ) | [static] |
Definition at line 692 of file Instantiate.cxx.
References at_ident, at_try, at_uswitch, id_tvar, IGNORE, TvPrinter::make(), Type::make(), and TVAR_POLY_SPECIAL.
Definition at line 567 of file Instantiate.cxx.
References loc, and name2fqn().
Referenced by buildNewDeclaration(), propagate_type_annotations(), and tvarSub().
| static string uniqName | ( | const string | name, | |
| const shared_ptr< AST > | def | |||
| ) | [static] |
Definition at line 470 of file Instantiate.cxx.
| void UpdateMegaEnvs | ( | shared_ptr< UocInfo > | uoc | ) |
Definition at line 297 of file Instantiate.cxx.
References DEBUG, if(), UocInfo::ifList, importInstBindings(), importSymBindings(), importTSBindings(), UocInfo::srcList, UOC_IS_MUTABLE, and UOC_SEEN_BY_INST.
1.4.7