Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made HLL entries first class GC citizens.

Properly store and mark created HLL entries.
  • Loading branch information...
commit 0a752a75955087bf7208b37392bff244a5801af1 1 parent 4bbe707
@bacek bacek authored
Showing with 12 additions and 6 deletions.
  1. +1 −0  include/parrot/interpreter.h
  2. +1 −0  src/gc/mark_sweep.c
  3. +10 −6 src/hll.c
View
1  include/parrot/interpreter.h
@@ -215,6 +215,7 @@ struct parrot_interp_t {
PMC *HLL_info; /* HLL names and types */
PMC *HLL_namespace; /* cache of HLL toplevel ns */
+ PMC *HLL_entries;
PMC *root_namespace; /* namespace hash */
PMC *scheduler; /* concurrency scheduler */
View
1  src/gc/mark_sweep.c
@@ -240,6 +240,7 @@ mark_interp(PARROT_INTERP)
/* Now mark the HLL stuff */
Parrot_gc_mark_PMC_alive(interp, interp->HLL_info);
Parrot_gc_mark_PMC_alive(interp, interp->HLL_namespace);
+ Parrot_gc_mark_PMC_alive(interp, interp->HLL_entries);
/* Mark the registry */
PARROT_ASSERT(interp->gc_registry);
View
16 src/hll.c
@@ -80,7 +80,7 @@ new_hll_entry(PARROT_INTERP, ARGIN(STRING *entry_name))
PMC *entry_id;
- PMC * const entry = Parrot_pmc_new_constant_init_int(interp,
+ PMC * const entry = Parrot_pmc_new_init_int(interp,
enum_class_FixedPMCArray, e_HLL_MAX);
if (entry_name && !STRING_IS_EMPTY(entry_name)) {
@@ -89,9 +89,11 @@ new_hll_entry(PARROT_INTERP, ARGIN(STRING *entry_name))
else
VTABLE_push_pmc(interp, hll_info, entry);
- entry_id = Parrot_pmc_new_constant_init_int(interp, enum_class_Integer, id);
+ entry_id = Parrot_pmc_new_init_int(interp, enum_class_Integer, id);
VTABLE_set_pmc_keyed_int(interp, entry, e_HLL_id, entry_id);
+ VTABLE_push_pmc(interp, interp->HLL_entries, entry);
+
return entry;
}
@@ -114,7 +116,9 @@ Parrot_hll_init_HLL(PARROT_INTERP)
interp->HLL_info =
Parrot_pmc_new(interp, enum_class_OrderedHash);
interp->HLL_namespace =
- Parrot_pmc_new_constant(interp, enum_class_ResizablePMCArray);
+ Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
+ interp->HLL_entries =
+ Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
Parrot_hll_register_HLL(interp, CONST_STRING(interp, "parrot"));
}
@@ -157,12 +161,12 @@ Parrot_hll_register_HLL(PARROT_INTERP, ARGIN(STRING *hll_name))
entry = new_hll_entry(interp, hll_name);
/* register HLL name */
- name = Parrot_pmc_new_constant(interp, enum_class_String);
+ name = Parrot_pmc_new(interp, enum_class_String);
VTABLE_set_string_native(interp, name, hll_name);
VTABLE_set_pmc_keyed_int(interp, entry, e_HLL_name, name);
- /* create HLL namespace using the *constant* name */
+ /* create HLL namespace */
hll_name = Parrot_str_downcase(interp, VTABLE_get_string(interp, name));
/* HLL type mappings aren't yet created, we can't create
@@ -297,7 +301,7 @@ Parrot_hll_register_HLL_type(PARROT_INTERP, INTVAL hll_id,
type_array = VTABLE_get_pmc_keyed_int(interp, entry, e_HLL_typemap);
if (PMC_IS_NULL(type_array)) {
int i;
- type_array = Parrot_pmc_new_constant(interp, enum_class_FixedIntegerArray);
+ type_array = Parrot_pmc_new(interp, enum_class_FixedIntegerArray);
VTABLE_set_integer_native(interp, type_array, PARROT_MAX_CLASSES);
for (i = 0; i < PARROT_MAX_CLASSES; ++i)
VTABLE_set_integer_keyed_int(interp, type_array, i, i);

0 comments on commit 0a752a7

Please sign in to comment.
Something went wrong with that request. Please try again.