-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
174f910
commit 1a9d58a
Showing
9 changed files
with
207 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef U3_ALLOCATE_V3_H | ||
#define U3_ALLOCATE_V3_H | ||
|
||
#include "pkg/noun/allocate.h" | ||
|
||
#include "pkg/noun/v3/manage.h" | ||
#include "options.h" | ||
|
||
/** Aliases. | ||
**/ | ||
# define u3R_v3 u3a_Road | ||
# define u3a_v3_balign u3a_balign | ||
# define u3a_v3_road u3a_road | ||
# define u3a_v3_walign u3a_walign | ||
|
||
/** Data structures. | ||
**/ | ||
|
||
/** Globals. | ||
**/ | ||
|
||
/** Functions. | ||
**/ | ||
/** Allocation. | ||
**/ | ||
/* Reference and arena control. | ||
*/ | ||
|
||
#endif /* ifndef U3_ALLOCATE_V3_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef U3_HASHTABLE_V3_H | ||
#define U3_HASHTABLE_V3_H | ||
|
||
#define u3h_v3_new_cache u3h_new_cache | ||
|
||
#include "pkg/noun/hashtable.h" | ||
|
||
#endif /* U3_HASHTABLE_V3_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/// @file | ||
|
||
#include "pkg/noun/v3/manage.h" | ||
|
||
#include "pkg/noun/v3/allocate.h" | ||
#include "pkg/noun/v3/hashtable.h" | ||
#include "pkg/noun/version.h" | ||
#include "pkg/noun/v2/vortex.h" | ||
#include "pkg/noun/v3/vortex.h" | ||
|
||
/* u3m_v3_migrate: perform loom migration if necessary. | ||
*/ | ||
void | ||
u3m_v3_migrate() | ||
{ | ||
fprintf(stderr, "loom: memoization migration running...\r\n"); | ||
|
||
|
||
c3_w ver_w = *(u3_Loom + u3C.wor_i - 1); // XX | ||
c3_w *mem_w = u3_Loom + u3a_v3_walign; | ||
c3_w len_w = u3C.wor_i - u3a_v3_walign; | ||
c3_w suz_w = c3_wiseof(u3v_v2_home); | ||
// XX check this later | ||
c3_w *mut_w = c3_align(mem_w + len_w - suz_w, u3a_v3_balign, C3_ALGLO); | ||
|
||
// old road | ||
u3v_v2_home* hum_u = (u3v_v2_home*)mut_w; | ||
u3a_v2_road* rud_u = &hum_u->rod_u; | ||
size_t ruz_t = sizeof(u3a_v2_road); | ||
|
||
// new home, new road | ||
u3v_v3_home hom_u = {0}; | ||
u3a_v3_road rod_u = {0}; | ||
|
||
// copy members, one-by-one, from old road to new road | ||
rod_u.par_p = rud_u->par_p; | ||
rod_u.kid_p = rud_u->kid_p; | ||
rod_u.nex_p = rud_u->nex_p; | ||
|
||
rod_u.cap_p = rud_u->cap_p; | ||
rod_u.hat_p = rud_u->hat_p; | ||
rod_u.mat_p = rud_u->mat_p; | ||
rod_u.rut_p = rud_u->rut_p; | ||
rod_u.ear_p = rud_u->ear_p; | ||
|
||
// no need to zero-out fut_w | ||
|
||
// no need to do anything with esc | ||
|
||
rod_u.how.fag_w = rud_u->how.fag_w; | ||
|
||
// XX destination buffer is size 196; is that because of padding? | ||
memcpy(rod_u.all.fre_p, rud_u->all.fre_p, sizeof(rud_u->all.fre_p)); | ||
rod_u.all.cel_p = rud_u->all.cel_p; | ||
rod_u.all.fre_w = rud_u->all.fre_w; | ||
rod_u.all.max_w = rud_u->all.max_w; | ||
|
||
rod_u.jed.hot_p = rud_u->jed.hot_p; | ||
rod_u.jed.war_p = rud_u->jed.war_p; | ||
rod_u.jed.cod_p = rud_u->jed.cod_p; | ||
rod_u.jed.han_p = rud_u->jed.han_p; | ||
rod_u.jed.bas_p = rud_u->jed.bas_p; | ||
|
||
rod_u.byc.har_p = rud_u->byc.har_p; | ||
|
||
rod_u.ski.gul = rud_u->ski.gul; | ||
|
||
rod_u.bug.tax = rud_u->bug.tax; | ||
rod_u.bug.mer = rud_u->bug.mer; | ||
|
||
rod_u.pro.nox_d = rud_u->pro.nox_d; | ||
rod_u.pro.cel_d = rud_u->pro.cel_d; | ||
rod_u.pro.don = rud_u->pro.don; | ||
rod_u.pro.trace = rud_u->pro.trace; | ||
rod_u.pro.day = rud_u->pro.day; | ||
|
||
rod_u.cax.har_p = rud_u->cax.har_p; | ||
|
||
// prepare the new home | ||
hom_u.arv_u = hum_u->arv_u; | ||
hom_u.rod_u = rod_u; | ||
hom_u.ver_w = U3V_VER3; | ||
|
||
// place the new home over the old one | ||
c3_w siz_w = c3_wiseof(u3v_home); | ||
c3_w *mat_w = c3_align(mem_w + len_w - siz_w, u3a_v3_balign, C3_ALGLO); | ||
memcpy(mat_w, &hom_u, sizeof(u3v_home)); | ||
|
||
// set globals | ||
u3H_v3 = (void*)mat_w; | ||
u3R_v3 = &u3H_v3->rod_u; | ||
|
||
// initialize persistent cache | ||
u3R_v3->cax.per_p = u3h_v3_new_cache(u3C.per_w); | ||
|
||
u3H_v3->ver_w = U3V_VER3; | ||
|
||
fprintf(stderr, "loom: memoization migration done\r\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/// @file | ||
|
||
#ifndef U3_MANAGE_V3_H | ||
#define U3_MANAGE_V3_H | ||
|
||
/** System management. | ||
**/ | ||
/* u3m_v3_migrate: perform pointer compression loom migration if necessary. | ||
ver_w - target version | ||
*/ | ||
void | ||
u3m_v3_migrate(); | ||
|
||
#endif /* ifndef U3_MANAGE_V3_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// @file | ||
|
||
#include "pkg/noun/v3/vortex.h" | ||
|
||
u3v_v3_home* u3v_v3_Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/// @file | ||
|
||
#ifndef U3_VORTEX_V3_H | ||
#define U3_VORTEX_V3_H | ||
|
||
#include "pkg/noun/vortex.h" | ||
|
||
#include "pkg/noun/v3/allocate.h" | ||
#include "pkg/noun/version.h" | ||
|
||
/** Aliases. | ||
**/ | ||
# define u3v_v3_arvo u3v_arvo | ||
|
||
/** Data structures. | ||
**/ | ||
/* u3v_v3_home: all internal (within image) state. | ||
** NB: version must be last for discriminability in north road | ||
*/ | ||
typedef struct _u3v_v3_home { | ||
u3a_v3_road rod_u; // storage state | ||
u3v_v3_arvo arv_u; // arvo state | ||
u3v_version ver_w; // version number | ||
} u3v_v3_home; | ||
|
||
/** Globals. | ||
**/ | ||
/// Arvo internal state. | ||
extern u3v_v3_home* u3v_v3_Home; | ||
# define u3H_v3 u3v_v3_Home | ||
# define u3A_v3 (&(u3v_v3_Home->arv_u)) | ||
|
||
/** Functions. | ||
**/ | ||
/* u3v_v3_rewrite_compact(): rewrite arvo kernel for compaction. | ||
*/ | ||
void | ||
u3v_v3_rewrite_compact(); | ||
|
||
#endif /* ifndef U3_VORTEX_V3_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters