Skip to content

Commit b428c51

Browse files
committed
Merge upstream DynAsm changes from LuaJIT
1 parent 24388fd commit b428c51

14 files changed

+547
-267
lines changed

ext/opcache/jit/dynasm/dasm_arm.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
** DynASM ARM encoding engine.
3-
** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
3+
** Copyright (C) 2005-2021 Mike Pall. All rights reserved.
44
** Released under the MIT license. See dynasm.lua for full copyright notice.
55
*/
66

@@ -254,6 +254,7 @@ void dasm_put(Dst_DECL, int start, ...)
254254
case DASM_IMMV8:
255255
CK((n & 3) == 0, RANGE_I);
256256
n >>= 2;
257+
/* fallthrough */
257258
case DASM_IMML8:
258259
case DASM_IMML12:
259260
CK(n >= 0 ? ((n>>((ins>>5)&31)) == 0) :
@@ -371,6 +372,7 @@ int dasm_encode(Dst_DECL, void *buffer)
371372
break;
372373
case DASM_REL_LG:
373374
CK(n >= 0, UNDEF_LG);
375+
/* fallthrough */
374376
case DASM_REL_PC:
375377
CK(n >= 0, UNDEF_PC);
376378
n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) - 4;

ext/opcache/jit/dynasm/dasm_arm.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- DynASM ARM module.
33
--
4-
-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
4+
-- Copyright (C) 2005-2021 Mike Pall. All rights reserved.
55
-- See dynasm.lua for full copyright notice.
66
------------------------------------------------------------------------------
77

ext/opcache/jit/dynasm/dasm_arm64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
** DynASM ARM64 encoding engine.
3-
** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
3+
** Copyright (C) 2005-2021 Mike Pall. All rights reserved.
44
** Released under the MIT license. See dynasm.lua for full copyright notice.
55
*/
66

@@ -427,6 +427,7 @@ int dasm_encode(Dst_DECL, void *buffer)
427427
break;
428428
case DASM_REL_LG:
429429
CK(n >= 0, UNDEF_LG);
430+
/* fallthrough */
430431
case DASM_REL_PC:
431432
CK(n >= 0, UNDEF_PC);
432433
n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) + 4;

ext/opcache/jit/dynasm/dasm_arm64.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- DynASM ARM64 module.
33
--
4-
-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
4+
-- Copyright (C) 2005-2021 Mike Pall. All rights reserved.
55
-- See dynasm.lua for full copyright notice.
66
------------------------------------------------------------------------------
77

ext/opcache/jit/dynasm/dasm_mips.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
** DynASM MIPS encoding engine.
3-
** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
3+
** Copyright (C) 2005-2021 Mike Pall. All rights reserved.
44
** Released under the MIT license. See dynasm.lua for full copyright notice.
55
*/
66

@@ -350,18 +350,20 @@ int dasm_encode(Dst_DECL, void *buffer)
350350
break;
351351
case DASM_REL_LG:
352352
CK(n >= 0, UNDEF_LG);
353+
/* fallthrough */
353354
case DASM_REL_PC:
354355
CK(n >= 0, UNDEF_PC);
355356
n = *DASM_POS2PTR(D, n);
356357
if (ins & 2048)
357-
n = n - (int)((char *)cp - base);
358-
else
359358
n = (n + (int)(size_t)base) & 0x0fffffff;
360-
patchrel:
359+
else
360+
n = n - (int)((char *)cp - base);
361+
patchrel: {
362+
unsigned int e = 16 + ((ins >> 12) & 15);
361363
CK((n & 3) == 0 &&
362-
((n + ((ins & 2048) ? 0x00020000 : 0)) >>
363-
((ins & 2048) ? 18 : 28)) == 0, RANGE_REL);
364-
cp[-1] |= ((n>>2) & ((ins & 2048) ? 0x0000ffff: 0x03ffffff));
364+
((n + ((ins & 2048) ? 0 : (1<<(e+1)))) >> (e+2)) == 0, RANGE_REL);
365+
cp[-1] |= ((n>>2) & ((1<<e)-1));
366+
}
365367
break;
366368
case DASM_LABEL_LG:
367369
ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);

0 commit comments

Comments
 (0)