Author Topic: Question for Charles / any one else - can you translate ?  (Read 2197 times)

0 Members and 2 Guests are viewing this topic.

RobbeK

  • Guest
Question for Charles / any one else - can you translate ?
« on: August 28, 2014, 10:28:26 AM »
Hi,

Got a copy of the Loch Ness Monster of compilers --  the (in) famous STALIN compiler.  -- comes with the text :

One aggressive optimization that differentiates Stalin (no pun intended, ref StalinGrad) somewhat, is its inlining of callbacks. For example a generic numeric multidimensional integral library would take a callback that implements the function that needs to be integrated. This function is typically computed several hundreds of thousands of times in a very tight hot loop incurring a call overhead on each one. In a C library such callbacks cannot be inlined as it is compiled ahead of time. The whole program analysis paradigm helps a lot in determining the callback function and inlining it in place, this triggers more opportunities for more conventional optimizations.

-- can some one explain this ???

Writing the Japi headers for the moment -- ( it works upto now -- but I'm only at around 30 foreign functions (rather boring job))

a typical out put when compiling   (takes a looooong time)

------------------                                           ------------ there's always RM failed , but the exec works perfectly
C:\Stalin0.11>stalingraph japitest.sc
Reading source
Expanding macros
Fast tree shake
Annotating expressions with their parents
Annotating variables with their environments
Annotating expressions with their environments
In-lining first-order calls to primitive procedures
Annotating expressions with their parents
Annotating variables with their environments
Annotating expressions with their environments
Annotating variables with their references
Performing flow analysis
Enumerating call sites
Determining which types and type sets are used
 17191 expressions
     0 internal symbol types
     0 external symbol types
    17 primitive procedure types
   241 non-called native procedure types
   364 called noop native procedure types
    63 called non-noop native procedure types
    12 foreign procedure types
     0 continuation types
     2 string types
     1 structure type
     8 headed vector types
     1 nonheaded vector type
     0 displaced vector types
 19601 type sets
   710 hunoz variables
  1689 non-hunoz variables
   585 noop environments
  1607 non-noop environments
0 call sites dispatch on clones
Maximal non-LET lexical nesting depth is 4
Maximal clone rate is 1
Determining which call sites to split
Performing flow analysis
Enumerating call sites
Determining which types and type sets are used
 17191 expressions
     0 internal symbol types
     0 external symbol types
    17 primitive procedure types
   241 non-called native procedure types
   364 called noop native procedure types
    63 called non-noop native procedure types
    12 foreign procedure types
     0 continuation types
     2 string types
     1 structure type
     8 headed vector types
     1 nonheaded vector type
     0 displaced vector types
 19601 type sets
   710 hunoz variables
  1689 non-hunoz variables
   585 noop environments
  1607 non-noop environments
0 call sites dispatch on clones
Maximal non-LET lexical nesting depth is 4
Maximal clone rate is 1
Determining which call sites to split
2 passes of flow analysis
Computing call graph
Determining which environments are called more than once
Determining which variables are referenced
Determining free variables
Determining necessarily-fictitious native procedure types
Annotating environments and continuation types
Inverting points-to relation
Determining escaping types
Determining which environments have unique call sites
Determining which environments are recursive
Determining which environments are reentrant
Asserting uniqueness
Performing lightweight closure conversion
Determining parents
Determining which expressions need conversion to CPS
  3742 expressions
     0 internal symbol types
     0 external symbol types
    17 primitive procedure types
   241 non-called native procedure types
   364 called noop native procedure types
    63 called non-noop native procedure types
    12 foreign procedure types
     0 continuation types
     2 string types
     1 structure type
     8 headed vector types
     1 nonheaded vector type
     0 displaced vector types
  4739 type sets
   368 hunoz variables
   618 non-hunoz variables
     0 noop environments
    63 non-noop environments
0 call sites dispatch on clones
Maximal non-LET lexical nesting depth is 4
Maximal clone rate is 1
Determining environment distances from root
Determining which environments have external self tail calls
Determining which environments have external continuation calls
Determining blocked environments
Determining which environments need to pass parameters globally
Determining allocations
Applying closed-world assumption
Determining indirect structure types
Determining which types are never allocated on the heap
Determining which types are atomic
Determining which environments have regions
Determining which type sets are squeezable
Determining which type sets are squishable
Determining alignments
Assigning global squish tags
W17192 is general case for the following reasons:
  nondegenerate nonheaded vector
Generating code
In [inside LOOP 796]
Argument to STRUCTURE-REF might not be a structure of the correct type
Removing unused declarations
Removing unused labels
Generating C code
Writing database
Compiling C code
gcc -I . -I c:/stalin0.11/include -I c:/stalin-0.11.1/include -o japitest japitest.c -fno-strict-aliasing -ljapi -lwsock32 -L . -L c:/stalin0.11/include -L c:/stalin-0.11.1/include -lm -lstalin
RM failed

C:\Stalin0.11>japitest

C:\Stalin0.11>  ???

best Rob ,  t.i.a
 

Charles Pegge

  • Guest
Re: Question for Charles / any one else - can you translate ?
« Reply #1 on: August 28, 2014, 12:05:35 PM »
Hi Rob,

As I understand it, Stalin replaces callback-calls with the callback-function content to eliminate the expense of parameter passing etc. Obviously it can't be done with a pre-compiled caller.

Once the callback function has been inlined, further optimizations may be possible.

RobbeK

  • Guest
Re: Question for Charles / any one else - can you translate ?
« Reply #2 on: August 29, 2014, 12:19:50 AM »
Thanks Charles, 

useful or acamedic ??  (don't know any one using this compiler - for Scheme, it brings the numerics to the level of C , no bignums, complex numbers, fractions etc ...  )

best Rob

Charles Pegge

  • Guest
Re: Question for Charles / any one else - can you translate ?
« Reply #3 on: August 29, 2014, 01:01:17 AM »

Ruthless efficiency is not so valued these days. Has it's 5 year plan expired?

RobbeK

  • Guest
Re: Question for Charles / any one else - can you translate ?
« Reply #4 on: August 29, 2014, 01:15:46 AM »
Has it's 5 year plan expired?   :)

yep , the Gulag got it hands on it   -- yes, funny name , next maybe the self-expanding Adolf compiler  ,,,

bet Rob