Skip to content

Commit

Permalink
Remove obsolete bss-related code/build features
Browse files Browse the repository at this point in the history
GC for unix/windows builds doesn't make use of the bss section anymore,
so we do not need the (sometimes complicated) build features and code related to it
  • Loading branch information
stinos committed Jan 8, 2015
1 parent 181bfb6 commit afd6c8e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 137 deletions.
8 changes: 3 additions & 5 deletions py/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,9 @@ void gc_dump_alloc_table(void) {
case AT_FREE: c = '.'; break;
/* this prints out if the object is reachable from BSS or STACK (for unix only)
case AT_HEAD: {
extern char __bss_start, _end;
extern char *stack_top;
c = 'h';
void **ptrs = (void**)&__bss_start;
mp_uint_t len = ((mp_uint_t)&_end - (mp_uint_t)&__bss_start) / sizeof(mp_uint_t);
void **ptrs = (void**)(void*)&mp_state_ctx;
mp_uint_t len = offsetof(mp_state_ctx_t, vm.stack_top) / sizeof(mp_uint_t);
for (mp_uint_t i = 0; i < len; i++) {
mp_uint_t ptr = (mp_uint_t)ptrs[i];
if (VERIFY_PTR(ptr) && BLOCK_FROM_PTR(ptr) == bl) {
Expand All @@ -709,7 +707,7 @@ void gc_dump_alloc_table(void) {
}
if (c == 'h') {
ptrs = (void**)&c;
len = ((mp_uint_t)stack_top - (mp_uint_t)&c) / sizeof(mp_uint_t);
len = ((mp_uint_t)MP_STATE_VM(stack_top) - (mp_uint_t)&c) / sizeof(mp_uint_t);
for (mp_uint_t i = 0; i < len; i++) {
mp_uint_t ptr = (mp_uint_t)ptrs[i];
if (VERIFY_PTR(ptr) && BLOCK_FROM_PTR(ptr) == bl) {
Expand Down
15 changes: 2 additions & 13 deletions unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ endif
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
CC = clang
# Use clang syntax for map file and set osx specific flags
LDFLAGS_ARCH = -Wl,-order_file,$(BUILD)/order.def -Wl,-map,$@.map
# Use clang syntax for map file
LDFLAGS_ARCH = -Wl,-map,$@.map
else
# Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref
Expand Down Expand Up @@ -92,17 +92,6 @@ SRC_C = \
alloc.c \
$(SRC_MOD)

ifeq ($(UNAME_S),Darwin)
# Must be the last file in list of sources
SRC_C += seg_helpers.c

# making seg_helpers.c rely on order.def will force order.def to be created
seg_helpers.c: $(BUILD)/order.def

# create order.def in build directory
$(BUILD)/order.def:
$(Q)echo "seg_helpers.o: ___bss_start" > $@
endif

OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))

Expand Down
38 changes: 0 additions & 38 deletions unix/seg_helpers.c

This file was deleted.

1 change: 0 additions & 1 deletion windows/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ SRC_C = \
realpath.c \
init.c \
sleep.c \
bss.c \

OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))

Expand Down
71 changes: 0 additions & 71 deletions windows/bss.c

This file was deleted.

3 changes: 0 additions & 3 deletions windows/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
#include <stdio.h>
#include <windows.h>

extern void getbss();

HANDLE hSleepEvent = NULL;

void init() {
getbss();
hSleepEvent = CreateEvent(NULL, TRUE, FALSE, FALSE);
#ifdef __MINGW32__
putenv("PRINTF_EXPONENT_DIGITS=2");
Expand Down
8 changes: 2 additions & 6 deletions windows/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ void msec_sleep(double msec);
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)


// Put static/global variables in sections with a known name we can lookup for the GC
// Put static/global variables in sections with a known name
// This used to be required for GC, not the case anymore but keep it as it makes the map file easier to inspect
// For this to work this header must be included by all sources, which is the case normally
#define MICROPY_PORT_DATASECTION "upydata"
#define MICROPY_PORT_BSSSECTION "upybss"
Expand All @@ -183,8 +184,3 @@ void msec_sleep(double msec);

int snprintf(char *dest, size_t count, const char *format, ...);
#endif

// MingW specifics
#ifdef __MINGW32__
#define MICROPY_PORT_BSSSECTION ".bss"
#endif

0 comments on commit afd6c8e

Please sign in to comment.