Changeset 324

Show
Ignore:
Timestamp:
06/28/08 23:46:42 (2 months ago)
Author:
JarrettBillingsley
Message:

Coroutine options.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/v2new/docs/minid.alloc.html

    r319 r324  
    114114            Page was generated with 
    115115            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    116             on Fri Jun 27 20:33:21 2008 
     116            on Sat Jun 28 22:13:14 2008 
    117117 
    118118        </td></tr> 
  • branches/v2new/docs/minid.api.html

    r319 r324  
    142142            Page was generated with 
    143143            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    144             on Fri Jun 27 20:33:21 2008 
     144            on Sat Jun 28 22:13:14 2008 
    145145 
    146146        </td></tr> 
  • branches/v2new/docs/minid.ex.html

    r319 r324  
    232232 
    233233<script>explorer.outline.writeEnabled = true;</script> 
    234 <dt><span class="decl">mdint  
     234<dt><span class="decl">nint  
    235235<span class="currsymbol">lookupCT</span> 
    236236<script>explorer.outline.addDecl('lookupCT');</script> 
     
    259259            Page was generated with 
    260260            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    261             on Fri Jun 27 20:33:22 2008 
     261            on Sat Jun 28 22:13:15 2008 
    262262 
    263263        </td></tr> 
  • branches/v2new/docs/minid.gc.html

    r319 r324  
    114114            Page was generated with 
    115115            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    116             on Fri Jun 27 20:33:20 2008 
     116            on Sat Jun 28 22:13:13 2008 
    117117 
    118118        </td></tr> 
  • branches/v2new/docs/minid.interpreter.html

    r319 r324  
    721721 
    722722<script>explorer.outline.writeEnabled = true;</script> 
     723<dt><span class="decl">int  
     724<span class="currsymbol">absIndex</span> 
     725<script>explorer.outline.addDecl('absIndex');</script> 
     726 
     727(MDThread* <span class="funcparam">t</span>, int <span class="funcparam">idx</span>); 
     728</span></dt> 
     729<script>explorer.outline.writeEnabled = false;</script> 
     730 
     731 
     732<dd>Given an index, returns the absolute index that corresponds to it.  This is useful for converting 
     733relative (negative) indices to indices that will never change.  If the index is already absolute, 
     734just returns it.  Throws an error if the index is out of range. 
     735<br><br> 
     736 
     737</dd> 
     738 
     739<script>explorer.outline.writeEnabled = true;</script> 
     740<dt><span class="decl">bool  
     741<span class="currsymbol">isValidIndex</span> 
     742<script>explorer.outline.addDecl('isValidIndex');</script> 
     743 
     744(MDThread* <span class="funcparam">t</span>, int <span class="funcparam">idx</span>); 
     745</span></dt> 
     746<script>explorer.outline.writeEnabled = false;</script> 
     747 
     748 
     749<dd>Sees if a given stack index (negative or positive) is valid.  Valid positive stack indices range 
     750from [0 .. stackSize(<span class="funcparam">t</span>).  Valid negative stack indices range from [-stackSize(<span class="funcparam">t</span>) .. 0. 
     751<br><br> 
     752 
     753</dd> 
     754 
     755<script>explorer.outline.writeEnabled = true;</script> 
    723756<dt><span class="decl">uint  
    724757<span class="currsymbol">rawCall</span> 
     
    26402673<script>explorer.outline.writeEnabled = true;</script> 
    26412674<dt><span class="decl">int  
    2642 <span class="currsymbol">superof</span> 
    2643 <script>explorer.outline.addDecl('superof');</script> 
     2675<span class="currsymbol">superOf</span> 
     2676<script>explorer.outline.addDecl('superOf');</script> 
    26442677 
    26452678(MDThread* <span class="funcparam">t</span>, int <span class="funcparam">slot</span>); 
     
    29172950            Page was generated with 
    29182951            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    2919             on Fri Jun 27 20:33:22 2008 
     2952            on Sat Jun 28 22:13:14 2008 
    29202953 
    29212954        </td></tr> 
  • branches/v2new/docs/minid.types.html

    r319 r324  
    4444<script>explorer.outline.incSymbolLevel();</script> 
    4545<dl> 
     46<script>explorer.outline.writeEnabled = true;</script> 
     47<dt><span class="decl">alias  
     48<span class="currsymbol">nint</span> 
     49<script>explorer.outline.addDecl('nint');</script> 
     50 
     51; 
     52</span></dt> 
     53<script>explorer.outline.writeEnabled = false;</script> 
     54 
     55 
     56<dd>The native signed integer type on this platform.  This is the same as ptrdiff_t but with a better name. 
     57<br><br> 
     58 
     59</dd> 
     60 
     61<script>explorer.outline.writeEnabled = true;</script> 
     62<dt><span class="decl">alias  
     63<span class="currsymbol">nuint</span> 
     64<script>explorer.outline.addDecl('nuint');</script> 
     65 
     66; 
     67</span></dt> 
     68<script>explorer.outline.writeEnabled = false;</script> 
     69 
     70 
     71<dd>The native unsigned integer type on this platform.  This is the same as size_t but with a better name. 
     72<br><br> 
     73 
     74</dd> 
     75 
    4676<script>explorer.outline.writeEnabled = true;</script> 
    4777<dt><span class="decl">alias  
     
    102132 
    103133 
    104 <dd>An alias for the type signature of a native function. 
     134<dd>An alias for the type signature of a native function.  It is defined as nuint function(MDThread*, nuint). 
    105135<br><br> 
    106136 
     
    133163            Page was generated with 
    134164            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    135             on Fri Jun 27 20:33:21 2008 
     165            on Sat Jun 28 22:13:13 2008 
    136166 
    137167        </td></tr> 
  • branches/v2new/docs/minid.utils.html

    r319 r324  
    662662            Page was generated with 
    663663            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    664             on Fri Jun 27 20:33:19 2008 
     664            on Sat Jun 28 22:13:12 2008 
    665665 
    666666        </td></tr> 
  • branches/v2new/docs/minid.vm.html

    r319 r324  
    6666            Page was generated with 
    6767            <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px"> 
    68             on Fri Jun 27 20:33:20 2008 
     68            on Sat Jun 28 22:13:13 2008 
    6969 
    7070        </td></tr> 
  • branches/v2new/minid/gc.d

    r319 r324  
    260260        markObj(vm, o.coroFunc); 
    261261 
    262     if(o.coroFiber) 
    263         markObj(vm, o.coroFiber); 
     262    version(MDRestrictedCoro) {} else 
     263    { 
     264        if(o.coroFiber) 
     265            markObj(vm, o.coroFiber); 
     266    } 
    264267} 
    265268 
  • branches/v2new/minid/interpreter.d

    r323 r324  
    2626import Float = tango.text.convert.Float; 
    2727import Integer = tango.text.convert.Integer; 
    28 import tango.core.Thread; 
     28 
     29version(MDRestrictedCoro) {} else 
     30    import tango.core.Thread; 
     31 
    2932import tango.core.Vararg; 
    3033import tango.stdc.string; 
     
    468471    } 
    469472 
     473    version(MDRestrictedCoro) 
     474    { 
     475        if(f.isNative) 
     476            throwException(t, "newThread - Native functions may not be used as the body of a coroutine"); 
     477    } 
     478 
    470479    maybeGC(t.vm); 
    471  
    472480    return pushThread(t, thread.create(t.vm, f)); 
    473481} 
     
    24782486        checkNumParams(t, 1); 
    24792487         
    2480         if(!isFunction(t, -1)) 
     2488        auto f = getFunction(t, -1); 
     2489 
     2490        if(f is null) 
    24812491        { 
    24822492            pushTypeString(t, -1); 
    24832493            throwException(t, "Attempting to reset a coroutine with a '{}' instead of a 'function'", getString(t, -1)); 
    24842494        } 
    2485          
    2486         t.coroFunc = getFunction(t, -1); 
     2495 
     2496        version(MDRestrictedCoro) 
     2497        { 
     2498            if(f.isNative) 
     2499                throwException(t, "newThread - Native functions may not be used as the body of a coroutine"); 
     2500        } 
     2501 
     2502        t.coroFunc = f; 
    24872503        pop(t); 
    24882504    } 
    24892505 
    2490     if(t.coroFiber) 
    2491         t.getFiber().reset(); 
     2506    version(MDRestrictedCoro) {} else 
     2507    { 
     2508        if(t.coroFiber) 
     2509        { 
     2510            assert(t.getFiber().state == Fiber.State.TERM); 
     2511            t.getFiber().reset(); 
     2512        } 
     2513    } 
    24922514 
    24932515    t.state = MDThread.State.Initial; 
     
    27622784private size_t commonCall(MDThread* t, AbsStack slot, nint numReturns, bool isScript) 
    27632785{ 
     2786    version(MDExtendedCoro) {} else 
     2787    { 
     2788        t.nativeCallDepth++; 
     2789        scope(exit) t.nativeCallDepth--; 
     2790    } 
     2791 
    27642792    if(isScript) 
    27652793        execute(t); 
     
    39914019                throwException(t, "No implementation of {} for type '{}'", MetaNames[MM.CatEq], getString(t, -1)); 
    39924020            } 
    3993                  
     4021 
     4022            version(MDExtendedCoro) {} else 
     4023            { 
     4024                t.nativeCallDepth++; 
     4025                scope(exit) t.nativeCallDepth--; 
     4026            } 
     4027 
    39944028            if(callPrologue2(t, method, firstSlot, 0, firstSlot, num, null)) 
    39954029                execute(t); 
     
    40704104} 
    40714105 
    4072 private class ThreadFiber : Fiber 
    4073 
    4074     private MDThread* t; 
    4075  
    4076     private this(MDThread* t) 
    4077     { 
    4078         super(&run); 
    4079         this.t = t; 
    4080     } 
    4081  
    4082     private void run() 
    4083     { 
    4084         assert(t.state == MDThread.State.Initial); 
    4085         t.stack[0] = t.coroFunc; 
    4086         rawCall(t, 0, -1); 
     4106version(MDRestrictedCoro) {} else 
     4107
     4108    private class ThreadFiber : Fiber 
     4109    { 
     4110        private MDThread* t; 
     4111     
     4112        private this(MDThread* t) 
     4113        { 
     4114            super(&run); 
     4115            this.t = t; 
     4116        } 
     4117     
     4118        private void run() 
     4119        { 
     4120            assert(t.state == MDThread.State.Initial); 
     4121            t.stack[0] = t.coroFunc; 
     4122            rawCall(t, 0, -1); 
     4123        } 
    40874124    } 
    40884125} 
     
    40904127private nuint resume(MDThread* t, size_t numParams) 
    40914128{ 
    4092     if(t.coroFiber is null) 
    4093         t.coroFiber = nativeobj.create(t.vm, new ThreadFiber(t)); 
     4129    version(MDExtendedCoro) 
     4130    { 
     4131        if(t.coroFiber is null) 
     4132            t.coroFiber = nativeobj.create(t.vm, new ThreadFiber(t)); 
     4133        else 
     4134            (cast(ThreadFiber)cast(void*)t.coroFiber.obj).t = t; 
     4135     
     4136        t.getFiber().call(); 
     4137        return t.numYields; 
     4138    } 
     4139    else version(MDRestrictedCoro) 
     4140    { 
     4141        if(t.state == MDThread.State.Initial) 
     4142        { 
     4143            t.stack[0] = t.coroFunc; 
     4144            auto result = callPrologue(t, cast(AbsStack)0, -1, numParams, null); 
     4145            assert(result == true, "resume callPrologue must return true"); 
     4146            execute(t); 
     4147        } 
     4148        else 
     4149        { 
     4150            callEpilogue(t, true); 
     4151            execute(t, t.savedCallDepth); 
     4152        } 
     4153 
     4154        return t.numYields; 
     4155    } 
    40944156    else 
    4095         (cast(ThreadFiber)cast(void*)t.coroFiber.obj).t = t; 
    4096  
    4097     t.getFiber().call(); 
    4098     return t.numYields; 
    4099  
    4100 //  if(t.state == MDThread.State.Initial) 
    4101 //  { 
    4102 //  
    4103 //  
    4104 //      if(t.coroFunc.isNative) 
    4105 //      { 
    4106 //          mixin(Unimpl); 
    4107 // //           assert(mCoroFiber !is null, "no coroutine fiber for native coroutine"); 
    4108 // // 
    4109 // //           nativeCallPrologue(mCoroFunc, 0, -1, 1, numParams, MDValue.nullValue); 
    4110 // //           mCoroFiber.call(); 
    4111 // // 
    4112 // //           if(mCoroFiber.state == Fiber.State.HOLD) 
    4113 // //               mState = State.Suspended; 
    4114 // //           else if(mCoroFiber.state == Fiber.State.TERM) 
    4115 // //               mState = State.Dead; 
    4116 //      } 
    4117 //      else 
    4118 //      { 
    4119 //          auto result = callPrologue(t, cast(AbsStack)0, -1, numParams, null); 
    4120 //          assert(result == true, "resume callPrologue must return true"); 
    4121 //          execute(t); 
    4122 //      } 
    4123 //  
    4124 //      return t.numYields; 
    4125 //  } 
    4126 //  else 
    4127 //  { 
    4128 //      if(t.coroFunc.isNative) 
    4129 //      { 
    4130 //          mixin(Unimpl); 
    4131 // //           mCoroFiber.call(); 
    4132 // // 
    4133 // //           if(mCoroFiber.state == Fiber.State.HOLD) 
    4134 // //               mState = State.Suspended; 
    4135 // //           else if(mCoroFiber.state == Fiber.State.TERM) 
    4136 // //               mState = State.Dead; 
    4137 //      } 
    4138 //      else 
    4139 //      { 
    4140 //          callEpilogue(t, true); 
    4141 //          execute(t, t.savedCallDepth); 
    4142 //      } 
    4143 //  
    4144 //      return t.numYields; 
    4145 //  } 
     4157    { 
     4158        if(t.state == MDThread.State.Initial) 
     4159        { 
     4160            if(t.coroFunc.isNative) 
     4161            { 
     4162                if(t.coroFiber is null) 
     4163                    t.coroFiber = nativeobj.create(t.vm, new ThreadFiber(t)); 
     4164                else 
     4165                    (cast(ThreadFiber)cast(void*)t.coroFiber.obj).t = t; 
     4166 
     4167                t.getFiber().call(); 
     4168            } 
     4169            else 
     4170            { 
     4171                t.stack[0] = t.coroFunc; 
     4172                auto result = callPrologue(t, cast(AbsStack)0, -1, numParams, null); 
     4173                assert(result == true, "resume callPrologue must return true"); 
     4174                execute(t); 
     4175            } 
     4176 
     4177            return t.numYields; 
     4178        } 
     4179        else 
     4180        { 
     4181            if(t.coroFunc.isNative) 
     4182            { 
     4183                assert(t.coroFiber !is null); 
     4184                t.getFiber().call(); 
     4185            } 
     4186            else 
     4187            { 
     4188                callEpilogue(t, true); 
     4189                execute(t, t.savedCallDepth); 
     4190            } 
     4191     
     4192            return t.numYields; 
     4193        } 
     4194    } 
    41464195} 
    41474196 
     
    42584307        case MDValue.Type.Function: 
    42594308            return callPrologue2(t, func.mFunction, slot, numReturns, slot + 1, numParams, proto); 
    4260              
     4309 
    42614310        case MDValue.Type.Thread: 
    42624311            auto thread = func.mThread; 
     
    44084457 
    44094458        try 
     4459        { 
     4460            version(MDExtendedCoro) {} else 
     4461            { 
     4462                t.nativeCallDepth++; 
     4463                scope(exit) t.nativeCallDepth--; 
     4464            } 
     4465 
    44104466            actualReturns = func.nativeFunc(t, numParams - 1); 
     4467        } 
    44114468        catch(MDException e) 
    44124469        { 
     
    44174474        { 
    44184475            // TODO: investigate? 
    4419 //          if(t.nativeCallDepth > 0) 
    4420 //          { 
    4421                 callEpilogue(t, false); 
    4422                 throw e; 
    4423 //          } 
    4424 // 
    4425 //          saveResults(t, t, cast(AbsStack)0, 0); 
    4426 //          callEpilogue(t, true); 
    4427 // 
    4428 //          if(t.arIndex > 0) 
    4429 //              throw e; 
    4430 // 
    4431 //          return false; 
     4476            version(MDExtendedCoro) 
     4477            { 
     4478                if(t.arIndex > 0) 
     4479                { 
     4480                    callEpilogue(t, false); 
     4481                    throw e; 
     4482                } 
     4483                 
     4484                return false; 
     4485            } 
     4486            else 
     4487            { 
     4488                if(t.nativeCallDepth > 0) 
     4489                { 
     4490                    callEpilogue(t, false); 
     4491                    throw e; 
     4492                } 
     4493 
     4494                saveResults(t, t, cast(AbsStack)0, 0); 
     4495                callEpilogue(t, true); 
     4496 
     4497                if(t.arIndex > 0) 
     4498                    throw e; 
     4499 
     4500                return false; 
     4501            } 
    44324502        } 
    44334503 
     
    56675737 
    56685738                case Op.Yield: 
     5739                    version(MDRestrictedCoro) 
     5740                    { 
     5741                        if(t.nativeCallDepth > 0) 
     5742                            throwException(t, "Attempting to yield across native / metamethod call boundary"); 
     5743                    } 
     5744                    else version(MDExtendedCoro) {} else 
     5745                    { 
     5746                        if(t.nativeCallDepth > 0 && (t.coroFunc !is null && !t.coroFunc.isNative)) 
     5747                            throwException(t, "Attempting to yield from script coroutine across native / metamethod call boundary"); 
     5748                    } 
     5749 
    56695750                    auto firstValue = stackBase + i.rd; 
    56705751                    auto ar = pushAR(t); 
     
    56855766                        t.numYields = i.rs - 1; 
    56865767                    } 
     5768                     
     5769                    version(MDExtendedCoro) {} else 
     5770                        t.savedCallDepth = depth; 
    56875771 
    56885772                    t.state = MDThread.State.Suspended; 
    5689                     Fiber.yield(); 
    5690                     t.state = MDThread.State.Running; 
    5691                     callEpilogue(t, true); 
    5692                     break; 
     5773 
     5774                    version(MDRestrictedCoro) 
     5775                        return; 
     5776                    else version(MDExtendedCoro) 
     5777                    { 
     5778                        Fiber.yield(); 
     5779                        t.state = MDThread.State.Running; 
     5780                        callEpilogue(t, true); 
     5781                        break; 
     5782                    } 
     5783                    else 
     5784                    { 
     5785                        if(t.coroFunc.isNative) 
     5786                        { 
     5787                            Fiber.yield(); 
     5788                            t.state = MDThread.State.Running; 
     5789                            callEpilogue(t, true); 
     5790                            break; 
     5791                        } 
     5792                        else 
     5793                            return; 
     5794                    } 
    56935795 
    56945796                case Op.CheckParams: 
     
    58855987                        throwException(t, "Coroutines must be created with a function, not '{}'", getString(t, -1)); 
    58865988                    } 
     5989                     
     5990                    version(MDRestrictedCoro) 
     5991                    { 
     5992                        if(RS.mFunction.isNative) 
     5993                            throwException(t, "Native functions may not be used as the body of a coroutine"); 
     5994                    } 
    58875995 
    58885996                    *get(i.rd) = thread.create(t.vm, RS.mFunction); 
     
    59936101 
    59946102        // TODO: investigate? 
    5995 //      if(t.nativeCallDepth > 0) 
    5996             throw e; 
    5997  
    5998 //      return; 
     6103        version(MDExtendedCoro) 
     6104        { 
     6105            if(t.arIndex > 0) 
     6106                throw e; 
     6107        } 
     6108        else 
     6109        { 
     6110            if(t.nativeCallDepth > 0) 
     6111                throw e; 
     6112        } 
     6113 
     6114        return; 
    59996115    } 
    60006116} 
  • branches/v2new/minid/thread.d

    r319 r324  
    101101        alloc.free(t); 
    102102    } 
    103      
    104   private bool[Fiber] fiberPool; 
     103 
     104//    private bool[Fiber] fiberPool; 
    105105} 
  • branches/v2new/minid/types.d

    r319 r324  
    2424module minid.types; 
    2525 
    26 import tango.core.Thread; 
     26version(MDRestrictedCoro) {} else 
     27    import tango.core.Thread; 
     28 
    2729import tango.text.convert.Layout; 
    2830 
     
    4951 
    5052/** 
    51 The underlying D type used to store the MiniD 'int' type. Also used throughout the API. 
    52 Defaults to the native word-sized integer type (ptrdiff_t).  If you define the MDForceLongInt
    53 version, it will force MiniD to use 64-bit integers even on 32-bit platforms.  If you define 
    54 the MDForceShortInts version, it will force MiniD to use 32-bit integers even on 64-bit platforms. 
     53The underlying D type used to store the MiniD 'int' type. Defaults to the native word-sized signed integer 
     54type (ptrdiff_t).  If you define the MDForceLongInts version, it will force MiniD to use 64-bit integer
     55even on 32-bit platforms.  If you define the MDForceShortInts version, it will force MiniD to use 32-bit 
     56integers even on 64-bit platforms. 
    5557*/ 
    5658version(MDForceLongInts) 
    5759{ 
    5860    version(MDForceShortInts) 
    59         static assert(false, "Defining both MDForceLongInts and MDForceShortInts is illegal"); 
     61    { 
     62        pragma(msg, "The 'MDForceLongInts' and 'MDForceShortInts' versions are mutually exclusive."); 
     63        pragma(msg, "Please define one or the other (or neither), not both.\n"); 
     64        static assert(false, "FAILCOPTER."); 
     65    } 
    6066 
    6167    public alias long mdint; 
     
    8591 
    8692/** 
    87  
     93The MiniD exception type.  This is the type that is thrown whenever you throw an exception from within 
     94MiniD, or when you use the throwException API call.  You can't directly instantiate this class, though, 
     95since it would be bad if you did (the interpreter needs to keep track of some internal state, which 
     96throwException does).  See throwException and catchException in minid.interpreter for more info 
     97on MiniD exception handling. 
    8898*/ 
    8999class MDException : Exception 
    90100{ 
    91     public this(char[] msg) 
     101    package this(char[] msg) 
    92102    { 
    93103        super(msg); 
     
    95105} 
    96106 
    97 class MDCompileException : MDException 
    98 
    99     bool atEOF = false; 
    100     bool solitaryExpression = false; 
    101      
    102     public this(char[] msg) 
     107/** 
     108An exception type representing a compilation error.  The message will be in the form "filename(line:column): 
     109error message".  Again, you can't directly instantiate this exception type. 
     110*/ 
     111final class MDCompileException : MDException 
     112
     113    /** 
     114    Indicates whether the compiler threw this at the end of the file or not.  If this is 
     115    true, this might be because the compiler ran out of input, in which case the code could 
     116    be made to compile by adding more code. 
     117    */ 
     118    public bool atEOF = false; 
     119     
     120    /** 
     121    Indicates whether the compiler threw this because of a statement that consisted of a no-effect expression. 
     122    If true, the code might be able to be compiled and evaluated as an expression. 
     123    */ 
     124    public bool solitaryExpression = false; 
     125 
     126    package this(char[] msg) 
    103127    { 
    104128        super(msg); 
     
    106130} 
    107131 
    108 class MDHaltException : Exception 
    109 
    110     public this() 
     132/** 
     133This is a semi-internal exception type.  Normally you won't need to know about it or catch it.  This is 
     134thrown when a coroutine (thread) needs to be halted.  It should never propagate out of the coroutine. 
     135The only time you might encounter it is if, in the middle of a native MiniD function, one of these 
     136is thrown, you might be able to catch it and clean up some resources, but you should rethrow it. 
     137 
     138Like the other exception types, you can't instantiate this directly, but you can halt threads with the 
     139"haltThread" function in minid.interpreter. 
     140*/ 
     141final class MDHaltException : Exception 
     142
     143    package this() 
    111144    { 
    112145        super("MiniD interpreter halted"); 
    113146    } 
    114147} 
     148 
     149version(MDRestrictedCoro) 
     150    version(MDExtendedCoro) 
     151    { 
     152        pragma(msg, "The 'MDRestrictedCoro' and 'MDExtendedCoro' versions are mutually exclusive."); 
     153        pragma(msg, "Please define one or the other (or neither), not both.\n"); 
     154        static assert(false, "FAILCOPTER."); 
     155    } 
    115156 
    116157// ================================================================================================================================================ 
     
    556597    package bool shouldHalt = false; 
    557598 
    558     // References a Fiber object 
    559     package MDNativeObj* coroFiber; 
    560599    package MDFunction* coroFunc; 
    561600    package State state = State.Initial; 
    562601    package size_t numYields; 
    563602 
    564     package Fiber getFiber() 
    565     { 
    566         assert(coroFiber !is null); 
    567         return cast(Fiber)cast(void*)coroFiber.obj; 
     603    version(MDExtendedCoro) {} else 
     604    { 
     605        package size_t savedCallDepth; 
     606        package size_t nativeCallDepth = 0; 
     607    } 
     608 
     609    version(MDRestrictedCoro) {} else 
     610    { 
     611        // References a Fiber object 
     612        package MDNativeObj* coroFiber; 
     613 
     614        package Fiber getFiber() 
     615        { 
     616            assert(coroFiber !is null); 
     617            return cast(Fiber)cast(void*)coroFiber.obj; 
     618        } 
    568619    } 
    569620} 
  • branches/v2new/test.d

    r323 r324  
    2626    lookupCT!("Timer")(t); 
    2727 
    28         auto funcReg = loadFunc(t, `samples\simple.md`); 
     28        auto funcReg = loadFunc(t, `benchmark\cheapconcurrency.md`); 
    2929        pushNull(t); 
    3030        rawCall(t, funcReg, 0);