MCPcopy Create free account
hub / github.com/anjo76/angelscript / LoadByteCode

Method LoadByteCode

sdk/angelscript/source/as_module.cpp:1638–1679  ·  view source on GitHub ↗

interface

Source from the content-addressed store, hash-verified

1636
1637// interface
1638int asCModule::LoadByteCode(asIBinaryStream *in, bool *wasDebugInfoStripped)
1639{
1640 if( in == 0 ) return asINVALID_ARG;
1641
1642 // Don't allow the module to be rebuilt if there are still
1643 // external references that will need the previous code
1644 if( HasExternalReferences(false) )
1645 {
1646 m_engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_MODULE_IS_IN_USE);
1647 return asMODULE_IS_IN_USE;
1648 }
1649
1650 // Only permit loading bytecode if no other thread is currently compiling
1651 // TODO: It should be possible to have multiple threads perform compilations
1652 int r = m_engine->RequestBuild();
1653 if( r < 0 )
1654 return r;
1655
1656 asCReader read(this, in, m_engine);
1657 r = read.Read(wasDebugInfoStripped);
1658 if (r < 0)
1659 {
1660 m_engine->BuildCompleted();
1661 return r;
1662 }
1663
1664 JITCompile();
1665
1666#ifdef AS_DEBUG
1667 // Verify that there are no unwanted gaps in the scriptFunctions array.
1668 for( asUINT n = 1; n < m_engine->scriptFunctions.GetLength(); n++ )
1669 {
1670 int id = n;
1671 if( m_engine->scriptFunctions[n] == 0 && !m_engine->freeScriptFunctionIds.Exists(id) )
1672 asASSERT( false );
1673 }
1674#endif
1675
1676 m_engine->BuildCompleted();
1677
1678 return r;
1679}
1680
1681// interface
1682int asCModule::CompileGlobalVar(const char *sectionName, const char *code, int lineOffset)

Callers 15

TestFunction · 0.80
TestFunction · 0.80
TestGlobalVarFunction · 0.80
test_debug.cppFile · 0.80
TestFunction · 0.80
TestFunction · 0.80
TestRefScopedFunction · 0.80
TestFunction · 0.80
TestFunction · 0.80

Calls 6

WriteMessageMethod · 0.80
RequestBuildMethod · 0.80
BuildCompletedMethod · 0.80
ReadMethod · 0.45
GetLengthMethod · 0.45
ExistsMethod · 0.45

Tested by 15

TestFunction · 0.64
TestFunction · 0.64
TestGlobalVarFunction · 0.64
TestFunction · 0.64
TestFunction · 0.64
TestRefScopedFunction · 0.64
TestFunction · 0.64
TestFunction · 0.64
TestFunction · 0.64
testTypedefFunction · 0.64
Test2Function · 0.64
TestFunction · 0.64