Front page | perl.cvs.parrot |
Postings from January 2009
[svn:parrot] r34998 - trunk/compilers/pirc/src
From:
kjs
Date:
January 5, 2009 09:21
Subject:
[svn:parrot] r34998 - trunk/compilers/pirc/src
Message ID:
20090105172147.D0807CB9F9@x12.develooper.com
Author: kjs
Date: Mon Jan 5 09:21:47 2009
New Revision: 34998
Modified:
trunk/compilers/pirc/src/bcgen.c
trunk/compilers/pirc/src/pircompunit.c
Log:
[pirc] store annotations in circular list. Add function to bcgen module, copied from jonathan++ 's annotation work.
Modified: trunk/compilers/pirc/src/bcgen.c
==============================================================================
--- trunk/compilers/pirc/src/bcgen.c (original)
+++ trunk/compilers/pirc/src/bcgen.c Mon Jan 5 09:21:47 2009
@@ -355,6 +355,28 @@
bc->opcursor = (opcode_t *)bc->interp->code->base.data;
}
+#if 0
+/*
+
+=item C<void
+create_annotations_segment(bytecode * const bc, opcode_t bytecode_offset)>
+
+Create an annotations segment, and an initial annotations group.
+
+=cut
+
+*/
+void
+create_annotations_segment(bytecode * const bc, opcode_t bytecode_offset) {
+ bc->interp->code->annotations = PackFile_Segment_new_seg(bc->interp,
+ bc->interp->code->base.dir,
+ PF_ANNOTATIONS_SEG, "ANNOTATIONS", 1);
+
+ /* Create initial group. */
+ PackFile_Annotations_add_group(bc->interp, bc->interp->code->annotations, bytecode_offset);
+}
+#endif
+
/*
=item C<void
Modified: trunk/compilers/pirc/src/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/src/pircompunit.c (original)
+++ trunk/compilers/pirc/src/pircompunit.c Mon Jan 5 09:21:47 2009
@@ -2477,6 +2477,7 @@
CURRENT_SUB(lexer)->info.regs_used[i] = reg_usage[i];
}
+
/*
=item C<void
@@ -2496,8 +2497,16 @@
ann->bytecode_index = lexer->stmt_counter;
++lexer->num_annotations; /* keep track of number of annotations */
- /* store the annotation in a list, managed by the lexer */
- ann->next = lexer->annotations;
+ /* store the annotation in a list, managed by the lexer
+ * the list is circular linked, so that the order of annotations is preserved.
+ */
+ if (lexer->annotations) {
+ ann->next = lexer->annotations->next; /* new node's next becomes the first one. */
+ lexer->annotations->next = ann;
+ }
+ else {
+ ann->next = ann; /* link to itself */
+ }
lexer->annotations = ann;
}
-
[svn:parrot] r34998 - trunk/compilers/pirc/src
by kjs