Changeset 169

Show
Ignore:
Timestamp:
05/20/07 17:35:04 (2 years ago)
Author:
JarrettBillingsley
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/minid/baselib.d

    r167 r169  
    430430    int mdtypeof(MDState s, uint numParams) 
    431431    { 
    432         s.push(typeStrings[s.getParam(0u).type]); 
     432        s.push(s.getParam(0u).typeString()); 
    433433        return 1; 
    434434    } 
  • trunk/minid/compiler.d

    r167 r169  
    31493149        ret.mNumParams = mNumParams; 
    31503150        ret.mNumUpvals = mUpvals.length; 
    3151         ret.mStackSize = mStackSize
     3151        ret.mStackSize = mStackSize + 1
    31523152        ret.mCode = mCode; 
    31533153        ret.mLineInfo = mLineInfo; 
  • trunk/minid/opcodes.d

    r167 r169  
    171171PopCatch..........I: n/a, n/a 
    172172PopFinally........I: n/a, n/a 
    173 Precall...........R: dest, src, lookup (0 = no, 1 = yes) 
     173   Precall...........R: dest, src, lookup (0 = no, 1 = yes) 
    174174PushCatch.........J: exception reg, branch offset 
    175175PushFinally.......J: n/a, branch offset 
  • trunk/minid/types.d

    r167 r169  
    28712871        writefln(); 
    28722872        writefln("-----Stack Dump-----"); 
    2873         for(int i = 0; i < mCurrentAR.savedTop; i++) 
     2873        for(int i = 0; i < mStack.length; i++) 
    28742874            writefln("[%2d:%3d]: %s", i, i - cast(int)mCurrentAR.base, mStack[i].toString()); 
    28752875 
     
    37173717            mCurrentAR.numReturns = numReturns; 
    37183718            mCurrentAR.env = closure.environment(); 
    3719              
     3719 
    37203720            mStackIndex = base + funcDef.mStackSize; 
    37213721 
     
    37933793        } 
    37943794 
    3795         mStackIndex = destSlot; 
    3796  
    37973795        if(mARIndex == 0) 
    37983796            mState = State.Dead; 
    37993797 
    3800         if(!isMultRet) 
     3798        if(isMultRet) 
     3799            mStackIndex = destSlot; 
     3800        else 
    38013801            mStackIndex = mCurrentAR.savedTop; 
    38023802 
     
    48694869    } 
    48704870     
    4871     protected MDValue lookupMethod(MDValue* RS, MDString methodName) 
     4871    protected final MDValue lookupMethod(MDValue* RS, MDString methodName) 
    48724872    { 
    48734873        MDValue* v; 
     
    49244924    } 
    49254925     
    4926     protected MDValue operatorCat(MDValue[] vals) 
     4926    protected final MDValue operatorCat(MDValue[] vals) 
    49274927    { 
    49284928        debug(TIMINGS) scope _profiler_ = new Profiler("Cat"); 
     
    49644964    } 
    49654965     
    4966     protected void operatorCatAssign(MDValue* dest, MDValue[] vals) 
     4966    protected final void operatorCatAssign(MDValue* dest, MDValue[] vals) 
    49674967    { 
    49684968        debug(TIMINGS) scope _profiler_ = new Profiler("CatEq"); 
     
    50955095                Instruction i = *mCurrentAR.pc; 
    50965096                mCurrentAR.pc++; 
    5097  
    5098                 MM operation = void; 
    50995097 
    51005098                switch(i.opcode) 
     
    55535551                            if(numParams == -1) 
    55545552                                numParams = getBasedStackIndex() - funcReg - 1; 
     5553                            else 
     5554                                mStackIndex = funcReg + numParams + 1; 
    55555555     
    55565556                            if(callPrologue(funcReg, numResults, numParams) == true) 
     
    55585558                                depth++; 
    55595559                                constTable = mCurrentAR.func.script.func.mConstants; 
     5560                            } 
     5561                            else 
     5562                            { 
     5563                                if(numResults >= 0) 
     5564                                    mStackIndex = mCurrentAR.savedTop; 
    55605565                            } 
    55615566                        } 
     
    55705575                            if(numParams == -1) 
    55715576                                numParams = getBasedStackIndex() - funcReg - 1; 
    5572      
     5577                            else 
     5578                                mStackIndex = funcReg + numParams + 1; 
     5579 
    55735580                            funcReg = basedIndexToAbs(funcReg); 
    55745581     
     
    56155622                            if(numParams == -1) 
    56165623                                numParams = getBasedStackIndex() - funcReg - 1; 
     5624                            else 
     5625                                mStackIndex = funcReg + numParams + 1; 
    56175626 
    56185627                            if(callPrologue(funcReg, numResults, numParams) == true) 
     
    56215630                                constTable = mCurrentAR.func.script.func.mConstants; 
    56225631                            } 
     5632                            else 
     5633                            { 
     5634                                if(numResults >= 0) 
     5635                                    mStackIndex = mCurrentAR.savedTop; 
     5636                            } 
    56235637                        } 
    56245638                        else 
     
    56335647                            if(numParams == -1) 
    56345648                                numParams = getBasedStackIndex() - funcReg - 1; 
     5649                            else 
     5650                                mStackIndex = funcReg + numParams + 1; 
    56355651     
    56365652                            funcReg = basedIndexToAbs(funcReg); 
     
    56655681 
    56665682                        int numResults = i.imm - 1; 
     5683                         
     5684                        if(numResults >= 0) 
     5685                            mStackIndex = i.rd + numResults; 
    56675686 
    56685687                        close(0); 
     
    56725691                        if(depth == 0) 
    56735692                            return; 
    5674  
     5693                             
    56755694                        constTable = mCurrentAR.func.script.func.mConstants; 
    56765695                        break; 
     
    56815700                        int numNeeded = i.imm - 1; 
    56825701                        int numVarargs = mCurrentAR.base - mCurrentAR.vargBase; 
     5702                        uint dest = basedIndexToAbs(i.rd); 
    56835703     
    56845704                        if(numNeeded == -1) 
     5705                        { 
    56855706                            numNeeded = numVarargs; 
    5686  
    5687                         needStackSlots(numNeeded); 
     5707                            mStackIndex = dest + numVarargs; 
     5708                            checkStack(mStackIndex); 
     5709                        } 
    56885710 
    56895711                        uint src = mCurrentAR.vargBase; 
    5690                         uint dest = basedIndexToAbs(i.rd); 
    56915712 
    56925713                        for(uint index = 0; index < numNeeded; index++) 
    56935714                        { 
    56945715                            if(index < numVarargs) 
    5695                                 copyAbsStack(dest + index, src); 
     5716                                copyAbsStack(dest, src); 
    56965717                            else 
    5697                                 getAbsStack(dest + index).setNull(); 
    5698      
     5718                                getAbsStack(dest).setNull(); 
     5719 
    56995720                            src++; 
     5721                            dest++; 
    57005722                        } 
    5701                          
    5702                         mStackIndex = dest + numNeeded
     5723 
     5724                        debug(STACKINDEX) writefln("Op.Vararg set stack index to ", mStackIndex)
    57035725                        break; 
    57045726