diff options
Diffstat (limited to 'src/linda.c')
| -rw-r--r-- | src/linda.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/linda.c b/src/linda.c index 637f909..390816b 100644 --- a/src/linda.c +++ b/src/linda.c | |||
| @@ -794,17 +794,12 @@ static void* linda_id( lua_State* L, DeepOp op_) | |||
| 794 | * One can use any memory allocation scheme. | 794 | * One can use any memory allocation scheme. |
| 795 | * just don't use L's allocF because we don't know which state will get the honor of GCing the linda | 795 | * just don't use L's allocF because we don't know which state will get the honor of GCing the linda |
| 796 | */ | 796 | */ |
| 797 | // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly | ||
| 798 | #if USE_LUA_STATE_ALLOCATOR() | ||
| 799 | { | 797 | { |
| 800 | Universe* const U = universe_get(L); | 798 | Universe* const U = universe_get(L); |
| 801 | AllocatorDefinition* const allocD = &U->protected_allocator.definition; | 799 | AllocatorDefinition* const allocD = &U->internal_allocator; |
| 802 | 800 | ||
| 803 | s = (struct s_Linda*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(struct s_Linda) + name_len); // terminating 0 is already included | 801 | s = (struct s_Linda*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(struct s_Linda) + name_len); // terminating 0 is already included |
| 804 | } | 802 | } |
| 805 | #else // USE_LUA_STATE_ALLOCATOR() | ||
| 806 | s = (struct s_Linda*)malloc(sizeof(struct s_Linda) + name_len); // terminating 0 is already included | ||
| 807 | #endif // USE_LUA_STATE_ALLOCATOR() | ||
| 808 | if( s) | 803 | if( s) |
| 809 | { | 804 | { |
| 810 | s->prelude.magic.value = DEEP_VERSION.value; | 805 | s->prelude.magic.value = DEEP_VERSION.value; |
| @@ -837,17 +832,12 @@ static void* linda_id( lua_State* L, DeepOp op_) | |||
| 837 | // There aren't any lanes waiting on these lindas, since all proxies have been gc'ed. Right? | 832 | // There aren't any lanes waiting on these lindas, since all proxies have been gc'ed. Right? |
| 838 | SIGNAL_FREE( &linda->read_happened); | 833 | SIGNAL_FREE( &linda->read_happened); |
| 839 | SIGNAL_FREE( &linda->write_happened); | 834 | SIGNAL_FREE( &linda->write_happened); |
| 840 | // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly | ||
| 841 | #if USE_LUA_STATE_ALLOCATOR() | ||
| 842 | { | 835 | { |
| 843 | Universe* const U = universe_get(L); | 836 | Universe* const U = universe_get(L); |
| 844 | AllocatorDefinition* const allocD = &U->protected_allocator.definition; | 837 | AllocatorDefinition* const allocD = &U->internal_allocator; |
| 845 | 838 | ||
| 846 | allocD->allocF(allocD->allocUD, linda, sizeof(struct s_Linda) + strlen(linda->name), 0); | 839 | allocD->allocF(allocD->allocUD, linda, sizeof(struct s_Linda) + strlen(linda->name), 0); |
| 847 | } | 840 | } |
| 848 | #else // USE_LUA_STATE_ALLOCATOR() | ||
| 849 | free(linda); | ||
| 850 | #endif // USE_LUA_STATE_ALLOCATOR() | ||
| 851 | return NULL; | 841 | return NULL; |
| 852 | } | 842 | } |
| 853 | 843 | ||
