[svn:parrot] r49105 - in branches/gc_massacre/t: dynoplibs op pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Sep 17 23:47:24 UTC 2010


Author: bacek
Date: Fri Sep 17 23:47:24 2010
New Revision: 49105
URL: https://trac.parrot.org/parrot/changeset/49105

Log:
eliminate use of sysinfo in coretest. fixes corevm/coretest.
int min/max are now constructed explicitly assuming 2's compliment (already assumed in some tests)
sanity of .SYSINFO_PARROT_INT{MIN,MAX} now offloaded to dynops tests

Modified:
   branches/gc_massacre/t/dynoplibs/sysinfo.t
   branches/gc_massacre/t/op/integer.t
   branches/gc_massacre/t/pmc/bigint.t

Modified: branches/gc_massacre/t/dynoplibs/sysinfo.t
==============================================================================
--- branches/gc_massacre/t/dynoplibs/sysinfo.t	Fri Sep 17 23:47:06 2010	(r49104)
+++ branches/gc_massacre/t/dynoplibs/sysinfo.t	Fri Sep 17 23:47:24 2010	(r49105)
@@ -11,7 +11,7 @@
 use Test::More;
 use Config;
 
-use Parrot::Test tests => 14;
+use Parrot::Test tests => 15;
 use Parrot::Config;
 
 
@@ -183,6 +183,21 @@
 CODE
 }
 
+pir_output_is(<<'CODE', <<OUTPUT, 'INTVAL min and max coherence');
+# assumes 2's compliment integer math
+.sub 'main' :main
+    .include 'test_more.pir'
+    .local int min, max
+    max = sysinfo .SYSINFO_PARROT_INTMAX
+    neg max
+    min = sysinfo .SYSINFO_PARROT_INTMIN
+    inc min
+    is(max, min)
+.end
+CODE
+ok 1
+OUTPUT
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gc_massacre/t/op/integer.t
==============================================================================
--- branches/gc_massacre/t/op/integer.t	Fri Sep 17 23:47:06 2010	(r49104)
+++ branches/gc_massacre/t/op/integer.t	Fri Sep 17 23:47:24 2010	(r49105)
@@ -750,15 +750,29 @@
 # minimum integer + 1. This should be true because we are assuming a
 # two's-complement machine.
 
-.loadlib 'sys_ops'
-.include 'sysinfo.pasm'
-
+.include 'iglobals.pasm'
 .sub test_negate_max_integer
-    .local int max
-    .local int min
-    max = sysinfo .SYSINFO_PARROT_INTMAX
+    .local int max, min
+
+    $P0 = getinterp
+    $P1 = $P0[.IGLOBALS_CONFIG_HASH]
+    $I0 = $P1['intvalsize']
+
+    # XXX can't use sysinfo (from sys_ops) in coretest
+    # build up 2's compliment min and max integers manually
+    max = 0x7F
+    min = 0x80
+    dec $I0
+  loop:
+    unless $I0 goto end_loop
+    min <<= 8
+    max <<= 8
+    max  |= 0xFF
+    dec $I0
+    goto loop
+  end_loop:
+
     neg max
-    min = sysinfo .SYSINFO_PARROT_INTMIN
     inc min
     is(max, min)
 .end

Modified: branches/gc_massacre/t/pmc/bigint.t
==============================================================================
--- branches/gc_massacre/t/pmc/bigint.t	Fri Sep 17 23:47:06 2010	(r49104)
+++ branches/gc_massacre/t/pmc/bigint.t	Fri Sep 17 23:47:24 2010	(r49105)
@@ -506,16 +506,36 @@
     ok($I1, 'negation')
 .end
 
-.loadlib 'sys_ops'
-.include 'sysinfo.pasm'
+.sub 'get_int_minmax'
+    .local int min, max
+
+    $P0 = getinterp
+    $P1 = $P0[.IGLOBALS_CONFIG_HASH]
+    $I0 = $P1['intvalsize']
+
+    # XXX can't use sysinfo (from sys_ops) in coretest
+    # build up 2's compliment min and max integers manually
+    max = 0x7F
+    min = 0x80
+    dec $I0
+  loop:
+    unless $I0 goto end_loop
+    min <<= 8
+    max <<= 8
+    max  |= 0xFF
+    dec $I0
+    goto loop
+  end_loop:
+
+    .return (min, max)
+.end
 
 .sub negate_min_integer
     .local int max
     .local int min
     .local pmc max_1
     .local pmc neg_min
-    max = sysinfo .SYSINFO_PARROT_INTMAX
-    min = sysinfo .SYSINFO_PARROT_INTMIN
+    (min, max) = 'get_int_minmax'()
     max_1 = box max
     inc max_1
     neg_min = box min
@@ -547,8 +567,7 @@
     .local pmc max_1
     .local pmc neg_min
     .local pmc result
-    max = sysinfo .SYSINFO_PARROT_INTMAX
-    min = sysinfo .SYSINFO_PARROT_INTMIN
+    (min, max) = 'get_int_minmax'()
     max_1 = box max
     inc max_1
     neg_min = box min


More information about the parrot-commits mailing list