• R/O
  • SSH
  • HTTPS

eirlua: コミット


コミットメタ情報

リビジョン8 (tree)
日時2018-02-06 04:30:08
作者quiret

ログメッセージ

- added Code::Blocks project for Linux compilation
- made Eir Lua compile under Linux (WIP; have to fix a lot of warnings and stuff)

変更サマリ

差分

--- src/lapi.config.cpp (revision 7)
+++ src/lapi.config.cpp (revision 8)
@@ -214,7 +214,7 @@
214214 lua_lock(L);
215215 {
216216 global_State *g = G(L);
217-
217+
218218 lua_config *cfg = g->config;
219219
220220 GlobalStateAllocPluginData *allocData = (GlobalStateAllocPluginData*)cfg->allocData;
@@ -281,7 +281,7 @@
281281 {
282282 inline void Multithreading( lua_config *cfg, lua_cfgValue value )
283283 {
284- cfg->isMultithreaded = ( value != FALSE );
284+ cfg->isMultithreaded = ( value != LUA_FALSE );
285285 }
286286 };
287287
@@ -294,7 +294,7 @@
294294
295295 bool success = DispatchConfigItem( cfg, cfgName, valueIn, dispatch );
296296
297- return ( success ) ? TRUE : FALSE;
297+ return ( success ) ? LUA_TRUE : LUA_FALSE;
298298 }
299299
300300 struct GetConfigItemDispatch
@@ -301,7 +301,7 @@
301301 {
302302 inline void Multithreading( lua_config *cfg, lua_cfgValue& value )
303303 {
304- value = ( cfg->isMultithreaded ? TRUE : FALSE );
304+ value = ( cfg->isMultithreaded ? LUA_TRUE : LUA_FALSE );
305305 }
306306 };
307307
@@ -315,7 +315,7 @@
315315
316316 bool success = DispatchConfigItem( cfg, cfgName, *valueOut, dispatch );
317317
318- return ( success ) ? TRUE : FALSE;
318+ return ( success ) ? LUA_TRUE : LUA_FALSE;
319319 }
320320
321321 LUA_API void lua_freeconfig( lua_config *cfg )
@@ -327,7 +327,7 @@
327327
328328 // Grab the allocation data interface.
329329 GlobalStateAllocPluginData *allocData = (GlobalStateAllocPluginData*)cfg->allocData;
330-
330+
331331 // Get the memory allocator onto the stack.
332332 GeneralMemoryAllocator allocMem = allocData->_memAlloc;
333333
@@ -339,4 +339,4 @@
339339
340340 // Dereference the library.
341341 _dereferenceLibrary();
342-}
\ No newline at end of file
342+}
--- src/lapi.exec.cpp (revision 7)
+++ src/lapi.exec.cpp (revision 8)
@@ -18,7 +18,7 @@
1818 {
1919 if ( nres == LUA_MULTRET )
2020 {
21- __noop(); //L->ciStack.Top()->top = L->rtStack.Top();
21+ //__noop(); //L->ciStack.Top()->top = L->rtStack.Top();
2222 }
2323 }
2424
@@ -193,4 +193,4 @@
193193 return 0;
194194
195195 return ((lua_Thread*)L)->status;
196-}
\ No newline at end of file
196+}
--- src/lapi.set.cpp (revision 7)
+++ src/lapi.set.cpp (revision 8)
@@ -185,7 +185,7 @@
185185 {
186186 luaC_objbarriert(L, h, mt);
187187
188- tableNativeImplementation *nativeMetaTable = GetTableNativeImplementation( mt );
188+ tableNativeImplementation *nativeMetaTable = tableNativeImplementation::GetNativeImplementation( mt );
189189
190190 if ( nativeMetaTable )
191191 {
--- src/lclass.cpp (revision 7)
+++ src/lclass.cpp (revision 8)
@@ -17,7 +17,9 @@
1717 #include "lfunc.class.hxx"
1818 #include "ldispatch.class.hxx"
1919
20-#include "lclass.hxx"
20+#include "lclass.hxx"
21+
22+#include <sdk/MacroUtils.h>
2123
2224 // Class type info plugin.
2325 classTypeInfoPlugin_t classTypeInfoPlugin( namespaceFactory, namespaceFactory_t::ANONYMOUS_PLUGIN_ID );
@@ -74,7 +76,7 @@
7476 Table* m_methTable;
7577 };
7678
77-__forceinline void class_allocateRegisterCache( lua_State *L, Class *j )
79+AINLINE void class_allocateRegisterCache( lua_State *L, Class *j )
7880 {
7981 if ( !j->methodCache )
8082 {
@@ -82,7 +84,7 @@
8284 }
8385 }
8486
85-__forceinline Closure* class_getDelayedMethodRegister( lua_State *L, Class *j, TString *methName, bool excludeInternal )
87+AINLINE Closure* class_getDelayedMethodRegister( lua_State *L, Class *j, TString *methName, bool excludeInternal )
8688 {
8789 if ( !j->methodCache )
8890 return NULL;
@@ -109,7 +111,7 @@
109111 return res;
110112 }
111113
112-__forceinline void class_readFromStorage( lua_State *L, Class *j, const TValue *key, StkId val, bool excludeInternal )
114+AINLINE void class_readFromStorage( lua_State *L, Class *j, const TValue *key, StkId val, bool excludeInternal )
113115 {
114116 {
115117 ConstValueAddress envRes = luaH_get( L, j->storage, key );
@@ -120,7 +122,7 @@
120122 return;
121123 }
122124 }
123-
125+
124126 if ( ttype( key ) == LUA_TSTRING )
125127 {
126128 // Check the delayed method registry
@@ -137,7 +139,7 @@
137139 setnilvalue( val );
138140 }
139141
140-__forceinline ConstValueAddress class_getFromStorage( lua_State *L, Class *j, const TValue *key, bool excludeInternal )
142+AINLINE ConstValueAddress class_getFromStorage( lua_State *L, Class *j, const TValue *key, bool excludeInternal )
141143 {
142144 {
143145 ConstValueAddress envRes = luaH_get( L, j->storage, key );
@@ -166,7 +168,7 @@
166168 return luaO_getnilcontext( L );
167169 }
168170
169-__forceinline ConstValueAddress class_getFromStorageString( lua_State *L, Class *j, TString *key, bool excludeInternal )
171+AINLINE ConstValueAddress class_getFromStorageString( lua_State *L, Class *j, TString *key, bool excludeInternal )
170172 {
171173 // Try the storage.
172174 {
@@ -197,7 +199,7 @@
197199 class_readFromStorage( L, m_class, key, val, true );
198200 }
199201
200-__forceinline void class_checkMethodDelayOverride( lua_State *L, Class *j, const TValue *key )
202+AINLINE void class_checkMethodDelayOverride( lua_State *L, Class *j, const TValue *key )
201203 {
202204 if ( j->methodCache && ttype( key ) == LUA_TSTRING )
203205 {
@@ -218,13 +220,13 @@
218220 setobj( L, tabidx, val );
219221 }
220222
221-__forceinline void class_checkEnvIndex( lua_State *L, Class *j )
223+AINLINE void class_checkEnvIndex( lua_State *L, Class *j )
222224 {
223225 if ( j->destroyed )
224226 throw lua_exception( L, LUA_ERRRUN, "attempt to index the environment of a destroyed class" );
225227 }
226228
227-__forceinline bool class_obtainPrivateEnvValue( lua_State *L, Class *j, ConstValueAddress& key, ValueAddress& value )
229+AINLINE bool class_obtainPrivateEnvValue( lua_State *L, Class *j, ConstValueAddress& key, ValueAddress& value )
228230 {
229231 const TValue *val = j->GetEnvValue( L, key );
230232
@@ -527,7 +529,7 @@
527529
528530 void Class::CallMethod( lua_State *L, const char *key )
529531 {
530-
532+
531533 }
532534
533535 void Class::SetTransmit( int type, void *entity )
@@ -552,7 +554,7 @@
552554
553555 if ( !trans )
554556 return false;
555-
557+
556558 for ( unsigned int n = 0; n < transCount; n++ )
557559 {
558560 trans_t& item = trans[n];
@@ -742,7 +744,7 @@
742744 return luaH_getstr( L, internStorage, GetSuperString( L ) );
743745 }
744746
745-__forceinline void class_checkDestroyedMethodCall( lua_State *L, Class *j )
747+AINLINE void class_checkDestroyedMethodCall( lua_State *L, Class *j )
746748 {
747749 if ( j->destroyed )
748750 throw lua_exception( L, LUA_ERRRUN, "attempt to access a destroyed class' method" );
@@ -833,7 +835,7 @@
833835 }
834836
835837 static int classmethod_rootTransNative( lua_State *L )
836-{
838+{
837839 CClosureMethodTrans *cl = (CClosureMethodTrans*)curr_func( L );
838840 Class *j = cl->m_class;
839841 MethodStackAllocation member( L, j, NULL );
@@ -908,7 +910,7 @@
908910 // Copy arguments while protecting slots
909911 for ( int n = 1; n <= top; n++ )
910912 {
911- ConstValueAddress copyArgument = index2constadr( L, n );
913+ ConstValueAddress copyArgument = index2constadr( L, n );
912914
913915 pushtvalue( L, copyArgument );
914916 }
@@ -1334,7 +1336,7 @@
13341336 {
13351337 ClassMethodRegister *reg = (ClassMethodRegister*)methodCache->GetNodeValue( node );
13361338 table = reg->GetMethodTable();
1337-
1339+
13381340 Closure *cl = reg->Create( L, this );
13391341 methodCache->DeleteNode( L, node ); // remove as it no longer serves a purpose
13401342
@@ -1353,7 +1355,7 @@
13531355 bool methWhite = iswhite( method ) != 0;
13541356
13551357 ValueAddress methodPtr = luaH_setstr( L, table, name );
1356-
1358+
13571359 setclvalue( L, methodPtr, method );
13581360
13591361 if ( methWhite && isblack( table ) )
@@ -1362,7 +1364,7 @@
13621364 }
13631365 }
13641366
1365-__forceinline void Class::RegisterMethod( lua_State *L, TString *methName, bool handlers )
1367+AINLINE void Class::RegisterMethod( lua_State *L, TString *methName, bool handlers )
13661368 {
13671369 Table *methTable;
13681370 Closure *prevMethod = GetMethod( L, methName, methTable ); // Acquire the previous method
@@ -1393,19 +1395,23 @@
13931395 cl->isEnvLocked = true;
13941396
13951397 Closure *handler;
1398+
1399+ bool hasItem = false;
1400+
1401+ if ( handlers )
1402+ {
1403+ Class::forceSuperItem *item = forceSuper->GetItem( methName );
13961404
1397- if ( !handlers )
1398- goto defaultHandler;
1399-
1400- Class::forceSuperItem *item = forceSuper->GetItem( methName );
1401-
1402- if ( item && item->cb )
1403- {
1404- handler = item->cb( L, cl, this, prevMethod );
1405- }
1406- else
1405+ if ( item && item->cb )
1406+ {
1407+ handler = item->cb( L, cl, this, prevMethod );
1408+
1409+ hasItem = true;
1410+ }
1411+ }
1412+
1413+ if ( !hasItem )
14071414 {
1408- defaultHandler:
14091415 if ( prevMethod )
14101416 {
14111417 CClosureMethodRedirectSuper *redirect = luaF_newCmethodredirectsuper( L, env, cl, this, prevMethod );
@@ -1458,7 +1464,7 @@
14581464 popstack( L, 1 );
14591465 }
14601466
1461-__forceinline Closure* class_createBaseMethod( lua_State *L, lua_CFunction proto, Closure *prevMethod, unsigned char numUpValues, GCObject *env, Class *j )
1467+AINLINE Closure* class_createBaseMethod( lua_State *L, lua_CFunction proto, Closure *prevMethod, unsigned char numUpValues, GCObject *env, Class *j )
14621468 {
14631469 CClosureMethod *meth = luaF_newCmethod( L, numUpValues, env, j );
14641470
@@ -1479,7 +1485,7 @@
14791485 return meth;
14801486 }
14811487
1482-__forceinline Closure* class_createMethodTrans( lua_State *L, lua_CFunction proto, Closure *prevMethod, unsigned char numUpValues, GCObject *env, Class *j, int trans )
1488+AINLINE Closure* class_createMethodTrans( lua_State *L, lua_CFunction proto, Closure *prevMethod, unsigned char numUpValues, GCObject *env, Class *j, int trans )
14831489 {
14841490 CClosureMethodTrans *meth = luaF_newCmethodtrans( L, numUpValues, env, j, trans );
14851491
@@ -1562,22 +1568,26 @@
15621568 int m_transID;
15631569 };
15641570
1565-__forceinline void class_setMethod( lua_State *L, Class *j, TString *methName, lua_CFunction proto, Closure *prevMethod, Table *methTable, _methodRegisterInfo& info, bool handlers = false )
1571+AINLINE void class_setMethod( lua_State *L, Class *j, TString *methName, lua_CFunction proto, Closure *prevMethod, Table *methTable, _methodRegisterInfo& info, bool handlers = false )
15661572 {
15671573 Closure *handler;
1574+
1575+ bool hasItem = false;
1576+
1577+ if ( handlers )
1578+ {
1579+ Class::forceSuperItem *item = j->forceSuper->GetItem( methName );
15681580
1569- if ( !handlers )
1570- goto defaultHandler;
1571-
1572- Class::forceSuperItem *item = j->forceSuper->GetItem( methName );
1573-
1574- if ( item && item->cbNative )
1575- {
1576- handler = item->cbNative( L, proto, j, prevMethod, info );
1577- }
1578- else
1581+ if ( item && item->cbNative )
1582+ {
1583+ handler = item->cbNative( L, proto, j, prevMethod, info );
1584+
1585+ hasItem = true;
1586+ }
1587+ }
1588+
1589+ if ( !hasItem )
15791590 {
1580-defaultHandler:
15811591 unsigned char num = info.numUpValues;
15821592
15831593 if ( num == 0 && !prevMethod )
@@ -1634,7 +1644,7 @@
16341644 handler->DereferenceGC( L );
16351645 }
16361646
1637-__forceinline void Class::RegisterMethod( lua_State *L, TString *methName, lua_CFunction proto, _methodRegisterInfo& info, bool handlers )
1647+AINLINE void Class::RegisterMethod( lua_State *L, TString *methName, lua_CFunction proto, _methodRegisterInfo& info, bool handlers )
16381648 {
16391649 Table *methTable;
16401650 Closure *prevMethod = GetMethod( L, methName, methTable ); // Acquire the previous method
@@ -1663,7 +1673,7 @@
16631673 popstack( L, info.numUpValues );
16641674 }
16651675
1666-__forceinline void Class::RegisterMethodAt( lua_State *L, TString *methName, lua_CFunction proto, Table *methodTable, _methodRegisterInfo& info, bool handlers )
1676+AINLINE void Class::RegisterMethodAt( lua_State *L, TString *methName, lua_CFunction proto, Table *methodTable, _methodRegisterInfo& info, bool handlers )
16671677 {
16681678 Table *methTable;
16691679 Closure *prevMethod = GetMethod( L, methName, methTable );
@@ -2235,7 +2245,7 @@
22352245 ConstValueAddress jval = index2constadr( L, lua_upvalueindex( 1 ) );
22362246
22372247 Class *j = jvalue( jval );
2238-
2248+
22392249 // Free unnecessary references.
22402250 j->env = NULL;
22412251 j->outenv = NULL;
@@ -2271,7 +2281,7 @@
22712281 return 0;
22722282 }
22732283
2274-static const luaL_Reg classmethods_c[] =
2284+static const luaL_Reg classmethods_c[] =
22752285 {
22762286 { "reference", classmethod_reference },
22772287 { "dereference", classmethod_dereference },
@@ -2469,7 +2479,7 @@
24692479
24702480 // Create a class-only storage
24712481 pushhvalue( L, c->internStorage );
2472-
2482+
24732483 if ( !( flags & LCLASS_API_NO_ENV_AWARENESS ) )
24742484 {
24752485 // Distribute the environment
@@ -2659,4 +2669,4 @@
26592669 void luaJ_libraryshutdown( void )
26602670 {
26612671 classEnvConnectingBridge.UnregisterPluginStruct();
2662-}
\ No newline at end of file
2672+}
--- src/ldebug.cpp (revision 7)
+++ src/ldebug.cpp (revision 8)
@@ -545,7 +545,7 @@
545545 case OP_FORPREP:
546546 checkreg(pt, a+3);
547547
548- __fallthrough;
548+ [[fallthrough]]
549549 case OP_JMP:
550550 {
551551 check(b >= 0 || pc + 1 >= -b);
@@ -745,7 +745,7 @@
745745 const char *kind = NULL;
746746
747747 CallInfo *current_ci = L->ciStack.Top();
748-
748+
749749 if ( L->GetCurrentStackFrame().IsInStack( L, L->rtStack, o ) )
750750 {
751751 stackOffset_t objOffset = L->ciStack.Top()->stack.GetStackOffset( L, L->rtStack, o );
@@ -915,4 +915,4 @@
915915 }
916916
917917 return stackDump;
918-}
\ No newline at end of file
918+}
--- src/ldo.cpp (revision 7)
+++ src/ldo.cpp (revision 8)
@@ -180,7 +180,7 @@
180180
181181 if ( oldTop > curTop )
182182 {
183- __debugbreak();
183+ assert( 0 );
184184 }
185185
186186 stackOffset_t topOffset;
@@ -209,7 +209,7 @@
209209 {
210210 stackOffset_t requiredStackSpace = cl->p->maxstacksize;
211211 stackOffset_t currentStackSpace = this->GetUsageCountBasedOn( L, L->base );
212-
212+
213213 lua_assert( requiredStackSpace <= currentStackSpace );
214214 }
215215 }
@@ -307,7 +307,7 @@
307307
308308 luaG_typeerror( L, stackAddr, "call" );
309309 }
310-
310+
311311 // TODO: fix this
312312
313313 // Get the absolute offset of the function on the stack.
@@ -458,7 +458,7 @@
458458 setnilvalue( srcOldStackArg.Pointer() );
459459 }
460460 }
461-
461+
462462 rtStack.Unlock( L );
463463 }
464464 }
@@ -522,7 +522,7 @@
522522 luaD_poscall(L, &firstResultCtx, ci_model, resultTopOffsetAbsolute);
523523 }
524524 }
525-
525+
526526 precallResult = PCRC;
527527 }
528528
@@ -674,7 +674,7 @@
674674 ** The arguments are on the stack, right after the function.
675675 ** When returns, all the results are on the stack, starting at the original
676676 ** function position.
677-*/
677+*/
678678 void luaD_call (lua_State *L, RtCtxItem& func, int nResults, eCallFrameModel callFrameBehavior, stackOffset_t topOffset)
679679 {
680680 callstack_ref ref( *L );
@@ -754,7 +754,7 @@
754754 }
755755
756756 callstack_ref ref( *L );
757-
757+
758758 // The OS thread is saved on it's position
759759 ((lua_Thread*)L)->resume();
760760
@@ -912,4 +912,4 @@
912912
913913 luaZ_freebuffer(L, &p.buff);
914914 return status;
915-}
\ No newline at end of file
915+}
--- src/lfunc.hxx (revision 7)
+++ src/lfunc.hxx (revision 8)
@@ -41,7 +41,7 @@
4141 size_t GetTypeSizeByObject( global_State *g, const void *mem ) const override
4242 {
4343 CClosureBasic *cl = (CClosureBasic*)mem;
44-
44+
4545 return sizeCclosure( cl->nupvalues );
4646 }
4747 };
@@ -113,7 +113,7 @@
113113 size_t GetTypeSizeByObject( global_State *g, const void *mem ) const override
114114 {
115115 LClosure *cl = (LClosure*)mem;
116-
116+
117117 return sizeLclosure( cl->nupvalues );
118118 }
119119 };
@@ -133,7 +133,7 @@
133133 typeSys.RegisterAbstractType <Closure> ( "closure", cfg->grayobjTypeInfo );
134134 cclosureTypeInfo =
135135 typeSys.RegisterAbstractType <CClosure> ( "cclosure", closureTypeInfo );
136- cclosureMethodRedirectTypeInfo =
136+ cclosureMethodRedirectTypeInfo =
137137 typeSys.RegisterStructType <CClosureMethodRedirect> ( "cclosure_MethodRedirect", cclosureTypeInfo );
138138 cclosureMethodRedirectSuperTypeInfo =
139139 typeSys.RegisterStructType <CClosureMethodRedirectSuper> ( "cclosure_MethodRedirectSuper", cclosureTypeInfo );
@@ -270,11 +270,6 @@
270270 {
271271 ClearMemory( g );
272272 }
273-
274- inline void operator = ( const globalStateClosureEnvPlugin& right )
275- {
276- throw std::exception( "cannot clone Lua global state closure env plugin" );
277- }
278273 };
279274
280275 typedef PluginConnectingBridge
@@ -285,4 +280,4 @@
285280
286281 extern closureEnvConnectingBridge_t closureEnvConnectingBridge;
287282
288-#endif //_LUA_CLOSURE_SHARED_INCLUDE_
\ No newline at end of file
283+#endif //_LUA_CLOSURE_SHARED_INCLUDE_
--- src/lgc.cpp (revision 7)
+++ src/lgc.cpp (revision 8)
@@ -125,7 +125,7 @@
125125 global_State *g = G(L);
126126
127127 globalStateGCEnv *gcEnv = GetGlobalGCEnvironment( g );
128-
128+
129129 if ( gcEnv )
130130 {
131131 condhardstacktests( luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1) );
@@ -325,7 +325,7 @@
325325 weakvalue = false;
326326 }
327327
328- tableNativeImplementation *nativeTable = GetTableNativeImplementation( this );
328+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( this );
329329
330330 if ( nativeTable )
331331 {
@@ -436,7 +436,7 @@
436436 black2gray( this ); /* keep it gray */
437437 }
438438
439- const tableNativeImplementation *nativeTable = GetTableConstNativeImplementation( this );
439+ const tableNativeImplementation *nativeTable = tableNativeImplementation::GetConstNativeImplementation( this );
440440
441441 return sizeof(Table) + sizeof(TValue) * nativeTable->sizearray +
442442 sizeof(Node) * sizenode( nativeTable );
@@ -564,7 +564,7 @@
564564 Table *h = gco2h(grayObj);
565565 lua_assert( h != NULL );
566566
567- tableNativeImplementation *nativeTable = GetTableNativeImplementation( h );
567+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( h );
568568
569569 if ( nativeTable )
570570 {
@@ -599,7 +599,7 @@
599599 }
600600 }
601601 }
602-
602+
603603 iter.Increment();
604604 }
605605 }
@@ -629,7 +629,7 @@
629629 The Lua GC is an asynchronous incremental runtime that ... (to be continued)
630630 */
631631 if ( (curr->marked ^ WHITEBITS) & deadmask )
632- {
632+ {
633633 isAlive = true;
634634 }
635635 }
@@ -756,7 +756,7 @@
756756 GCObject *theObj = (GCObject*)iter.Resolve();
757757
758758 // Investigate the object.
759- __noop();
759+ assert( 0 );
760760 }
761761 }
762762
@@ -841,7 +841,7 @@
841841 if ( gcEnv->GCthread->status == THREAD_SUSPENDED )
842842 {
843843 gcEnv->GCthread->resume();
844-
844+
845845 while ( gcEnv->GCthread->status == THREAD_SUSPENDED && gcEnv->gcstate != GCSpause )
846846 {
847847 gcEnv->GCthread->resume();
@@ -1084,7 +1084,7 @@
10841084 uv->gcflags.isGCActive = true;
10851085
10861086 if (isgray(uv))
1087- {
1087+ {
10881088 if (gcEnv->gcstate == GCSpropagate)
10891089 {
10901090 gray2black(uv); /* closed upvalues need barrier */
@@ -1176,7 +1176,7 @@
11761176 object resides on TValue is valid. Directly after increasing the GC-ref-count the object is valid too, because it stays
11771177 on TValue aswell. But what happens after removing from TValue?
11781178
1179- Since the ref-GC algorithm is after the TValue propagation, the object stays valid. If the GC-pc is directly before the
1179+ Since the ref-GC algorithm is after the TValue propagation, the object stays valid. If the GC-pc is directly before the
11801180 ref-GC runtime it could have been marked by the TValue propagation. If it was not then the GC runtime must be on the start
11811181 of its cycle, hence in valid state. Thus the runtime is valid.
11821182
@@ -1307,7 +1307,7 @@
13071307 _luaC_paycost( gcEnv, (lua_Thread*)L, GCSWEEPCOST );
13081308 }
13091309 while ( gcEnv->sweepstrgc < g->strt.size ); // end phase once we swept all strings
1310-
1310+
13111311 // Sweep (free) unused objects
13121312 gcEnv->gcstate = GCSsweep;
13131313
@@ -1335,7 +1335,7 @@
13351335
13361336 // Finalize all executive objects
13371337 gcEnv->gcstate = GCSfinalize;
1338-
1338+
13391339 while ( !gcEnv->tmudata.IsEmpty() )
13401340 {
13411341 GCTM(L, g, gcEnv);
@@ -1395,7 +1395,7 @@
13951395
13961396 // Since we store the GC thread in the global GC table, we can now dereference it.
13971397 L->DereferenceGC( g->mainthread );
1398-
1398+
13991399 if ( !L->AllocateRuntime() )
14001400 throw lua_exception( g->mainthread, LUA_ERRRUN, "fatal: could not allocate GCthread" );
14011401
@@ -1445,7 +1445,7 @@
14451445 // Make sure we eliminated all classes.
14461446 // If we have not, the runtime is faulty.
14471447 Closure *dfail = g->events[LUA_EVENT_GC_DEALLOC_FAIL];
1448-
1448+
14491449 // Grab all objects and attempt another deallocation.
14501450 if ( dfail )
14511451 {
@@ -1532,4 +1532,4 @@
15321532 #ifndef LUA_EXCLUDE_GARBAGE_COLLECTOR
15331533 gcEnvConnectingBridge.UnregisterPluginStruct();
15341534 #endif
1535-}
\ No newline at end of file
1535+}
--- src/lmem.h (revision 7)
+++ src/lmem.h (revision 8)
@@ -10,7 +10,7 @@
1010
1111 #include <stddef.h>
1212
13-#include <sdk\MemoryUtils.h>
13+#include <sdk/MemoryUtils.h>
1414
1515 #include "llimits.h"
1616 #include "lua.h"
@@ -248,7 +248,7 @@
248248
249249 theTail->allocCount = startCount;
250250
251- LIST_APPEND( m_summonedBlocks.root, theTail->node );
251+ LIST_APPEND( m_summonBlocks.root, theTail->node );
252252 }
253253 }
254254
--- src/lobject.cpp (revision 7)
+++ src/lobject.cpp (revision 8)
@@ -265,7 +265,9 @@
265265 LocalValueAddress objval;
266266 setgcvalue( L, objval, this );
267267
268- luaV_handle_index( L, objval.ConstCast(), luaT_gettmbyobj( L, objval, TM_INDEX ), key, val );
268+ ConstValueAddress tmobjval = luaT_gettmbyobj( L, objval, TM_INDEX );
269+
270+ luaV_handle_index( L, objval.ConstCast(), tmobjval, key, val );
269271 }
270272
271273 void GCObject::NewIndex( lua_State *L, ConstValueAddress& key, ConstValueAddress& val )
@@ -273,7 +275,9 @@
273275 LocalValueAddress objval;
274276 setgcvalue( L, objval, this );
275277
276- luaV_handle_newindex( L, objval.ConstCast(), luaT_gettmbyobj( L, objval, TM_NEWINDEX ), key, val );
278+ ConstValueAddress tmobjval = luaT_gettmbyobj( L, objval, TM_NEWINDEX );
279+
280+ luaV_handle_newindex( L, objval.ConstCast(), tmobjval, key, val );
277281 }
278282
279283 // Module initialization.
@@ -285,4 +289,4 @@
285289 void luaO_shutdown( lua_config *cfg )
286290 {
287291 return;
288-}
\ No newline at end of file
292+}
--- src/lobject.h (revision 7)
+++ src/lobject.h (revision 8)
@@ -12,7 +12,7 @@
1212 #include <stdarg.h>
1313 #include <vector>
1414 #include <map>
15-#include <sdk\rwlist.hpp>
15+#include <sdk/rwlist.hpp>
1616
1717 #include "llimits.h"
1818 #include "lua.h"
@@ -203,7 +203,7 @@
203203 // Make sure we allocate enough items on the stack so we have its base.
204204 {
205205 stackOffset_t allocStackOffset = -1;
206-
206+
207207 bool hasTopOffset = theStack.GetTopOffset( L, allocStackOffset );
208208
209209 if ( !hasTopOffset || allocStackOffset < baseOffset )
@@ -305,7 +305,7 @@
305305 stackOffset_t stackUsageCount = this->GetUsageCount( L, theStack );
306306
307307 CtxItem result;
308-
308+
309309 if ( realOffset < stackUsageCount )
310310 {
311311 result = theStack.GetStackItemBasedOn( L, realOffset, this->base );
@@ -867,7 +867,7 @@
867867
868868 theStack.Unlock( L );
869869 }
870-
870+
871871 public:
872872 inline baseProtect( lua_State *L, StackView *theView, stackType& theStack, stackOffset_t setToOffset ) : L( L ), theStack( theStack )
873873 {
@@ -981,7 +981,7 @@
981981 // Flags that are internally used by the GC.
982982 this->gcflags.isGCActive = false;
983983 this->gcflags.isGCGrayActive = false;
984- }
984+ }
985985
986986 inline GCObject( const GCObject& right ) : gcObjList_t::node()
987987 {
@@ -1424,7 +1424,7 @@
14241424
14251425 typedef Closure* (*forceSuperCallback)( lua_State *L, Closure *newMethod, Class *j, Closure *prevMethod );
14261426 typedef Closure* (*forceSuperCallbackNative)( lua_State *L, lua_CFunction proto, Class *j, Closure *prevMethod, _methodRegisterInfo& info );
1427-
1427+
14281428 struct forceSuperItem
14291429 {
14301430 forceSuperCallback cb;
@@ -1556,7 +1556,7 @@
15561556
15571557 // TODO
15581558 }
1559-
1559+
15601560 void Dereference( lua_State *L )
15611561 {
15621562 // TODO
@@ -1672,7 +1672,7 @@
16721672 {
16731673 classType *outObj = NULL;
16741674 {
1675- global_State *g = G(L);
1675+ global_State *g = L->gstate;
16761676
16771677 LuaTypeSystem& typeSys = g->config->typeSys;
16781678
@@ -1689,7 +1689,7 @@
16891689 template <typename classType>
16901690 FASTAPI void lua_delete( lua_State *L, classType *obj )
16911691 {
1692- global_State *g = G(L);
1692+ global_State *g = L->gstate;
16931693
16941694 LuaTypeSystem& typeSys = g->config->typeSys;
16951695
--- src/lpluginutil.hxx (revision 7)
+++ src/lpluginutil.hxx (revision 8)
@@ -3,7 +3,7 @@
33 #ifndef _LUA_PLUGIN_UTILITIES_
44 #define _LUA_PLUGIN_UTILITIES_
55
6-#include <sdk\PluginHelpers.h>
6+#include <sdk/PluginHelpers.h>
77
88 struct _globalStateStructFactoryMeta
99 {
@@ -57,4 +57,4 @@
5757 {
5858 };
5959
60-#endif //_LUA_PLUGIN_UTILITIES_
\ No newline at end of file
60+#endif //_LUA_PLUGIN_UTILITIES_
--- src/lstack.h (revision 7)
+++ src/lstack.h (revision 8)
@@ -1,6 +1,8 @@
11 // Stack utilities for Lua.
22 #ifndef _LUA_STACK_UTILITIES_
3-#define _LUA_STACK_UTILITIES_
3+#define _LUA_STACK_UTILITIES_
4+
5+#include "lobject.h"
46
57 #include <algorithm>
68
@@ -20,7 +22,7 @@
2022 struct StructAddress
2123 {
2224 typedef typename std::remove_const <structType>::type nonconst_structType;
23-
25+
2426 friend struct StructAddress <nonconst_structType>;
2527 friend struct StructAddress <const structType>;
2628
@@ -46,8 +48,8 @@
4648 this->address = valPtr;
4749 }
4850
49- template <typename = std::enable_if <!std::is_same <structType, nonconst_structType>::value>::type>
50- inline StructAddress( StructAddress <nonconst_structType>&& right )
51+ template <typename dep_struct_type, typename = typename std::enable_if <std::is_same <dep_struct_type, nonconst_structType>::value && !std::is_same <dep_struct_type, structType>::value>::type>
52+ inline StructAddress( StructAddress <dep_struct_type>&& right )
5153 {
5254 this->L = right.L;
5355 this->valContext = (DataContext <structType>*)right.valContext;
@@ -146,7 +148,7 @@
146148 inline structType* operator -> ( void ) const
147149 {
148150 return Pointer( this->L );
149- }
151+ }
150152
151153 inline StructAddress <const structType>& ConstCast( void )
152154 {
@@ -169,7 +171,7 @@
169171
170172 typedef movementManagerType movman_t;
171173
172-private:
174+private:
173175 dataType *base; // start of stack
174176 dataType *end; // end of stack
175177 stackItem_t top; // top of stack
@@ -231,7 +233,7 @@
231233 {
232234 // Make sure there are no alive context items that are valid in the context of this stack.
233235 lua_assert( LIST_EMPTY( m_contextItems.root ) == true );
234-
236+
235237 lua_assert( this->base == NULL );
236238 }
237239
@@ -260,7 +262,7 @@
260262 SetSize( L, 0 );
261263
262264 // Call shutdown on acceleration structures.
263- global_State *g = G(L);
265+ global_State *g = L->gstate;
264266
265267 _cachedVirtualStackItem.Shutdown( g );
266268 _cachedVirtualStackItemConst.Shutdown( g );
@@ -344,7 +346,7 @@
344346 Unlock( L );
345347 }
346348 }
347-
349+
348350 class CtxItem
349351 {
350352 protected:
@@ -1231,7 +1233,7 @@
12311233 stackOffset_t currentStackUsageCount = this->GetUsageCount( L );
12321234
12331235 lua_assert( currentStackUsageCount >= numCopy ); // make sure we have enough items to copy over
1234-
1236+
12351237 if ( currentStackUsageCount >= numCopy )
12361238 {
12371239 NativeCrossCopyExtern( L, dstArray, Top() - (numCopy - 1), numCopy );
@@ -1248,7 +1250,7 @@
12481250 {
12491251 stackItem_t removePtr = GetStackItemBasedOn( L, index, theBase ).Pointer();
12501252 stackItem_t topPtr = this->Top();
1251-
1253+
12521254 while ( ++removePtr < topPtr )
12531255 {
12541256 movementManagerType::SetItem( L, removePtr, removePtr - 1 );
@@ -1362,7 +1364,7 @@
13621364 inline stack_iterator( lua_State *L, growingStack& theStack, stackItem_t startIter, stackItem_t endIter ) : theStack( theStack )
13631365 {
13641366 this->L = L;
1365-
1367+
13661368 this->curIter = startIter;
13671369 this->endIter = endIter;
13681370 }
@@ -1406,4 +1408,4 @@
14061408 }
14071409 };
14081410
1409-#endif //_LUA_STACK_UTILITIES_
\ No newline at end of file
1411+#endif //_LUA_STACK_UTILITIES_
--- src/lstate.cpp (revision 7)
+++ src/lstate.cpp (revision 8)
@@ -213,7 +213,7 @@
213213 setnilvalue(gt(L));
214214 }
215215
216-static void __stdcall luaE_threadEntryPoint( NativeExecutive::CFiber *theFiber, void *ud )
216+static void luaE_threadEntryPoint( NativeExecutive::CFiber *theFiber, void *ud )
217217 {
218218 lua_Thread *L = (lua_Thread*)ud;
219219
@@ -383,7 +383,7 @@
383383 if ( fiberProc != NULL )
384384 {
385385 fiber = mtManager->CreateFiber( fiberProc, this );
386-
386+
387387 if ( fiber != NULL )
388388 {
389389 // initiate it
--- src/lstate.h (revision 7)
+++ src/lstate.h (revision 8)
@@ -38,7 +38,7 @@
3838
3939 // Since we use advanced memory allocation techniques, we depend on custom
4040 // memory management templates.
41-#include <sdk\MemoryUtils.h>
41+#include <sdk/MemoryUtils.h>
4242
4343 // Put plugin ids here!
4444 #define GLOBAL_STATE_PLUGIN_ALLOC_HOLD 0x00000000
@@ -66,7 +66,7 @@
6666
6767 void SetYieldDisabled( bool disable ) { yieldDisabled = disable; }
6868 bool IsYieldDisabled() { return yieldDisabled; }
69-
69+
7070 void resume();
7171 void yield();
7272
--- src/lstrtable.h (revision 7)
+++ src/lstrtable.h (revision 8)
@@ -137,32 +137,32 @@
137137 public:
138138 void SetItem( lua_State *L, TString *key, type& val )
139139 {
140- STableItemHeader *item = FindNode( key );
140+ STableItemHeader *item = this->FindNode( key );
141141
142142 if ( !item )
143- item = AllocateNode( L, key, sizeof(type) );
143+ item = this->AllocateNode( L, key, sizeof(type) );
144144
145- SetNodeValue( item, val );
145+ this->SetNodeValue( item, val );
146146 }
147147
148148 type* GetItem( const TString *key )
149149 {
150- STableItemHeader *item = FindNode( key );
150+ STableItemHeader *item = this->FindNode( key );
151151
152152 if ( !item )
153153 return NULL;
154154
155- return (type*)GetNodeValue( item );
155+ return (type*)this->GetNodeValue( item );
156156 }
157157
158158 void UnsetItem( lua_State *L, TString *key )
159159 {
160- STableItemHeader *item = FindNode( key );
160+ STableItemHeader *item = this->FindNode( key );
161161
162162 if ( !item )
163163 return;
164164
165- DeleteNode( L, item );
165+ this->DeleteNode( L, item );
166166 }
167167
168168 size_t GetNodeSize( STableItemHeader *node ) const
@@ -172,7 +172,7 @@
172172 };
173173
174174 // Dynamic class string table
175-struct __declspec(novtable) VirtualClassEntry abstract
175+struct VirtualClassEntry abstract
176176 {
177177 virtual ~VirtualClassEntry( void ) {}
178178
@@ -196,4 +196,4 @@
196196 // String table which requires inline handling
197197 typedef DynamicStringTable <DynamicNodeTypeInfo> ClassStringTable;
198198
199-#endif //_LUA_STRINGTABLE_
\ No newline at end of file
199+#endif //_LUA_STRINGTABLE_
--- src/ltable.cpp (revision 7)
+++ src/ltable.cpp (revision 8)
@@ -47,7 +47,7 @@
4747
4848
4949 #define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t))))
50-
50+
5151 #define hashstr(t,str) hashpow2(t, (str)->hash)
5252 #define hashboolean(t,p) hashpow2(t, p)
5353
@@ -250,7 +250,7 @@
250250 bool luaH_next( lua_State *L, Table *t )
251251 {
252252 // Get the native implementation that we use for this table.
253- tableNativeImplementation *nativeTable = GetTableNativeImplementation( t );
253+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( t );
254254
255255 if ( !nativeTable )
256256 return false;
@@ -319,14 +319,19 @@
319319 */
320320
321321 /*
322-** inserts a new key into a hash table; first, check whether key's main
323-** position is free. If not, check whether colliding node is in its main
324-** position or not: if it is not, move colliding node to an empty place and
325-** put new key in its main position; otherwise (colliding node is in its main
326-** position), new key goes to an empty position.
322+** inserts a new key into a hash table; first, check whether key's main
323+** position is free. If not, check whether colliding node is in its main
324+** position or not: if it is not, move colliding node to an empty place and
325+** put new key in its main position; otherwise (colliding node is in its main
326+** position), new key goes to an empty position.
327327 ** atomic operation.
328-*/
328+*/
329329 template <typename valueType>
330+bool _findkeybystr( tableNativeImplementation *t, const TString *key, valueType*& valueOut );
331+template <typename valueType, typename keyType>
332+bool _findkeybynum( tableNativeImplementation *t, const keyType& key, valueType*& valueOut );
333+
334+template <typename valueType>
330335 bool _findkey( tableNativeImplementation *t, const TValue *key, valueType*& valueOut )
331336 {
332337 bool foundValue = false;
@@ -813,7 +818,7 @@
813818 }
814819
815820 /* create new hash part with appropriate size */
816- setnodevector(L, t, nhsize);
821+ setnodevector(L, t, nhsize);
817822
818823 if ( nasize < oldasize )
819824 { /* array part must shrink? */
@@ -872,7 +877,7 @@
872877 LIST_FOREACH_END
873878
874879 LIST_FOREACH_BEGIN( TableValueConstAccessContext, t->immutableDynamicValues.root, managerNode )
875-
880+
876881 item->UpdateContextValue( arrold, nold, arrnew, nodenew, oldasize, oldhsize, nasize, nhsize );
877882
878883 LIST_FOREACH_END
@@ -887,7 +892,7 @@
887892
888893 void luaH_resizearray (lua_State *L, Table *t, size_t nasize)
889894 {
890- tableNativeImplementation *nativeTable = GetTableNativeImplementation( t );
895+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( t );
891896
892897 if ( nativeTable )
893898 {
@@ -902,7 +907,7 @@
902907
903908 void luaH_ensureslots (lua_State *L, Table *h, size_t last)
904909 {
905- tableNativeImplementation *nativeTable = GetTableNativeImplementation( h );
910+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( h );
906911
907912 if ( nativeTable )
908913 {
@@ -938,7 +943,7 @@
938943 global_State *g = this->gstate;
939944
940945 // Cleaning up is done by the native table implementation.
941-
946+
942947 luaC_unlink( g, this );
943948 }
944949
@@ -958,7 +963,7 @@
958963
959964 if ( t )
960965 {
961- tableNativeImplementation *nativeTable = GetTableNativeImplementation( t );
966+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( t );
962967
963968 if ( nativeTable )
964969 {
@@ -980,8 +985,8 @@
980985 {
981986 ConstValueAddress retAddr;
982987
983- tableNativeImplementation *nativeTable = GetTableNativeImplementation( t );
984-
988+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( t );
989+
985990 if ( nativeTable )
986991 {
987992 const TValue *retValue = luaO_nilobject;
@@ -1098,7 +1103,7 @@
10981103 {
10991104 ValueAddress retAddr;
11001105
1101- tableNativeImplementation *nativeTable = GetTableNativeImplementation( t );
1106+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( t );
11021107
11031108 if ( nativeTable )
11041109 {
@@ -1118,7 +1123,7 @@
11181123 retAddr = ValueAddress( L, ctx );
11191124 }
11201125 }
1121-
1126+
11221127 return retAddr;
11231128 }
11241129
@@ -1244,9 +1249,9 @@
12441249 size_t luaH_getn( lua_State *L, Table *t )
12451250 {
12461251 size_t num = 0;
1247-
1248- tableNativeImplementation *nativeTable = GetTableNativeImplementation( t );
12491252
1253+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( t );
1254+
12501255 if ( nativeTable )
12511256 {
12521257 global_State *g = G(L);
@@ -1373,4 +1378,4 @@
13731378
13741379 luaV_settable( L, tm, key, val );
13751380 }
1376-}
\ No newline at end of file
1381+}
--- src/ltable.hxx (revision 7)
+++ src/ltable.hxx (revision 8)
@@ -60,13 +60,23 @@
6060 }
6161
6262 return ourSize;
63+ }
64+
65+ static inline tableNativeImplementation* GetNativeImplementation( Table *tab )
66+ {
67+ return (tableNativeImplementation*)( tab + 1 );
6368 }
6469
70+ static inline const tableNativeImplementation* GetConstNativeImplementation( const Table *tab )
71+ {
72+ return (const tableNativeImplementation*)( tab + 1 );
73+ }
74+
6575 private:
6676 inline void* GetNativeRWLockPointer( void ) const
6777 {
6878 return (void*)( this + 1 );
69- }
79+ }
7080
7181 inline void _construct_lock( global_State *g )
7282 {
@@ -107,7 +117,7 @@
107117 // Copy data from the source table.
108118 {
109119 NativeExecutive::CReadWriteReadContextSafe <> readContext( right.GetRuntimeLock( g ) );
110-
120+
111121 this->flags = right.flags;
112122
113123 Node *rightNode = right.node;
@@ -313,7 +323,7 @@
313323 }
314324 }
315325
316- lu_byte flags; /* 1<<p means tagmethod(p) is not present */
326+ lu_byte flags; /* 1<<p means tagmethod(p) is not present */
317327 std::uint16_t lsizenode; /* log2 of size of `node' array */
318328 TValue *array; /* array part */
319329 Node *node;
@@ -372,7 +382,7 @@
372382 luaC_barriert( L, this->linkedTable, this->value );
373383 }
374384
375- tableNativeImplementation *nativeTable = GetTableNativeImplementation( this->linkedTable );
385+ tableNativeImplementation *nativeTable = GetNativeImplementation( this->linkedTable );
376386
377387 if ( nativeTable )
378388 {
@@ -403,7 +413,7 @@
403413 {
404414 this->hasFetchedValuePointer = true;
405415
406- tableNativeImplementation *nativeTable = GetTableNativeImplementation( this->linkedTable );
416+ tableNativeImplementation *nativeTable = GetNativeImplementation( this->linkedTable );
407417
408418 if ( nativeTable )
409419 {
@@ -460,7 +470,7 @@
460470 Node *asNodeValue = (Node*)( (char*)ourValuePointer - offsetof( Node, i_val ) );
461471
462472 size_t real_oldnsize = twoto( oldnsize );
463-
473+
464474 ptrdiff_t nodeoff = ( asNodeValue - nold );
465475
466476 if ( nodeoff >= 0 )
@@ -491,16 +501,6 @@
491501 typedef tableNativeImplementation::TableValueAccessContext TableValueAccessContext;
492502 typedef tableNativeImplementation::TableValueConstAccessContext TableValueConstAccessContext;
493503
494-inline tableNativeImplementation* GetTableNativeImplementation( Table *tab )
495-{
496- return (tableNativeImplementation*)( tab + 1 );
497-}
498-
499-inline const tableNativeImplementation* GetTableConstNativeImplementation( const Table *tab )
500-{
501- return (const tableNativeImplementation*)( tab + 1 );
502-}
503-
504504 // Table environment plugin.
505505 struct globalStateTableEnvPlugin
506506 {
@@ -528,11 +528,6 @@
528528 ClearMemory( g );
529529 }
530530
531- inline void operator = ( const globalStateTableEnvPlugin& right )
532- {
533- throw std::exception( "cannot clone Lua global state table environment" );
534- }
535-
536531 // Dummy node that is used for optimization.
537532 Node dummynode;
538533
@@ -714,4 +709,4 @@
714709
715710 extern PluginDependantStructRegister <tableTypeInfoPlugin, namespaceFactory_t> tableTypeInfo;
716711
717-#endif //_LUA_TABLE_NATIVE_IMPLEMENTATION_
\ No newline at end of file
712+#endif //_LUA_TABLE_NATIVE_IMPLEMENTATION_
--- src/ltm.cpp (revision 7)
+++ src/ltm.cpp (revision 8)
@@ -86,7 +86,7 @@
8686 int luaT_gettype( lua_State *L, unsigned int index )
8787 {
8888 UNUSED(L);
89-
89+
9090 const int theTypes[] =
9191 {
9292 LUA_TNIL,
@@ -132,7 +132,7 @@
132132 if (ttisnil(tm))
133133 { /* no tag method? */
134134
135- tableNativeImplementation *nativeTable = GetTableNativeImplementation( events );
135+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( events );
136136
137137 if ( nativeTable )
138138 {
@@ -153,7 +153,7 @@
153153
154154 if ( et != NULL )
155155 {
156- tableNativeImplementation *nativeTable = GetTableNativeImplementation( et );
156+ tableNativeImplementation *nativeTable = tableNativeImplementation::GetNativeImplementation( et );
157157
158158 if ( nativeTable != NULL )
159159 {
@@ -208,4 +208,4 @@
208208 void luaT_moduleshutdown( lua_config *cfg )
209209 {
210210 return;
211-}
\ No newline at end of file
211+}
--- src/ltypesys.h (revision 7)
+++ src/ltypesys.h (revision 8)
@@ -2,7 +2,7 @@
22 #ifndef _LUA_TYPE_ABSTRACTION_SYSTEM_
33 #define _LUA_TYPE_ABSTRACTION_SYSTEM_
44
5-#include <sdk\DynamicTypeSystem.h>
5+#include <sdk/DynamicTypeSystem.h>
66
77 #include "lmem.h"
88
@@ -17,4 +17,4 @@
1717 // NOTE: we are using conditional struct flavor because Lua types are VERY complicated!
1818 typedef DynamicTypeSystem <GeneralMemoryAllocator, global_State> LuaTypeSystem;
1919
20-#endif //_LUA_TYPE_ABSTRACTION_SYSTEM_
\ No newline at end of file
20+#endif //_LUA_TYPE_ABSTRACTION_SYSTEM_
--- src/lua.h (revision 7)
+++ src/lua.h (revision 8)
@@ -10,10 +10,6 @@
1010 #ifndef lua_h
1111 #define lua_h
1212
13-#ifndef _WIN32
14-#error Lua: Windows only build!
15-#endif
16-
1713 #include <stdarg.h>
1814 #include <stddef.h>
1915
@@ -24,7 +20,7 @@
2420 #define LUA_VERSION "Lua 5.1"
2521 #define LUA_RELEASE "Lua 5.1.4 MTA"
2622 #define LUA_VERSION_NUM 501
27-#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio (C) 2013-2014 Martin Turski"
23+#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio (C) 2013-2018 Martin Turski"
2824 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
2925
3026
@@ -87,7 +83,14 @@
8783 #define LUA_TDISPATCH 9
8884 #define LUA_TOBJECT 10
8985 #define LUA_TTHREAD 11
90-#define LUA_TRUNTIME 12
86+#define LUA_TRUNTIME 12
87+
88+/*
89+** configuration values
90+*/
91+
92+#define LUA_TRUE 1
93+#define LUA_FALSE 0
9194
9295 /*
9396 * WARNING: if you change the order of this enumeration,
@@ -338,7 +341,7 @@
338341
339342
340343
341-/*
344+/*
342345 ** ===============================================================
343346 ** some useful macros
344347 ** ===============================================================
--- src/luaconf.h (revision 7)
+++ src/luaconf.h (revision 8)
@@ -561,13 +561,8 @@
561561 */
562562 #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
563563
564-#ifdef _MSC_VER
565-#define LUA_MAXALIGN __declspec(align(8))
566-#elif __GNUC__
567-#define LUA_MAXALIGN __attribute__(aligned(8))
568-#endif
564+#define LUA_MAXALIGN alignas(8)
569565
570-
571566 #include <string>
572567 /* C++ exceptions */
573568 #include <exception>
@@ -614,13 +609,15 @@
614609 typedef int (*lua_CFunction) (lua_State *L);
615610
616611 LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
617-LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
612+LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
613+
614+#include <string.h>
618615
619616 // Added special exception management (The_GTA)
620617 class lua_exception : public std::exception
621618 {
622619 public:
623- lua_exception( lua_State *L, unsigned int status, const char *msg, int startLevel = 0 ) : std::exception( msg )
620+ lua_exception( lua_State *L, unsigned int status, const char *msg, int startLevel = 0 ) : std::exception()
624621 {
625622 m_status = status;
626623 m_thread = L;
@@ -671,13 +668,25 @@
671668 void getDebug( lua_Debug& debug ) const
672669 {
673670 debug = m_debug;
671+ }
672+
673+ const char* what( void ) const noexcept
674+ {
675+ return this->m_what;
674676 }
675677
676678 private:
677679 unsigned int m_status;
678680 lua_State* m_thread;
679- lua_Debug m_debug;
680-};
681+ lua_Debug m_debug;
682+ const char* m_what;
683+};
684+
685+#if defined(__linux__)
686+#ifndef abstract
687+#define abstract
688+#endif //abstract
689+#endif //__linux__
681690
682691 class ILuaState abstract
683692 {
@@ -726,7 +735,7 @@
726735
727736 virtual bool IsDestroying() const = 0;
728737 virtual bool IsDestroyed() const = 0;
729-
738+
730739 virtual bool IsRootedIn( lua_State *L, int idx ) const = 0;
731740
732741 virtual void PushEnvironment( lua_State *L ) = 0;
--- src/lvm.cpp (revision 7)
+++ src/lvm.cpp (revision 8)
@@ -137,7 +137,11 @@
137137 if ( iscollectable( t ) )
138138 gcvalue( t )->Index( L, key, val );
139139 else
140- luaV_handle_index( L, t, luaT_gettmbyobj( L, t, TM_INDEX ), key, val );
140+ {
141+ ConstValueAddress tmobjval = luaT_gettmbyobj( L, t, TM_INDEX );
142+
143+ luaV_handle_index( L, t, tmobjval, key, val );
144+ }
141145 }
142146
143147 // WARNING: stack reallocating function
@@ -173,7 +177,11 @@
173177 if ( iscollectable( t ) )
174178 gcvalue( t )->NewIndex( L, key, val );
175179 else
176- luaV_handle_newindex( L, t, luaT_gettmbyobj( L, t, TM_NEWINDEX ), key, val );
180+ {
181+ ConstValueAddress tmobjval = luaT_gettmbyobj( L, t, TM_NEWINDEX );
182+
183+ luaV_handle_newindex( L, t, tmobjval, key, val );
184+ }
177185 }
178186
179187
@@ -347,7 +355,7 @@
347355 void luaV_concat (lua_State *L, stackOffset_t total, stackOffset_t last)
348356 {
349357 lua_assert( total >= 2 );
350-
358+
351359 do
352360 {
353361 stackOffset_t topOffset = last + 1;
@@ -455,7 +463,7 @@
455463 FASTAPI ValueAddress RB( const Instruction i )
456464 {
457465 //check_exp(getBMode(GET_OPCODE(i)) == OpArgR, )
458- RtCtxItem stackItem = L->GetCurrentStackFrame().GetStackItem( L, *rtStack, GETARG_B(i) );
466+ RtCtxItem stackItem = L->GetCurrentStackFrame().GetStackItem( L, *rtStack, GETARG_B(i) );
459467
460468 return ValueAddress( L, rtStack->GetNewVirtualStackItem( L, std::move( stackItem ) ) );
461469 }
@@ -690,7 +698,7 @@
690698 bcframe.rtStack->GetStackOffset( L,
691699 func + rtStack_t::GetDeferredStackOffset( pfunc, newCurrentFrame->stack.Base( L, rtStack ) )
692700 );
693-
701+
694702 // Rebase this stack frame.
695703 ciPrev->stack.InitializeEx( L, *bcframe.rtStack, newBaseOffset, clvalue(pfunc)->GetLClosure()->p->maxstacksize );
696704
@@ -1310,4 +1318,4 @@
13101318 void luaV_shutdown( lua_config *cfg )
13111319 {
13121320 return;
1313-}
\ No newline at end of file
1321+}
旧リポジトリブラウザで表示