Is it just me, or is the write barrier in this snippet from core_ops.c
in the wrong place? Note the "return" on the line above it!
20508 opcode_t *
20509 Parrot_subclass_p_p(opcode_t *cur_opcode, PARROT_INTERP) {
20510
20511 PMC * const parent_class = Parrot_oo_get_class(interp,
PREG(2));
20512 opcode_t * const next = cur_opcode + 3;
20513
20514 if (PMC_IS_NULL(parent_class)) {
20515 opcode_t * const handler = Parrot_ex_throw_from_op_args(interp,
next,
20516 EXCEPTION_NO_CLASS,
20517 "Class '%Ss' doesn't exist", VTABLE_get_string(interp,
PREG(2)));return (opcode_t *)handler;
20518 }
20519 PREG(1) = Parrot_pmc_new(interp, enum_class_Class);
20520 VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t
*)next;
20521 PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp));
20522 }
Also, in many of the files generated from PMCs, there are strange
placements of return and GC_WRITE_BARRIER statements. Here's an excerpt
from src/pmc/float.c. Note the write barrier on line 432, the return on
433, and another write barrier on line 440. I'd estimate there are about
200 more such examples.
412 static void
413 Parrot_Float_nci_acos(PARROT_INTERP, PMC *_self)
414 {
415 PMC * const _ctx = CURRENT_CONTEXT(interp);
416 PMC * const _call_object = Parrot_pcc_get_signature(interp, _ctx);
417 PMC * _ret_object;
418
419 { /* BEGIN PARMS SCOPE */
420
421 Parrot_pcc_fill_params_from_c_args(interp, _call_object, "Pi",
422 &_self);
423 { /* BEGIN PMETHOD BODY */
424
425 PMC * const d = Parrot_pmc_new(interp, VTABLE_type(interp, _self));
426 SETATTR_Float_fv(interp, d, acos(_self->vtable->get_number(interp,
_self)));
427 {
428 /*BEGIN RETURN PMC *d */
429 _ret_object = Parrot_pcc_build_call_from_c_args(interp,
_call_object,
430 "P", (PMC*)d);
431 UNUSED(_ret_object);
432 PARROT_GC_WRITE_BARRIER(interp, _self);
433 return;
434 /*END RETURN PMC *d */
435 }
436
437
438 } /* END PMETHOD BODY */
439
440 PARROT_GC_WRITE_BARRIER(interp, _self);
441
442 } /* END PARAMS SCOPE */
443 return;
444 }
--
Andy Dougherty [email protected]
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev