1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-24 21:41:04 +00:00

Forced inlining for both GCC/clang & MSVC

This commit is contained in:
CPunch 2022-04-28 11:07:11 -05:00
parent 64f7e40fa0
commit 9cea98c86a
4 changed files with 17 additions and 6 deletions

View File

@ -30,7 +30,10 @@
"alloca.h": "c",
"bot.h": "c",
"string_view": "c",
"lconfig.h": "c"
"lconfig.h": "c",
"inttypes.h": "c",
"time.h": "c",
"features.h": "c"
},
"cSpell.words": [
"cnc's",

View File

@ -18,4 +18,10 @@
# define LAIKA_DEBUG(...) ((void)0) /* no op */
#endif
#ifndef _WIN32
# define LAIKA_FORCEINLINE __attribute__((always_inline)) inline
#else
# define LAIKA_FORCEINLINE __forceinline
#endif
#endif

View File

@ -3,6 +3,7 @@
#include <inttypes.h>
#include "laika.h"
#include "lvm.h"
/* Laika Box:
@ -22,12 +23,12 @@ struct sLaikaB_box {
struct sLaikaV_vm vm;
};
inline void laikaB_unlock(struct sLaikaB_box *box) {
LAIKA_FORCEINLINE void laikaB_unlock(struct sLaikaB_box *box) {
}
/* safely free's allocated buffer using libsodium's api for clearing sensitive data from memory */
inline void laikaB_lock(struct sLaikaB_box *box) {
LAIKA_FORCEINLINE void laikaB_lock(struct sLaikaB_box *box) {
}

View File

@ -9,6 +9,7 @@
#include <inttypes.h>
#include "laika.h"
#include "lerror.h"
#define LAIKA_VM_CODESIZE 512
@ -58,7 +59,7 @@ enum {
OP_TESTJMP, /* if stk_indx[uint8_t] != 0, pc += [uint8_t] */
};
inline void laikaV_execute(struct sLaikaV_vm *vm) {
LAIKA_FORCEINLINE void laikaV_execute(struct sLaikaV_vm *vm) {
#define READBYTE (vm->code[vm->pc++])
#define BINOP(x) { \