interface
| 1658 | |
| 1659 | // interface |
| 1660 | int asCModule::LoadByteCode(asIBinaryStream *in, bool *wasDebugInfoStripped) |
| 1661 | { |
| 1662 | if( in == 0 ) return asINVALID_ARG; |
| 1663 | |
| 1664 | // Don't allow the module to be rebuilt if there are still |
| 1665 | // external references that will need the previous code |
| 1666 | if( HasExternalReferences(false) ) |
| 1667 | { |
| 1668 | m_engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_MODULE_IS_IN_USE); |
| 1669 | return asMODULE_IS_IN_USE; |
| 1670 | } |
| 1671 | |
| 1672 | // Only permit loading bytecode if no other thread is currently compiling |
| 1673 | // TODO: It should be possible to have multiple threads perform compilations |
| 1674 | int r = m_engine->RequestBuild(); |
| 1675 | if( r < 0 ) |
| 1676 | return r; |
| 1677 | |
| 1678 | asCReader read(this, in, m_engine); |
| 1679 | r = read.Read(wasDebugInfoStripped); |
| 1680 | if (r < 0) |
| 1681 | { |
| 1682 | m_engine->BuildCompleted(); |
| 1683 | return r; |
| 1684 | } |
| 1685 | |
| 1686 | JITCompile(); |
| 1687 | |
| 1688 | #ifdef AS_DEBUG |
| 1689 | // Verify that there are no unwanted gaps in the scriptFunctions array. |
| 1690 | for( asUINT n = 1; n < m_engine->scriptFunctions.GetLength(); n++ ) |
| 1691 | { |
| 1692 | int id = n; |
| 1693 | if( m_engine->scriptFunctions[n] == 0 && !m_engine->freeScriptFunctionIds.Exists(id) ) |
| 1694 | asASSERT( false ); |
| 1695 | } |
| 1696 | #endif |
| 1697 | |
| 1698 | m_engine->BuildCompleted(); |
| 1699 | |
| 1700 | return r; |
| 1701 | } |
| 1702 | |
| 1703 | // interface |
| 1704 | int asCModule::CompileGlobalVar(const char *sectionName, const char *code, int lineOffset) |
nothing calls this directly
no test coverage detected