[svn:parrot] r44298 - in trunk: src/nci tools/dev
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Mon Feb 22 18:32:14 UTC 2010
Author: plobsing
Date: Mon Feb 22 18:32:11 2010
New Revision: 44298
URL: https://trac.parrot.org/parrot/changeset/44298
Log:
refactor loader generation to predeclare loader function (avoids warnings)
Modified:
trunk/src/nci/core_thunks.c
trunk/src/nci/extra_thunks.c
trunk/tools/dev/nci_thunk_gen.pir
Modified: trunk/src/nci/core_thunks.c
==============================================================================
--- trunk/src/nci/core_thunks.c Mon Feb 22 15:59:26 2010 (r44297)
+++ trunk/src/nci/core_thunks.c Mon Feb 22 18:32:11 2010 (r44298)
@@ -1040,10 +1040,12 @@
}
-
void
Parrot_nci_load_core_thunks(PARROT_INTERP)
-{
+;
+ void
+Parrot_nci_load_core_thunks(PARROT_INTERP)
+ {
PMC *iglobals;
PMC *nci_funcs;
PMC *temp_pmc;
@@ -1231,6 +1233,7 @@
VTABLE_set_pointer(interp, temp_pmc, (void *)pcf_P_Ji);
VTABLE_set_pmc_keyed_str(interp, nci_funcs, CONST_STRING(interp, "PJi"), temp_pmc);
+
}
Modified: trunk/src/nci/extra_thunks.c
==============================================================================
--- trunk/src/nci/extra_thunks.c Mon Feb 22 15:59:26 2010 (r44297)
+++ trunk/src/nci/extra_thunks.c Mon Feb 22 18:32:11 2010 (r44298)
@@ -6192,10 +6192,12 @@
}
-
void
Parrot_nci_load_extra_thunks(PARROT_INTERP)
-{
+;
+ void
+Parrot_nci_load_extra_thunks(PARROT_INTERP)
+ {
PMC *iglobals;
PMC *nci_funcs;
PMC *temp_pmc;
@@ -7223,6 +7225,7 @@
VTABLE_set_pointer(interp, temp_pmc, (void *)pcf_i_pitii);
VTABLE_set_pmc_keyed_str(interp, nci_funcs, CONST_STRING(interp, "ipitii"), temp_pmc);
+
}
Modified: trunk/tools/dev/nci_thunk_gen.pir
==============================================================================
--- trunk/tools/dev/nci_thunk_gen.pir Mon Feb 22 15:59:26 2010 (r44297)
+++ trunk/tools/dev/nci_thunk_gen.pir Mon Feb 22 18:32:11 2010 (r44298)
@@ -337,8 +337,6 @@
/* All our static functions that call in various ways. Yes, terribly
hackish, but that is just fine */
-PARROT_DYNEXT_EXPORT void Parrot_glut_nci_loader(PARROT_INTERP);
-
HEAD
.return (head)
.end
@@ -367,72 +365,58 @@
.sub 'get_loader'
.param pmc sigs
+ $S0 = 'get_loader_decl'(sigs)
+ $S1 = 'get_loader_body'(sigs)
+ $S2 = 'sprintf'(<<'LOADER', $S0, $S0, $S1)
+%s;
+%s {
+%s
+}
+LOADER
+ .return ($S2)
+.end
+
+.sub 'get_loader_decl'
+ .param pmc sigs
$S0 = 'read_from_opts'(.LOADER_STORAGE_CLASS)
$S1 = 'read_from_opts'(.LOADER_NAME)
- .local string code
- code = 'sprintf'(<<'FN_HEADER', $S0, $S1)
-
+ $S2 = 'sprintf'(<<'DECL', $S0, $S1)
%s void
%s(PARROT_INTERP)
-{
- PMC *iglobals;
- PMC *nci_funcs;
- PMC *temp_pmc;
-
- iglobals = interp->iglobals;
- PARROT_ASSERT(!(PMC_IS_NULL(iglobals)));
-
- nci_funcs = VTABLE_get_pmc_keyed_int(interp, iglobals,
- IGLOBALS_NCI_FUNCS);
- PARROT_ASSERT(!(PMC_IS_NULL(nci_funcs)));
-
-FN_HEADER
-
- .local int i, n
- i = 0
- n = sigs
- loop:
- if i >= n goto end_loop
-
- .local pmc sig
- sig = shift sigs
-
- .local string fn_name
- fn_name = 'sig_to_fn_name'(sig :flat)
-
- .local string key
- key = join '', sig
-
- $S0 = 'sprintf'(<<'TEMPLATE', fn_name, key)
- temp_pmc = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
- VTABLE_set_pointer(interp, temp_pmc, (void *)%s);
- VTABLE_set_pmc_keyed_str(interp, nci_funcs, CONST_STRING(interp, "%s"), temp_pmc);
-
-TEMPLATE
- code = concat code, $S0
+DECL
+ .return ($S2)
+.end
- inc i
- goto loop
- end_loop:
+.sub 'get_dynext_loader'
+ .param pmc sigs
- code = concat code, <<'FN_FOOTER'
+ $S0 = 'get_dynext_loader_decl'(sigs)
+ $S1 = 'get_loader_body'(sigs)
+ $S2 = 'sprintf'(<<'LOADER', $S0, $S0, $S1)
+%s;
+%s {
+%s
}
-FN_FOOTER
-
- .return (code)
+LOADER
+ .return ($S2)
.end
-.sub 'get_dynext_loader'
+.sub 'get_dynext_loader_decl'
.param pmc sigs
$S0 = 'read_from_opts'(.LOADER_STORAGE_CLASS)
$S1 = 'read_from_opts'(.LOADER_NAME)
- .local string code
- code = 'sprintf'(<<'FN_HEADER', $S0, $S1)
-
+ $S2 = 'sprintf'(<<'DECL', $S0, $S1)
%s void
%s(PARROT_INTERP, SHIM(PMC *lib))
-{
+DECL
+ .return ($S2)
+.end
+
+.sub 'get_loader_body'
+ .param pmc sigs
+ .local string code
+ code = 'sprintf'(<<'HEADER', $S0, $S1)
PMC *iglobals;
PMC *nci_funcs;
PMC *temp_pmc;
@@ -444,7 +428,7 @@
IGLOBALS_NCI_FUNCS);
PARROT_ASSERT(!(PMC_IS_NULL(nci_funcs)));
-FN_HEADER
+HEADER
.local int i, n
i = 0
@@ -473,10 +457,6 @@
goto loop
end_loop:
- code = concat code, <<'FN_FOOTER'
-}
-FN_FOOTER
-
.return (code)
.end
More information about the parrot-commits
mailing list