Commit 203322e2561bf99fd80d0fd169c66b1504e1e10e

Authored by Alain Prouté
1 parent f6a899ec

-

Showing 1 changed file with 11 additions and 3 deletions   Show diff stats
anubis_dev/vm/src/dynamic_module.cpp
... ... @@ -3,7 +3,7 @@
3 3 Anubis Virtual Machine.
4 4 The stuff for loading/unloading '.adm's dynamically
5 5  
6   - Author: Alain Prouté (july 2013)
  6 + Author: Alain Prouté (july 2013)
7 7  
8 8 **********************************************************************************/
9 9  
... ... @@ -385,8 +385,8 @@
385 385 uses the regular primitives defined in predefined.anubis.
386 386  
387 387 The 'load_adm' program can be found in 'compiler/src/predef.anubis'. It does not need any new
388   - virtual machine instructions. However it needs a special (hidden) syntax: £type_desc(<type>)
389   - and two syscalls: '£relocate_code' and '£execute_module'.
  388 + virtual machine instructions. However it needs a special (hidden) syntax: £type_desc(<type>)
  389 + and two syscalls: '£relocate_code' and '£execute_module'.
390 390  
391 391  
392 392 */
... ... @@ -435,6 +435,14 @@ U32 number_of_module_slots = 0; /* total number
435 435 int /* 0 = out of memory, 1 = ok */
436 436 resize_modules_array(AnubisAllocator *allocator)
437 437 {
  438 + /**/
  439 + if (modules == NULL)
  440 + {
  441 + U32 seg = allocator->AllocateDataSegment(sizeof(struct Exec_Mod_struct)*module_slots_step);
  442 + if ((U32 *)seg == NULL) return 0;
  443 + modules = (struct Exec_Mod_struct *)seg;
  444 + return 1;
  445 + }
438 446 if (number_of_modules == number_of_module_slots)
439 447 {
440 448 /* the array needs to be enlarged */
... ...