[svn:parrot] r47952 - in branches/gsoc_threads: . include/parrot src src/interp src/pmc src/runcore t/pmc t/src tools/dev

Chandon at svn.parrot.org Chandon at svn.parrot.org
Thu Jul 1 22:23:10 UTC 2010


Author: Chandon
Date: Thu Jul  1 22:23:10 2010
New Revision: 47952
URL: https://trac.parrot.org/parrot/changeset/47952

Log:
[gsoc_threads] merge from trunk

Modified:
   branches/gsoc_threads/   (props changed)
   branches/gsoc_threads/include/parrot/extend.h
   branches/gsoc_threads/include/parrot/runcore_trace.h   (props changed)
   branches/gsoc_threads/src/extend.c
   branches/gsoc_threads/src/interp/inter_create.c   (props changed)
   branches/gsoc_threads/src/packfile.c
   branches/gsoc_threads/src/pmc/fixedintegerarray.pmc
   branches/gsoc_threads/src/pmc/sub.pmc
   branches/gsoc_threads/src/runcore/cores.c   (props changed)
   branches/gsoc_threads/src/runcore/trace.c   (props changed)
   branches/gsoc_threads/t/pmc/filehandle.t
   branches/gsoc_threads/t/src/embed.t   (props changed)
   branches/gsoc_threads/tools/dev/mk_gitignore.pl   (props changed)

Modified: branches/gsoc_threads/include/parrot/extend.h
==============================================================================
--- branches/gsoc_threads/include/parrot/extend.h	Thu Jul  1 22:20:44 2010	(r47951)
+++ branches/gsoc_threads/include/parrot/extend.h	Thu Jul  1 22:23:10 2010	(r47952)
@@ -73,8 +73,10 @@
         __attribute__nonnull__(3);
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 PARROT_WARN_UNUSED_RESULT
-Parrot_Language Parrot_find_language(SHIM_INTERP, SHIM(char *language));
+Parrot_Language Parrot_find_language(SHIM_INTERP,
+    SHIM(const char *language));
 
 PARROT_EXPORT
 int Parrot_fprintf(PARROT_INTERP,
@@ -89,22 +91,27 @@
 void Parrot_free_cstring(ARGFREE(char *string));
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_Int Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_Float Parrot_get_numreg(PARROT_INTERP, Parrot_Int regnum)
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_PMC Parrot_get_pmcreg(PARROT_INTERP, Parrot_Int regnum)
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_PMC Parrot_get_root_namespace(PARROT_INTERP)
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_String Parrot_get_strreg(PARROT_INTERP, Parrot_Int regnum)
         __attribute__nonnull__(1);
 
@@ -127,6 +134,7 @@
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_PMC Parrot_PMC_null(void);
 
 PARROT_EXPORT

Modified: branches/gsoc_threads/src/extend.c
==============================================================================
--- branches/gsoc_threads/src/extend.c	Thu Jul  1 22:20:44 2010	(r47951)
+++ branches/gsoc_threads/src/extend.c	Thu Jul  1 22:23:10 2010	(r47952)
@@ -180,6 +180,7 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_PMC
 Parrot_get_root_namespace(PARROT_INTERP)
 {
@@ -243,6 +244,7 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_PMC
 Parrot_PMC_null(void)
 {
@@ -337,6 +339,7 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_Int
 Parrot_get_intreg(PARROT_INTERP, Parrot_Int regnum)
 {
@@ -355,6 +358,7 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_Float
 Parrot_get_numreg(PARROT_INTERP, Parrot_Int regnum)
 {
@@ -373,6 +377,7 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_String
 Parrot_get_strreg(PARROT_INTERP, Parrot_Int regnum)
 {
@@ -391,6 +396,7 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 Parrot_PMC
 Parrot_get_pmcreg(PARROT_INTERP, Parrot_Int regnum)
 {
@@ -513,7 +519,8 @@
 
 /*
 
-=item C<Parrot_Language Parrot_find_language(PARROT_INTERP, char *language)>
+=item C<Parrot_Language Parrot_find_language(PARROT_INTERP, const char
+*language)>
 
 Find the magic language token for a language, by language name.
 
@@ -522,9 +529,10 @@
 */
 
 PARROT_EXPORT
+PARROT_PURE_FUNCTION
 PARROT_WARN_UNUSED_RESULT
 Parrot_Language
-Parrot_find_language(SHIM_INTERP, SHIM(char *language))
+Parrot_find_language(SHIM_INTERP, SHIM(const char *language))
 {
     ASSERT_ARGS(Parrot_find_language)
     return 0;

Modified: branches/gsoc_threads/src/packfile.c
==============================================================================
--- branches/gsoc_threads/src/packfile.c	Thu Jul  1 22:20:44 2010	(r47951)
+++ branches/gsoc_threads/src/packfile.c	Thu Jul  1 22:23:10 2010	(r47952)
@@ -3313,7 +3313,8 @@
 
 =item C<static size_t fixup_packed_size(PARROT_INTERP, PackFile_Segment *self)>
 
-I<What does this do?>
+Calculates the size, in multiples of C<opcode_t>, required to store the
+passed C<PackFile_FixupTable> in bytecode.
 
 =cut
 

Modified: branches/gsoc_threads/src/pmc/fixedintegerarray.pmc
==============================================================================
--- branches/gsoc_threads/src/pmc/fixedintegerarray.pmc	Thu Jul  1 22:20:44 2010	(r47951)
+++ branches/gsoc_threads/src/pmc/fixedintegerarray.pmc	Thu Jul  1 22:23:10 2010	(r47952)
@@ -23,13 +23,20 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static int auxcmpfunc(const INTVAL *i, const INTVAL *j);
-#define ASSERT_ARGS_auxcmpfunc __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+PARROT_PURE_FUNCTION
+static int auxcmpfunc(ARGIN(const INTVAL *i), ARGIN(const INTVAL *j))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+#define ASSERT_ARGS_auxcmpfunc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(i) \
+    , PARROT_ASSERT_ARG(j))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
+PARROT_PURE_FUNCTION
 static int
-auxcmpfunc(const INTVAL *i, const INTVAL *j)
+auxcmpfunc(ARGIN(const INTVAL *i), ARGIN(const INTVAL *j))
 {
     ASSERT_ARGS(auxcmpfunc)
     return *i - *j;
@@ -545,8 +552,8 @@
             return 0;
 
         for (j = 0; j < n; ++j) {
-            INTVAL item1 = SELF.get_integer_keyed_int(j);
-            INTVAL item2 = VTABLE_get_integer_keyed_int(INTERP, value, j);
+            const INTVAL item1 = SELF.get_integer_keyed_int(j);
+            const INTVAL item2 = VTABLE_get_integer_keyed_int(INTERP, value, j);
 
             if (item1 != item2)
                 return 0;

Modified: branches/gsoc_threads/src/pmc/sub.pmc
==============================================================================
--- branches/gsoc_threads/src/pmc/sub.pmc	Thu Jul  1 22:20:44 2010	(r47951)
+++ branches/gsoc_threads/src/pmc/sub.pmc	Thu Jul  1 22:23:10 2010	(r47952)
@@ -185,8 +185,19 @@
 
         /* comp_flags is actually UINTVAL */
         field = CONST_STRING(INTERP, "comp_flags");
-        if (VTABLE_exists_keyed_str(INTERP, init, field))
-            attrs->comp_flags = (UINTVAL)VTABLE_get_integer_keyed_str(INTERP, init, field);
+        if (VTABLE_exists_keyed_str(INTERP, init, field)) {
+            UINTVAL flags = (UINTVAL)VTABLE_get_integer_keyed_str(INTERP, init, field);
+            /* Mask comp flags only */
+            attrs->comp_flags = flags & SUB_COMP_FLAG_MASK;
+        }
+
+        /* In order to create Sub dynamicaly we have to set PObj flags */
+        field = CONST_STRING(INTERP, "pf_flags");
+        if (VTABLE_exists_keyed_str(INTERP, init, field)) {
+            UINTVAL flags = (UINTVAL)VTABLE_get_integer_keyed_str(INTERP, init, field);
+            /* Mask Sub specific flags only */
+            PObj_get_FLAGS(SELF) |= flags & SUB_FLAG_PF_MASK;
+        }
 
         field = CONST_STRING(INTERP, "n_regs_used");
         if (VTABLE_exists_keyed_str(INTERP, init, field)) {
@@ -1125,6 +1136,31 @@
 
         RETURN(INTVAL arity);
     }
+
+/*
+=item C<INTVAL comp_flags()>
+
+=item C<INTVAL pf_flags()>
+
+(Experimental) Returns Sub flags.
+
+=cut
+*/
+    METHOD comp_flags() {
+        Parrot_Sub_attributes  *sub;
+        INTVAL                  flags;
+
+        PMC_get_sub(INTERP, SELF, sub);
+        flags = sub->comp_flags;
+        RETURN(INTVAL flags);
+    }
+
+    METHOD pf_flags() {
+        /* Only PF specific flags */
+        INTVAL  flags = PObj_get_FLAGS(SELF) & SUB_FLAG_PF_MASK;
+        RETURN(INTVAL flags);
+    }
+
 }
 
 

Modified: branches/gsoc_threads/t/pmc/filehandle.t
==============================================================================
--- branches/gsoc_threads/t/pmc/filehandle.t	Thu Jul  1 22:20:44 2010	(r47951)
+++ branches/gsoc_threads/t/pmc/filehandle.t	Thu Jul  1 22:23:10 2010	(r47952)
@@ -7,7 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 
 use Test::More;
-use Parrot::Test tests => 22;
+use Parrot::Test tests => 23;
 use Parrot::Test::Util 'create_tempfile';
 use Parrot::Test::Util 'create_tempfile';
 
@@ -635,6 +635,39 @@
 ok
 OUTPUT
 
+pir_output_is( <<'CODE', <<'OUTPUT', "readall - failure conditions" );
+.include 'except_types.pasm'
+.sub main :main
+    .local pmc fh, eh
+    fh = new ['FileHandle']
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_PIO_ERROR)
+    set_addr eh, catch1
+    push_eh eh
+    # Using unopened FileHandle
+    fh.'readall'()
+    say 'should never happen'
+    goto test2
+  catch1:
+    finalize eh
+    say 'caught unopened'
+  test2:
+    set_addr eh, catch2
+    fh.'open'('README')
+    # Using opened FileHandle with the filepath option
+    fh.'readall'('README')
+    say 'should never happen'
+    goto end
+  catch2:
+    finalize eh
+    say 'caught reopen'
+  end:
+.end
+CODE
+caught unopened
+caught reopen
+OUTPUT
+
 pir_output_is( <<"CODE", <<"OUTPUT", "readall() - utf8 on closed filehandle" );
 .sub 'main'
     .local pmc ifh


More information about the parrot-commits mailing list