Skip to content

Commit

Permalink
config: simplify use of external allocator
Browse files Browse the repository at this point in the history
SLJIT_EXEC_OFFSET is a definition that is only required when used
with SLJIT_PROT_EXECUTABLE_ALLOCATOR.

Expand the fallback definition also for cases with an external
allocator is in use to simplify the interface.
  • Loading branch information
carenas committed Nov 30, 2022
1 parent d598b86 commit e6448b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sljit_src/sljitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extern "C" {

/* Executable code allocation:
If SLJIT_EXECUTABLE_ALLOCATOR is not defined, the application should
define SLJIT_MALLOC_EXEC, SLJIT_FREE_EXEC, and SLJIT_EXEC_OFFSET. */
define SLJIT_MALLOC_EXEC and SLJIT_FREE_EXEC. */
#ifndef SLJIT_EXECUTABLE_ALLOCATOR
/* Enabled by default. */
#define SLJIT_EXECUTABLE_ALLOCATOR 1
Expand Down
6 changes: 4 additions & 2 deletions sljit_src/sljitConfigInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,14 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void);
#if (defined SLJIT_PROT_EXECUTABLE_ALLOCATOR && SLJIT_PROT_EXECUTABLE_ALLOCATOR)
SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#define SLJIT_EXEC_OFFSET(ptr) sljit_exec_offset(ptr)
#else
#define SLJIT_EXEC_OFFSET(ptr) 0
#endif

#endif /* SLJIT_EXECUTABLE_ALLOCATOR */

#ifndef SLJIT_EXEC_OFFSET
#define SLJIT_EXEC_OFFSET(ptr) 0
#endif

/**********************************************/
/* Registers and locals offset determination. */
/**********************************************/
Expand Down

0 comments on commit e6448b0

Please sign in to comment.