Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track location of InstallMethod and InstallImmediateMethod #2393

Merged
merged 5 commits into from
Apr 23, 2018

Commits on Apr 23, 2018

  1. Add constant BASE_SIZE_METHODS_OPER_ENTRY

    ... for accessing the methods in METHODS_OPERATION(oper,n). By using
    this constant, it becomes easier to add additional entries for each
    method.
    
    Note that the layout of METHODS_OPERATION is strictly speaking an
    internal implementation detail, and thus packages directly accessing it
    do so at their own risk. If a package accesses METHODS_OPERATION anyway
    (currently only Browse) it should be updated to use METHODS_OPERATION.
    (For backwards compatibility, if BASE_SIZE_METHODS_OPER_ENTRY is not
    defined, it can be set to 4).
    fingolfin committed Apr 23, 2018
    Configuration menu
    Copy the full SHA
    a81e42f View commit details
    Browse the repository at this point in the history
  2. Change some local var names in ApplicableMethodTypes

    ... to make it a bit easier to figure out what's going on
    fingolfin committed Apr 23, 2018
    Configuration menu
    Copy the full SHA
    9070371 View commit details
    Browse the repository at this point in the history
  3. Track location of InstallMethod

    This makes the information displayed by TraceMethods and by
    ApplicableMethod much more useful in many case, which resolves gap-system#2239.
    For example, consider this method for `AsList`, installed in coll.gi:
    
        InstallMethod( AsList,
            "for collections that are constant time access lists",
            [ IsCollection and IsConstantTimeAccessList ],
            Immutable );
    
    With GAP 4.8, no location information is shown at all:
    
        gap> TraceMethods(AsList); AsList("abc");;
        #I  AsList: for collections that are constant time access lists
    
    With GAP 4.9 / master, the location where the method (i.e., the
    underlying function) was defined is shown, which already does the job in
    many cases, but not here:
    
        gap> TraceMethods(AsList); AsList("abc");;
        #I  AsList: for collections that are constant time access lists at src/objects.c:fail
    
    With this PR, we get this (note that instead of GAPROOT, the actual path
    is printed)
    
        gap> TraceMethods(AsList); AsList("abc");;
        #I  AsList: for collections that are constant time access lists at GAPROOT/lib/coll.gi:302
    fingolfin committed Apr 23, 2018
    Configuration menu
    Copy the full SHA
    bc2c12a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ecb5760 View commit details
    Browse the repository at this point in the history
  5. Tack location of InstallImmediateMethod

    Before:
    
        gap> TraceImmediateMethods( );
        gap> g:= Group( (1,2,3), (1,2) );;
        #I  immediate: Size
        #I  immediate: IsCyclic
        #I  immediate: IsCommutative
        #I  immediate: IsTrivial
        gap>
        gap> M0:=Magma(FamilyObj([1]), []);;
        gap> AsSSortedList(M0);
        #I  immediate: RepresentativeSmallest
        #I  immediate: AsList
        #I  immediate: EnumeratorSorted
        #I  immediate: GeneratorsOfDomain
        #I  immediate: Size
        #I  immediate: RepresentativeSmallest
        #I  immediate: IsFinite
        #I  immediate: IsTrivial
        #I  immediate: IsEmpty
        #I  immediate: IsNonTrivial
        #I  immediate: Size
        #I  immediate: RepresentativeSmallest
        [  ]
    
    After (note how e.g. the entry for EnumeratorSorted points at
    coll.gi:379, and not at the location where the method function
    was defined):
    
        gap> TraceImmediateMethods( );
        gap> g:= Group( (1,2,3), (1,2) );;
        #I RunImmediateMethods
        #I  immediate: Size at GAPROOT/lib/coll.gi:179
        #I  immediate: IsCyclic at GAPROOT/lib/grp.gi:40
        #I  immediate: IsCommutative at GAPROOT/lib/magma.gi:196
        #I  immediate: IsTrivial at GAPROOT/lib/magma.gi:130
        gap>
        gap> M0:=Magma(FamilyObj([1]), []);;
        #I RunImmediateMethods
        #I RunImmediateMethods
        gap> AsSSortedList(M0);
        #I RunImmediateMethods
        #I  immediate: RepresentativeSmallest at GAPROOT/lib/coll.gi:226
        #I  immediate: AsList at GAPROOT/lib/domain.gi:206
        #I  immediate: EnumeratorSorted at GAPROOT/lib/coll.gi:379
        #I  immediate: GeneratorsOfDomain at GAPROOT/lib/domain.gi:181
        #I  immediate: Size at GAPROOT/lib/coll.gi:183
        #I  immediate: RepresentativeSmallest at GAPROOT/lib/coll.gi:215
        #I  immediate: IsFinite at GAPROOT/lib/coll.gi:148
        #I  immediate: IsTrivial at GAPROOT/lib/coll.gi:116
        #I  immediate: IsEmpty at GAPROOT/lib/coll.gi:97
        #I  immediate: IsNonTrivial at GAPROOT/lib/coll.gi:134
        #I RunImmediateMethods
        #I  immediate: Size at GAPROOT/lib/coll.gi:179
        #I RunImmediateMethods
        #I  immediate: RepresentativeSmallest at GAPROOT/lib/coll.gi:215
        [  ]
    fingolfin committed Apr 23, 2018
    Configuration menu
    Copy the full SHA
    feb533d View commit details
    Browse the repository at this point in the history