diff options
Diffstat (limited to 'src/lj_buf.c')
-rw-r--r-- | src/lj_buf.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lj_buf.c b/src/lj_buf.c index a05dc22e..c08d23c9 100644 --- a/src/lj_buf.c +++ b/src/lj_buf.c | |||
@@ -13,8 +13,9 @@ | |||
13 | #include "lj_err.h" | 13 | #include "lj_err.h" |
14 | #include "lj_buf.h" | 14 | #include "lj_buf.h" |
15 | 15 | ||
16 | LJ_NOINLINE void lj_buf_grow(lua_State *L, SBuf *sb, char *en) | 16 | LJ_NOINLINE void LJ_FASTCALL lj_buf_grow(SBuf *sb, char *en) |
17 | { | 17 | { |
18 | lua_State *L = sbufL(sb); | ||
18 | char *b = sbufB(sb); | 19 | char *b = sbufB(sb); |
19 | MSize sz = (MSize)(en - b); | 20 | MSize sz = (MSize)(en - b); |
20 | MSize osz = (MSize)(sbufE(sb) - b), nsz = osz; | 21 | MSize osz = (MSize)(sbufE(sb) - b), nsz = osz; |
@@ -29,12 +30,14 @@ LJ_NOINLINE void lj_buf_grow(lua_State *L, SBuf *sb, char *en) | |||
29 | setmref(sb->e, b + nsz); | 30 | setmref(sb->e, b + nsz); |
30 | } | 31 | } |
31 | 32 | ||
32 | char *lj_buf_tmp(lua_State *L, MSize sz) | 33 | char * LJ_FASTCALL lj_buf_tmp(lua_State *L, MSize sz) |
33 | { | 34 | { |
34 | return lj_buf_need(L, &G(L)->tmpbuf, sz); | 35 | SBuf *sb = &G(L)->tmpbuf; |
36 | setmref(sb->L, L); | ||
37 | return lj_buf_need(sb, sz); | ||
35 | } | 38 | } |
36 | 39 | ||
37 | void lj_buf_shrink(lua_State *L, SBuf *sb) | 40 | void LJ_FASTCALL lj_buf_shrink(lua_State *L, SBuf *sb) |
38 | { | 41 | { |
39 | char *b = sbufB(sb); | 42 | char *b = sbufB(sb); |
40 | MSize osz = (MSize)(sbufE(sb) - b); | 43 | MSize osz = (MSize)(sbufE(sb) - b); |
@@ -54,14 +57,14 @@ char *lj_buf_wmem(char *p, const void *q, MSize len) | |||
54 | return p; | 57 | return p; |
55 | } | 58 | } |
56 | 59 | ||
57 | void lj_buf_putmem(lua_State *L, SBuf *sb, const void *q, MSize len) | 60 | void lj_buf_putmem(SBuf *sb, const void *q, MSize len) |
58 | { | 61 | { |
59 | char *p = lj_buf_more(L, sb, len); | 62 | char *p = lj_buf_more(sb, len); |
60 | p = lj_buf_wmem(p, q, len); | 63 | p = lj_buf_wmem(p, q, len); |
61 | setsbufP(sb, p); | 64 | setsbufP(sb, p); |
62 | } | 65 | } |
63 | 66 | ||
64 | uint32_t lj_buf_ruleb128(const char **pp) | 67 | uint32_t LJ_FASTCALL lj_buf_ruleb128(const char **pp) |
65 | { | 68 | { |
66 | const uint8_t *p = (const uint8_t *)*pp; | 69 | const uint8_t *p = (const uint8_t *)*pp; |
67 | uint32_t v = *p++; | 70 | uint32_t v = *p++; |
@@ -74,7 +77,7 @@ uint32_t lj_buf_ruleb128(const char **pp) | |||
74 | return v; | 77 | return v; |
75 | } | 78 | } |
76 | 79 | ||
77 | char *lj_buf_wuleb128(char *p, uint32_t v) | 80 | char * LJ_FASTCALL lj_buf_wuleb128(char *p, uint32_t v) |
78 | { | 81 | { |
79 | for (; v >= 0x80; v >>= 7) | 82 | for (; v >= 0x80; v >>= 7) |
80 | *p++ = (char)((v & 0x7f) | 0x80); | 83 | *p++ = (char)((v & 0x7f) | 0x80); |