Release 2.1, patchlevel 1

Official release date: May 30, 2007.

Summary

This release of CodeSurfer introduces some major new features and some very significant improvements to the storage of intermediate representations. The GrammaTech Path Inspector installer is now incorporated with CodeSurfer. The Scheme API has been substantially renovated and the C API has been completely replaced. Also, a number of fairly minor improvements and bug fixes have been made.

Major New Features in CodeSurfer 2.1

  • Object Store. CodeSurfer now uses a persistent object store for all structures. Previously this had been a memory-mapped file, which limited the size of project that could be built to the address space of the process. The object store removes that limitation. There is now essentially no limit on project size, and CodeSurfer has been used to build projects with as much as 30 million LOC on super-lite settings. Note however that the pointer analysis phase, which runs as a separate process, continues to have an address-space limitation, so it may not scale to large programs. Also, it may still be infeasible to use some of the more aggressive build options on large programs because the build may still consume too much time or space. Finally, the GUI has not changed significantly, and is unlikely to be scalable to very large projects.
  • Path Inspector. The installer for GrammaTech's Path Inspector tool is now incorporated in the CodeSurfer installer. Access to Path Inspector functionality requires a license key. This key is included with the Professional and Programmable packages.

Other New Features in CodeSurfer 2.1

  • C++ Support. The CodeSurfer internal representation has been extended to model C++ features:
    • exceptions
    • abnormal function exits
    • templates
  • Building.
    • CodeSurfer can exclude 'bad' compilations of project components from the project. If more than a specified number of compilations are found to be erroneous, the project will not be built.
    • New build preset: super-lite.
    • New/improved build options:
      New Option Description
      -abnormal-exit-filename Specifies a file that lists functions to be treated as abnormal exits.
      -decl-vertices Specifies whether CodeSurfer will create declaration vertices.
      -error-limit Specifies the number of parse errors allowed in a compilation before the compilation is excluded from the build.
      -handle-abnormal-exits Specifies whether CodeSurfer will build the control-flow graph to include edges and program points for abnormal exits.
      -handle-exceptions Specifies whether CodeSurfer will build the control-flow graph to include edges and program points for exceptions.
      -managed-objects-io-buffer-capacity Specifies the I/O buffer capacity for managing objects in core.
      -managed-objects-resident-limit Specifies an upper limit on the total amount of space that can be used by objects in core.
      -min-ok-percent Specifies the minimum percentage of the compilations that has to be included for the build to proceed.
      -new-failure-behavior Specifies how CodeSurfer should treat a failure of C++ command new.
      -verbose Now takes an integer argument in the range [ 0 .. 9 ] rather than a simple yes/no. Higher values cause more reporting is carried out by CodeSurfer during the compilation process.
    • New library models added for:
      • GNU builtins.
      • Linux kernel functions.
    • New compiler models added:
      • armcc
      • mcpcom (Intel compiler, used by icc and icpc)
    • Support for authoring custom compiler models.
    • New executable null-cc allows CodeSurfer projects to be built on systems where there is no compiler.

Modified

  • Installation directory structure.
    • CodeSurfer subtree: GrammaTech/CodeSurfer/csurf.
    • Path Inspector subtree: GrammaTech/CodeSurfer/path-inspector.
  • Executables.
    • On Linux there is one executable named csurf, where previously there had been a shell script named csurf and an executable named codesurfer.
    • On Windows there are now two executables: csurf.exe (used for command line invocations) and wcsurf.exe (used when CodeSurfer is invoked through the Start menu).
  • CodeSurfer Library Models Directory.
    • Build option -libcsmodels now takes a string argument, rather than a symbol.
    • Preference CodeSurfer Library Models Dir now has a string value.

Deprecated

  • MSVS Project Import
    • The standard CodeSurfer build mechanism can generate CodeSurfer projects from MSVS projects without the need for importing, so the MSVS project import feature has been deprecated. Future CodeSurfer releases will not allow MSVS project imports.

Removed

  • Compiler models:
    • acpp
    • ghcc
    • ntcc
  • Building:
    • Memory-Only Build is no longer required because the object store allows large projects to be built.
    • The user no longer needs to specify the method to be used for process hooking.
    • Build options removed:
      • -hook-method
      • -mmap-base-address
      • -no-mmalloc
  • GUI: Property Sheets
    • There is no longer a specific property sheet showing all calls from a given caller function to a given callee function. This information is contained within the call sites property sheet for the caller function.

Scheme API Changes

There have been a large number of changes to the CodeSurfer API. The most significant of these are described below. If you have written scripts for previous versions of CodeSurfer, and they no longer work with this version, then please feel free to contact us for assistance on adapting them.

Exceptions

  • Most functions that can produce errors now throw informative exceptions instead of returning #f. The exception is s-read-sdg, which will return #f if any error condition occurs.
  • The following functions now throw CS_SDG_NOT_PRESENT when an SDG is not currently loaded:
    • s-slice-out
    • s-slice-in
    • s-forward-slice-out
    • s-forward-slice-in
    • s-truncated-chop
    • s-var-truncated-chop
    • pdg-abs-loc-used-vertices
    • pdg-abs-loc-killed-vertices
    • pdg-abs-loc-cond-killed-vertices
    • pdg-abs-loc-may-killed-vertices
    • pdg-vertex-ids-used
    • pdg-vertex-ids-killed
    • pdg-vertex-ids-cond-killed
    • pdg-vertex-actual-points-to
    • pdg-vertex-actual-to-formals
    • abs-loc-used-vertices
    • abs-loc-killed-vertices
    • abs-loc-cond-killed-vertices
    • abs-loc-may-killed-vertices
    • abs-loc-pointed-to-by
    • abs-loc-points-to
    • pdg-gmod-abs-loc-set
    • pdg-gref-abs-loc-set
    • pdg-exceptional-exits
    • pdg-normal-exit
    • pdg-vertex-cfg-inter-sources
    • pdg-vertex-cfg-inter-targets
    • pdg-vertex-cfg-sources
    • pdg-vertex-cfg-targets
    • pdg-vertex-cfg-predecessors
    • pdg-vertex-cfg-successors

Types

Types Removed

  • PDG_CALLs are no longer first-class objects.
    • All pdg-call-* functions have been removed. Use pdg-vertex-* functions applied to call site vertices.
    • pdg-call-sites now returns a list of PDG_VERTEX.

Types Modified

  • Normalized ASTs:
    • Now organized in an inheritance hierarchy.
    • In many cases, types of children have changed (due to addition of new normalized AST classes).
  • Unnormalized ASTs:
    • Unnormalized ASTs can no longer undergo coercion.

Types Added

  • UIDs are now a distinct type.
    • The first item of INCLUDE_PATH is now a UID.
  • SFIDs are now a distinct type.
  • BASIC_BLOCK_CFG_EDGE_SET is now a type
  • BASIC_BLOCK_SET is now a type
  • Unnormalized AST:
    • Helper type operator-name-kind now has several hundred additional possible values corresponding to GNU builtins.
  • Normalized AST:
    • A large number of new normalized AST classes have been added.
    • New helper enumerations:
      • nast_int_kind_names
      • nast_int_kind_pp_names
      • nast_flt_kind_names
      • nast_flt_kind_pp_names
      • nast_storage_class_names

Functions

Functions Removed

Type Removed Function Use Instead
ABS_LOC
  abs-loc-primary-declarations abs-loc-primary-declaration
  abs-loc-heap-type abs-loc-type
  abs-loc-ast-list  
  abs-loc-extern-only?  
  abs-loc-global-map-traverse abs-loc-for-each with abs-loc-global?
  abs-loc-heap-map-traverse abs-loc-for-each with abs-loc-heap?
  abs-loc-string-map-traverse abs-loc-for-each with abs-loc-string?
  abs-loc-file-static-map-traverse abs-loc-for-each with abs-loc-file-static?
  abs-loc-local-static-map-traverse abs-loc-for-each with abs-loc-local-static?
  abs-loc-local-map-traverse abs-loc-for-each with abs-loc-local?
AST
  ast-dig* Coercion is no longer available.
  ast-explode** Coercion is no longer available.
INT_PAIR_SET
  ips-to-pdgvs-mapping-close map will be garbage-collected automatically when it goes out of scope
  ips-to-pdgvs-mapping-open ips-to-pdgvs-map-open
  ips-to-pdgvs-mapping-lookup ips-to-pdgvs-map-lookup
PDG_CALL all functions removed
  pdg-call? pdg-vertex-kind
  pdg-call-vertex no longer need to correlate PDG_CALL to PDG_VERTEX
  pdg-call-actuals-in pdg-vertex-actuals-in
  pdg-call-actuals-in-as-list pdg-vertex-actuals-in-as-list
  pdg-call-actuals-out pdg-vertex-actuals-out
  pdg-call-pdg pdg-vertex-callee
PDG_VERTEX
  pdg-vertex-ast pdg-vertex-asts
  pdg-vertex-basic-block-first-vertex pdg-vertex-basic-block, then basic-block-first-vertex
  pdg-vertex-basic-block-last-vertex pdg-vertex-basic-block, then basic-block-last-vertex
  pdg-vertex-previous-basic-blocks pdg-vertex-basic-block, then basic-block-predecessors
  pdg-vertex-next-basic-blocks pdg-vertex-basic-block, then basic-block-successors
  pdg-vertex-same-basic-block pdg-vertex-basic-block, then basic-block-vertices, then pdg-vertex-set-member?
PDG_VERTEX_SET
  pdg-vertex-set-intersect-size pdg-vertex-set-intersect, then pdg-vertex-set-cardinality
Source Files
  file-get-sfid  

Functions Modified

  • Some functions now throw exceptions. See section Exceptions for details.
Type Modified Function Modification
ABS_LOC
  abs-loc-kind Return value change: can now return #f
  abs-loc-name Parameter change: now takes an additional, optional argument indicating the maximum string length. When this argument is missing, maximum length is unbounded.
  abs-loc-represented-string Parameter change: now takes an additional, optional argument indicating the maximum string length. When this argument is missing, maximum length is unbounded.
  abs-loc-for-each Behavior change: now halts the traversal when the passed closure returns #f (previously it halted when the closure returned anything other than #f ).
  abs-loc-represented-string Behavior change: no longer appends "..." to strings that have been truncated.
PDG
  pdg-call-sites Return value change: now returns a list of PDG_VERTEX.
PDG_VERTEX
  pdg-vertex-rank Return value change: can now return #f
  pdg-vertex-characters Parameter change: now takes an additional, optional argument indicating the maximum string length. When this argument is missing, maximum length is unbounded.
Behavior change: no longer appends "..." to strings that have been truncated.
PDG_VERTEX_SET
  pdg-vertex-set-to-int-pair-set Parameter change: there is no longer a BOOLEAN second argument.
SDG
  sdg-error-count Parameter change: now takes one boolean argument including-dropped.
Return value change: now returns the number of errors if known, 'unknown-positive if the warning count is an indefinite positive number, or 'unknown if the warning count is completely unknown.
  sdg-warning-count Parameter change: now takes one boolean argument including-dropped.
Return value change: now returns the number of errors if known, 'unknown-positive if the warning count is an indefinite positive number, or 'unknown if the warning count is completely unknown.
SET_NATURAL
  set-natural-first-non-elmt Return value change: can now return a natural number that cannot be stored in the set.
  set-natural-next-non-elmt Return value change: can now return a natural number that cannot be stored in the set (never returns #f).
Source Files
  file-get-linecount Parameter change: now takes an SFID (not a UID).
  file-get-include-pos-name Return value change: now returns a list of SFID values.
  file-warning-count Return value change: now returns the number of errors if known, 'unknown-positive if the warning count is an indefinite positive number, or 'unknown if the warning count is completely unknown.
  file-error-count Return value change: now returns the number of errors if known, 'unknown-positive if the warning count is an indefinite positive number, or 'unknown if the warning count is completely unknown.
  file-get-characters Parameter change: now takes an SFID as its first argument (not a FILE_PATH).
Parameter change: now takes an additional, optional argument indicating the maximum string length. When this argument is missing, maximum length is unbounded.

Functions Added

Type New Functions
ABS_LOC
  • abs-loc-primary-declaration
  • abs-loc-type
  • abs-loc-formal?
  • abs-loc-lookup-by-name
ABS_LOC_SET
  • mutable-abs-loc-set?
  • abs-loc-set-cardinality
  • abs-loc-set-kind
  • abs-loc-set-empty?
  • abs-loc-set-copy
  • list->abs-loc-set
  • abs-loc-set-union!
AST no new functions
AST_CLASS no new functions
BASIC_BLOCK
  • basic-block?
  • basic-block-first-vertex
  • basic-block-last-vertex
  • basic-block-predecessors
  • basic-block-successors
  • basic-block-vertices
BASIC_BLOCK_CFG_EDGE_SET
  • basic-block-cfg-edge-set?
  • basic-block-cfg-edge-set-cardinality
  • basic-block-cfg-edge-set-traverse
BASIC_BLOCK_SET
  • mutable-basic-block-set?
  • basic-block-set-create
  • basic-block-set-delete!
  • basic-block-set-put!
  • basic-block-set-empty?
  • basic-block-set-cardinality
  • basic-block-set-kind
  • basic-block-set-member?
  • basic-block-set-copy
  • basic-block-set->list
  • basic-block-set-intersect
  • basic-block-set-intersects?
  • basic-block-set-union
  • basic-block-set-union!
  • basic-block-set-subtract
  • basic-block-set-traverse
Bitwise Operators no new functions
CFG_EDGE_SET
  • mutable-cfg-edge-set?
INT_PAIR_SET
  • mutable-int-pair-set?
  • int-pair-set-delete!
  • int-pair-set-cardinality
  • int-pair-set-kind
  • int-pair-set-member?
  • int-pair-set-copy
  • int-pair-set-intersect
  • int-pair-set-intersects?
  • int-pair-set-union
  • int-pair-set-union!
  • int-pair-set-subtract
  • ips-to-pdgvs-map-open
  • ips-to-pdgvs-map-lookup
Interest Sets no new functions
Miscellaneous
  • csurf-version
  • csurf-major-version
  • csurf-minor-version
  • csurf-patch-version
  • csurf-install-prefix
  • gthome-directory
  • hex-number
  • bin-number
  • vector-binary-search
  • get-codesurfer-timestamp
  • get-user-name
  • get-machine-name
  • set-resident-capacity
  • get-resident-capacity
  • set-io-buffer-capacity
  • get-io-buffer-capacity-pending
  • get-io-buffer-capacity-current
PDG
  • pdg-file-line
  • pdg-basic-blocks
  • pdg-entry-basic-block
  • pdg-exit-basic-block
PDG_VERTEX
  • pdg-vertex-file-line
  • pdg-vertex-asts
  • pdg-vertex-callee
  • pdg-vertex-callee-id
  • pdg-vertex-actuals-in
  • pdg-vertex-actuals-in-as-list
  • pdg-vertex-actuals-out
  • pdg-vertex-exceptional-returns
  • pdg-vertex-normal-return
  • pdg-vertex-solitary-cfg-source
  • pdg-vertex-solitary-cfg-target
  • pdg-vertex-kind-participates-in-cfg
  • pdg-vertex-basic-block
PDG_VERTEX_SET
  • mutable-pdg-vertex-set?
  • pdg-vertex-set-empty?
  • pdg-vertex-set-kind
  • pdg-vertex-set-cardinality
  • pdg-vertex-set-copy
Printing no new functions
SDG
  • s-read-sdg
  • sdg-ignored-uids
  • sdg-loaded?
  • file-is-newer-than-build?
  • sdg-for-each-pdg
SET_NATURAL no new functions
Serialization no new functions
Set Expressions no new functions
Source Files
  • uid?
  • sfid?
  • file-get-characters-in-uid
  • file-get-children
  • file-get-parent
  • file-sfid-line->uid-off
  • file-uid->sfid
  • file-sfid->uid
  • file-uid-line->sfid-line
  • file-sfid-line->uid-line
  • file-sfid->string
  • file-uid->string
  • file-sfid-for-each-child
  • file-tokdef-for-each
  • file-color-map-for-each
  • uid-for-each-pdg
Variable-Mode Queries no new functions

Treatment of Sets

New Set Types

  • BASIC_BLOCK_CFG_EDGE_SET is now a type
  • BASIC_BLOCK_SET is now a type

Set Mutability

Some kinds of sets may be either mutable or immutable.

  • If a set is of immutable type, CONST_ appears as a prefix of its type name.
  • Any function that can take an immutable set can also take a mutable set; not all functions that can take mutable sets can take immutable sets.
  • PDG_EDGE_SETs and BASIC_BLOCK_CFG_EDGE_SETs are always immutable.
  • SET_NATURALs are always mutable.
  • Mutation functions will throw exceptions if called on immutable sets.
  • New functions test for mutability:
    • mutable-abs-loc-set?
    • mutable-basic-block-set?
    • mutable-cfg-edge-set?
    • mutable-int-pair-set?
    • mutable-pdg-vertex-set?

Set Functions

  • Set types ABS_LOC_SET, BASIC_BLOCK_SET, INT_PAIR_SET, and PDG_VERTEX_SET support the full complement of basic set operations. For set_type in {abs-loc-set, basic-block-set, int-pair-set, pdg-vertex-set}, the basic set functions are:
    • set_type?
    • mutable-set_type?
    • set_type-create
    • set_type-delete!
    • set_type-put!
    • set_type-empty
    • set_type-cardinality
    • set_type-kind
    • set_type-member?
    • set_type-copy
    • set_type->list
    • set_type-intersect
    • set_type-intersects?
    • set_type-union
    • set_type-union!
    • set_type-subtract
    • set_type-traverse
    • equal?
    • eqv?
  • Generic set functions (set-cardinality and set-kind) have been removed. Use the appropriate function for the type of set involved.

C API Changes

The C API for CodeSurfer has been completely rewritten.

Fixes

  • Multiple installations of CodeSurfer can coexist more peacefully on Windows.
  • Several memory leak fixes.
  • Varargs after parameter with default value now parsed correctly.
  • GUI
    • Edit / Open File no longer hangs (Windows).
    • ALT key combinations no longer cause crashes.
    • Finder: The Find Type option is now disabled when AST Database is set to no.

Free Trial | Products | Customers | Support | News | Jobs | About Us         © 2007-2008, GrammaTech, Inc. All rights reserved.