Permalink
Browse files

fix 2 segfaults

* redo changes in nci.pmc
* disable DOD in thaw


git-svn-id: https://svn.parrot.org/parrot/trunk@7663 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 8838c7f commit 68446993af4571917209b6f72e96edb149ab072e Leopold Toetsch committed Mar 20, 2005
Showing with 20 additions and 8 deletions.
  1. +7 −2 classes/nci.pmc
  2. +1 −0 ops/core.ops
  3. +7 −1 src/pmc_freeze.c
  4. +5 −5 t/pmc/namespace.t
View
@@ -125,10 +125,15 @@ shifted down.
Parrot_csub_t func = (Parrot_csub_t)D2FPTR(PMC_data(SELF));
PMC *obj;
/*
- * if the invocant is a class shift down arguments
+ * If the invocant is a class or there is no invocant
+ * shift down arguments.
+ * But not if it's a plain NCI function created
+ * from dlfunc.
*/
obj = REG_PMC(2);
- if (PObj_is_class_TEST(obj) || obj->vtable->class == obj) {
+ if (!(PObj_get_FLAGS(SELF) & PObj_private1_FLAG) &&
+ (PMC_IS_NULL(obj) || PObj_is_class_TEST(obj) ||
+ obj->vtable->class == obj)) {
INTVAL i, n;
REG_PMC(2) = REG_PMC(5); /* obj = 1st arg */
n = --REG_INT(3); /* argcP */
View
@@ -1167,6 +1167,7 @@ op dlfunc (out PMC, in PMC, in STR, in STR) {
else {
$1 = pmc_new(interpreter, enum_class_NCI);
$1->vtable->set_pointer_keyed_str(interpreter, $1, $4, F2DPTR(p));
+ PObj_get_FLAGS($1) |= PObj_private1_FLAG;
}
goto NEXT();
}
View
@@ -1475,8 +1475,14 @@ run_thaw(Parrot_Interp interpreter, STRING* image, visit_enum_type what)
* if we are thawing a lot of PMCs, its cheaper to do
* a DOD run first and then block DOD - the limit should be
* chosen so that no more then one DOD run would be triggered
+ *
+ * XXX
+ *
+ * md5_3.imc shows a segfault during thawing the config hash
+ * info->thaw_ptr becomes invalid - seems that the hash got
+ * collected under us.
*/
- if (string_length(interpreter, image) > THAW_BLOCK_DOD_SIZE) {
+ if (1 || (string_length(interpreter, image) > THAW_BLOCK_DOD_SIZE)) {
Parrot_do_dod_run(interpreter, 1);
Parrot_block_DOD(interpreter);
Parrot_block_GC(interpreter);
View
@@ -178,9 +178,7 @@ ok
baz
OUTPUT
-TODO: {
- local $TODO = "probably wrong function called";
- pir_output_like(<<'CODE', <<'OUTPUT', "func() namespace resolution");
+pir_output_like(<<'CODE', <<'OUTPUT', "func() namespace resolution");
.sub main @MAIN
print "calling foo\n"
@@ -227,6 +225,8 @@ CODE
calling Foo::foo
Foo::foo
Foo::bar
-fie.*not found/
+ fie
+calling baz
+.*baz.*not found/
OUTPUT
-}
+

0 comments on commit 6844699

Please sign in to comment.