Changeset c15085d for src/AST


Ignore:
Timestamp:
Jul 3, 2020, 4:50:21 PM (4 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
aebf5b0
Parents:
276f105
Message:

tracing memory allocation of resolver passes

Location:
src/AST
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    r276f105 rc15085d  
    2828        /* setup the scope for passes that want to run code at exit */ \
    2929        __attribute__((unused)) ast::__pass::guard_value          guard2( ast::__pass::at_cleanup    (pass, 0) ); \
     30        /* begin tracing memory allocation if requested by this pass */ \
     31        __pass::beginTrace( pass, 0 ); \
    3032        /* call the implementation of the previsit of this pass */ \
    3133        __pass::previsit( pass, node, 0 );
     
    4244        auto __return = __pass::postvisit( pass, node, 0 ); \
    4345        assertf(__return, "post visit should never return null"); \
     46        /* end tracing memory allocation if requested by this pass */ \
     47        __pass::endTrace( pass, 0 ); \
    4448        return __return;
    4549
  • src/AST/Pass.proto.hpp

    r276f105 rc15085d  
    1616#pragma once
    1717// IWYU pragma: private, include "Pass.hpp"
     18
     19#include "Common/Stats/Heap.h"
    1820
    1921namespace ast {
     
    244246        #undef FIELD_PTR
    245247
     248        template< typename pass_t >
     249        static inline auto beginTrace(pass_t & pass, int) -> decltype( pass_t::traceId, void() ) {
     250                Stats::Heap::stacktrace_push(pass_t::traceId);
     251        }
     252
     253        template< typename pass_t >
     254        static inline auto endTrace(pass_t & pass, int) -> decltype( pass_t::traceId, void() ) {
     255                Stats::Heap::stacktrace_pop();
     256        }
     257
     258        template< typename pass_t >
     259        static void beginTrace(pass_t &, long) {}
     260
     261        template< typename pass_t >
     262        static void endTrace(pass_t &, long) {}
     263
    246264        // Another feature of the templated visitor is that it calls beginScope()/endScope() for compound statement.
    247265        // All passes which have such functions are assumed desire this behaviour
  • src/AST/TypeSubstitution.cpp

    r276f105 rc15085d  
    1818
    1919namespace ast {
     20
     21
     22size_t TypeSubstitution::Substituter::traceId = Stats::Heap::new_stacktrace_id("TypeSubstitution");
    2023
    2124TypeSubstitution::TypeSubstitution() {
  • src/AST/TypeSubstitution.hpp

    r276f105 rc15085d  
    160160// definitition must happen after PassVisitor is included so that WithGuards can be used
    161161struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter> {
     162                static size_t traceId;
    162163
    163164                Substituter( const TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
Note: See TracChangeset for help on using the changeset viewer.