Let's start Scheme

2011-11-23

Inlinable marking

On Sagittarius Scheme, as I wrote before (in Japanese) it has mechanism to inline non exported small procedure and seems constant variable implicitly. Well, it sounds really good, it does optimise like GCC's static functions or static const variables.
However, if it marks wrong way, there is problems. I have introduced define-constant syntax and implicit inliner for non exported constant value since version 0.2.2. The latter one had the problem. The compiler marks some variable which should not be inlinable as inlinable. Let me show my embarrassing staff:
(library (test)
   (export test)
   (import (rnrs))

  (define *inner-value* #f)
  (define *inner-value2* #f)

  (define (test)
    (and (begin (set! *inner-value* #t))
         (begin (set! *inner-value2* '())))
    (display *inner-value*)(display *inner-value2*)(newline))
)
In this case, (I actually did not check if it does mark wrongly or not) *inner-value2* will be marked as inlinable, so the compiler inline it as #f. This is the problem. As you can see, it has to be '().
Inlinable marking is written as conservative as possible. Well, actually it wasn't ...

I was too lazy to open an issue for this on Google code, so I just fixed it.

2 comments:

Anonymous said...

tk_rippleさんは英語が好きそうなので、少しだけ変なところを指摘させてもらいます…

> it has mechanism to inline

there is a mechanism

> there is problems.

there are problems

> I have introduced … since version 0.2.2.

> I (have) introduced … in version 0.2.2

> embarrassing staff:

embarrassing stuff :P

> so the compiler inline it

so the compiler inlines it

> is written as conservative as possible.

is written to be as conservative as possible.

kei said...

ご指摘ありがとうございます。

別に英語が好きというわけではないのですが、アウトプットをちょっと頑張らないと仕事に支障がでそうなのでたまに英語で書いているだけです。
(本当はオランダ語で書ければいいのですが、さすがに無理なので(^^;)

Post a Comment