Skip to content

Commit

Permalink
Merge #133 branch 'fix-alloc' into integrate
Browse files Browse the repository at this point in the history
  • Loading branch information
lukego committed Dec 11, 2017
2 parents 6d9b473 + 43691e0 commit 9df1238
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/lj_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void close_state(lua_State *L)
lj_mem_free(g, J->bclog, sizeof(BCRecLog)*65536);
lj_mem_free(g, J->snapmapbuf, J->sizesnapmap);
lj_mem_free(g, J->snapbuf, J->sizesnap);
lj_mem_free(g, J->irbuf-REF_BIAS, 65536*sizeof(IRIns));
lj_mem_free(g, J->irbuf, 65536*sizeof(IRIns));
lua_assert(g->gc.total == sizeof(GG_State));
#ifndef LUAJIT_USE_SYSMALLOC
if (g->allocf == lj_alloc_f)
Expand Down Expand Up @@ -220,10 +220,10 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud)
J->maxbclog = 65536;
J->bclog = (BCRecLog *)lj_mem_new(L, sizeof(BCRecLog)*J->maxbclog);
J->nbclog = 0;
IRIns *irbufmem = (IRIns *)lj_mem_new(L, sizeof(IRIns)*65536);
if (irbufmem == NULL || J->snapbuf == NULL || J->snapmapbuf == NULL)
J->irbuf = (IRIns *)lj_mem_new(L, sizeof(IRIns)*65536);
if (J->irbuf == NULL || J->snapbuf == NULL ||
J->bclog == NULL || J->snapmapbuf == NULL)
return NULL;
J->irbuf = irbufmem + REF_BIAS;
lj_dispatch_init((GG_State *)L);
L->status = LUA_ERRERR+1; /* Avoid touching the stack upon memory error. */
if (lj_vm_cpcall(L, NULL, NULL, cpluaopen) != 0) {
Expand Down
97 changes: 80 additions & 17 deletions src/reusevm/lj_vm.S
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ lj_BC_ILOOP:
.size lj_BC_JLOOP, 50
lj_BC_JLOOP:
.byte 73,139,142,240,244,255,255,72,139,4,193,72,139,64,88,72
.byte 139,108,36,16,73,137,150,40,242,255,255,73,137,174,104,241
.byte 139,108,36,16,73,137,150,32,242,255,255,73,137,174,96,241
.byte 255,255,72,131,236,16,76,137,100,36,16,76,137,108,36,8
.byte 255,224

Expand Down Expand Up @@ -1098,7 +1098,11 @@ lj_BC_FUNCC:
.byte 72,139,108,36,16,72,141,68,194,248,72,137,85,32,72,141
.byte 136,160,0,0,0,72,59,77,48,72,137,69,40,72,137,239
.byte 15,135,31,2,0,0,65,199,134,64,241,255,255,254,255,255
<<<<<<< HEAD
.byte 255,65,255,215,72,139,85,32,73,137,174,32,242,255,255,65
=======
.byte 255,65,255,215,72,139,85,32,73,137,174,24,242,255,255,65
>>>>>>> fix-alloc
.byte 199,134,64,241,255,255,255,255,255,255,72,141,12,194,72,247
.byte 217,72,3,77,40,72,139,90,248,233,156,0,0,0

Expand All @@ -1111,8 +1115,13 @@ lj_BC_FUNCCW:
.byte 72,139,108,36,16,72,141,68,194,248,72,137,85,32,72,141
.byte 136,160,0,0,0,72,59,77,48,72,137,69,40,76,137,254
.byte 72,137,239,15,135,174,1,0,0,65,199,134,64,241,255,255
<<<<<<< HEAD
.byte 254,255,255,255,65,255,150,8,242,255,255,72,139,85,32,73
.byte 137,174,32,242,255,255,65,199,134,64,241,255,255,255,255,255
=======
.byte 254,255,255,255,65,255,150,0,242,255,255,72,139,85,32,73
.byte 137,174,24,242,255,255,65,199,134,64,241,255,255,255,255,255
>>>>>>> fix-alloc
.byte 255,72,141,12,194,72,247,217,72,3,77,40,72,139,90,248
.byte 235,42

Expand Down Expand Up @@ -1251,7 +1260,11 @@ lj_vm_resume:
.byte 76,141,124,36,1,76,139,117,16,73,129,198,64,15,0,0
.byte 72,137,68,36,24,72,137,68,36,32,137,68,36,8,137,68
.byte 36,12,76,137,125,80,56,69,11,15,132,153,0,0,0,73
<<<<<<< HEAD
.byte 137,174,32,242,255,255,65,199,134,64,241,255,255,255,255,255
=======
.byte 137,174,24,242,255,255,65,199,134,64,241,255,255,255,255,255
>>>>>>> fix-alloc
.byte 255,136,69,11,72,139,85,32,72,139,69,40,72,41,200,193
.byte 232,3,131,192,1,72,41,209,72,139,90,248,137,4,36,247
.byte 195,3,0,0,0,15,132,205,247,255,255,233,219,253,255,255
Expand All @@ -1273,7 +1286,11 @@ lj_vm_call:
.byte 0,0,0,137,84,36,8,72,137,253,72,137,124,36,16,72
.byte 137,241,76,139,117,16,76,139,125,80,76,137,124,36,32,72
.byte 137,108,36,24,73,129,198,64,15,0,0,72,137,101,80,73
<<<<<<< HEAD
.byte 137,174,32,242,255,255,65,199,134,64,241,255,255,255,255,255
=======
.byte 137,174,24,242,255,255,65,199,134,64,241,255,255,255,255,255
>>>>>>> fix-alloc
.byte 255,72,139,85,32,72,1,203,72,41,211,72,139,69,40,72
.byte 41,200,193,232,3,131,192,1

Expand Down Expand Up @@ -1302,7 +1319,11 @@ lj_vm_cpcall:
.byte 253,72,137,124,36,16,72,137,108,36,24,76,139,125,56,76
.byte 43,125,40,76,139,117,16,199,68,36,12,0,0,0,0,68
.byte 137,124,36,8,73,129,198,64,15,0,0,76,139,125,80,76
<<<<<<< HEAD
.byte 137,124,36,32,72,137,101,80,73,137,174,32,242,255,255,255
=======
.byte 137,124,36,32,72,137,101,80,73,137,174,24,242,255,255,255
>>>>>>> fix-alloc
.byte 209,72,133,192,15,132,27,253,255,255,72,137,193,187,5,0
.byte 0,0,233,56,255,255,255

Expand Down Expand Up @@ -1335,7 +1356,7 @@ lj_cont_cat:
lj_vmeta_tgets:
.byte 73,187,0,0,0,0,0,128,253,255,76,9,216,72,137,4
.byte 36,72,141,4,36,128,123,252,54,117,53,72,185,0,0,0
.byte 0,0,0,250,255,72,9,233,73,141,174,160,241,255,255,72
.byte 0,0,0,250,255,72,9,233,73,141,174,152,241,255,255,72
.byte 137,77,0,235,35

.globl lj_vmeta_tgetb
Expand Down Expand Up @@ -1385,7 +1406,7 @@ lj_vmeta_tgetr:
lj_vmeta_tsets:
.byte 73,187,0,0,0,0,0,128,253,255,76,9,216,72,137,4
.byte 36,72,141,4,36,128,123,252,55,117,53,72,185,0,0,0
.byte 0,0,0,250,255,72,9,233,73,141,174,160,241,255,255,72
.byte 0,0,0,250,255,72,9,233,73,141,174,152,241,255,255,72
.byte 137,77,0,235,35

.globl lj_vmeta_tsetb
Expand Down Expand Up @@ -1620,13 +1641,13 @@ lj_ff_getmetatable:
.byte 73,137,235,72,193,229,17,72,193,237,17,73,193,251,47,65
.byte 131,251,244,117,113,72,139,109,32,72,133,237,72,199,66,240
.byte 255,255,255,255,15,132,144,7,0,0,72,184,0,0,0,0
.byte 0,0,250,255,72,9,232,72,137,66,240,73,139,134,192,242
.byte 0,0,250,255,72,9,232,72,137,66,240,73,139,134,184,242
.byte 255,255,139,77,52,35,72,12,73,187,0,0,0,0,0,128
.byte 253,255,76,9,216,107,201,24,72,3,77,40,72,57,65,8
.byte 116,14,72,139,73,16,72,133,201,117,241,233,74,7,0,0
.byte 72,139,41,72,131,253,255,15,132,61,7,0,0,72,137,106
.byte 240,233,52,7,0,0,65,131,251,243,116,137,65,131,251,242
.byte 119,6,65,187,242,255,255,255,65,247,211,75,139,172,222,232
.byte 119,6,65,187,242,255,255,255,65,247,211,75,139,172,222,224
.byte 242,255,255,233,113,255,255,255

.globl lj_ff_setmetatable
Expand Down Expand Up @@ -1673,7 +1694,11 @@ lj_ff_tostring:
.byte 131,248,2,15,130,108,17,0,0,72,139,90,248,72,139,42
.byte 73,137,235,73,193,251,47,65,131,251,251,117,9,72,137,106
.byte 240,233,252,5,0,0,65,131,251,242,15,135,64,17,0,0
<<<<<<< HEAD
.byte 73,131,190,80,243,255,255,0,15,133,55,17,0,0,73,139
=======
.byte 73,131,190,72,243,255,255,0,15,133,55,17,0,0,73,139
>>>>>>> fix-alloc
.byte 174,224,240,255,255,73,59,174,232,240,255,255,114,5,232,217
.byte 17,0,0,72,139,108,36,16,72,137,85,32,72,137,92,36
.byte 24,72,137,214,72,137,239
Expand Down Expand Up @@ -1760,7 +1785,7 @@ lj_ff_ipairs:
.size lj_ff_pcall, 64
lj_ff_pcall:
.byte 131,248,2,15,130,7,15,0,0,72,141,74,16,131,232,1
.byte 187,22,0,0,0,65,15,182,174,137,241,255,255,72,193,237
.byte 187,22,0,0,0,65,15,182,174,129,241,255,255,72,193,237
.byte 4,72,131,229,1,72,1,235,73,137,199,74,139,108,249,232
.byte 74,137,108,249,240,73,131,239,1,119,240,233,3,246,255,255

Expand Down Expand Up @@ -1791,7 +1816,11 @@ lj_ff_coroutine_resume:
.byte 203,116,17,72,139,4,43,72,137,67,248,72,131,235,8,72
.byte 57,203,117,239,72,137,206,72,139,60,36,232,12,244,255,255
.byte 72,139,108,36,16,72,139,28,36,72,139,85,32,73,137,174
<<<<<<< HEAD
.byte 32,242,255,255,65,199,134,64,241,255,255,255,255,255,255,131
=======
.byte 24,242,255,255,65,199,134,64,241,255,255,255,255,255,255,131
>>>>>>> fix-alloc
.byte 248,1,119,104,72,139,75,32,76,139,123,40,72,137,75,40
.byte 76,137,251,72,41,203,116,35,72,141,4,26,193,235,3,72
.byte 59,69,48,119,110,72,137,213,72,41,205,72,139,1,72,137
Expand Down Expand Up @@ -1821,7 +1850,11 @@ lj_ff_coroutine_wrap_aux:
.byte 32,72,137,85,40,72,141,108,194,240,72,41,221,72,57,203
.byte 116,17,72,139,4,43,72,137,67,248,72,131,235,8,72,57
.byte 203,117,239,72,137,206,72,139,60,36,232,154,242,255,255,72
<<<<<<< HEAD
.byte 139,108,36,16,72,139,28,36,72,139,85,32,73,137,174,32
=======
.byte 139,108,36,16,72,139,28,36,72,139,85,32,73,137,174,24
>>>>>>> fix-alloc
.byte 242,255,255,65,199,134,64,241,255,255,255,255,255,255,131,248
.byte 1,119,85,72,139,75,32,76,139,123,40,72,137,75,40,76
.byte 137,251,72,41,203,116,35,72,141,4,26,193,235,3,72,59
Expand Down Expand Up @@ -2205,7 +2238,7 @@ lj_ff_string_reverse:
.byte 73,59,174,232,240,255,255,114,5,232,157,5,0,0,72,139
.byte 50,73,137,243,72,193,230,17,72,193,238,17,73,193,251,47
.byte 65,131,251,251,15,133,202,4,0,0,72,139,108,36,16,73
.byte 141,190,80,241,255,255,72,137,85,32,72,139,71,16,72,137
.byte 141,190,72,241,255,255,72,137,85,32,72,139,71,16,72,137
.byte 111,24,72,137,7,72,137,92,36,24
call lj_buf_putstr_reverse
.byte 72,137,199
Expand All @@ -2221,7 +2254,7 @@ lj_ff_string_lower:
.byte 73,59,174,232,240,255,255,114,5,232,49,5,0,0,72,139
.byte 50,73,137,243,72,193,230,17,72,193,238,17,73,193,251,47
.byte 65,131,251,251,15,133,94,4,0,0,72,139,108,36,16,73
.byte 141,190,80,241,255,255,72,137,85,32,72,139,71,16,72,137
.byte 141,190,72,241,255,255,72,137,85,32,72,139,71,16,72,137
.byte 111,24,72,137,7,72,137,92,36,24
call lj_buf_putstr_lower
.byte 72,137,199
Expand All @@ -2237,7 +2270,7 @@ lj_ff_string_upper:
.byte 73,59,174,232,240,255,255,114,5,232,197,4,0,0,72,139
.byte 50,73,137,243,72,193,230,17,72,193,238,17,73,193,251,47
.byte 65,131,251,251,15,133,242,3,0,0,72,139,108,36,16,73
.byte 141,190,80,241,255,255,72,137,85,32,72,139,71,16,72,137
.byte 141,190,72,241,255,255,72,137,85,32,72,139,71,16,72,137
.byte 111,24,72,137,7,72,137,92,36,24
call lj_buf_putstr_upper
.byte 72,137,199
Expand Down Expand Up @@ -2442,23 +2475,23 @@ lj_fff_gcstep:
.type lj_vm_record, @function
.size lj_vm_record, 17
lj_vm_record:
.byte 168,16,117,56,168,12,116,52,65,255,142,248,241,255,255,235
.byte 168,16,117,56,168,12,116,52,65,255,142,240,241,255,255,235
.byte 43

.globl lj_vm_rethook
.hidden lj_vm_rethook
.type lj_vm_rethook, @function
.size lj_vm_rethook, 14
lj_vm_rethook:
.byte 65,15,182,134,137,241,255,255,168,16,117,59,235,29
.byte 65,15,182,134,129,241,255,255,168,16,117,59,235,29

.globl lj_vm_inshook
.hidden lj_vm_inshook
.type lj_vm_inshook, @function
.size lj_vm_inshook, 73
lj_vm_inshook:
.byte 65,15,182,134,137,241,255,255,168,16,117,45,168,12,116,41
.byte 65,255,142,248,241,255,255,116,4,168,4,116,28,72,139,108
.byte 65,15,182,134,129,241,255,255,168,16,117,45,168,12,116,41
.byte 65,255,142,240,241,255,255,116,4,168,4,116,28,72,139,108
.byte 36,16,72,137,85,32,72,137,222,72,137,239
call lj_dispatch_ins
.byte 72,139,85,32,15,182,75,253,15,182,107,252,15,183,67,254
Expand All @@ -2478,8 +2511,8 @@ lj_cont_hook:
lj_vm_hotloop:
.byte 72,139,106,240,72,193,229,17,72,193,237,17,72,139,109,32
.byte 15,182,69,163,72,141,4,194,72,139,108,36,16,72,137,85
.byte 32,72,137,69,40,72,137,222,73,141,190,104,243,255,255,73
.byte 137,174,232,243,255,255,72,137,92,36,24
.byte 32,72,137,69,40,72,137,222,73,141,190,96,243,255,255,73
.byte 137,174,224,243,255,255,72,137,92,36,24
call lj_trace_hot
.byte 235,153

Expand Down Expand Up @@ -2516,7 +2549,7 @@ lj_cont_stitch:
.byte 65,15,183,107,104,65,15,183,67,106,57,232,15,132,103,231
.byte 255,255,133,192,15,133,153,223,255,255,73,137,174,60,255,255
.byte 255,72,139,108,36,16,72,137,85,32,72,137,222,73,141,190
.byte 104,243,255,255,73,137,174,232,243,255,255
.byte 96,243,255,255,73,137,174,224,243,255,255
call lj_dispatch_stitch
.byte 72,139,85,32,233,48,231,255,255,72,199,1,255,255,255,255
.byte 72,131,193,8,235,156
Expand All @@ -2530,6 +2563,7 @@ lj_vm_exit_handler:
.byte 141,108,36,88,85,83,82,81,80,15,182,69,248,138,101,240
.byte 76,137,125,248,76,137,117,240,65,139,142,64,241,255,255,65
.byte 199,134,64,241,255,255,252,255,255,255,65,137,134,60,255,255
<<<<<<< HEAD
.byte 255,65,137,142,56,255,255,255,65,137,142,72,241,255,255,72
.byte 129,236,128,0,0,0,72,131,197,128,242,68,15,17,125,248
.byte 242,68,15,17,117,240,242,68,15,17,109,232,242,68,15,17
Expand All @@ -2540,6 +2574,18 @@ lj_vm_exit_handler:
.byte 69,128,73,139,174,32,242,255,255,73,139,150,40,242,255,255
.byte 73,137,174,232,243,255,255,72,137,85,32,72,137,230,73,141
.byte 190,104,243,255,255,73,199,134,40,242,255,255,0,0,0,0
=======
.byte 255,65,137,142,56,255,255,255,72,129,236,128,0,0,0,72
.byte 131,197,128,242,68,15,17,125,248,242,68,15,17,117,240,242
.byte 68,15,17,109,232,242,68,15,17,101,224,242,68,15,17,93
.byte 216,242,68,15,17,85,208,242,68,15,17,77,200,242,68,15
.byte 17,69,192,242,15,17,125,184,242,15,17,117,176,242,15,17
.byte 109,168,242,15,17,101,160,242,15,17,93,152,242,15,17,85
.byte 144,242,15,17,77,136,242,15,17,69,128,73,139,174,24,242
.byte 255,255,73,139,150,32,242,255,255,73,137,174,224,243,255,255
.byte 72,137,85,32,72,137,230,73,141,190,96,243,255,255,73,199
.byte 134,32,242,255,255,0,0,0,0
>>>>>>> fix-alloc
call lj_trace_exit
.byte 72,139,77,80,72,131,225,252,72,137,105,16,72,139,85,32
.byte 72,139,89,24,235,25
Expand All @@ -2549,6 +2595,7 @@ lj_vm_exit_handler:
.type lj_vm_exit_interp, @function
.size lj_vm_exit_interp, 191
lj_vm_exit_interp:
<<<<<<< HEAD
.byte 72,141,76,36,16,69,139,150,64,241,255,255,65,131,250,1
.byte 114,7,69,137,150,72,241,255,255,76,139,105,248,76,139,33
.byte 72,137,204,133,192,15,136,134,0,0,0,72,139,108,36,16
Expand All @@ -2561,6 +2608,18 @@ lj_vm_exit_interp:
.byte 0,117,238,15,182,64,253,72,247,216,76,139,124,194,224,73
.byte 193,231,17,73,193,239,17,77,139,127,32,77,139,127,184,235
.byte 208,72,247,216,72,137,239,72,137,198
=======
.byte 72,141,76,36,16,76,139,105,248,76,139,33,72,137,204,133
.byte 192,15,136,127,0,0,0,72,139,108,36,16,137,4,36,76
.byte 139,122,240,73,193,231,17,73,193,239,17,77,139,127,32,77
.byte 139,127,184,72,137,85,32,73,199,134,32,242,255,255,0,0
.byte 0,0,65,199,134,64,241,255,255,255,255,255,255,139,3,15
.byte 182,204,15,182,232,72,131,195,4,193,232,16,131,253,89,114
.byte 8,131,253,97,115,7,139,4,36,65,255,36,238,72,139,66
.byte 248,169,3,0,0,0,117,238,15,182,64,253,72,247,216,76
.byte 139,124,194,224,73,193,231,17,73,193,239,17,77,139,127,32
.byte 77,139,127,184,235,208,72,247,216,72,137,239,72,137,198
>>>>>>> fix-alloc
call lj_err_throw

.globl lj_vm_floor_sse
Expand Down Expand Up @@ -2665,7 +2724,11 @@ lj_assert_bad_for_arg_type:
.size lj_vm_ffi_callback, 202
lj_vm_ffi_callback:
.byte 83,65,87,65,86,65,85,65,84,72,131,236,40,76,141,181
<<<<<<< HEAD
.byte 64,15,0,0,72,139,157,112,1,0,0,15,183,192,137,131
=======
.byte 64,15,0,0,72,139,157,104,1,0,0,15,183,192,137,131
>>>>>>> fix-alloc
.byte 208,0,0,0,72,137,123,112,72,137,115,120,72,137,147,128
.byte 0,0,0,72,137,139,136,0,0,0,242,15,17,67,48,242
.byte 15,17,75,56,242,15,17,83,64,242,15,17,91,72,72,141
Expand All @@ -2684,7 +2747,7 @@ lj_vm_ffi_callback:
.type lj_cont_ffi_callback, @function
.size lj_cont_ffi_callback, 49
lj_cont_ffi_callback:
.byte 72,139,76,36,16,73,139,158,48,242,255,255,72,137,75,16
.byte 72,139,76,36,16,73,139,158,40,242,255,255,72,137,75,16
.byte 72,137,81,32,72,137,105,40,72,137,223,72,137,198
call lj_ccallback_leave
.byte 72,139,67,112,242,15,16,67,48,233,143,221,255,255
Expand Down

0 comments on commit 9df1238

Please sign in to comment.