Permalink
Browse files

More fixes, almost there

  • Loading branch information...
1 parent e98ef02 commit c1ab56ef65f648a1eb1b7514e1f1054f49bb6e42 Mariano Wahlmann committed Nov 15, 2010
Showing with 35 additions and 33 deletions.
  1. +2 −0 include/parrot/api.h
  2. +6 −6 include/parrot/gc_api.h
  3. +26 −26 src/embed/api.c
  4. +1 −1 src/embed/embed_private.h
View
@@ -12,6 +12,8 @@
#include "parrot/compiler.h"
#include "parrot/config.h"
#include "parrot/core_types.h"
+#include "parrot/runcore_api.h"
+#include "parrot/gc_api.h"
#define PARROT_API PARROT_EXPORT
View
@@ -135,10 +135,6 @@ void Parrot_gc_free_memory_chunk(PARROT_INTERP, ARGIN_NULLOK(void *data))
__attribute__nonnull__(1);
PARROT_EXPORT
-INTVAL Parrot_gc_get_system_id(PARROT_INTERP, const char *name)
- __attribute__nonnull__(1);
-
-PARROT_EXPORT
void Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
__attribute__nonnull__(1)
FUNC_MODIFIES(*obj);
@@ -171,6 +167,10 @@ void * Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP,
__attribute__nonnull__(1);
PARROT_EXPORT
+void Parrot_gc_set_system_type(PARROT_INTERP, const char *name)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
unsigned int Parrot_is_blocked_GC_mark(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -348,8 +348,6 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP)
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_gc_get_system_id __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_mark_PMC_alive_fun __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_mark_PObj_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -364,6 +362,8 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP)
#define ASSERT_ARGS_Parrot_gc_reallocate_memory_chunk_with_interior_pointers \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_set_system_type __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
View
@@ -12,13 +12,13 @@ Parrot_api_make_interpreter(ARGIN_NULLOK(PMC *parent), Parrot_Int flags, ARGIN_N
{
ASSERT_ARGS(Parrot_api_make_interpreter)
int alt_stacktop;
- struct parrot_interp_t * interp_raw;
+ Parrot_Interp interp_raw;
void *stacktop_ptr = &alt_stacktop;
PMC * iglobals;
Parrot_set_config_hash();
{
- Parrot_Interp * const parent_raw = PMC_IS_NULL(parent) ? NULL : GET_RAW_INTERP(parent);
+ const Parrot_Interp parent_raw = PMC_IS_NULL(parent) ? NULL : GET_RAW_INTERP(parent);
interp_raw = allocate_interpreter(parent_raw, flags);
if (args) {
if (args->stacktop)
@@ -33,7 +33,7 @@ Parrot_api_make_interpreter(ARGIN_NULLOK(PMC *parent), Parrot_Int flags, ARGIN_N
}
initialize_interpreter(interp_raw, stacktop_ptr);
iglobals = interp_raw->iglobals;
- *interp = VTABLE_get_pmc_keyed_int(interp, iglobals, (Parrot_Int)IGLOBALS_INTERPRETER);
+ *interp = VTABLE_get_pmc_keyed_int(interp_raw, parent_raw->iglobals, (Parrot_Int)IGLOBALS_INTERPRETER);
return !PMC_IS_NULL(*interp);
}
@@ -55,7 +55,7 @@ Parrot_Int
Parrot_api_debug_flag(ARGMOD(PMC *interp_pmc), Parrot_Int flags, Parrot_Int set)
{
ASSERT_ARGS(Parrot_api_debug_flag)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
if (set)
interp->debug_flags |= flags;
else
@@ -68,7 +68,7 @@ Parrot_Int
Parrot_api_flag(ARGMOD(PMC *interp_pmc), Parrot_Int flags, Parrot_Int set)
{
ASSERT_ARGS(Parrot_api_flag)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
if (set) {
Interp_flags_SET(interp, flags);
if (flags & (PARROT_BOUNDS_FLAG | PARROT_PROFILE_FLAG))
@@ -84,7 +84,7 @@ Parrot_Int
Parrot_api_set_executable_name(ARGMOD(PMC *interp_pmc), ARGIN(const char * name))
{
ASSERT_ARGS(Parrot_api_set_executable_name)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
STRING * const name_str = Parrot_str_new(interp, name, 0);
PMC * const name_pmc = Parrot_pmc_new(interp, enum_class_String);
VTABLE_set_string_native(interp, name_pmc, name_str);
@@ -98,7 +98,7 @@ Parrot_Int
Parrot_api_destroy_interpreter(ARGIN(PMC *interp_pmc))
{
ASSERT_ARGS(Parrot_api_destroy_interpreter)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
Parrot_destroy(interp);
Parrot_exit(interp, 0);
EMBED_API_CALLOUT(interp_pmc, interp);
@@ -120,37 +120,37 @@ Parrot_Int
Parrot_api_load_bytecode_file(ARGMOD(PMC *interp_pmc), ARGIN(const char *filename), ARGOUT(PMC **pbc))
{
ASSERT_ARGS(Parrot_api_load_bytecode_file)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
PackFile * const pf = Parrot_pbc_read(interp, filename, 0);
if (!pf)
EMBED_API_FAILURE(interp_pmc, interp);
*pbc = Parrot_pmc_new(interp, enum_class_Packfile);
VTABLE_set_pointer(interp, *pbc, pf);
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrot_api_run_bytecode(ARGMOD(PMC *interp_pmc), ARGIN(PMC *pbc), ARGIN(PMC *mainargs))
{
ASSERT_ARGS(Parrot_api_run_bytecode)
- EMBED_API_CALLIN(interp_pmc, interp);
- PackFile * const pf = VTABLE_get_pointer(interp, pbc);
+ EMBED_API_CALLIN(interp_pmc, interp)
+ PackFile * const pf = (PackFile *)VTABLE_get_pointer(interp, pbc);
if (!pf)
EMBED_API_FAILURE(interp_pmc, interp);
Parrot_pbc_load(interp, pf);
PackFile_fixup_subs(interp, PBC_IMMEDIATE, NULL);
PackFile_fixup_subs(interp, PBC_POSTCOMP, NULL);
PackFile_fixup_subs(interp, PBC_MAIN, NULL);
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrot_api_build_argv_array(ARGMOD(PMC *interp_pmc), Parrot_Int argc, ARGIN(char **argv), ARGOUT(PMC **args))
{
ASSERT_ARGS(Parrot_api_build_argv_array)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
PMC * const userargv = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
Parrot_Int i;
@@ -161,61 +161,61 @@ Parrot_api_build_argv_array(ARGMOD(PMC *interp_pmc), Parrot_Int argc, ARGIN(char
VTABLE_push_string(interp, userargv, arg);
}
*args = userargv;
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrot_api_set_warnings(ARGMOD(PMC *interp_pmc), Parrot_Int flags)
{
ASSERT_ARGS(Parrot_api_set_warnings)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
/* Activates the given warnings. (Macro from warnings.h.) */
PARROT_WARNINGS_on(interp, flags);
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrot_api_set_output_file(ARGMOD(PMC *interp_pmc), ARGIN(const char * filename))
{
ASSERT_ARGS(Parrot_api_set_output_file)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
if (!filename && !interp->output_file)
interp->output_file = "-";
else
interp->output_file = filename;
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrt_api_add_library_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path))
{
//ASSERT_ARGS(Parrot_api_add_library_search_path)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_LIBRARY);
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrt_api_add_include_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path))
{
//ASSERT_ARGS(Parrot_api_add_include_search_path)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_INCLUDE);
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
PARROT_API
Parrot_Int
Parrt_api_add_dynext_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path))
{
//ASSERT_ARGS(Parrot_api_add_dynext_search_path)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
Parrot_lib_add_path_from_cstring(interp, path, PARROT_LIB_PATH_DYNEXT);
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
/*
@@ -235,7 +235,7 @@ Parrot_Int
Parrot_api_set_stdhandles(ARGIN(PMC *interp_pmc), Parrot_Int stdin, Parrot_Int stdout, Parrot_Int stderr)
{
ASSERT_ARGS(Parrot_api_set_stdhandles)
- EMBED_API_CALLIN(interp_pmc, interp);
+ EMBED_API_CALLIN(interp_pmc, interp)
void *dummy;
if(PIO_INVALID_HANDLE != (PIOHANDLE)stdin) {
@@ -256,5 +256,5 @@ Parrot_api_set_stdhandles(ARGIN(PMC *interp_pmc), Parrot_Int stdin, Parrot_Int s
dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDERR_FILENO,pmc);
}
- EMBED_API_CALLOUT(interp_pmc, interp);
+ EMBED_API_CALLOUT(interp_pmc, interp)
}
@@ -7,7 +7,7 @@
#define GET_RAW_INTERP(p) ((Parrot_ParrotInterpreter_attributes*)(p)->data)->interp;
#define EMBED_API_CALLIN(p, i) \
void * _oldtop; \
- Interp * (i) = PMC_IS_NULL(p) ? NULL : GET_RAW_INTERP(p); \
+ Parrot_Interp (i) = PMC_IS_NULL(p) ? NULL : GET_RAW_INTERP(p); \
_oldtop = (i)->lo_var_ptr; \
if (_oldtop) {} else (i)->lo_var_ptr = &_oldtop; \
if (setjmp((i)->api_jmp_buf)) { \

0 comments on commit c1ab56e

Please sign in to comment.