diff --git a/mps/code/mpm.h b/mps/code/mpm.h index ebe75a09707..17ece35d524 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -475,7 +475,7 @@ extern double TraceWorkFactor; extern Res TraceScanArea(ScanState ss, Word *base, Word *limit, mps_area_scan_t scan_area, - void *closure, size_t closure_size); + void *closure); extern void TraceScanSingleRef(TraceSet ts, Rank rank, Arena arena, Seg seg, Ref *refIO); @@ -966,7 +966,7 @@ extern Res RootCreateArea(Root *rootReturn, Arena arena, Rank rank, RootMode mode, Word *base, Word *limit, mps_area_scan_t scan_area, - void *closure, size_t closure_size); + void *closure); extern Res RootCreateAreaTagged(Root *rootReturn, Arena arena, Rank rank, RootMode mode, Word *base, Word *limit, @@ -975,7 +975,7 @@ extern Res RootCreateAreaTagged(Root *rootReturn, Arena arena, extern Res RootCreateThread(Root *rootReturn, Arena arena, Rank rank, Thread thread, mps_area_scan_t scan_area, - void *closure, size_t closure_size, + void *closure, Word *stackCold); extern Res RootCreateThreadTagged(Root *rootReturn, Arena arena, Rank rank, Thread thread, diff --git a/mps/code/mps.h b/mps/code/mps.h index 737677da518..65ab6d6bbf3 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -109,8 +109,7 @@ typedef struct mps_scan_tag_s { } mps_scan_tag_s; typedef mps_res_t (*mps_root_scan_t)(mps_ss_t, void *, size_t); -typedef mps_res_t (*mps_area_scan_t)(mps_ss_t, void *, void *, - void *, size_t); +typedef mps_res_t (*mps_area_scan_t)(mps_ss_t, void *, void *, void *); typedef mps_res_t (*mps_fmt_scan_t)(mps_ss_t, mps_addr_t, mps_addr_t); typedef mps_res_t (*mps_reg_scan_t)(mps_ss_t, mps_thr_t, void *, size_t); @@ -682,7 +681,7 @@ extern mps_res_t mps_root_create_table_masked(mps_root_t *, mps_arena_t, extern mps_res_t mps_root_create_area(mps_root_t *, mps_arena_t, mps_rank_t, mps_rm_t, void *, void *, - mps_area_scan_t, void *, size_t); + mps_area_scan_t, void *); extern mps_res_t mps_root_create_area_tagged(mps_root_t *, mps_arena_t, mps_rank_t, mps_rm_t, void *, void *, @@ -700,7 +699,7 @@ extern mps_res_t mps_root_create_thread(mps_root_t *, mps_arena_t, extern mps_res_t mps_root_create_thread_scanned(mps_root_t *, mps_arena_t, mps_rank_t, mps_rm_t, mps_thr_t, mps_area_scan_t, - void *, size_t, + void *, void *); extern mps_res_t mps_root_create_thread_tagged(mps_root_t *, mps_arena_t, mps_rank_t, mps_rm_t, mps_thr_t, @@ -820,18 +819,10 @@ extern void mps_pool_check_free_space(mps_pool_t); /* Scanner Support */ -extern mps_res_t mps_scan_area(mps_ss_t, - void *, void *, - void *, size_t); -extern mps_res_t mps_scan_area_masked(mps_ss_t, - void *, void *, - void *, size_t); -extern mps_res_t mps_scan_area_tagged(mps_ss_t, - void *, void *, - void *, size_t); -extern mps_res_t mps_scan_area_tagged_or_zero(mps_ss_t, - void *, void *, - void *, size_t); +extern mps_res_t mps_scan_area(mps_ss_t, void *, void *, void *); +extern mps_res_t mps_scan_area_masked(mps_ss_t, void *, void *, void *); +extern mps_res_t mps_scan_area_tagged(mps_ss_t, void *, void *, void *); +extern mps_res_t mps_scan_area_tagged_or_zero(mps_ss_t, void *, void *, void *); extern mps_res_t mps_fix(mps_ss_t, mps_addr_t *); diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 655a226549c..c9acee2da5e 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -1302,7 +1302,7 @@ mps_res_t mps_root_create_table(mps_root_t *mps_root_o, mps_arena_t arena, res = RootCreateArea(&root, arena, rank, mode, (void *)base, (void *)(base + size), - mps_scan_area, NULL, 0); + mps_scan_area, NULL); ArenaLeave(arena); @@ -1317,7 +1317,7 @@ mps_res_t mps_root_create_area(mps_root_t *mps_root_o, mps_rank_t mps_rank, mps_rm_t mps_rm, void *base, void *limit, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { Rank rank = (Rank)mps_rank; Root root; @@ -1335,7 +1335,7 @@ mps_res_t mps_root_create_area(mps_root_t *mps_root_o, res = RootCreateArea(&root, arena, rank, mode, base, limit, - scan_area, closure, closure_size); + scan_area, closure); ArenaLeave(arena); @@ -1478,7 +1478,6 @@ mps_res_t mps_root_create_thread_scanned(mps_root_t *mps_root_o, mps_thr_t thread, mps_area_scan_t scan_area, void *closure, - size_t closure_size, void *cold) { Rank rank = (Rank)mps_rank; @@ -1497,7 +1496,7 @@ mps_res_t mps_root_create_thread_scanned(mps_root_t *mps_root_o, /* See .root-mode. */ res = RootCreateThread(&root, arena, rank, thread, - scan_area, closure, closure_size, + scan_area, closure, (Word *)cold); ArenaLeave(arena); diff --git a/mps/code/prmci3fr.c b/mps/code/prmci3fr.c index d9f989db17c..87ec5f436dc 100644 --- a/mps/code/prmci3fr.c +++ b/mps/code/prmci3fr.c @@ -40,7 +40,7 @@ Addr MutatorFaultContextSP(MutatorFaultContext mfc) Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { Res res; @@ -51,7 +51,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, ss, (Word *)mfc->ucontext, (Word *)((char *)mfc->ucontext + sizeof(*(mfc->ucontext))), - scan_area, closure, closure_size + scan_area, closure ); return res; diff --git a/mps/code/prmci3li.c b/mps/code/prmci3li.c index 419f83f8b4a..da04ac4810b 100644 --- a/mps/code/prmci3li.c +++ b/mps/code/prmci3li.c @@ -103,7 +103,7 @@ Addr MutatorFaultContextSP(MutatorFaultContext mfc) Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { mcontext_t *mc; Res res; @@ -115,7 +115,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, res = TraceScanArea(ss, (Word *)mc, (Word *)((char *)mc + sizeof(*mc)), - scan_area, closure, closure_size); + scan_area, closure); return res; } diff --git a/mps/code/prmci3xc.c b/mps/code/prmci3xc.c index abeef4988c4..8eda902c244 100644 --- a/mps/code/prmci3xc.c +++ b/mps/code/prmci3xc.c @@ -98,7 +98,7 @@ Addr MutatorFaultContextSP(MutatorFaultContext mfc) Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { x86_thread_state32_t *mc; Res res; @@ -110,7 +110,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, res = TraceScanArea(ss, (Word *)mc, (Word *)((char *)mc + sizeof(*mc)), - scan_area, closure, closure_size); + scan_area, closure); return res; } diff --git a/mps/code/prmci6fr.c b/mps/code/prmci6fr.c index d8676d2a4c3..b1c1a67590f 100644 --- a/mps/code/prmci6fr.c +++ b/mps/code/prmci6fr.c @@ -34,7 +34,7 @@ Addr MutatorFaultContextSP(MutatorFaultContext mfc) Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { Res res; @@ -45,7 +45,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, ss, (Word *)mfc->ucontext, (Word *)((char *)mfc->ucontext + sizeof(*(mfc->ucontext))), - scan_area, closure, closure_size + scan_area, closure ); return res; diff --git a/mps/code/prmci6li.c b/mps/code/prmci6li.c index fe7cb96627a..67354c99414 100644 --- a/mps/code/prmci6li.c +++ b/mps/code/prmci6li.c @@ -107,7 +107,7 @@ Addr MutatorFaultContextSP(MutatorFaultContext mfc) Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { mcontext_t *mc; Res res; @@ -119,7 +119,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, res = TraceScanArea(ss, (Word *)mc, (Word *)((char *)mc + sizeof(*mc)), - scan_area, closure, closure_size); + scan_area, closure); return res; } diff --git a/mps/code/prmci6xc.c b/mps/code/prmci6xc.c index 69591a321ab..ae8ef06f739 100644 --- a/mps/code/prmci6xc.c +++ b/mps/code/prmci6xc.c @@ -101,7 +101,7 @@ Addr MutatorFaultContextSP(MutatorFaultContext mfc) Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { x86_thread_state64_t *mc; Res res; @@ -113,7 +113,7 @@ Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, res = TraceScanArea(ss, (Word *)mc, (Word *)((char *)mc + sizeof(*mc)), - scan_area, closure, closure_size); + scan_area, closure); return res; } diff --git a/mps/code/prot.h b/mps/code/prot.h index c2ae9d20e69..f3104cb27b7 100644 --- a/mps/code/prot.h +++ b/mps/code/prot.h @@ -32,7 +32,7 @@ extern Res ProtStepInstruction(MutatorFaultContext context); extern Addr MutatorFaultContextSP(MutatorFaultContext mfc); extern Res MutatorFaultContextScan(ScanState ss, MutatorFaultContext mfc, mps_area_scan_t scan, - void *closure, size_t closure_size); + void *closure); #endif /* prot_h */ diff --git a/mps/code/root.c b/mps/code/root.c index 82737e536b0..ae16e3dcd13 100644 --- a/mps/code/root.c +++ b/mps/code/root.c @@ -17,13 +17,8 @@ SRCID(root, "$Id$"); #define RootSig ((Sig)0x51960029) /* SIGnature ROOT */ -typedef struct ClosureStruct { - void *p; - size_t s; -} ClosureStruct; - typedef union AreaScanUnion { - ClosureStruct closure; + void *closure; mps_scan_tag_s tag; /* tag for scanning */ } AreaScanUnion; @@ -44,7 +39,8 @@ typedef struct RootStruct { union RootUnion { struct { mps_root_scan_t scan; /* the function which does the scanning */ - ClosureStruct closure; /* closure for scan function */ + void *p; /* closure for scan function */ + size_t s; /* closure for scan function */ } fun; struct { Word *base; /* beginning of area */ @@ -274,7 +270,7 @@ Res RootCreateArea(Root *rootReturn, Arena arena, Rank rank, RootMode mode, Word *base, Word *limit, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { Res res; union RootUnion theUnion; @@ -292,8 +288,7 @@ Res RootCreateArea(Root *rootReturn, Arena arena, theUnion.area.base = base; theUnion.area.limit = limit; theUnion.area.scan_area = scan_area; - theUnion.area.the.closure.p = closure; - theUnion.area.the.closure.s = closure_size; + theUnion.area.the.closure = closure; res = rootCreateProtectable(rootReturn, arena, rank, mode, RootAREA, (Addr)base, (Addr)limit, &theUnion); @@ -327,7 +322,7 @@ Res RootCreateAreaTagged(Root *rootReturn, Arena arena, Res RootCreateThread(Root *rootReturn, Arena arena, Rank rank, Thread thread, mps_area_scan_t scan_area, - void *closure, size_t closure_size, + void *closure, Word *stackCold) { union RootUnion theUnion; @@ -342,8 +337,7 @@ Res RootCreateThread(Root *rootReturn, Arena arena, theUnion.thread.thread = thread; theUnion.thread.scan_area = scan_area; - theUnion.thread.the.closure.p = closure; - theUnion.thread.the.closure.s = closure_size; + theUnion.thread.the.closure = closure; theUnion.thread.stackCold = stackCold; return rootCreate(rootReturn, arena, rank, (RootMode)0, RootTHREAD, @@ -416,8 +410,8 @@ Res RootCreateFun(Root *rootReturn, Arena arena, Rank rank, AVER(FUNCHECK(scan)); theUnion.fun.scan = scan; - theUnion.fun.closure.p = p; - theUnion.fun.closure.s = s; + theUnion.fun.p = p; + theUnion.fun.s = s; return rootCreate(rootReturn, arena, rank, (RootMode)0, RootFUN, &theUnion); } @@ -535,8 +529,7 @@ Res RootScan(ScanState ss, Root root) root->the.area.base, root->the.area.limit, root->the.area.scan_area, - root->the.area.the.closure.p, - root->the.area.the.closure.s); + root->the.area.the.closure); if (res != ResOK) goto failScan; break; @@ -546,16 +539,15 @@ Res RootScan(ScanState ss, Root root) root->the.area.base, root->the.area.limit, root->the.area.scan_area, - &root->the.area.the.tag, - sizeof(root->the.area.the.tag)); + &root->the.area.the.tag); if (res != ResOK) goto failScan; break; case RootFUN: res = root->the.fun.scan(&ss->ss_s, - root->the.fun.closure.p, - root->the.fun.closure.s); + root->the.fun.p, + root->the.fun.s); if (res != ResOK) goto failScan; break; @@ -564,8 +556,7 @@ Res RootScan(ScanState ss, Root root) res = ThreadScan(ss, root->the.thread.thread, root->the.thread.stackCold, root->the.thread.scan_area, - root->the.thread.the.closure.p, - root->the.thread.the.closure.s); + root->the.thread.the.closure); if (res != ResOK) goto failScan; break; @@ -574,8 +565,7 @@ Res RootScan(ScanState ss, Root root) res = ThreadScan(ss, root->the.thread.thread, root->the.thread.stackCold, root->the.thread.scan_area, - &root->the.thread.the.tag, - sizeof(root->the.thread.the.tag)); + &root->the.thread.the.tag); if (res != ResOK) goto failScan; break; @@ -706,11 +696,10 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) switch(root->var) { case RootAREA: res = WriteF(stream, depth + 2, - "area base $A limit $A scan_area closure $P closure_size $U\n", + "area base $A limit $A scan_area closure $P\n", (WriteFA)root->the.area.base, (WriteFA)root->the.area.limit, - (WriteFP)root->the.area.the.closure.p, - (WriteFP)root->the.area.the.closure.s, + (WriteFP)root->the.area.the.closure, NULL); if (res != ResOK) return res; @@ -732,8 +721,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) res = WriteF(stream, depth + 2, "scan function $F\n", (WriteFF)root->the.fun.scan, "environment p $P s $W\n", - (WriteFP)root->the.fun.closure.p, - (WriteFW)root->the.fun.closure.s, + (WriteFP)root->the.fun.p, + (WriteFW)root->the.fun.s, NULL); if (res != ResOK) return res; @@ -742,9 +731,8 @@ Res RootDescribe(Root root, mps_lib_FILE *stream, Count depth) case RootTHREAD: res = WriteF(stream, depth + 2, "thread $P\n", (WriteFP)root->the.thread.thread, - "closure $P size $U\n", - (WriteFP)root->the.thread.the.closure.p, - (WriteFU)root->the.thread.the.closure.s, + "closure $P\n", + (WriteFP)root->the.thread.the.closure, "stackCold $P\n", (WriteFP)root->the.thread.stackCold, NULL); if (res != ResOK) diff --git a/mps/code/scan.c b/mps/code/scan.c index 99b4d5d0987..3e01c9fed17 100644 --- a/mps/code/scan.c +++ b/mps/code/scan.c @@ -27,10 +27,9 @@ mps_res_t mps_scan_area(mps_ss_t ss, void *base, void *limit, - void *closure, size_t closure_size) + void *closure) { (void)closure; /* unused */ - (void)closure_size; /* unused */ MPS_SCAN_BEGIN(ss) { mps_word_t *p = base; @@ -86,11 +85,10 @@ mps_res_t mps_scan_area(mps_ss_t ss, mps_res_t mps_scan_area_masked(mps_ss_t ss, void *base, void *limit, - void *closure, size_t closure_size) + void *closure) { mps_scan_tag_t tag = closure; mps_word_t mask = tag->mask; - (void)closure_size; /* unused */ MPS_SCAN_AREA_TAGGED(1); @@ -109,12 +107,11 @@ mps_res_t mps_scan_area_masked(mps_ss_t ss, mps_res_t mps_scan_area_tagged(mps_ss_t ss, void *base, void *limit, - void *closure, size_t closure_size) + void *closure) { mps_scan_tag_t tag = closure; mps_word_t mask = tag->mask; mps_word_t pattern = tag->pattern; - (void)closure_size; /* unused */ MPS_SCAN_AREA_TAGGED(tag_bits == pattern); @@ -139,12 +136,11 @@ mps_res_t mps_scan_area_tagged(mps_ss_t ss, mps_res_t mps_scan_area_tagged_or_zero(mps_ss_t ss, void *base, void *limit, - void *closure, size_t closure_size) + void *closure) { mps_scan_tag_t tag = closure; mps_word_t mask = tag->mask; mps_word_t pattern = tag->pattern; - (void)closure_size; /* unused */ MPS_SCAN_AREA_TAGGED(tag_bits == 0 || tag_bits == pattern); diff --git a/mps/code/ss.c b/mps/code/ss.c index c0c109e01d2..fb23794c4a8 100644 --- a/mps/code/ss.c +++ b/mps/code/ss.c @@ -26,8 +26,7 @@ SRCID(ss, "$Id$"); Res StackScanInner(ScanState ss, Word *stackCold, Word *stackHot, Count nSavedRegs, - mps_area_scan_t scan_area, - void *closure, size_t closure_size) + mps_area_scan_t scan_area, void *closure) { Arena arena; Res res; @@ -50,16 +49,16 @@ Res StackScanInner(ScanState ss, Word *stackCold, Word *stackHot, AVER(stackHot < arena->stackAtArenaEnter); AVER(arena->stackAtArenaEnter < stackCold); res = TraceScanArea(ss, stackHot, stackHot + nSavedRegs, - scan_area, closure, closure_size); + scan_area, closure); if (res != ResOK) return res; res = TraceScanArea(ss, arena->stackAtArenaEnter, stackCold, - scan_area, closure, closure_size); + scan_area, closure); if (res != ResOK) return res; } else { res = TraceScanArea(ss, stackHot, stackCold, - scan_area, closure, closure_size); + scan_area, closure); if (res != ResOK) return res; } diff --git a/mps/code/ss.h b/mps/code/ss.h index 02dc34f9fcf..75d939194e2 100644 --- a/mps/code/ss.h +++ b/mps/code/ss.h @@ -33,11 +33,10 @@ */ extern Res StackScan(ScanState ss, Word *stackCold, - mps_area_scan_t scan_area, - void *closure, size_t closure_size); + mps_area_scan_t scan_area, void *closure); extern Res StackScanInner(ScanState ss, Word *stackCold, Word *stackHot, - Count nSavedRegs, mps_area_scan_t scan_area, - void *closure, size_t closure_size); + Count nSavedRegs, + mps_area_scan_t scan_area, void *closure); #endif /* ss_h */ diff --git a/mps/code/ssan.c b/mps/code/ssan.c index cbb0daa4dd2..2a36f493351 100644 --- a/mps/code/ssan.c +++ b/mps/code/ssan.c @@ -23,7 +23,7 @@ SRCID(ssan, "$Id$"); Res StackScan(ScanState ss, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { jmp_buf jb; Word *stackHot = (void *)&jb; @@ -38,7 +38,7 @@ Res StackScan(ScanState ss, Word *stackCold, (void)setjmp(jb); return StackScanInner(ss, stackCold, stackHot, sizeof jb / sizeof(Word), - scan_area, closure, closure_size); + scan_area, closure); } diff --git a/mps/code/ssixi3.c b/mps/code/ssixi3.c index 56fb1290a66..a922cabc5a6 100644 --- a/mps/code/ssixi3.c +++ b/mps/code/ssixi3.c @@ -51,7 +51,7 @@ SRCID(ssixi3, "$Id$"); Res StackScan(ScanState ss, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { Word calleeSaveRegs[4]; @@ -65,7 +65,7 @@ Res StackScan(ScanState ss, Word *stackCold, ASMV("mov %%ebp, %0" : "=m" (calleeSaveRegs[3])); return StackScanInner(ss, stackCold, calleeSaveRegs, NELEMS(calleeSaveRegs), - scan_area, closure, closure_size); + scan_area, closure); } diff --git a/mps/code/ssixi6.c b/mps/code/ssixi6.c index 71a3dd40cf2..2d70d62697c 100644 --- a/mps/code/ssixi6.c +++ b/mps/code/ssixi6.c @@ -49,7 +49,7 @@ SRCID(ssixi6, "$Id$"); Res StackScan(ScanState ss, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { Word calleeSaveRegs[6]; @@ -65,7 +65,7 @@ Res StackScan(ScanState ss, Word *stackCold, ASMV("mov %%r15, %0" : "=m" (calleeSaveRegs[5])); return StackScanInner(ss, stackCold, calleeSaveRegs, NELEMS(calleeSaveRegs), - scan_area, closure, closure_size); + scan_area, closure); } diff --git a/mps/code/ssw3i3mv.c b/mps/code/ssw3i3mv.c index da95ebb106d..2b2d0bd4d08 100644 --- a/mps/code/ssw3i3mv.c +++ b/mps/code/ssw3i3mv.c @@ -24,7 +24,7 @@ SRCID(ssw3i3mv, "$Id$"); Res StackScan(ScanState ss, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { jmp_buf jb; @@ -45,7 +45,7 @@ Res StackScan(ScanState ss, Word *stackCold, AVER(offsetof(_JUMP_BUFFER, Esi) == offsetof(_JUMP_BUFFER, Ebx) + 8); return StackScanInner(ss, stackCold, (Word *)&((_JUMP_BUFFER *)jb)->Ebx, 3, - scan_area, closure, closure_size); + scan_area, closure); } /* C. COPYRIGHT AND LICENSE diff --git a/mps/code/ssw3i3pc.c b/mps/code/ssw3i3pc.c index 913a3d5a035..bead20fe898 100644 --- a/mps/code/ssw3i3pc.c +++ b/mps/code/ssw3i3pc.c @@ -48,7 +48,7 @@ typedef struct __JUMP_BUFFER { Res StackScan(ScanState ss, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { jmp_buf jb; @@ -68,7 +68,7 @@ Res StackScan(ScanState ss, Word *stackCold, AVER(offsetof(_JUMP_BUFFER, Esi) == offsetof(_JUMP_BUFFER, Ebx) + 8); return StackScanInner(ss, stackCold, (Word *)&((_JUMP_BUFFER *)jb)->Ebx, 3, - scan_area, closure, closure_size); + scan_area, closure); } diff --git a/mps/code/ssw3i6mv.c b/mps/code/ssw3i6mv.c index 9bc3a8e573b..884424d259c 100644 --- a/mps/code/ssw3i6mv.c +++ b/mps/code/ssw3i6mv.c @@ -31,8 +31,8 @@ SRCID(ssw3i6mv, "$Id$"); Res StackScan(ScanState ss, Word *stackCold, - mps_area_scan_t scan_area, - void *closure, size_t closure_size) + mps_area_scan_t scan_area + void *closure) { jmp_buf jb; @@ -64,7 +64,7 @@ Res StackScan(ScanState ss, Word *stackCold, AVER(offsetof(_JUMP_BUFFER, R15) == offsetof(_JUMP_BUFFER, Rbx) + 64); return StackScanInner(ss, stackCold, (Word *)&((_JUMP_BUFFER *)jb)->Rbx, 9, - scan_area, closure, closure_size); + scan_area, closure); } /* C. COPYRIGHT AND LICENSE diff --git a/mps/code/th.h b/mps/code/th.h index 39f1d91133b..29a4d243d1d 100644 --- a/mps/code/th.h +++ b/mps/code/th.h @@ -70,7 +70,7 @@ extern Arena ThreadArena(Thread thread); extern Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size); + void *closure); #endif /* th_h */ diff --git a/mps/code/than.c b/mps/code/than.c index cf41e02f50b..3e2dbaa81a0 100644 --- a/mps/code/than.c +++ b/mps/code/than.c @@ -119,10 +119,10 @@ Arena ThreadArena(Thread thread) Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { UNUSED(thread); - return StackScan(ss, stackCold, scan_area, closure, closure_size); + return StackScan(ss, stackCold, scan_area, closure); } diff --git a/mps/code/thix.c b/mps/code/thix.c index 6e51d2a5d5f..219ae33bcdd 100644 --- a/mps/code/thix.c +++ b/mps/code/thix.c @@ -241,7 +241,7 @@ Arena ThreadArena(Thread thread) Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { pthread_t self; Res res; @@ -251,7 +251,7 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, if(pthread_equal(self, thread->id)) { /* scan this thread's stack */ AVER(thread->alive); - res = StackScan(ss, stackCold, scan_area, closure, closure_size); + res = StackScan(ss, stackCold, scan_area, closure); if(res != ResOK) return res; } else if (thread->alive) { @@ -273,12 +273,12 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, * stackCold (.stack.full-descend) */ res = TraceScanArea(ss, stackBase, stackLimit, - scan_area, closure, closure_size); + scan_area, closure); if(res != ResOK) return res; /* scan the registers in the mutator fault context */ - res = MutatorFaultContextScan(ss, mfc, scan_area, closure, closure_size); + res = MutatorFaultContextScan(ss, mfc, scan_area, closure); if(res != ResOK) return res; } diff --git a/mps/code/thw3i3.c b/mps/code/thw3i3.c index e5fa73a8082..03675ed46b2 100644 --- a/mps/code/thw3i3.c +++ b/mps/code/thw3i3.c @@ -68,8 +68,7 @@ SRCID(thw3i3, "$Id$"); Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, - mps_area_scan_t scan_area, - void *closure, size_t closure_size) + mps_area_scan_t scan_area, void *closure) { DWORD id; Res res; @@ -107,7 +106,7 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, * stackCold (.stack.full-descend) */ res = TraceScanArea(ss, stackBase, stackLimit, - scan_area, closure, closure_size); + scan_area, closure); if(res != ResOK) return res; @@ -118,12 +117,12 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, */ res = TraceScanArea(ss, (Word *)&context, (Word *)((char *)&context + sizeof(CONTEXT)), - scan_area, closure, closure_size); + scan_area, closure); if(res != ResOK) return res; } else { /* scan this thread's stack */ - res = StackScan(ss, stackCold, scan_area, closure, closure_size); + res = StackScan(ss, stackCold, scan_area, closure); if(res != ResOK) return res; } diff --git a/mps/code/thw3i6.c b/mps/code/thw3i6.c index 090c2c43aa9..67350022ad6 100644 --- a/mps/code/thw3i6.c +++ b/mps/code/thw3i6.c @@ -69,7 +69,7 @@ SRCID(thw3i6, "$Id$"); Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { DWORD id; Res res; @@ -107,7 +107,7 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, * stackCold (.stack.full-descend) */ res = TraceScanArea(ss, stackBase, stackLimit, - scan_area, closure, closure_size); + scan_area, closure); if(res != ResOK) return res; @@ -118,12 +118,12 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, */ res = TraceScanArea(ss, (Word *)&context, (Word *)((char *)&context + sizeof(CONTEXT)), - scan_area, closure, closure_size); + scan_area, closure); if(res != ResOK) return res; } else { /* scan this thread's stack */ - res = StackScan(ss, stackCold, scan_area, closure, closure_size); + res = StackScan(ss, stackCold, scan_area, closure); if(res != ResOK) return res; } diff --git a/mps/code/thxc.c b/mps/code/thxc.c index e5277072dc5..3bb449d46fe 100644 --- a/mps/code/thxc.c +++ b/mps/code/thxc.c @@ -211,8 +211,7 @@ Arena ThreadArena(Thread thread) #include "prmcxc.h" Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, - mps_area_scan_t scan_area, - void *closure, size_t closure_size) + mps_area_scan_t scan_area, void *closure) { mach_port_t self; Res res; @@ -223,7 +222,7 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, if (thread->port == self) { /* scan this thread's stack */ AVER(thread->alive); - res = StackScan(ss, stackCold, scan_area, closure, closure_size); + res = StackScan(ss, stackCold, scan_area, closure); if(res != ResOK) return res; } else if (thread->alive) { @@ -261,12 +260,12 @@ Res ThreadScan(ScanState ss, Thread thread, Word *stackCold, * stackCold (.stack.full-descend) */ res = TraceScanArea(ss, stackBase, stackLimit, - scan_area, closure, closure_size); + scan_area, closure); if(res != ResOK) return res; /* scan the registers in the mutator fault context */ - res = MutatorFaultContextScan(ss, &mfcStruct, scan_area, closure, closure_size); + res = MutatorFaultContextScan(ss, &mfcStruct, scan_area, closure); if(res != ResOK) return res; } diff --git a/mps/code/trace.c b/mps/code/trace.c index 001c5b90526..10592f7df2e 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1432,7 +1432,7 @@ void TraceScanSingleRef(TraceSet ts, Rank rank, Arena arena, Res TraceScanArea(ScanState ss, Word *base, Word *limit, mps_area_scan_t scan_area, - void *closure, size_t closure_size) + void *closure) { AVERT(ScanState, ss); AVER(base != NULL); @@ -1446,7 +1446,7 @@ Res TraceScanArea(ScanState ss, Word *base, Word *limit, scan_area. */ ss->scannedSize += AddrOffset(base, limit); - return scan_area(&ss->ss_s, base, limit, closure, closure_size); + return scan_area(&ss->ss_s, base, limit, closure); } diff --git a/mps/manual/source/topic/root.rst b/mps/manual/source/topic/root.rst index 743c865f6a5..3b49d120a3f 100644 --- a/mps/manual/source/topic/root.rst +++ b/mps/manual/source/topic/root.rst @@ -489,7 +489,7 @@ Root interface requires expertise with the platform's virtual memory interface. -.. c:function:: mps_res_t mps_root_create_thread_scanned(mps_root_t *root_o, mps_arena_t arena, mps_rank_t rank, mps_rm_t rm, mps_thr_t thread, mps_area_scan_t scan_area, void *closure, size_t closure_size, void *cold) +.. c:function:: mps_res_t mps_root_create_thread_scanned(mps_root_t *root_o, mps_arena_t arena, mps_rank_t rank, mps_rm_t rm, mps_thr_t thread, mps_area_scan_t scan_area, void *closure, void *cold) Register a :term:`root` that consists of the :term:`references` in a :term:`thread's ` registers and stack, scanned by an @@ -511,13 +511,9 @@ Root interface :c:func:`mps_scan_area`, or a similar user-defined function. See :ref:`topic-scanning-area`. - ``closure`` is an arbitrary pointer that is passed to ``scan_area`` + ``closure`` is an arbitrary pointer that will be passed to ``scan_area`` and intended to point to any parameters it needs. - ``closure_size`` is an arbitrary size that is passed to - ``scan_area`` but is conventionally the size of the parameter - object pointer to by ``closure``. - ``cold`` is a pointer to the :term:`cold end` of stack to be scanned. On platforms where the stack grows downwards (currently, all supported platforms), locations below this address will be @@ -531,7 +527,7 @@ Root interface The registered root description persists until it is destroyed by calling :c:func:`mps_root_destroy`. -.. c:function:: mps_res_t mps_root_create_area(mps_root_t *root_o, mps_arena_t arena, mps_rank_t rank, mps_rm_t rm, void *base, void *limit, mps_area_scan_t scan_area, void *closure, size_t closure_size) +.. c:function:: mps_res_t mps_root_create_area(mps_root_t *root_o, mps_arena_t arena, mps_rank_t rank, mps_rm_t rm, void *base, void *limit, mps_area_scan_t scan_area, void *closure) Register a :term:`root` that consists of an area of memory scanned by an area scanning function. @@ -553,12 +549,8 @@ Root interface :c:func:`mps_scan_area`, or a similar user-defined function. See :ref:`topic-scanning-area`. - ``closure`` is an arbitrary pointer that is passed to ``scan_area`` - and intended to point to any parameters it needs. - - ``closure_size`` is an arbitrary size that is passed to - ``scan_area`` but is conventionally the size of the parameter - object pointer to by ``closure``. + ``closure`` is an arbitrary pointer that will be passed to + ``scan_area`` and intended to point to any parameters it needs. Returns :c:macro:`MPS_RES_OK` if the root was registered successfully, :c:macro:`MPS_RES_MEMORY` if the new root diff --git a/mps/manual/source/topic/scanning.rst b/mps/manual/source/topic/scanning.rst index cac8d7457e3..eab99c79b2f 100644 --- a/mps/manual/source/topic/scanning.rst +++ b/mps/manual/source/topic/scanning.rst @@ -531,7 +531,7 @@ the scanners, found in ``scan.c`` in the MPS source code. mps_res_t scan(mps_ss_t ss, void *base, void *limit, - void *closure, size_t closure_size); + void *closure); ``ss`` is the :term:`scan state`. @@ -545,17 +545,11 @@ the scanners, found in ``scan.c`` in the MPS source code. :c:func:`mps_root_create_thread_tagged` then it is the value of the ``closure`` argument originally passed to that function. - ``closure_size`` is an arbitrary size, conventionally used for the - size of the :term:`closure` pointed to by ``closure``. For example, - if the scanner was originally registered with - :c:func:`mps_root_create_thread_tagged` then it is the value of - the ``closure_size`` argument originally passed to that function. - -.. c:function:: mps_res_t mps_scan_area(mps_ss_t ss, void *base, void *limit, void *closure, size_t closure_size) +.. c:function:: mps_res_t mps_scan_area(mps_ss_t ss, void *base, void *limit, void *closure) Scan an area of memory :term:`fixing ` every word. - ``closure`` and ``closure_size`` are ignored. Expects ``base`` - and ``limit`` to be word-aligned. + ``closure`` is ignored. Expects ``base`` and ``limit`` to be + word-aligned. This scanner is appropriate for use when all words in the area are simple untagged references. @@ -586,7 +580,7 @@ the scanners, found in ``scan.c`` in the MPS source code. interpretation depends on which area scanner it is passed to. See the documentation for the individual area scanners. -.. c:function:: mps_res_t mps_scan_area_masked(mps_ss_t ss, void *base, void *limit, void *closure, size_t closure_size) +.. c:function:: mps_res_t mps_scan_area_masked(mps_ss_t ss, void *base, void *limit, void *closure) Scan an area of memory :term:`fixing ` every word, but remove tag bits before fixing references, and restore them afterwards. @@ -603,7 +597,7 @@ the scanners, found in ``scan.c`` in the MPS source code. references no matter what tag they have. This can be especially useful if you are debugging your tagging scheme. -.. c:function:: mps_res_t mps_scan_area_tagged(mps_ss_t ss, void *base, void *limit, void *closure, size_t closure_size) +.. c:function:: mps_res_t mps_scan_area_tagged(mps_ss_t ss, void *base, void *limit, void *closure) Scan an area of memory :term:`fixing ` only words whose masked bits match a particular tag pattern. ``closure`` should @@ -626,7 +620,7 @@ the scanners, found in ``scan.c`` in the MPS source code. version of the pointer. See :c:func:`mps_root_create_thread_tagged`. -.. c:function:: mps_res_t mps_scan_area_tagged_or_zero(mps_ss_t ss, void *base, void *limit, void *closure, size_t closure_size) +.. c:function:: mps_res_t mps_scan_area_tagged_or_zero(mps_ss_t ss, void *base, void *limit, void *closure) Scan an area of memory :term:`fixing ` only words whose masked bits are zero or match a particular tag pattern.