8000 Code style/whitespace cleanup; remove obsolete headers. · tmbinc/micropython@dda4646 · GitHub
[go: up one dir, main page]

Skip to content

Commit dda4646

Browse files
committed
Code style/whitespace cleanup; remove obsolete headers.
And move the MAP_ANON redefinition from py/asmx64.c to unix/alloc.c.
1 parent a669cbc commit dda4646

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

py/asmarm.c

Lines cha 8000 nged: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,15 @@ void asm_arm_end_pass(asm_arm_t *as) {
8484
if(as->code_base == NULL) {
8585
assert(0);
8686
}
87-
}
88-
else if(as->pass == ASM_ARM_PASS_EMIT) {
87+
} else if(as->pass == ASM_ARM_PASS_EMIT) {
8988
#ifdef __arm__
9089
// flush I- and D-cache
91-
asm volatile(
90+
asm volatile(
9291
"0:"
9392
"mrc p15, 0, r15, c7, c10, 3\n"
9493
"bne 0b\n"
9594
"mov r0, #0\n"
96-
"mcr p15, 0, r0, c7, c7, 0\n"
95+
"mcr p15, 0, r0, c7, c7, 0\n"
9796
: : : "r0", "cc");
9897
#endif
9998
}

py/asmx64.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,8 @@
3535
// wrapper around everything in this file
3636
#if MICROPY_EMIT_X64
3737

38-
#include <sys/types.h>
39-
#include <sys/mman.h>
40-
4138
#include "asmx64.h"
4239

43-
#if defined(__OpenBSD__) || defined(__MACH__)
44-
#define MAP_ANONYMOUS MAP_ANON
45-
#endif
46-
4740
/* all offsets are measured in multiples of 8 bytes */
4841
#define WORD_SIZE (8)
4942

@@ -164,7 +157,7 @@ void asm_x64_start_pass(asm_x64_t *as, uint pass) {
164157
void asm_x64_end_pass(asm_x64_t *as) {
165158
if (as->pass == ASM_X64_PASS_COMPUTE) {
166159
MP_PLAT_ALLOC_EXEC(as->code_offset, (void**) &as->code_base, &as->code_size);
167-
if(as->code_base == NULL) {
160+
if(as->code_base == NULL) {
168161
assert(0);
169162
}
170163
//printf("code_size: %u\n", as->code_size);

py/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3692,7 +3692,7 @@ mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is
36923692
#elif MICROPY_EMIT_THUMB
36933693
emit_native_thumb_free(emit_native);
36943694
#elif MICROPY_EMIT_ARM
3695-
emit_native_arm_free(emit_native);
3695+
emit_native_arm_free(emit_native);
36963696
#endif
36973697
}
36983698
#endif

py/emitnative.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ STATIC void emit_native_end_pass(emit_t *emit) {
394394
void *f = asm_thumb_get_code(emit->as);
395395
mp_uint_t f_len = asm_thumb_get_code_size(emit->as);
396396
#elif N_ARM
397-
void *f = asm_arm_get_code(emit->as);
397+
void *f = asm_arm_get_code(emit->as);
398398
mp_uint_t f_len = asm_arm_get_code_size(emit->as);
399399
#endif
400400

unix/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ SRC_C = \
7575
file.c \
7676
modsocket.c \
7777
modos.c \
78-
alloc.c \
78+
alloc.c \
7979
$(SRC_MOD)
8080

8181
ifeq ($(UNAME_S),Darwin)

unix/alloc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030

3131
#include "mpconfigport.h"
3232

33-
void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size)
34-
{
33+
#if defined(__OpenBSD__) || defined(__MACH__)
34+
#define MAP_ANONYMOUS MAP_ANON
35+
#endif
36+
37+
void mp_unix_alloc_exec(mp_uint_t min_size, void **ptr, mp_uint_t *size) {
3538
// size needs to be a multiple of the page size
3639
*size = (min_size + 0xfff) & (~0xfff);
3740
*ptr = mmap(NULL, *size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -40,7 +43,6 @@ void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size)
4043
}
4144
}
4245

43-
void mp_unix_free_exec(void *ptr, mp_uint_t size)
44-
{
46+
void mp_unix_free_exec(void *ptr, mp_uint_t size) {
4547
munmap(ptr, size);
4648
}

0 commit comments

Comments
 (0)
0