Author: chromatic
Date: Wed May 23 15:50:30 2007
New Revision: 18636
Modified:
trunk/src/extend.c
trunk/t/src/compiler.t
Log:
[REVERT] Reverted accidentally-committed code from r18635.
I left the copyright notices; they needed a change anyway and it's only a
LITTLE bit confusing.
Modified: trunk/src/extend.c
==============================================================================
--- trunk/src/extend.c (original)
+++ trunk/src/extend.c Wed May 23 15:50:30 2007
@@ -770,6 +770,8 @@
PARROT_CALLIN_START(interp);
va_start(ap, signature);
+ CONTEXT(interp->ctx)->constants =
+ PMC_sub(sub)->seg->const_table->constants;
result = Parrot_runops_fromc_arglist(interp, sub, signature, ap);
va_end(ap);
Modified: trunk/t/src/compiler.t
==============================================================================
--- trunk/t/src/compiler.t (original)
+++ trunk/t/src/compiler.t Wed May 23 15:50:30 2007
@@ -27,16 +27,11 @@
=cut
-SKIP:
-{
-# skip( "compreg disabled", 1 );
-
c_output_is( <<'CODE', <<'OUTPUT', "compreg/compile" );
#include <stdio.h>
#include "parrot/parrot.h"
#include "parrot/embed.h"
-#include "parrot/extend.h"
extern void imcc_init(Parrot_Interp interp);
@@ -54,7 +49,7 @@
compreg = VTABLE_get_pmc_keyed_int(interp,
interp->iglobals,
IGLOBALS_COMPREG_HASH);
- pir = const_string(interp, "PIR");
+ pir = const_string(interp, "PIR");
comp = VTABLE_get_pmc_keyed_str(interp, compreg, pir);
if (PMC_IS_NULL(comp) || !VTABLE_defined(interp, comp)) {
PIO_eprintf(interp, "Pir compiler not loaded");
@@ -63,7 +58,7 @@
/*
* compile source
*/
- prog = Parrot_call_sub(interp, comp, "PS", string_from_cstring(interp,
c_src, 0) );
+ prog = imcc_compile_pir(interp, c_src);
if (PMC_IS_NULL(prog) || !VTABLE_defined(interp, prog)) {
PIO_eprintf(interp, "Pir compiler returned no prog");
@@ -112,8 +107,6 @@
CODE
ok
OUTPUT
-}
-
c_output_is( <<'CODE', <<'OUTPUT', "Parror Compile API Single call" );
#include <stdio.h>
@@ -131,28 +124,40 @@
PMC *comp, *prog, *compreg, *entry;
opcode_t *dest;
STRING *error;
+ /*
+ * get PIR compiler - TODO API
+ */
+ compreg = VTABLE_get_pmc_keyed_int(interp,
+ interp->iglobals,
+ IGLOBALS_COMPREG_HASH);
+ pir = const_string(interp, "PIR");
+ comp = VTABLE_get_pmc_keyed_str(interp, compreg, pir);
+ if (PMC_IS_NULL(comp) || !VTABLE_defined(interp, comp)) {
+ PIO_eprintf(interp, "Pir compiler not loaded");
+ exit(1);
+ }
/*
* compile source
*/
- pir = const_string(interp, "PIR");
prog = Parrot_compile_string(interp, pir, c_src, &error);
- if (PMC_IS_NULL(prog)) {
- PIO_eprintf(interp, "PIR compiler returned no Sub PMC");
+ if (PMC_IS_NULL(prog) || !VTABLE_defined(interp, prog)) {
+ PIO_eprintf(interp, "Pir compiler returned no prog");
exit(1);
}
-
/* keep eval PMC alive */
dod_register_pmc(interp, prog);
-
/* locate function to run */
smain = const_string(interp, "main");
entry = Parrot_find_global_cur(interp, smain);
-
/* location of the entry */
- Parrot_call_sub( interp, entry, "vv" );
-
+ interp->current_cont = new_ret_continuation_pmc(interp, NULL);
+ dest = VTABLE_invoke(interp, entry, NULL);
+ /* where to start */
+ interp->resume_offset = dest -interp->code->base.data;
+ /* and go */
+ Parrot_runcode(interp, argc, argv);
return NULL;
}
@@ -184,7 +189,6 @@
CODE
ok
OUTPUT
-
c_output_is( <<'CODE', <<'OUTPUT', "Parror Compile API Multiple Calls" );
#include <stdio.h>
@@ -276,7 +280,6 @@
ok
hola
OUTPUT
-
c_output_is( <<'CODE', <<'OUTPUT', "Parror Compile API Multiple 1st bad PIR" );
#include <stdio.h>