/* ... */
lua_pushvalue(L, index);
/* ... table */
- lua_getfield(L, LUA_REGISTRYINDEX, "simgrid.maestro_tables");
+ lua_pushstring(L, "simgrid.maestro_tables");
+ /* ... table "simgrid.maestro_tables" */
+ lua_rawget(L, LUA_REGISTRYINDEX);
/* ... table maestrotbs */
lua_pushvalue(L, -2);
/* ... table maestrotbs table */
void* maestro_table_ptr = NULL;
/* ... */
+ lua_pushvalue(L, index);
+ /* ... table */
lua_pushstring(L, "simgrid.maestro_tables");
- /* ... "simgrid.maestro_tables" */
+ /* ... table "simgrid.maestro_tables" */
lua_rawget(L, LUA_REGISTRYINDEX);
- /* ... maestrotbs */
- lua_pushvalue(L, index);
- /* ... maestrotbs table */
+ /* ... table maestrotbs */
+ lua_pushvalue(L, -2);
+ /* ... table maestrotbs table */
lua_gettable(L, -2);
- /* ... maestrotbs tableptr/nil */
+ /* ... table maestrotbs tableptr/nil */
if (!lua_isnil(L, -1)) {
- /* ... maestrotbs tableptr */
+ /* ... table maestrotbs tableptr */
maestro_table_ptr = (void*) lua_topointer(L, -1);
}
- lua_pop(L, 2);
+ lua_pop(L, 3);
/* ... */
return maestro_table_ptr;
}
table_ptr = (void*) lua_topointer(src, -1);
if (!sglua_is_maestro(src)) {
- XBT_DEBUG("Using a non-maestro table pointer");
+ XBT_DEBUG("%sMaestro does not know this table",
+ sglua_get_spaces(indent));
}
}
- else if (sglua_is_maestro(src)) {
+
+ if (sglua_is_maestro(src)) {
/* register the table in maestro itself */
+ XBT_DEBUG("%sKeeping track of this table in maestro itself",
+ sglua_get_spaces(indent));
sglua_add_maestro_table(src, -1, table_ptr);
+ xbt_assert(sglua_get_maestro_table_ptr(src, -1) == table_ptr);
}
/* to avoid infinite recursion, see if this table is already known by dst */
/* FIXME: we may have added a table with a non-maestro pointer, is this a
problem? */
XBT_DEBUG("%sTable marked as known", sglua_get_spaces(indent));
+ xbt_assert(sglua_get_maestro_table_ptr(dst, -1) == table_ptr);
sglua_stack_dump("dst after marking the table as known (should be ... table): ", dst);