이글루스 | 로그인
메뉴릿
카테고리
전체
공지사항
계획
Languages
Humanities
Mathematics
Education
Economics
Computers
HCI
Media
Engineering
Natural Science
TmaxSoft
BluemoonSoft
미분류
최근 등록된 덧글
짝짝짝 올 많이 컸네 일구
by izeye at 11/12
제가 갖고 있는 소스 파일..
by 언제나19 at 10/17
우왕 고맙습니다~~. ..
by 언제나19 at 10/16
http://nethack.byus..
by uriel at 10/16
근본적으로 activation ..
by uriel at 10/16
다운 안되는데여;;;;;
by 강병진 at 10/14
일단, 형변환 자체가 ..
by uriel at 04/11
어제는 괜히 xfix 실행..
by 언제나19 at 01/18
좀 기다리세요. 내년 4..
by 언제나19 at 11/04
바꾸어라.. 언제나19-..
by kang at 11/03
최근 등록된 트랙백
textcube를 다시 설치
by 공부가 본업.
gnuplot을 c 함수로 ..
by 상품 + 글 의견 남기기
gsl, gnu scientific li..
by 상품 + 글 의견 남기기
ubuntu, ati에서 dual..
by 상품 + 글 의견 남기기
Data browser로 sql d..
by 공부가 본업.
근황
by Yi jeon goo
근황
by Yi jeon goo
라이프로그
화려한 휴가
화려한 휴가

좋지 아니한가
좋지 아니한가

300
300

포토로그

언제나19의 포토로그
메모장 실험
메모장도 로그가 남나 실험
이전블로그
more...
이글루링크
◈ ◈ ◈ 바다가 머무는 ..
Mono log
Liard's newspaper
Yochin의 대전생활.
M log
art.oriented
* Sea of Blue *
이글루 파인더
rss

skin by 狂風
CallFrame 설명

CallFrame에 대한 설명
squirrel 소스에 주석으로 박혀있는 설명.


/*
    The layout of a register frame looks like this:

    For

    function f(x, y) {
        var v1;
        function g() { }
        var v2;
        return (x) * (y);
    }

    assuming (x) and (y) generated temporaries t1 and t2, you would have

    ------------------------------------
    |  x |  y |  g | v2 | v1 | t1 | t2 | <-- value held
    ------------------------------------
    | -5 | -4 | -3 | -2 | -1 | +0 | +1 | <-- register index
    ------------------------------------
    | params->|<-locals      | temps->

    Because temporary registers are allocated in a stack-like fashion, we
    can reclaim them with a simple popping algorithm. The same goes for labels.
    (We never reclaim parameter or local registers, because parameters and
    locals are DontDelete.)

    The register layout before a function call looks like this:

    For

    function f(x, y)
    {
    }

    f(1);

    >                        <------------------------------
    <                        >  reserved: call frame  |  1 | <-- value held
    >         >snip<         <------------------------------
    <                        > +0 | +1 | +2 | +3 | +4 | +5 | <-- register index
    >                        <------------------------------
    | params->|<-locals      | temps->

    The call instruction fills in the "call frame" registers. It also pads
    missing arguments at the end of the call:

    >                        <-----------------------------------
    <                        >  reserved: call frame  |  1 |  ? | <-- value held ("?" stands for "undefined")
    >         >snip<         <-----------------------------------
    <                        > +0 | +1 | +2 | +3 | +4 | +5 | +6 | <-- register index
    >                        <-----------------------------------
    | params->|<-locals      | temps->

    After filling in missing arguments, the call instruction sets up the new
    stack frame to overlap the end of the old stack frame:

                             |---------------------------------->                        <
                             |  reserved: call frame  |  1 |  ? <                        > <-- value held ("?" stands for "undefined")
                             |---------------------------------->         >snip<         <
                             | -7 | -6 | -5 | -4 | -3 | -2 | -1 <                        > <-- register index
                             |---------------------------------->                        <
                             |                        | params->|<-locals       | temps->

    That way, arguments are "copied" into the callee's stack frame for free.

    If the caller supplies too many arguments, this trick doesn't work. The
    extra arguments protrude into space reserved for locals and temporaries.
    In that case, the call instruction makes a real copy of the call frame header,
    along with just the arguments expected by the callee, leaving the original
    call frame header and arguments behind. (The call instruction can't just discard
    extra arguments, because the "arguments" object may access them later.)
    This copying strategy ensures that all named values will be at the indices
    expected by the callee.
*/

by 언제나19 | 2009/07/20 15:09 | Computers | 트랙백 | 덧글(0)
트랙백 주소 : http://always19.egloos.com/tb/2399057
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글


◀ 이전 페이지 다음 페이지 ▶