misc fixes to build related to thread-local support

svn: r16941
This commit is contained in:
Matthew Flatt 2009-11-21 16:16:41 +00:00
parent 9454a471d3
commit 7b05f75878
4 changed files with 33 additions and 20 deletions

View File

@ -431,7 +431,7 @@ xsrc/wxs_win.cc: $(srcdir)/../wxs/wxs_win.cxx $(XFORMDEP) $(XFORMPRECOMPDEP)
xsrc/wxJPEG.cc: $(srcdir)/../../wxcommon/wxJPEG.cxx $(XFORMDEP) $(XFORMPRECOMPDEP)
$(XFORMWP) xsrc/wxJPEG.cc $(srcdir)/../../wxcommon/wxJPEG.cxx
GCPREINC = -DSCHEME_THREADLOCAL_H -include $(srcdir)/../../mzscheme/gc2/gc2.h
GCPREINC = -include $(srcdir)/../../mzscheme/gc2/gc2.h
POSTFLAGS = $(OPTIONS) @COMPFLAGS@ @PROFFLAGS@ @CFLAGS@
XXPOSTFLAGS = $(OPTIONS) @COMPFLAGS@ @PROFFLAGS@ @CXXFLAGS@

View File

@ -2,10 +2,12 @@
#ifndef __mzscheme_gc_2__
#define __mzscheme_gc_2__
#ifdef INCLUDE_WITHOUT_PATHS
# include "schthread.h"
#else
# include "../include/schthread.h"
#ifndef GC2_JUST_MACROS
# ifdef INCLUDE_WITHOUT_PATHS
# include "schthread.h"
# else
# include "../include/schthread.h"
# endif
#endif
/***************************************************************************/
@ -409,9 +411,12 @@ GC2_EXTERN void GC_switch_back_from_master(void *gc);
Switches to back to gc from the master GC
*/
GC2_EXTERN void *GC_make_jit_nursery_page();
GC2_EXTERN unsigned long GC_make_jit_nursery_page();
/*
obtains a nursery page from the GC for thread local allocation
Obtains a nursery page from the GC for thread local allocation.
The result is an unsigned long because it's not a valid
pointer to a GCable object. The result becomes invalid (i.e. it's collected)
with the next GC.
*/

View File

@ -417,7 +417,7 @@ int GC_is_allocated(void *p)
/* struct objhead is defined in gc2_obj.h */
/* Make sure alloction starts out double-word aligned.
The header on each allocated object is one word, so to make
the content double-word aligned, we deeper. */
the content double-word aligned, we may need a prefix. */
#ifdef GC_ALIGN_SIXTEEN
# ifdef SIXTY_FOUR_BIT_INTEGERS
# define PREFIX_WSIZE 1
@ -722,7 +722,7 @@ inline static void gen0_free_nursery_mpage(NewGC *gc, mpage *page, size_t page_s
/* Needs to be consistent with GC_alloc_alignment(): */
#define THREAD_LOCAL_PAGE_SIZE APAGE_SIZE
void *GC_make_jit_nursery_page() {
unsigned long GC_make_jit_nursery_page() {
NewGC *gc = GC_get_GC();
mpage *new_mpage;
@ -742,7 +742,19 @@ void *GC_make_jit_nursery_page() {
gc->thread_local_pages = new_mpage;
}
return (void *)(NUM(new_mpage->addr) + new_mpage->size);
if (!new_mpage->size) {
/* To avoid roundoff problems, the JIT needs the
result to be not a multiple of THREAD_LOCAL_PAGE_SIZE,
so add a prefix if alignment didn't force one. */
#if defined(GC_ALIGN_SIXTEEN)
new_mpage->size = 16;
#elif defined(GC_ALIGN_EIGHT)
new_mpage->size = 8;
#else
new_mpage->size = WORD_SIZE;
#endif
}
return (NUM(new_mpage->addr) + new_mpage->size);
}
inline static void gen0_free_jit_nursery_page(NewGC *gc, mpage *page) {

View File

@ -110,7 +110,6 @@ typedef struct Thread_Local_Variables {
struct Scheme_Overflow *offstack_overflow_;
struct Scheme_Overflow_Jmp *scheme_overflow_jmp_;
void *scheme_overflow_stack_start_;
struct future_t *current_ft_;
void **codetab_tree_;
int during_set_;
Stack_Cache_Elem stack_cache_stack_[STACK_CACHE_SIZE];
@ -181,7 +180,9 @@ typedef struct Thread_Local_Variables {
int swap_no_setjmp_;
int thread_swap_count_;
int scheme_did_gc_count_;
int worker_gc_counter_;
struct Scheme_Future_State *scheme_future_state_;
struct Scheme_Future_Thread_State *scheme_future_thread_state_;
void *jit_future_storage_[2];
struct Scheme_Object **scheme_current_runstack_start_;
struct Scheme_Object **scheme_current_runstack_;
MZ_MARK_STACK_TYPE scheme_current_cont_mark_stack_;
@ -212,10 +213,6 @@ typedef struct Thread_Local_Variables {
unsigned long current_total_allocation_;
struct gmp_tmp_stack gmp_tmp_xxx_;
struct gmp_tmp_stack *gmp_tmp_current_;
#if FUTURES_ENABLED
pthread_cond_t worker_can_continue_cv_;
void *jit_future_storage_[2];
#endif
} Thread_Local_Variables;
#if defined(IMPLEMENT_THREAD_LOCAL_VIA_PTHREADS)
@ -274,7 +271,6 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL;
#define offstack_overflow XOA (scheme_get_thread_local_variables()->offstack_overflow_)
#define scheme_overflow_jmp XOA (scheme_get_thread_local_variables()->scheme_overflow_jmp_)
#define scheme_overflow_stack_start XOA (scheme_get_thread_local_variables()->scheme_overflow_stack_start_)
#define current_ft XOA (scheme_get_thread_local_variables()->current_ft_)
#define codetab_tree XOA (scheme_get_thread_local_variables()->codetab_tree_)
#define during_set XOA (scheme_get_thread_local_variables()->during_set_)
#define thread_local_pointers XOA (scheme_get_thread_local_variables()->thread_local_pointers_)
@ -346,7 +342,9 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL;
#define swap_no_setjmp XOA (scheme_get_thread_local_variables()->swap_no_setjmp_)
#define thread_swap_count XOA (scheme_get_thread_local_variables()->thread_swap_count_)
#define scheme_did_gc_count XOA (scheme_get_thread_local_variables()->scheme_did_gc_count_)
#define worker_gc_counter XOA (scheme_get_thread_local_variables()->worker_gc_counter_)
#define scheme_future_state XOA (scheme_get_thread_local_variables()->scheme_future_state_)
#define scheme_future_thread_state XOA (scheme_get_thread_local_variables()->scheme_future_thread_state_)
#define jit_future_storage XOA (scheme_get_thread_local_variables()->jit_future_storage_)
#define scheme_current_runstack_start XOA (scheme_get_thread_local_variables()->scheme_current_runstack_start_)
#define scheme_current_runstack XOA (scheme_get_thread_local_variables()->scheme_current_runstack_)
#define scheme_current_cont_mark_stack XOA (scheme_get_thread_local_variables()->scheme_current_cont_mark_stack_)
@ -377,8 +375,6 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL;
#define current_total_allocation XOA (scheme_get_thread_local_variables()->current_total_allocation_)
#define gmp_tmp_xxx XOA (scheme_get_thread_local_variables()->gmp_tmp_xxx_)
#define gmp_tmp_current XOA (scheme_get_thread_local_variables()->gmp_tmp_current_)
#define worker_can_continue_cv XOA (scheme_get_thread_local_variables()->worker_can_continue_cv_)
#define jit_future_storage XOA (scheme_get_thread_local_variables()->jit_future_storage_)
/* **************************************** */