[svn:parrot] r43921 - in trunk: . compilers/data_json compilers/imcc compilers/json compilers/nqp compilers/pct compilers/pge compilers/tge config/auto/sizes docs docs/book/draft docs/book/pct docs/dev docs/pdds examples/embed examples/languages/abc examples/languages/squaak examples/pge ext/nqp-rx include/parrot lib/Parrot lib/Parrot/Configure/Step ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math runtime/parrot/library/Math/Random src src/call src/gc src/interp src/ops src/pmc src/runcore t/compilers/tge t/library t/oo t/op t/pmc t/src t/steps/init/hints tools/build tools/dev tools/util
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat Feb 13 02:10:42 UTC 2010
Author: whiteknight
Date: Sat Feb 13 02:10:36 2010
New Revision: 43921
URL: https://trac.parrot.org/parrot/changeset/43921
Log:
merge vtable_massacre branch
Deleted:
trunk/t/op/bitwise.t
Modified:
trunk/ (props changed)
trunk/DEPRECATED.pod
trunk/MANIFEST
trunk/compilers/data_json/Rules.mak (props changed)
trunk/compilers/imcc/Rules.mak (props changed)
trunk/compilers/json/Rules.mak (props changed)
trunk/compilers/nqp/Rules.mak (props changed)
trunk/compilers/pct/Rules.mak (props changed)
trunk/compilers/pge/Rules.mak (props changed)
trunk/compilers/tge/Rules.mak (props changed)
trunk/config/auto/sizes/intval_maxmin_c.in (props changed)
trunk/docs/book/draft/README (props changed)
trunk/docs/book/draft/appa_glossary.pod (props changed)
trunk/docs/book/draft/appb_patch_submission.pod (props changed)
trunk/docs/book/draft/appc_command_line_options.pod (props changed)
trunk/docs/book/draft/appd_build_options.pod (props changed)
trunk/docs/book/draft/appe_source_code.pod (props changed)
trunk/docs/book/draft/ch01_introduction.pod (props changed)
trunk/docs/book/draft/ch02_getting_started.pod (props changed)
trunk/docs/book/draft/ch07_dynpmcs.pod (props changed)
trunk/docs/book/draft/ch08_dynops.pod (props changed)
trunk/docs/book/draft/ch10_opcode_reference.pod (props changed)
trunk/docs/book/draft/ch11_directive_reference.pod (props changed)
trunk/docs/book/draft/ch12_operator_reference.pod (props changed)
trunk/docs/book/draft/chXX_hlls.pod (props changed)
trunk/docs/book/draft/chXX_library.pod (props changed)
trunk/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
trunk/docs/book/pct/ch01_introduction.pod (props changed)
trunk/docs/book/pct/ch02_getting_started.pod (props changed)
trunk/docs/book/pct/ch03_compiler_tools.pod (props changed)
trunk/docs/book/pct/ch04_pge.pod (props changed)
trunk/docs/book/pct/ch05_nqp.pod (props changed)
trunk/docs/dev/c_functions.pod (props changed)
trunk/docs/embed.pod
trunk/docs/pdds/pdd17_pmc.pod
trunk/docs/pdds/pdd28_strings.pod
trunk/docs/pdds/pdd30_install.pod (props changed)
trunk/examples/embed/cotorra.c (props changed)
trunk/examples/languages/abc/ (props changed)
trunk/examples/languages/squaak/ (props changed)
trunk/examples/pge/demo.pir (props changed)
trunk/ext/nqp-rx/Rules.mak (props changed)
trunk/include/parrot/call.h (props changed)
trunk/include/parrot/gc_api.h (props changed)
trunk/include/parrot/runcore_api.h (props changed)
trunk/include/parrot/runcore_profiling.h (props changed)
trunk/include/parrot/runcore_trace.h (props changed)
trunk/lib/Parrot/Configure/Step/Test.pm (props changed)
trunk/lib/Parrot/H2inc.pm (props changed)
trunk/ports/cpan/pause_guide.pod (props changed)
trunk/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
trunk/ports/debian/libparrot-dev.install.in (props changed)
trunk/ports/debian/libparrot.install.in (props changed)
trunk/ports/debian/parrot-doc.install.in (props changed)
trunk/ports/debian/parrot.install.in (props changed)
trunk/ports/fedora/parrot.spec.fedora (props changed)
trunk/ports/mandriva/parrot.spec.mandriva (props changed)
trunk/ports/suse/parrot.spec.suse (props changed)
trunk/runtime/parrot/languages/ (props changed)
trunk/runtime/parrot/library/Math/Rand.pir (props changed)
trunk/runtime/parrot/library/Math/Random/mt19937ar.pir (props changed)
trunk/runtime/parrot/library/Rules.mak (props changed)
trunk/src/call/ops.c (props changed)
trunk/src/call/pcc.c (props changed)
trunk/src/gc/alloc_memory.c (props changed)
trunk/src/gc/alloc_resources.c (props changed)
trunk/src/gc/api.c (props changed)
trunk/src/gc/malloc.c (props changed)
trunk/src/gc/malloc_trace.c (props changed)
trunk/src/gc/mark_sweep.c (props changed)
trunk/src/gc/system.c (props changed)
trunk/src/interp/inter_cb.c (props changed)
trunk/src/interp/inter_create.c (props changed)
trunk/src/interp/inter_misc.c (props changed)
trunk/src/ops/bit.ops
trunk/src/ops/math.ops
trunk/src/pmc/bigint.pmc
trunk/src/pmc/bignum.pmc
trunk/src/pmc/complex.pmc
trunk/src/pmc/default.pmc
trunk/src/pmc/integer.pmc
trunk/src/pmc/scalar.pmc
trunk/src/pmc/string.pmc
trunk/src/runcore/cores.c (props changed)
trunk/src/runcore/main.c (props changed)
trunk/src/runcore/profiling.c (props changed)
trunk/src/runcore/trace.c (props changed)
trunk/src/vtable.tbl
trunk/t/compilers/tge/NoneGrammar.tg (props changed)
trunk/t/library/mt19937ar.t (props changed)
trunk/t/library/mt19937ar.txt (props changed)
trunk/t/oo/root_new.t (props changed)
trunk/t/op/arithmetics_pmc.t
trunk/t/op/trans.t
trunk/t/pmc/bigint.t
trunk/t/pmc/complex.t
trunk/t/pmc/multidispatch.t
trunk/t/pmc/namespace-old.t (props changed)
trunk/t/pmc/string.t
trunk/t/src/embed.t (props changed)
trunk/t/steps/init/hints/linux-01.t (props changed)
trunk/tools/build/cc_flags.pl (props changed)
trunk/tools/build/h2inc.pl (props changed)
trunk/tools/dev/fetch_languages.pl (props changed)
trunk/tools/dev/mk_gitignore.pl (props changed)
trunk/tools/dev/vtablize.pl
trunk/tools/util/perlcritic-cage.conf (props changed)
Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/DEPRECATED.pod Sat Feb 13 02:10:36 2010 (r43921)
@@ -52,13 +52,6 @@
L<https://trac.parrot.org/parrot/ticket/264>
-=item various VTABLE functions [eligible in 1.5]
-
-The get_bigint, set_bigint_*, pow, i_pow and nextkey_keyed VTABLE functions are
-deprecated and will be removed.
-
-L<https://trac.parrot.org/parrot/ticket/866>
-
=item Use of undocumented variables in class_init [eligible in 2.1]
The current implementation allows the class_init vtable function body to
@@ -77,14 +70,6 @@
L<https://trac.parrot.org/parrot/ticket/103>
-=item All bitwise VTABLE functions [eligible in 2.1]
-
-All bitwise VTABLE functions (all VTABLE functions containing C<bitwise> in
-their names) will be removed. Equivalent functionality will by supplied by
-bitwise dynops.
-
-L<https://trac.parrot.org/parrot/ticket/1260>
-
=item CPointer PMC [eligible in 2.1]
And all uses in the Parrot calling conventions.
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/MANIFEST Sat Feb 13 02:10:36 2010 (r43921)
@@ -1801,7 +1801,6 @@
t/op/arithmetics.t [test]
t/op/arithmetics_pmc.t [test]
t/op/basic.t [test]
-t/op/bitwise.t [test]
t/op/box.t [test]
t/op/calling.t [test]
t/op/cc_params.t [test]
Modified: trunk/docs/embed.pod
==============================================================================
--- trunk/docs/embed.pod Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/docs/embed.pod Sat Feb 13 02:10:36 2010 (r43921)
@@ -1053,46 +1053,6 @@
=item C<Parrot_PMC_assign_string_native>
-=item C<Parrot_PMC_bitwise_and>
-
-=item C<Parrot_PMC_bitwise_and_int>
-
-=item C<Parrot_PMC_bitwise_ands>
-
-=item C<Parrot_PMC_bitwise_ands_str>
-
-=item C<Parrot_PMC_bitwise_lsr>
-
-=item C<Parrot_PMC_bitwise_lsr_int>
-
-=item C<Parrot_PMC_bitwise_not>
-
-=item C<Parrot_PMC_bitwise_nots>
-
-=item C<Parrot_PMC_bitwise_or>
-
-=item C<Parrot_PMC_bitwise_or_int>
-
-=item C<Parrot_PMC_bitwise_ors>
-
-=item C<Parrot_PMC_bitwise_ors_str>
-
-=item C<Parrot_PMC_bitwise_shl>
-
-=item C<Parrot_PMC_bitwise_shl_int>
-
-=item C<Parrot_PMC_bitwise_shr>
-
-=item C<Parrot_PMC_bitwise_shr_int>
-
-=item C<Parrot_PMC_bitwise_xor>
-
-=item C<Parrot_PMC_bitwise_xor_int>
-
-=item C<Parrot_PMC_bitwise_xors>
-
-=item C<Parrot_PMC_bitwise_xors_str>
-
=item C<Parrot_PMC_can>
=item C<Parrot_PMC_clone>
@@ -1163,8 +1123,6 @@
=item C<Parrot_PMC_get_attr_str>
-=item C<Parrot_PMC_get_bignum>
-
=item C<Parrot_PMC_get_bool>
=item C<Parrot_PMC_get_class>
@@ -1253,46 +1211,6 @@
=item C<Parrot_PMC_i_add_int>
-=item C<Parrot_PMC_i_bitwise_and>
-
-=item C<Parrot_PMC_i_bitwise_and_int>
-
-=item C<Parrot_PMC_i_bitwise_ands>
-
-=item C<Parrot_PMC_i_bitwise_ands_str>
-
-=item C<Parrot_PMC_i_bitwise_lsr>
-
-=item C<Parrot_PMC_i_bitwise_lsr_int>
-
-=item C<Parrot_PMC_i_bitwise_not>
-
-=item C<Parrot_PMC_i_bitwise_nots>
-
-=item C<Parrot_PMC_i_bitwise_or>
-
-=item C<Parrot_PMC_i_bitwise_or_int>
-
-=item C<Parrot_PMC_i_bitwise_ors>
-
-=item C<Parrot_PMC_i_bitwise_ors_str>
-
-=item C<Parrot_PMC_i_bitwise_shl>
-
-=item C<Parrot_PMC_i_bitwise_shl_int>
-
-=item C<Parrot_PMC_i_bitwise_shr>
-
-=item C<Parrot_PMC_i_bitwise_shr_int>
-
-=item C<Parrot_PMC_i_bitwise_xor>
-
-=item C<Parrot_PMC_i_bitwise_xor_int>
-
-=item C<Parrot_PMC_i_bitwise_xors>
-
-=item C<Parrot_PMC_i_bitwise_xors_str>
-
=item C<Parrot_PMC_i_concatenate>
=item C<Parrot_PMC_i_concatenate_str>
@@ -1661,14 +1579,6 @@
=item C<Parrot_str_append>
-=item C<Parrot_str_bitwise_and>
-
-=item C<Parrot_str_bitwise_not>
-
-=item C<Parrot_str_bitwise_or>
-
-=item C<Parrot_str_bitwise_xor>
-
=item C<Parrot_str_boolean>
=item C<Parrot_str_byte_length>
Modified: trunk/docs/pdds/pdd17_pmc.pod
==============================================================================
--- trunk/docs/pdds/pdd17_pmc.pod Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/docs/pdds/pdd17_pmc.pod Sat Feb 13 02:10:36 2010 (r43921)
@@ -628,12 +628,6 @@
Return the native floating-point value of the PMC.
-=item get_bignum
-
- PMC* get_bignum(INTERP, PMC *self)
-
-Return the extended precision numeric value of the PMC as a new bignum PMC.
-
=item get_string
STRING* get_string(INTERP, PMC *self)
Modified: trunk/docs/pdds/pdd28_strings.pod
==============================================================================
--- trunk/docs/pdds/pdd28_strings.pod Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/docs/pdds/pdd28_strings.pod Sat Feb 13 02:10:36 2010 (r43921)
@@ -666,10 +666,6 @@
Return the floating-point representation of the string.
-=item get_bignum
-
-Return the big number representation of the string.
-
=item get_string
Return the string value of the String PMC.
Modified: trunk/src/ops/bit.ops
==============================================================================
--- trunk/src/ops/bit.ops Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/ops/bit.ops Sat Feb 13 02:10:36 2010 (r43921)
@@ -63,11 +63,15 @@
}
inline op band(invar PMC, in INT) :base_core {
- VTABLE_i_bitwise_and_int(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = a & $2;
+ VTABLE_set_integer_native(interp, $1, b);
}
inline op band(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_and(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = VTABLE_get_integer(interp, $2);
+ VTABLE_set_integer_native(interp, $1, a & b);
}
inline op band(out INT, in INT, in INT) :base_core {
@@ -75,11 +79,14 @@
}
inline op band(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_bitwise_and_int(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ VTABLE_set_integer_native(interp, $1, a & $3);
}
inline op band(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_and(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ const INTVAL b = VTABLE_get_integer(interp, $3);
+ VTABLE_set_integer_native(interp, $1, a & b);
}
=item B<bands>(inout STR, in STR)
@@ -107,11 +114,16 @@
}
inline op bands(invar PMC, in STR) :base_core {
- VTABLE_i_bitwise_ands_str(interp, $1, $2);
+ STRING * const a = VTABLE_get_string(interp, $1);
+ STRING * const b = Parrot_str_bitwise_and(interp, a, $2, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
inline op bands(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_ands(interp, $1, $2);
+ STRING * a = VTABLE_get_string(interp, $1);
+ STRING * b = VTABLE_get_string(interp, $2);
+ a = Parrot_str_bitwise_and(interp, a, b, NULL);
+ VTABLE_set_string_native(interp, $1, a);
}
inline op bands(out STR, in STR, in STR) :base_core {
@@ -119,11 +131,16 @@
}
inline op bands(invar PMC, invar PMC, in STR) :base_core {
- $1 = VTABLE_bitwise_ands_str(interp, $2, $3, $1);
+ STRING * const a = VTABLE_get_string(interp, $2);
+ STRING * const b = Parrot_str_bitwise_and(interp, a, $3, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
inline op bands(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_ands(interp, $2, $3, $1);
+ STRING * const a = VTABLE_get_string(interp, $2);
+ STRING * const b = VTABLE_get_string(interp, $3);
+ STRING * const c = Parrot_str_bitwise_and(interp, a, b, NULL);
+ VTABLE_set_string_native(interp, $1, c);
}
########################################
@@ -149,11 +166,13 @@
}
inline op bnot(invar PMC) :base_core {
- VTABLE_i_bitwise_not(interp, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ VTABLE_set_integer_native(interp, $1, ~a);
}
inline op bnot(out PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_not(interp, $2, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ VTABLE_set_integer_native(interp, $1, ~a);
}
=item B<bnots>(inout STR)
@@ -175,11 +194,15 @@
}
inline op bnots(invar PMC) :base_core {
- VTABLE_i_bitwise_nots(interp, $1);
+ STRING * a = VTABLE_get_string(interp, $1);
+ STRING * b = Parrot_str_bitwise_not(interp, a, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
inline op bnots(out PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_nots(interp, $2, $1);
+ STRING * a = VTABLE_get_string(interp, $2);
+ STRING * b = Parrot_str_bitwise_not(interp, a, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
########################################
@@ -209,11 +232,14 @@
}
inline op bor(invar PMC, in INT) :base_core {
- VTABLE_i_bitwise_or_int(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ VTABLE_set_integer_native(interp, $1, a | $2);
}
inline op bor(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_or(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = VTABLE_get_integer(interp, $2);
+ VTABLE_set_integer_native(interp, $1, a | b);
}
inline op bor(out INT, in INT, in INT) :base_core {
@@ -221,11 +247,14 @@
}
inline op bor(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_bitwise_or_int(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ VTABLE_set_integer_native(interp, $1, a | $3);
}
inline op bor(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_or(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ const INTVAL b = VTABLE_get_integer(interp, $3);
+ VTABLE_set_integer_native(interp, $1, a | b);
}
=item B<bors>(inout STR, in STR)
@@ -253,11 +282,16 @@
}
inline op bors(invar PMC, in STR) :base_core {
- VTABLE_i_bitwise_ors_str(interp, $1, $2);
+ STRING * const a = VTABLE_get_string(interp, $1);
+ STRING * const b = Parrot_str_bitwise_or(interp, a, $2, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
inline op bors(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_ors(interp, $1, $2);
+ STRING * const a = VTABLE_get_string(interp, $1);
+ STRING * const b = VTABLE_get_string(interp, $2);
+ STRING * const c = Parrot_str_bitwise_or(interp, a, b, NULL);
+ VTABLE_set_string_native(interp, $1, c);
}
inline op bors(out STR, in STR, in STR) :base_core {
@@ -265,11 +299,16 @@
}
inline op bors(invar PMC, invar PMC, in STR) :base_core {
- $1 = VTABLE_bitwise_ors_str(interp, $2, $3, $1);
+ STRING * const b = VTABLE_get_string(interp, $2);
+ STRING * const c = Parrot_str_bitwise_or(interp, b, $3, NULL);
+ VTABLE_set_string_native(interp, $1, c);
}
inline op bors(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_ors(interp, $2, $3, $1);
+ STRING * const a = VTABLE_get_string(interp, $2);
+ STRING * const b = VTABLE_get_string(interp, $3);
+ STRING * const c = Parrot_str_bitwise_or(interp, a, b, NULL);
+ VTABLE_set_string_native(interp, $1, c);
}
########################################
@@ -297,11 +336,16 @@
}
inline op shl(invar PMC, in INT) :base_core {
- VTABLE_i_bitwise_shl_int(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = bit_shift_left(a, $2);
+ VTABLE_set_integer_native(interp, $1, b);
}
inline op shl(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_shl(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = VTABLE_get_integer(interp, $2);
+ const INTVAL c = bit_shift_left(a, b);
+ VTABLE_set_integer_native(interp, $1, c);
}
inline op shl(out INT, in INT, in INT) :base_core {
@@ -309,11 +353,16 @@
}
inline op shl(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_bitwise_shl_int(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ const INTVAL b = bit_shift_left(a, $3);
+ VTABLE_set_integer_native(interp, $1, b);
}
inline op shl(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_shl(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ const INTVAL b = VTABLE_get_integer(interp, $3);
+ const INTVAL c = bit_shift_left(a, b);
+ VTABLE_set_integer_native(interp, $1, c);
}
########################################
@@ -342,11 +391,16 @@
}
inline op shr(invar PMC, in INT) :base_core {
- VTABLE_i_bitwise_shr_int(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = bit_shift_left(a, -$2);
+ VTABLE_set_integer_native(interp, $1, b);
}
inline op shr(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_shr(interp, $1, $2);
+ const INTVAL a = VTABLE_get_integer(interp, $1);
+ const INTVAL b = VTABLE_get_integer(interp, $2);
+ const INTVAL c = bit_shift_left(a, -b);
+ VTABLE_set_integer_native(interp, $1, c);
}
inline op shr(out INT, in INT, in INT) :base_core {
@@ -355,11 +409,16 @@
}
inline op shr(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_bitwise_shr_int(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ const INTVAL c = bit_shift_left(a, -$3);
+ VTABLE_set_integer_native(interp, $1, c);
}
inline op shr(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_shr(interp, $2, $3, $1);
+ const INTVAL a = VTABLE_get_integer(interp, $2);
+ const INTVAL b = VTABLE_get_integer(interp, $3);
+ const INTVAL c = bit_shift_left(a, -b);
+ VTABLE_set_integer_native(interp, $1, c);
}
########################################
@@ -383,19 +442,22 @@
=cut
inline op lsr(out INT, in INT) :base_core {
- /*
- * lvalue casts are evil, but this one isn't evil enough to kill.
- * it's just casting a signed integral to the equivalent unsigned.
- */
- LVALUE_CAST(UINTVAL, $1) >>= $2;
+ const UINTVAL a = (UINTVAL)$1;
+ const UINTVAL b = a >> $2;
+ $1 = (INTVAL)b;
}
inline op lsr(invar PMC, in INT) :base_core {
- VTABLE_i_bitwise_lsr_int(interp, $1, $2);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $1);
+ const UINTVAL b = a >> $2;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)b);
}
inline op lsr(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_lsr(interp, $1, $2);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $1);
+ const UINTVAL b = (UINTVAL)VTABLE_get_integer(interp, $2);
+ const UINTVAL c = a >> b;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)c);
}
inline op lsr(out INT, in INT, in INT) :base_core {
@@ -403,11 +465,17 @@
}
inline op lsr(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_bitwise_lsr_int(interp, $2, $3, $1);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $2);
+ const UINTVAL b = (UINTVAL)$3;
+ const UINTVAL c = a >> b;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)c);
}
inline op lsr(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_lsr(interp, $2, $3, $1);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $2);
+ const UINTVAL b = (UINTVAL)VTABLE_get_integer(interp, $3);
+ const UINTVAL c = a >> b;
+ VTABLE_set_integer_native(interp, $3, (INTVAL)c);
}
=item B<rot>(out INT, in INT, in INT, inconst INT)
@@ -433,9 +501,6 @@
$1 = d;
}
-
-}
-
########################################
=item B<bxor>(inout INT, in INT)
@@ -463,11 +528,16 @@
}
inline op bxor(invar PMC, in INT) :base_core {
- VTABLE_i_bitwise_xor_int(interp, $1, $2);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $1);
+ const UINTVAL b = a ^ $2;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)b);
}
inline op bxor(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_xor(interp, $1, $2);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $1);
+ const UINTVAL b = (UINTVAL)VTABLE_get_integer(interp, $2);
+ const UINTVAL c = a ^ b;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)c);
}
inline op bxor(out INT, in INT, in INT) :base_core {
@@ -475,11 +545,16 @@
}
inline op bxor(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_bitwise_xor_int(interp, $2, $3, $1);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $2);
+ const UINTVAL b = a ^ $3;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)b);
}
inline op bxor(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_xor(interp, $2, $3, $1);
+ const UINTVAL a = (UINTVAL)VTABLE_get_integer(interp, $2);
+ const UINTVAL b = (UINTVAL)VTABLE_get_integer(interp, $3);
+ const UINTVAL c = a ^ b;
+ VTABLE_set_integer_native(interp, $1, (INTVAL)c);
}
=item B<bxors>(inout STR, in STR)
@@ -507,11 +582,16 @@
}
inline op bxors(invar PMC, in STR) :base_core {
- VTABLE_i_bitwise_xors_str(interp, $1, $2);
+ STRING *a = VTABLE_get_string(interp, $1);
+ STRING *b = Parrot_str_bitwise_xor(interp, a, $2, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
inline op bxors(invar PMC, invar PMC) :base_core {
- VTABLE_i_bitwise_xors(interp, $1, $2);
+ STRING *a = VTABLE_get_string(interp, $1);
+ STRING *b = VTABLE_get_string(interp, $2);
+ STRING *c = Parrot_str_bitwise_xor(interp, a, b, NULL);
+ VTABLE_set_string_native(interp, $1, c);
}
inline op bxors(out STR, in STR, in STR) :base_core {
@@ -519,11 +599,16 @@
}
inline op bxors(invar PMC, invar PMC, in STR) :base_core {
- $1 = VTABLE_bitwise_xors_str(interp, $2, $3, $1);
+ STRING *a = VTABLE_get_string(interp, $2);
+ STRING *b = Parrot_str_bitwise_xor(interp, a, $3, NULL);
+ VTABLE_set_string_native(interp, $1, b);
}
inline op bxors(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_bitwise_xors(interp, $2, $3, $1);
+ STRING *a = VTABLE_get_string(interp, $2);
+ STRING *b = VTABLE_get_string(interp, $3);
+ STRING *c = Parrot_str_bitwise_xor(interp, a, b, NULL);
+ VTABLE_set_string_native(interp, $1, c);
}
=back
Modified: trunk/src/ops/math.ops
==============================================================================
--- trunk/src/ops/math.ops Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/ops/math.ops Sat Feb 13 02:10:36 2010 (r43921)
@@ -812,15 +812,35 @@
}
inline op pow(invar PMC, invar PMC, invar PMC) :base_core {
- $1 = VTABLE_pow(interp, $2, $3, $1);
+ const FLOATVAL a = VTABLE_get_number(interp, $2);
+ const FLOATVAL b = VTABLE_get_number(interp, $3);
+ const FLOATVAL c = pow(a, b);
+ if (PMC_IS_NULL($1))
+ $1 = pmc_new(interp, enum_class_Float);
+ else
+ $1 = pmc_new(interp, $1->vtable->base_type);
+ VTABLE_set_number_native(interp, $1, c);
}
inline op pow(invar PMC, invar PMC, in INT) :base_core {
- $1 = VTABLE_pow_int(interp, $2, $3, $1);
+ const FLOATVAL a = VTABLE_get_number(interp, $2);
+ const FLOATVAL b = (FLOATVAL)$3;
+ const FLOATVAL c = pow(a, b);
+ if (PMC_IS_NULL($1))
+ $1 = pmc_new(interp, enum_class_Float);
+ else
+ $1 = pmc_new(interp, $1->vtable->base_type);
+ VTABLE_set_number_native(interp, $1, c);
}
inline op pow(invar PMC, invar PMC, in NUM) :base_core {
- $1 = VTABLE_pow_float(interp, $2, $3, $1);
+ const FLOATVAL a = VTABLE_get_number(interp, $2);
+ const FLOATVAL c = pow(a, $3);
+ if (PMC_IS_NULL($1))
+ $1 = pmc_new(interp, enum_class_Float);
+ else
+ $1 = pmc_new(interp, $1->vtable->base_type);
+ VTABLE_set_number_native(interp, $1, c);
}
inline op pow(out NUM, in NUM, in INT) :base_core {
Modified: trunk/src/pmc/bigint.pmc
==============================================================================
--- trunk/src/pmc/bigint.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/bigint.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2004-2009, Parrot Foundation.
+Copyright (C) 2004-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -323,36 +323,6 @@
mpz_neg(bi_dest->b, bi_self->b);
}
-static void
-bigint_bitwise_shl_bigint_int(PARROT_INTERP, PMC *self,
- INTVAL value, PMC *dest)
-{
- BIGINT *bi_self, *bi_dest;
- GETATTR_BigInt_bi(interp, self, bi_self);
- GETATTR_BigInt_bi(interp, dest, bi_dest);
- /* The third args to mpz_mul_2exp and mpz_tdiv_q_2exp are unsigned, so we
- need to do something sensible with negative values. */
- if (value >= 0)
- mpz_mul_2exp(bi_dest->b, bi_self->b, (unsigned long int)value);
- else
- mpz_tdiv_q_2exp(bi_dest->b, bi_self->b, (unsigned long int)-value);
-}
-
-static void
-bigint_bitwise_shr_bigint_int(PARROT_INTERP, PMC *self,
- INTVAL value, PMC *dest)
-{
- BIGINT *bi_self, *bi_dest;
- GETATTR_BigInt_bi(interp, self, bi_self);
- GETATTR_BigInt_bi(interp, dest, bi_dest);
- /* The third args to mpz_mul_2exp and mpz_tdiv_q_2exp are unsigned, so we
- need to do something sensible with negative values. */
- if (value >= 0)
- mpz_tdiv_q_2exp(bi_dest->b, bi_self->b, (unsigned long int)value);
- else
- mpz_mul_2exp(bi_dest->b, bi_self->b, (unsigned long int)-value);
-}
-
#else /* ifdef PARROT_HAS_GMP */
typedef struct BIGINT {
@@ -533,32 +503,6 @@
"no bigint lib loaded");
}
-static void
-bigint_bitwise_shl_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest) {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
- "no bigint lib loaded");
-}
-
-static void
-bigint_bitwise_shl_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
-{
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
- "no bigint lib loaded");
-}
-
-static void
-bigint_bitwise_shr_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest) {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
- "no bigint lib loaded");
-}
-
-static void
-bigint_bitwise_shr_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
-{
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
- "no bigint lib loaded");
-}
-
#endif /* ifdef PARROT_HAS_GMP */
pmclass BigInt auto_attrs {
@@ -701,20 +645,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Returns SELF
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- return SELF;
- }
-
-/*
-
=item C<INTVAL get_bool()>
Returns the boolean value of the integer.
@@ -957,20 +887,13 @@
"BigInt: no multiple dispatch variant 'i_multiply_float' for FLOATVAL");
}
- VTABLE PMC *pow_int(INTVAL value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_pow_bigint_int(INTERP, SELF, value, dest);
- return dest;
- }
-
- MULTI PMC *pow(PMC *value, PMC *dest) {
+ METHOD PMC *pow(PMC *value) {
/* XXX only Integer RHS currently */
const INTVAL r = VTABLE_get_integer(INTERP, value);
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
+ PMC *dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
bigint_pow_bigint_int(INTERP, SELF, r, dest);
- return dest;
+ RETURN(PMC *dest);
}
MULTI PMC *divide(BigInt value, PMC *dest) {
@@ -1188,151 +1111,6 @@
VTABLE void i_neg() {
bigint_neg(INTERP, SELF, SELF);
}
-
-/*
-
-=item C<PMC *bitwise_shl(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_shl_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the shift left of the BigInt by C<*value>.
-
-=item C<void i_bitwise_shl(PMC *value)>
-
-=item C<void i_bitwise_shl_int(INTVAL value)>
-
-Inplace shift left.
-
-=cut
-
-*/
-
- MULTI PMC *bitwise_shl(BigInt value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_bitwise_shl_bigint_int(INTERP, SELF,
- VTABLE_get_integer(INTERP, value),
- dest);
- return dest;
- }
-
- MULTI PMC *bitwise_shl(Integer value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_bitwise_shl_bigint_int(INTERP, SELF,
- VTABLE_get_integer(interp, value), dest);
- return dest;
- }
- MULTI PMC *bitwise_shl(DEFAULT value, PMC *dest) {
- UNUSED(dest)
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_INTERNAL_NOT_IMPLEMENTED,
- "BigInt: no multiple dispatch variant 'bitwise_shl' for %Ss",
- VTABLE_name(interp, value));
- }
-
- VTABLE PMC *bitwise_shl_int(INTVAL value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_bitwise_shl_bigint_int(INTERP, SELF, value, dest);
- return dest;
- }
-
-
- MULTI void i_bitwise_shl(BigInt value) {
- bigint_bitwise_shl_bigint_int(INTERP, SELF,
- VTABLE_get_integer(INTERP, value),
- SELF);
- }
-
- MULTI void i_bitwise_shl(Integer value) {
- bigint_bitwise_shl_bigint_int(INTERP, SELF,
- VTABLE_get_integer(interp, value), SELF);
- }
-
- MULTI void i_bitwise_shl(DEFAULT value) {
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_INTERNAL_NOT_IMPLEMENTED,
- "BigInt: no multiple dispatch variant 'i_bitwise_shl' for %Ss",
- VTABLE_name(interp, value));
- }
-
- VTABLE void i_bitwise_shl_int(INTVAL value) {
- bigint_bitwise_shl_bigint_int(INTERP, SELF, value, SELF);
- }
-
-/*
-
-=item C<PMC *bitwise_shr(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_shr_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the shift right of the BigInt by C<*value>.
-
-=item C<void i_bitwise_shr(PMC *value)>
-
-=item C<void i_bitwise_shr_int(INTVAL value)>
-
-Inplace shift left.
-
-=cut
-
-*/
-
- MULTI PMC *bitwise_shr(BigInt value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_bitwise_shr_bigint_int(INTERP, SELF,
- VTABLE_get_integer(INTERP, value),
- dest);
- return dest;
- }
-
- MULTI PMC *bitwise_shr(Integer value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_bitwise_shr_bigint_int(INTERP, SELF,
- VTABLE_get_integer(interp, value), dest);
- return dest;
- }
-
- MULTI PMC *bitwise_shr(DEFAULT value, PMC *dest) {
- UNUSED(dest)
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_INTERNAL_NOT_IMPLEMENTED,
- "BigInt: no multiple dispatch variant 'bitwise_shr' for %Ss",
- VTABLE_name(interp, value));
- }
-
- VTABLE PMC *bitwise_shr_int(INTVAL value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- bigint_bitwise_shr_bigint_int(INTERP, SELF, value, dest);
- return dest;
- }
-
-
- MULTI void i_bitwise_shr(BigInt value) {
- bigint_bitwise_shr_bigint_int(INTERP, SELF,
- VTABLE_get_integer(INTERP, value),
- SELF);
- }
-
- MULTI void i_bitwise_shr(Integer value) {
- bigint_bitwise_shr_bigint_int(INTERP, SELF,
- VTABLE_get_integer(interp, value), SELF);
- }
-
- MULTI void i_bitwise_shr(DEFAULT value) {
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_INTERNAL_NOT_IMPLEMENTED,
- "BigInt: no multiple dispatch variant 'i_bitwise_shr' for %Ss",
- VTABLE_name(interp, value));
- }
-
- VTABLE void i_bitwise_shr_int(INTVAL value) {
- bigint_bitwise_shr_bigint_int(INTERP, SELF, value, SELF);
- }
}
/*
Modified: trunk/src/pmc/bignum.pmc
==============================================================================
--- trunk/src/pmc/bignum.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/bignum.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2004-2009, Parrot Foundation.
+Copyright (C) 2004-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -929,20 +929,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Returns SELF, keeping floating point precision.
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- return SELF;
- }
-
-/*
-
=item C<FLOATVAL get_bigint()>
Trunc the BigNum to an BigInt.
@@ -1242,26 +1228,25 @@
/*
-=item C<void pow()>
+=item C<METHOD PMC *pow()>
-=cut
+Raises self to the power of value. Replacement method added when the pow()
+vtable was removed
-*/
+TODO: Needs testing.
+TODO: Only supports Integer values for now.
- VTABLE PMC *pow_int(INTVAL value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
+=cut
- bignum_pow_bignum_int(INTERP, SELF, value, dest);
- return dest;
- }
+*/
- MULTI PMC *pow(PMC *value, PMC *dest) {
+ METHOD PMC *pow(PMC *value) {
/* only Integer RHS currently. TODO: check number and bignum types */
INTVAL r = VTABLE_get_integer(INTERP, value);
- dest = pmc_new(INTERP, SELF->vtable->base_type);
+ PMC *dest = pmc_new(INTERP, SELF->vtable->base_type);
bignum_pow_bignum_int(INTERP, SELF, r, dest);
- return dest;
+ RETURN(PMC *dest);
}
/*
Modified: trunk/src/pmc/complex.pmc
==============================================================================
--- trunk/src/pmc/complex.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/complex.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -1775,9 +1775,12 @@
/*
-=item C<PMC *pow(PMC *value, PMC *dest)>
+=item C<METHOD PMC *pow(PMC *value)>
-Return SELF to the C<value>th power and return result in C<dest>.
+Raise SELF to the power of value. Replacement for the old pow() vtable, which
+was deleted.
+
+TODO: Requires testing
=item C<METHOD PMC *sqrt()>
@@ -1792,38 +1795,19 @@
*/
- MULTI PMC *pow(Complex value, PMC *dest) {
+ METHOD pow(PMC * value) {
PMC *l = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
PMC *log;
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
+ PMC *dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
Parrot_pcc_invoke_method_from_c_args(interp, SELF, CONST_STRING(interp, "ln"),
"->P", &log);
- l = Parrot_Complex_multi_multiply_Complex_PMC(INTERP,
- log, value, l);
+ l = VTABLE_multiply(INTERP, log, value, l);
Parrot_pcc_invoke_method_from_c_args(interp, l, CONST_STRING(interp, "exp"),
"->P", &dest);
-
- return dest;
- }
-
- MULTI PMC *pow(DEFAULT value, PMC *dest) {
- PMC *l = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
- PMC *log;
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- Parrot_pcc_invoke_method_from_c_args(interp, SELF, CONST_STRING(interp, "ln"),
- "->P", &log);
- l = Parrot_Complex_multi_multiply_DEFAULT_PMC(INTERP, log, value, l);
- Parrot_pcc_invoke_method_from_c_args(interp, l, CONST_STRING(interp, "exp"),
- "->P", &dest);
-
- return dest;
+ RETURN(PMC *dest);
}
METHOD sqrt() {
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/default.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -1692,678 +1692,6 @@
/*
-=item C<PMC *pow(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'pow'.
-
-=cut
-
-*/
-
- VTABLE PMC *pow(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "pow", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *pow_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'pow_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *pow_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "pow_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *pow_float(FLOATVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'pow_float'.
-
-=cut
-
-*/
-
- VTABLE PMC *pow_float(FLOATVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "pow_float", "PNP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_pow(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_pow'.
-
-=cut
-
-*/
-
- VTABLE void i_pow(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_pow", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_pow_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_pow_int'.
-
-=cut
-
-*/
-
- VTABLE void i_pow_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_pow_int", "PI", SELF, value);
- }
-
-/*
-
-=item C<void i_pow_float(FLOATVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_pow_float'.
-
-=cut
-
-*/
-
- VTABLE void i_pow_float(FLOATVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_pow_float", "PN", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_or(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_or'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_or(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_or", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_or_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_or_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_or_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_or_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_or(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_or'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_or(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_or", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_or_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_or_int'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_or_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_or_int", "PI", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_and(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_and'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_and(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_and", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_and_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_and_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_and_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_and_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_and(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_and'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_and(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_and", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_and_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_and_int'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_and_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_and_int", "PI", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_xor(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_xor'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_xor(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_xor", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_xor_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_xor_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_xor_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_xor_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_xor(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_xor'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_xor(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_xor", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_xor_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_xor_int'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_xor_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_xor_int", "PI", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_ors(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_ors'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_ors(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_ors", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_ors_str(STRING *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_ors_str'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_ors_str(STRING *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_ors_str", "PSP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_ors(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_ors'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_ors(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_ors", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_ors_str(STRING *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_ors_str'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_ors_str(STRING *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_ors_str", "PS", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_ands(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_ands'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_ands(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_ands", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_ands_str(STRING *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_ands_str'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_ands_str(STRING *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_ands_str", "PSP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_ands(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_ands'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_ands(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_ands", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_ands_str(STRING *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_ands_str'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_ands_str(STRING *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_ands_str", "PS", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_xors(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_xors'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_xors(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_xors", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_xors_str(STRING *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_xors_str'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_xors_str(STRING *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_xors_str", "PSP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_xors(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_xors'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_xors(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_xors", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_xors_str(STRING *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_xors_str'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_xors_str(STRING *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_xors_str", "PS", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_shl(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_shl'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_shl(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_shl", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_shl_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_shl_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_shl_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_shl_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_shl(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_shl'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_shl(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_shl", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_shl_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_shl_int'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_shl_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_shl_int", "PI", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_shr(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_shr'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_shr(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_shr", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_shr_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_shr_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_shr_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_shr_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_shr(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_shr'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_shr(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_shr", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_shr_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_shr_int'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_shr_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_shr_int", "PI", SELF, value);
- }
-
-/*
-
-=item C<PMC *bitwise_lsr(PMC *value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_lsr'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_lsr(PMC *value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_lsr", "PPP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<PMC *bitwise_lsr_int(INTVAL value, PMC *dest)>
-
-Default fallback. Performs a multiple dispatch call for 'bitwise_lsr_int'.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_lsr_int(INTVAL value, PMC *dest) {
- PMC *result = PMCNULL;
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "bitwise_lsr_int", "PIP->P", SELF, value, dest, &result);
- return result;
- }
-
-/*
-
-=item C<void i_bitwise_lsr(PMC *value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_lsr'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_lsr(PMC *value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_lsr", "PP", SELF, value);
- }
-
-/*
-
-=item C<void i_bitwise_lsr_int(INTVAL value)>
-
-Default fallback. Performs a multiple dispatch call for 'i_bitwise_lsr_int'.
-
-=cut
-
-*/
-
- VTABLE void i_bitwise_lsr_int(INTVAL value) {
- Parrot_mmd_multi_dispatch_from_c_args(interp,
- "i_bitwise_lsr_int", "PI", SELF, value);
- }
-
-/*
-
=item C<INTVAL cmp(PMC *value)>
Default fallback. Performs a multiple dispatch call for 'cmp'.
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/integer.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -179,24 +179,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Return a new BigInt PMC with the value of C<SELF>.
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- const INTVAL val = SELF.get_integer();
- PMC * const ret = pmc_new(INTERP, enum_class_BigInt);
- VTABLE_set_integer_native(INTERP, ret, val);
- return ret;
- }
-
-
-/*
-
=item C<STRING *get_string()>
=item C<STRING *get_repr()>
@@ -239,10 +221,6 @@
Morphs the integer to a C<Boolean> and sets the value from C<value>.
-=item C<void set_bigint_int(INTVAL value)>
-
-Morphs the integer to a C<BigInt> and sets the value from C<value>.
-
=item C<void set_string_native(STRING *value)>
Morphs the integer to a C<String> and sets the value from C<value>.
@@ -263,11 +241,6 @@
}
- VTABLE void set_bignum_int(INTVAL value) {
- pmc_reuse(INTERP, SELF, enum_class_BigInt, 0);
- SELF.set_integer_native(value);
- }
-
VTABLE void set_string_native(STRING *value) {
pmc_reuse(INTERP, SELF, enum_class_String, 0);
@@ -301,7 +274,8 @@
else {
PMC * temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_add(interp, temp, value, dest);
}
}
@@ -323,7 +297,8 @@
MULTI PMC *add(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_add(interp, temp, value, dest);
}
@@ -350,7 +325,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_add_int(interp, temp, b, dest);
}
}
@@ -399,8 +375,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
- VTABLE_i_add_int(interp, temp, b);
+ SELF = upgrade_self_to_bignum(interp, SELF);
+ VTABLE_i_add_int(interp, SELF, b);
}
}
@@ -439,7 +415,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_subtract(interp, temp, value, dest);
}
}
@@ -461,7 +438,8 @@
MULTI PMC *subtract(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_subtract(interp, temp, value, dest);
}
@@ -498,7 +476,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_subtract_int(interp, temp, b, dest);
}
}
@@ -597,7 +576,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_multiply(INTERP, temp, value, dest);
}
}
@@ -641,7 +621,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_multiply_int(INTERP, temp, b, dest);
}
}
@@ -727,7 +708,8 @@
MULTI PMC *divide(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_divide(INTERP, temp, value, dest);
}
@@ -787,7 +769,8 @@
MULTI PMC *floor_divide(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_floor_divide(INTERP, temp, value, dest);
}
@@ -909,7 +892,8 @@
MULTI PMC *modulus(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_modulus(INTERP, temp, value, dest);
}
@@ -993,97 +977,6 @@
intval_mod(SELF.get_integer() , (INTVAL)value));
}
-
-/*
-
-=item C<PMC *pow(PMC *value, PMC *dest)>
-
-=item C<PMC *pow_int(INTVAL value, PMC *dest)>
-
-Returns SELF to the C<value>th power in C<dest>.
-
-=item C<void i_pow(PMC *value)>
-
-=item C<void i_pow_int(INTVAL value)>
-
-Raises SELF to the C<value>th power.
-
-TODO: TT #1228: Implement Complex and BigInt RHS values for the pow() functions
-
-=cut
-
-*/
-
- MULTI PMC *pow(Integer value, PMC *dest) {
- const INTVAL v = VTABLE_get_integer(INTERP, value);
- return STATICSELF.pow_int(v, dest);
- }
-
-
- MULTI PMC *pow(DEFAULT value, PMC *dest) {
- PMC * const auxval = pmc_new(INTERP, VTABLE_type(INTERP, value));
- FLOATVAL selfval = SELF.get_integer();
- VTABLE_set_number_native(INTERP, auxval, selfval);
- return VTABLE_pow(INTERP, auxval, value, dest);
- }
-
-
- VTABLE PMC *pow_int(INTVAL b, PMC *dest) {
- const INTVAL a = SELF.get_integer();
- const INTVAL orig_b = b;
- INTVAL r = 1;
-
- if (b < 0)
- return SUPER(b, dest);
-
- if (a) {
- INTVAL temp = a;
- while (b > 0) {
- INTVAL prev = r;
- if (b & 1) {
- r *= temp;
- if (r / temp != prev) {
- PMC *temp;
- maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
- return VTABLE_pow_int(INTERP, temp, orig_b, dest);
- }
- }
-
- b >>= 1;
- if (!b)
- break;
-
- prev = temp;
- temp *= temp;
-
- if (prev != 0 && temp / prev != prev) {
- PMC *temp;
- maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
- return VTABLE_pow_int(INTERP, temp, orig_b, dest);
- }
- }
- }
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, r);
- return dest;
-
- }
-
-
- VTABLE void i_pow(PMC *value) {
- SELF.pow(value, SELF);
- }
-
-
- VTABLE void i_pow_int(INTVAL value) {
- STATICSELF.pow_int(value, SELF);
- }
-
-
/*
=item C<INTVAL is_equal(PMC *value)>
Modified: trunk/src/pmc/scalar.pmc
==============================================================================
--- trunk/src/pmc/scalar.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/scalar.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -20,68 +20,6 @@
#include "pmc/pmc_bigint.h"
-static PMC *
-bitwise_left_shift_internal(PARROT_INTERP, PMC *self,
- PMC *dest, INTVAL shift_amount)
-{
- /* This handles both left and right shifts; the sign of shift_amount
- controls the direction, shifting left if positive and right if negative.
- If we get an error (which can only happen for left shifts) and
- PARROT_ERRORS_OVERFLOW_FLAG is set, then we throw an error, else the
- destination is promoted to a BigInt before shifting. If dest == self,
- then the shift is done in place. */
- const INTVAL base = VTABLE_get_integer(interp, self);
- INTVAL result = 0;
- int overflow_p = 0;
-
- /* Compute the shift. */
- if (shift_amount >= 8*INTVAL_SIZE) {
- /* Extreme left shift; no need to do an integer shift first. */
- overflow_p = 1;
- }
- else if (shift_amount >= 0) {
- /* Left shift. */
- result = base << shift_amount;
- overflow_p = (result >> shift_amount) != base;
- }
- else if (shift_amount > -8*INTVAL_SIZE) {
- /* Right shift. By definition, this can never overflow. */
- result = base >> -shift_amount;
- }
- else {
- /* Extreme right shift. */
- result = 0;
- }
-
- /* Store the result. */
- if (! overflow_p) {
- /* If SELF is the destination, we won't want to create a
- new PMC, because then we won't have the result in SELF.
- Only create a new PMC if we aren't saving the result
- to SELF, or if they are both NULL */
- if (dest != self || dest == NULL)
- dest = pmc_new(interp, VTABLE_type(interp, self));
-
- VTABLE_set_integer_native(interp, dest, result);
- }
- else if (PARROT_ERRORS_test(interp, PARROT_ERRORS_OVERFLOW_FLAG)) {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ERR_OVERFLOW,
- "Integer overflow");
- }
- else {
- /* Overflow; must promote dest to BigInt, and do a BigInt shift. */
- if (self == dest)
- pmc_reuse(interp, self, enum_class_BigInt, 0);
- else
- dest = pmc_new(interp, enum_class_BigInt);
-
- VTABLE_set_integer_native(interp, dest, base);
- VTABLE_i_bitwise_shl_int(interp, dest, shift_amount);
- }
-
- return dest;
-}
-
pmclass scalar {
/*
@@ -641,72 +579,6 @@
/*
-=item C<PMC *pow(PMC *value, PMC *dest)>
-
-=item C<PMC *pow_int(INTVAL value, PMC *dest)>
-
-=item C<PMC *pow_float(FLOATVAL value, PMC *dest)>
-
-Calculates C<SELF pow value> and returns
-the result in C<dest>. See also ops/math.ops.
-
-=item C<void i_pow(PMC *value)>
-
-=item C<void i_pow_int(INTVAL value)>
-
-=item C<void i_pow_float(FLOATVAL value)>
-
-Calculates pow inplace
-
-=cut
-
-*/
-
- MULTI PMC *pow(PMC *value, PMC *dest) {
- const FLOATVAL d = VTABLE_get_number(INTERP, value);
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_number_native(INTERP, dest, pow(SELF.get_number(), d));
- return dest;
- }
-
- VTABLE PMC *pow_int(INTVAL value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_number_native(INTERP, dest,
- pow(SELF.get_number(), (double)value));
-
- return dest;
- }
-
- VTABLE PMC *pow_float(FLOATVAL value, PMC *dest) {
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_number_native(INTERP, dest,
- pow(SELF.get_number(), value));
- return dest;
- }
-
- VTABLE void i_pow(PMC *value) {
- const FLOATVAL d = VTABLE_get_number(INTERP, value);
-
- VTABLE_set_number_native(INTERP, SELF,
- pow(SELF.get_number(), d));
- }
-
- VTABLE void i_pow_int(INTVAL value) {
- VTABLE_set_number_native(INTERP, SELF,
- pow(SELF.get_number(), (float)value));
- }
-
- VTABLE void i_pow_float(FLOATVAL value) {
- VTABLE_set_number_native(INTERP, SELF,
- pow(SELF.get_number(), value));
- }
-
-/*
-
=item C<PMC *neg(PMC *dest)>
=item C<void i_neg()>
@@ -734,311 +606,6 @@
=back
-=head2 Bitwise Methods
-
-=over 4
-
-=item C<PMC *bitwise_or(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_or_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the bitwise C<OR> of the scalar and C<value>.
-
-=item C<void i_bitwise_or(PMC *value)>
-
-=item C<void i_bitwise_or_int(INTVAL value)>
-
-Inplace bitwise or.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_or(PMC *value, PMC *dest) {
- const INTVAL result = SELF.get_integer() | VTABLE_get_integer(INTERP, value);
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
-
- VTABLE PMC *bitwise_or_int(INTVAL value, PMC *dest) {
- const INTVAL result = SELF.get_integer() | value;
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE void i_bitwise_or(PMC *value) {
- const INTVAL result =
- SELF.get_integer() | VTABLE_get_integer(INTERP, value);
-
- SELF.set_integer_native(result);
- }
-
-
- VTABLE void i_bitwise_or_int(INTVAL value) {
- const INTVAL result = SELF.get_integer() | value;
- SELF.set_integer_native(result);
- }
-
-/*
-
-=item C<PMC *bitwise_and(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_and_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the bitwise C<AND> of the scalar and C<value>.
-
-=item C<void i_bitwise_and(PMC *value)>
-
-=item C<void i_bitwise_and_int(INTVAL value)>
-
-Inplace bitwise and.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_and(PMC *value, PMC *dest) {
- const INTVAL result =
- SELF.get_integer() & VTABLE_get_integer(INTERP, value);
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE PMC *bitwise_and_int(INTVAL value, PMC *dest) {
- const INTVAL result = SELF.get_integer() & value;
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE void i_bitwise_and(PMC *value) {
- const INTVAL result =
- SELF.get_integer() & VTABLE_get_integer(INTERP, value);
- SELF.set_integer_native(result);
- }
-
-
- VTABLE void i_bitwise_and_int(INTVAL value) {
- const INTVAL result = SELF.get_integer() & value;
- SELF.set_integer_native(result);
- }
-
-/*
-
-=item C<void bitwise_xor(PMC *value, PMC *dest)>
-
-=item C<void bitwise_xor_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the bitwise C<XOR> of the scalar and C<*value>.
-
-=item C<void i_bitwise_xor(PMC *value)>
-
-=item C<void i_bitwise_xor_int(INTVAL value)>
-
-Inplace bitwise and.
-
-=cut
-
-*/
-
- MULTI PMC *bitwise_xor(PMC *value, PMC *dest) {
- const INTVAL result =
- SELF.get_integer() ^ VTABLE_get_integer(INTERP, value);
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE PMC *bitwise_xor_int(INTVAL value, PMC *dest) {
- const INTVAL result = SELF.get_integer() ^ value;
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE void i_bitwise_xor(PMC *value) {
- const INTVAL result =
- SELF.get_integer() ^ VTABLE_get_integer(INTERP, value);
- SELF.set_integer_native(result);
- }
-
- VTABLE void i_bitwise_xor_int(INTVAL value) {
- const INTVAL result = SELF.get_integer() ^ value;
- SELF.set_integer_native(result);
- }
-
-/*
-
-=item C<PMC *bitwise_not(PMC *dest)>
-
-=item C<void i_bitwise_not()>
-
-Returns in C<*dest> the bitwise negation of the scalar and C<value>.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_not(PMC *dest) {
- const INTVAL a = ~SELF.get_integer();
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, a);
- return dest;
- }
-
- VTABLE void i_bitwise_not() {
- VTABLE_set_integer_native(INTERP, SELF, ~SELF.get_integer());
- }
-
-/*
-
-=item C<PMC *bitwise_shr(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_shr_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the arithmetic shift right of the scalar by C<value>.
-A negative C<value> shifts left.
-The destination may become a C<BigInt> as a result (but only if the shift amount
-is less than zero).
-
-=item C<void i_bitwise_shr(PMC *value)>
-
-=item C<void i_bitwise_shr_int(INTVAL value)>
-
-Inplace shift right. A negative C<value> shifts left.
-SELF may become a C<BigInt> as a result (but only if the shift amount is less
-than zero).
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_shr(PMC *value, PMC *dest) {
- return bitwise_left_shift_internal(INTERP, SELF, dest,
- -VTABLE_get_integer(INTERP, value));
- }
-
- VTABLE PMC *bitwise_shr_int(INTVAL value, PMC *dest) {
- return bitwise_left_shift_internal(INTERP, SELF, dest, -value);
- }
-
- VTABLE void i_bitwise_shr(PMC *value) {
- bitwise_left_shift_internal(INTERP, SELF, SELF,
- -VTABLE_get_integer(INTERP, value));
- }
-
- VTABLE void i_bitwise_shr_int(INTVAL value) {
- bitwise_left_shift_internal(INTERP, SELF, SELF, -value);
- }
-
-/*
-
-=item C<PMC *bitwise_lsr(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_lsr_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the logical shift right of the scalar by C<*value>.
-
-=item C<void i_bitwise_lsr(PMC *value)>
-
-=item C<void i_bitwise_lsr_int(INTVAL value)>
-
-Inplace shift right.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_lsr(PMC *value, PMC *dest) {
- const INTVAL result = (UINTVAL)SELF.get_integer() >>
- VTABLE_get_integer(INTERP, value);
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE PMC *bitwise_lsr_int(INTVAL value, PMC *dest) {
- const INTVAL result = (UINTVAL)SELF.get_integer() >> value;
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
-
- VTABLE_set_integer_native(INTERP, dest, result);
- return dest;
- }
-
- VTABLE void i_bitwise_lsr(PMC *value) {
- const INTVAL result = (UINTVAL)SELF.get_integer() >>
- VTABLE_get_integer(INTERP, value);
- SELF.set_integer_native(result);
- }
-
- VTABLE void i_bitwise_lsr_int(INTVAL value) {
- const INTVAL result = (UINTVAL)SELF.get_integer() >> value;
- SELF.set_integer_native(result);
- }
-
-/*
-
-=item C<PMC *bitwise_shl(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_shl_int(INTVAL value, PMC *dest)>
-
-Returns in C<*dest> the shift left of the scalar by C<*value>. A negative
-C<value> shifts right. The destination may become a C<BigInt> as a result.
-
-=item C<void i_bitwise_shl(PMC *value)>
-
-=item C<void i_bitwise_shl_int(INTVAL value)>
-
-Inplace shift left. A negative C<value> shifts right. SELF may become a
-C<BigInt> as a result.
-
-=cut
-
-*/
-
- VTABLE PMC *bitwise_shl(PMC *value, PMC *dest) {
- return bitwise_left_shift_internal(INTERP, SELF, dest,
- VTABLE_get_integer(INTERP, value));
- }
-
- VTABLE PMC *bitwise_shl_int(INTVAL value, PMC *dest) {
- return bitwise_left_shift_internal(INTERP, SELF, dest, value);
- }
-
- VTABLE void i_bitwise_shl(PMC *value) {
- bitwise_left_shift_internal(INTERP, SELF, SELF,
- VTABLE_get_integer(INTERP, value));
- }
-
- VTABLE void i_bitwise_shl_int(INTVAL value) {
- bitwise_left_shift_internal(INTERP, SELF, SELF, value);
- }
-
-/*
-
-=back
-
=head2 String Methods
=over 4
Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/pmc/string.pmc Sat Feb 13 02:10:36 2010 (r43921)
@@ -108,23 +108,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Returns the big numbers representation of the string.
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- STRING * const s = SELF.get_string();
- PMC * const ret = pmc_new(INTERP, enum_class_BigInt);
- VTABLE_set_string_native(INTERP, ret, s);
- return ret;
- }
-
-/*
-
=item C<STRING *get_string()>
Returns the string itself.
@@ -250,172 +233,6 @@
/*
-=item C<PMC *bitwise_ors(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_ors_str(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_ands(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_ands_str(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_xors(PMC *value, PMC *dest)>
-
-=item C<PMC *bitwise_xors_str(PMC *value, PMC *dest)>
-
-=item C<void bitwise_nots(PMC *value)>
-
-These functions perform bitwise operations on entire
-strings, and place the result in C<dest>.
-
-=item C<void i_bitwise_ors(PMC *value)>
-
-=item C<void i_bitwise_ors_str(PMC *value)>
-
-=item C<void i_bitwise_ands(PMC *value)>
-
-=item C<void i_bitwise_ands_str(PMC *value)>
-
-=item C<void i_bitwise_xors(PMC *value)>
-
-=item C<void i_bitwise_xors_str(PMC *value)>
-
-=item C<void i_bitwise_nots(PMC *value)>
-
-These functions perform bitwise operations on entire
-strings in place.
-
-=cut
-
-*/
- VTABLE PMC *bitwise_ors(PMC *value, PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
- STRING * const v = VTABLE_get_string(INTERP, value);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_or(INTERP, s, v, NULL));
-
- return dest;
- }
-
- VTABLE PMC *bitwise_ors_str(STRING *value, PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_or(INTERP, s, value, NULL));
-
- return dest;
- }
-
- VTABLE void i_bitwise_ors(PMC *value) {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- STRING * const v = VTABLE_get_string(INTERP, value);
- SELF.set_string_native(Parrot_str_bitwise_or(INTERP, s, v, &s));
- }
-
- VTABLE void i_bitwise_ors_str(STRING *value) {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- SELF.set_string_native(Parrot_str_bitwise_or(INTERP, s, value, &s));
- }
-
- VTABLE PMC *bitwise_ands(PMC *value, PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
- STRING * const v = VTABLE_get_string(INTERP, value);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_and(INTERP, s, v, NULL));
-
- return dest;
- }
-
- VTABLE PMC *bitwise_ands_str(STRING *value, PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_and(INTERP, s, value, NULL));
-
- return dest;
- }
-
-
- VTABLE void i_bitwise_ands(PMC *value) {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- STRING * const v = VTABLE_get_string(INTERP, value);
- SELF.set_string_native(Parrot_str_bitwise_and(INTERP, s, v, &s));
- }
-
- VTABLE void i_bitwise_ands_str(STRING *value) {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- SELF.set_string_native(Parrot_str_bitwise_and(INTERP, s, value, &s));
- }
-
- VTABLE PMC *bitwise_xors(PMC *value, PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
- STRING * const v = VTABLE_get_string(INTERP, value);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_xor(INTERP, s, v, NULL));
-
- return dest;
- }
-
- VTABLE PMC *bitwise_xors_str(STRING *value, PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_xor(INTERP, s, value, NULL));
-
- return dest;
- }
-
- VTABLE void i_bitwise_xors(PMC *value) {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- STRING * const v = VTABLE_get_string(INTERP, value);
- SELF.set_string_native(Parrot_str_bitwise_xor(INTERP, s, v, &s));
- }
-
- VTABLE void i_bitwise_xors_str(STRING *value) {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- SELF.set_string_native(Parrot_str_bitwise_xor(INTERP, s, value, &s));
- }
-
- VTABLE PMC *bitwise_nots(PMC *dest) {
- STRING * const s = VTABLE_get_string(INTERP, SELF);
-
- if (!dest)
- dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- VTABLE_set_string_native(INTERP, dest,
- Parrot_str_bitwise_not(INTERP, s, NULL));
-
- return dest;
- }
-
- VTABLE void i_bitwise_nots() {
- STRING *s = VTABLE_get_string(INTERP, SELF);
- VTABLE_set_string_native(
- INTERP, SELF, Parrot_str_bitwise_not(INTERP, s, &s));
- }
-
-/*
-
=item C<INTVAL is_equal(PMC *value)>
Compares the string with C<value>; returns true if
Modified: trunk/src/vtable.tbl
==============================================================================
--- trunk/src/vtable.tbl Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/src/vtable.tbl Sat Feb 13 02:10:36 2010 (r43921)
@@ -41,8 +41,6 @@
FLOATVAL get_number_keyed_int(INTVAL key)
FLOATVAL get_number_keyed_str(STRING* key)
-PMC* get_bignum()
-
STRING* get_string()
STRING* get_repr()
STRING* get_string_keyed(PMC* key)
@@ -72,10 +70,6 @@
void set_number_keyed_int(INTVAL key, FLOATVAL value)
void set_number_keyed_str(STRING* key, FLOATVAL value)
-void set_bignum_int(INTVAL value)
-void set_bignum_num(FLOATVAL value)
-void set_bignum_str(STRING* value)
-
void set_string_native(STRING* value)
void assign_string_native(STRING* value)
void set_string_keyed(PMC* key, STRING* value)
@@ -177,14 +171,6 @@
void i_modulus_int(INTVAL value) :write
void i_modulus_float(FLOATVAL value) :write
-PMC* pow(PMC* value, PMC* dest)
-PMC* pow_int(INTVAL value, PMC* dest)
-PMC* pow_float(FLOATVAL value, PMC* dest)
-
-void i_pow(PMC* value) :write
-void i_pow_int(INTVAL value) :write
-void i_pow_float(FLOATVAL value) :write
-
void increment() :write
void decrement() :write
@@ -194,67 +180,6 @@
PMC* neg(PMC* dest)
void i_neg() :write
-[BITWISE]
-PMC* bitwise_or(PMC* value, PMC* dest)
-PMC* bitwise_or_int(INTVAL value, PMC* dest)
-
-void i_bitwise_or(PMC* value) :write
-void i_bitwise_or_int(INTVAL value) :write
-
-PMC* bitwise_and(PMC* value, PMC* dest)
-PMC* bitwise_and_int(INTVAL value, PMC* dest)
-
-void i_bitwise_and(PMC* value) :write
-void i_bitwise_and_int(INTVAL value) :write
-
-PMC* bitwise_xor(PMC* value, PMC* dest)
-PMC* bitwise_xor_int(INTVAL value, PMC* dest)
-
-void i_bitwise_xor(PMC* value) :write
-void i_bitwise_xor_int(INTVAL value) :write
-
-PMC* bitwise_ors(PMC* value, PMC* dest)
-PMC* bitwise_ors_str(STRING* value, PMC* dest)
-
-void i_bitwise_ors(PMC* value) :write
-void i_bitwise_ors_str(STRING* value) :write
-
-PMC* bitwise_ands(PMC* value, PMC* dest)
-PMC* bitwise_ands_str(STRING* value, PMC* dest)
-
-void i_bitwise_ands(PMC* value) :write
-void i_bitwise_ands_str(STRING* value) :write
-
-PMC* bitwise_xors(PMC* value, PMC* dest)
-PMC* bitwise_xors_str(STRING* value, PMC* dest)
-
-void i_bitwise_xors(PMC* value) :write
-void i_bitwise_xors_str(STRING* value) :write
-
-PMC* bitwise_not(PMC* dest)
-void i_bitwise_not() :write
-
-PMC* bitwise_nots(PMC* dest)
-void i_bitwise_nots() :write
-
-PMC* bitwise_shl(PMC* value, PMC* dest)
-PMC* bitwise_shl_int(INTVAL value, PMC* dest)
-
-void i_bitwise_shl(PMC* value) :write
-void i_bitwise_shl_int(INTVAL value) :write
-
-PMC* bitwise_shr(PMC* value, PMC* dest)
-PMC* bitwise_shr_int(INTVAL value, PMC* dest)
-
-void i_bitwise_shr(PMC* value) :write
-void i_bitwise_shr_int(INTVAL value) :write
-
-PMC* bitwise_lsr(PMC* value, PMC* dest)
-PMC* bitwise_lsr_int(INTVAL value, PMC* dest)
-
-void i_bitwise_lsr(PMC* value) :write
-void i_bitwise_lsr_int(INTVAL value) :write
-
[CMP]
INTVAL is_equal(PMC* value)
INTVAL is_equal_num(PMC* value)
Modified: trunk/t/op/arithmetics_pmc.t
==============================================================================
--- trunk/t/op/arithmetics_pmc.t Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/t/op/arithmetics_pmc.t Sat Feb 13 02:10:36 2010 (r43921)
@@ -20,7 +20,7 @@
.include 'test_more.pir'
.include "iglobals.pasm"
- plan(68)
+ plan(44)
# Don't check BigInt or BigNum without gmp
.local pmc interp # a handle to our interpreter object.
@@ -35,7 +35,7 @@
if gmp goto do_big_ones
skip( 34, "will not test BigInt or BigNum without gmp" )
- goto end
+ goto end
do_big_ones:
run_tests_for('BigInt')
@@ -54,15 +54,9 @@
test_concatenate(type)
test_logical_xor(type)
test_logical_or(type)
- test_bitwise_shr(type)
- test_bitwise_or(type)
- test_bitwise_shl(type)
- test_bitwise_xor(type)
test_modulus(type)
test_pow(type)
test_subtract(type)
- test_bitwise_lsr(type)
- test_bitwise_and(type)
.end
.sub test_add
@@ -86,7 +80,7 @@
add $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -116,7 +110,7 @@
div $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -146,7 +140,7 @@
mul $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -176,7 +170,7 @@
fdiv $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -206,7 +200,7 @@
and $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -236,7 +230,7 @@
concat $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -266,7 +260,7 @@
xor $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -296,127 +290,7 @@
or $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
- is( $I0, 0, $S0 )
- goto end
-
- done:
- ok(1, 'ignoring exceptions')
- end:
-.end
-
-.sub test_bitwise_shr
- .param pmc type
-
- $P0 = new type
- $P0 = 40
- $P1 = new type
- $P1 = 2
- $P2 = new type
- $P2 = 115200
-
- $P99 = $P2
-
- $S0 = "original dest is untouched in bitwise_shr for "
- $S1 = type
- concat $S0, $S1
-
- # ignore exceptions
- push_eh done
- shr $P2, $P0, $P1
-
- $I0 = cmp $P99, 115200
-
- is( $I0, 0, $S0 )
- goto end
-
- done:
- ok(1, 'ignoring exceptions')
- end:
-.end
-
-.sub test_bitwise_or
- .param pmc type
- $P0 = new type
- $P0 = 40
- $P1 = new type
- $P1 = 2
- $P2 = new type
- $P2 = 115200
-
- $P99 = $P2
-
- $S0 = "original dest is untouched in bitwise_or for "
- $S1 = type
- concat $S0, $S1
-
- # ignore exceptions
- push_eh done
- bor $P2, $P0, $P1
-
- $I0 = cmp $P99, 115200
-
- is( $I0, 0, $S0 )
- goto end
-
- done:
- ok(1, 'ignoring exceptions')
- end:
-.end
-
-.sub test_bitwise_shl
- .param pmc type
-
- $P0 = new type
- $P0 = 40
- $P1 = new type
- $P1 = 2
- $P2 = new type
- $P2 = 115200
-
- $P99 = $P2
-
- $S0 = "original dest is untouched in bitwise_shl for "
- $S1 = type
- concat $S0, $S1
-
- # ignore exceptions
- push_eh done
- shl $P2, $P0, $P1
-
- $I0 = cmp $P99, 115200
-
- is( $I0, 0, $S0 )
- goto end
-
- done:
- ok(1, 'ignoring exceptions')
- end:
-.end
-
-.sub test_bitwise_xor
- .param pmc type
-
- $P0 = new type
- $P0 = 40
- $P1 = new type
- $P1 = 2
- $P2 = new type
- $P2 = 115200
-
- $P99 = $P2
-
- $S0 = "original dest is untouched in bitwise_xor for "
- $S1 = type
- concat $S0, $S1
-
- # ignore exceptions
- push_eh done
- bxor $P2, $P0, $P1
-
- $I0 = cmp $P99, 115200
-
is( $I0, 0, $S0 )
goto end
@@ -446,7 +320,7 @@
mod $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -476,7 +350,7 @@
pow $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
+
is( $I0, 0, $S0 )
goto end
@@ -506,67 +380,7 @@
sub $P2, $P0, $P1
$I0 = cmp $P99, 115200
-
- is( $I0, 0, $S0 )
- goto end
-
- done:
- ok(1, 'ignoring exceptions')
- end:
-.end
-
-.sub test_bitwise_lsr
- .param pmc type
- $P0 = new type
- $P0 = 40
- $P1 = new type
- $P1 = 2
- $P2 = new type
- $P2 = 115200
-
- $P99 = $P2
-
- $S0 = "original dest is untouched in bitwise_lsr for "
- $S1 = type
- concat $S0, $S1
-
- # ignore exceptions
- push_eh done
- lsr $P2, $P0, $P1
-
- $I0 = cmp $P99, 115200
-
- is( $I0, 0, $S0 )
- goto end
-
- done:
- ok(1, 'ignoring exceptions')
- end:
-.end
-
-.sub test_bitwise_and
- .param pmc type
-
- $P0 = new type
- $P0 = 40
- $P1 = new type
- $P1 = 2
- $P2 = new type
- $P2 = 115200
-
- $P99 = $P2
-
- $S0 = "original dest is untouched in bitwise_and for "
- $S1 = type
- concat $S0, $S1
-
- # ignore exceptions
- push_eh done
- band $P2, $P0, $P1
-
- $I0 = cmp $P99, 115200
-
is( $I0, 0, $S0 )
goto end
Deleted: trunk/t/op/bitwise.t
==============================================================================
--- trunk/t/op/bitwise.t Sat Feb 13 02:10:36 2010 (r43920)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,474 +0,0 @@
-#!parrot
-# Copyright (C) 2001-2009, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/op/bitwise.t - Bitwise Ops
-
-=head1 SYNOPSIS
-
- % prove t/op/bitwise.t
-
-=head1 DESCRIPTION
-
-Tests various bitwise logical operations.
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
-
- plan(68)
-
- test_shr_i_i_i_shift_rt_()
- test_shr_i_i_shift_rt_()
- test_shr_i_i_ic_shift_rt_()
- test_shr_i_ic_i_shift_rt_()
- test_shr_i_ic_ic_shift_rt_()
- test_lsr_i_ic_ic_shift_rt_()
- test_lsr_i_ic_shift_rt()
- test_lsr_i_i_i_shift_rt()
- test_lsr_i_i_ic_shift_rt()
- test_shr_i_i_ic_shift_rt_negative()
- test_shl_i_i_i_shift_lt()
- test_shl_i_i_ic_shift_lt()
- test_shl_i_ic_i_shift_lt()
- test_shl_i_ic_ic_shift_lt()
- test_shl_i_i_shift_lt()
- test_bxor_i_i_i_xor()
- test_bxor_i_i_ic_xor()
- test_bxor_i_ic_xor()
- test_band_i_i_i_and()
- test_band_i_i_ic_and()
- test_band_i_i_ic_and_2()
- test_bor_i_i_i()
- test_bor_i_i_ic()
- test_bor_i_i_ic_2()
- test_bnot_i_i_2()
- test_rot_i_i_ic_ic()
- test_i_reg_shl_and_pmc_shl_are_consistent()
- # END_OF_TESTS
-.end
-
-.macro exception_is ( M )
- .local pmc exception
- .local string message
- .get_results (exception)
-
- message = exception['message']
- is( message, .M, .M )
-.endm
-
-.sub test_shr_i_i_i_shift_rt_
- set $I0, 0b001100
- set $I1, 0b010100
- set $I2, 1
- set $I3, 2
- shr $I4, $I0, $I2
- shr $I2, $I0, $I2
- shr $I1, $I1, $I3
- is( $I4, "6", 'shr_i_i_i (>>)' )
- is( $I2, "6", 'shr_i_i_i (>>)' )
- is( $I1, "5", 'shr_i_i_i (>>)' )
- is( $I0, "12", 'shr_i_i_i (>>)' )
-.end
-
-.sub test_shr_i_i_shift_rt_
- set $I0, 0b001100
- set $I1, 0b010100
- set $I2, 1
- set $I3, 2
- shr $I0, $I2
- shr $I1, $I3
- is( $I0, "6", 'shr_i_i (>>)' )
- is( $I1, "5", 'shr_i_i (>>)' )
-.end
-
-.sub test_shr_i_i_ic_shift_rt_
- set $I0, 0b001100
- set $I1, 0b010100
- shr $I2, $I0, 1
- shr $I1, $I1, 2
- is( $I2, "6", 'shr_i_i_ic (>>)' )
- is( $I1, "5", 'shr_i_i_ic (>>)' )
- is( $I0, "12", 'shr_i_i_ic (>>)' )
-.end
-
-.sub test_shr_i_ic_i_shift_rt_
- set $I0, 1
- set $I1, 2
- shr $I2, 0b001100, $I0
- shr $I1, 0b010100, $I1
- is( $I2, "6", 'shr_i_ic_i (>>)' )
- is( $I1, "5", 'shr_i_ic_i (>>)' )
-.end
-
-.sub test_shr_i_ic_ic_shift_rt_
- shr $I2, 0b001100, 1
- shr $I1, 0b010100, 2
- is( $I2, "6", 'shr_i_ic_ic (>>)' )
- is( $I1, "5", 'shr_i_ic_ic (>>)' )
-.end
-
-# The crux of this test is that a proper logical right shift
-# will clear the most significant bit, so the shifted value
-# will be a positive value on any 2's or 1's complement CPU
-.sub test_lsr_i_ic_ic_shift_rt_
- lsr $I2, -40, 1
- lt $I2, 0, BAD
- ok( 1, 'lsr_i_ic_ic (>>)' )
- goto END
- BAD:
- ok( 0, 'lsr_i_ic_ic (>>)' )
- END:
-.end
-
-.sub test_lsr_i_ic_shift_rt
- set $I2, -100
- lsr $I2, 1
- lt $I2, 0, BAD
- ok( 1, 'lsr_i_ic (>>) OK')
- goto END
- BAD:
- ok( 0, 'lsr_i_ic (>>)')
- END:
-.end
-
-.sub test_lsr_i_i_i_shift_rt
- set $I0, -40
- set $I1, 1
- lsr $I2, $I0, $I1
- lt $I2, 0, BAD
- ok( 1, 'lsr_i_i_i (>>) OK')
- goto END
- BAD:
- ok( 0, 'lsr_i_i_i (>>)')
- END:
-.end
-
-# ... and the missing op signature was untested and wrong in JIT/i386
-.sub test_lsr_i_i_ic_shift_rt
- set $I0, -40
- lsr $I2, $I0, 1
- lt $I2, 0, BAD
- ok( 1, 'lsr_i_i_ic (>>) OK')
- goto END
- BAD:
- ok( 0, 'lsr_i_i_ic (>>)')
- END:
-.end
-
-.sub test_shr_i_i_ic_shift_rt_negative
- set $I0, -40
- shr $I2, $I0, 1
- ge $I2, 0, BAD
- ok( 1, 'shr_i_i_ic (>>) negative OK')
- goto END
- BAD:
- ok( 0, 'shr_i_i_ic (>>) negative')
- END:
-.end
-
-.sub test_shl_i_i_i_shift_lt
- set $I0, 0b001100
- set $I1, 0b010100
- set $I2, 2
- set $I3, 1
- shl $I4, $I0, $I2
- shl $I2, $I0, $I2
- shl $I1, $I1, $I3
- is( $I4, "48", 'shl_i_i_i (<<)' )
- is( $I2, "48", 'shl_i_i_i (<<)' )
- is( $I1, "40", 'shl_i_i_i (<<)' )
- is( $I0, "12", 'shl_i_i_i (<<)' )
-.end
-
-.sub test_shl_i_i_ic_shift_lt
- set $I0, 0b001100
- set $I1, 0b010100
- shl $I2, $I0, 2
- shl $I1, $I1, 1
- is( $I2, "48", 'shl_i_i_ic (<<)' )
- is( $I1, "40", 'shl_i_i_ic (<<)' )
- is( $I0, "12", 'shl_i_i_ic (<<)' )
-.end
-
-.sub test_shl_i_ic_i_shift_lt
- set $I0, 2
- set $I1, 1
- shl $I2, 0b001100, $I0
- shl $I1, 0b010100, $I1
- is( $I2, "48", 'shl_i_ic_i (<<)' )
- is( $I1, "40", 'shl_i_ic_i (<<)' )
-.end
-
-.sub test_shl_i_ic_ic_shift_lt
- shl $I2, 0b001100, 2
- shl $I1, 0b010100, 1
- is( $I2, "48", 'shl_i_ic_ic (<<)' )
- is( $I1, "40", 'shl_i_ic_ic (<<)' )
-.end
-
-.sub test_shl_i_i_shift_lt
- set $I0, 0b001100
- set $I1, 0b010100
- set $I2, 1
- set $I3, 2
- shl $I0, $I2
- shl $I1, $I3
- is( $I0, "24", 'shl_i_i (<<)' )
- is( $I1, "80", 'shl_i_i (<<)' )
-.end
-
-.sub test_bxor_i_i_i_xor
- set $I0, 0b001100
- set $I1, 0b100110
- bxor $I2, $I0, $I1
- is( $I2, "42", 'bxor_i_i_i (^)' )
- bxor $I1, $I0, $I1
- is( $I1, "42", 'bxor_i_i_i (^)' )
- is( $I0, "12", 'bxor_i_i_i (^)' )
-.end
-
-.sub test_bxor_i_i_ic_xor
- set $I0, 0b001100
- bxor $I2, $I0, 0b100110
- is( $I2, "42", 'bxor_i_i_ic (^)' )
- is( $I0, "12", 'bxor_i_i_ic (^)' )
- bxor $I0, $I0, 0b100110
- is( $I0, "42", 'bxor_i_i_ic (^)' )
-.end
-
-.sub test_bxor_i_ic_xor
- set $I0, 0b001100
- set $I2, 0b000011
- bxor $I2, $I0
- is( $I2, "15", 'bxor_i|ic (^)' )
- set $I2, 0b001100
- bxor $I2, $I0
- is( $I2, "0", 'bxor_i|ic (^)' )
- set $I2, 0b101010
- bxor $I2, $I2
- is( $I2, "0", 'bxor_i|ic (^)' )
- set $I2, 0b010101
- bxor $I2, 0b000011
- is( $I2, "22", 'bxor_i|ic (^)' )
-.end
-
-.sub test_band_i_i_i_and
- set $I0, 0b001100
- set $I1, 0b010110
- band $I2, $I0,$I1
- is( $I2, "4", 'band_i_i_i (&)' )
- band $I1,$I0,$I1
- is( $I1, "4", 'band_i_i_i (&)' )
- is( $I0, "12", 'band_i_i_i (&)' )
-.end
-
-.sub test_band_i_i_ic_and
- set $I0, 0b001100
- band $I2, $I0,0b010110
- is( $I2, "4", 'band_i_i_ic (&)' )
- is( $I0, "12", 'band_i_i_ic (&)' )
- band $I0,$I0,0b010110
- is( $I0, "4", 'band_i_i_ic (&)' )
-.end
-
-.sub test_band_i_i_ic_and_2
- set $I0, 0b001100
- set $I2, 0b000011
- band $I2, $I0
- is( $I2, "0", 'band_i_i|ic (&)' )
-
- set $I2, 0b001100
- band $I2, $I0
- is( $I2, "12", 'band_i_i|ic (&)' )
-
- set $I2, 0b101010
- band $I2, $I2
- is( $I2, "42", 'band_i_i|ic (&)' )
-
- set $I2, 0b010101
- band $I2, 0b000011
- is( $I2, "1", 'band_i_i|ic (&)' )
-.end
-
-.sub test_bor_i_i_i
- set $I0, 0b001100
- set $I1, 0b010110
- bor $I2, $I0,$I1
- is( $I2, "30", 'bor_i_i_i (|)' )
- bor $I1,$I0,$I1
- is( $I1, "30", 'bor_i_i_i (|)' )
- is( $I0, "12", 'bor_i_i_i (|)' )
-.end
-
-.sub test_bor_i_i_ic
- set $I0, 0b001100
- bor $I2, $I0,0b010110
- is( $I2, "30", 'bor_i_i_ic (|)' )
- is( $I0, "12", 'bor_i_i_ic (|)' )
- bor $I0,$I0,0b010110
- is( $I0, "30", 'bor_i_i_ic (|)' )
-.end
-
-.sub test_bor_i_i_ic_2
- set $I0, 0b001100
- set $I2, 0b000011
- bor $I2, $I0
- is( $I2, "15", 'bor_i_i|ic (|) 2' )
- set $I2, 0b001100
- bor $I2, $I0
- is( $I2, "12", 'bor_i_i|ic (|) 2' )
- set $I2, 0b101010
- bor $I2, $I2
- is( $I2, "42", 'bor_i_i|ic (|) 2' )
- set $I2, 0b010101
- bor $I2, 0b000011
- is( $I2, "23", 'bor_i_i|ic (|) 2' )
-.end
-
-.sub test_bnot_i_i_2
- set $I0, 0b001100
- set $I1, 0b001100
- set $I31, 0b111111
- bnot $I2, $I0
- band $I2, $I2, $I31
- is( $I2, "51", 'bnot_i_i (~) 2' )
- bnot $I1, $I1
- band $I1, $I1, $I31
- is( $I1, "51", 'bnot_i_i (~) 2' )
- is( $I0, "12", 'bnot_i_i (~) 2' )
-.end
-
-.sub test_rot_i_i_ic_ic
- .include "iglobals.pasm"
- .local pmc interp # a handle to our interpreter object.
- interp = getinterp
- .local pmc config
- config = interp[.IGLOBALS_CONFIG_HASH]
- .local int intvalsize
- intvalsize = config['intvalsize']
-
- .local int int_bits
- int_bits = intvalsize * 8
-
- set $I0, 0b001100
-
- gt intvalsize, 4, do64bit
-
- rot $I1, $I0, 1, 32 # 1 left
- is( $I1, "24", 'rot_i_i_ic_ic' )
- rot $I1, $I0, -1, 32 # 1 right
- is( $I1, "6", 'rot_i_i_ic_ic' )
- goto END
-
- do64bit:
- rot $I1, $I0, 1, 64 # 1 left
- is( $I1, "24", 'rot_i_i_ic_ic' )
- rot $I1, $I0, -1, 64 # 1 right
- is( $I1, "6", 'rot_i_i_ic_ic' )
-
- END:
-.end
-
-## The PMC shl op will promote Integer to Bigint when needed. We can't stuff a
-## BigInt in an I register, but we can produce the same result modulo wordsize.
-## [Only we cheat by using the word size minus one, so that we don't have to
-## deal with negative numbers. -- rgr, 2-Jun-07.]
-.sub test_i_reg_shl_and_pmc_shl_are_consistent
-
- .include "iglobals.pasm"
- .local pmc interp # a handle to our interpreter object.
- interp = getinterp
- .local pmc config
- config = interp[.IGLOBALS_CONFIG_HASH]
- .local int gmp
- gmp = config['gmp']
-
- if gmp, runtest
- skip( 2, 'no BigInt lib found' )
- goto END
-
- runtest:
-
- ## Figure out the wordsize. We need integer_modulus because assigning a
- ## too-big BigInt throws an error otherwise.
- .include 'sysinfo.pasm'
- .local int i_bytes_per_word, i_bits_per_word_minus_one
- .local pmc bits_per_word_minus_one, integer_modulus
- i_bytes_per_word = sysinfo .SYSINFO_PARROT_INTSIZE
- i_bits_per_word_minus_one = 8 * i_bytes_per_word
- dec i_bits_per_word_minus_one
- bits_per_word_minus_one = new 'Integer'
- bits_per_word_minus_one = i_bits_per_word_minus_one
- integer_modulus = new 'BigInt'
- integer_modulus = 1
- integer_modulus <<= bits_per_word_minus_one
-
- ## Test shifting a positive number.
- new $P0, 'Integer'
- set $P0, 1000001
- test_shift($P0, integer_modulus)
-
- ## Test shifting a negative number.
- set $P0, -1000001
- test_shift($P0, integer_modulus)
- END:
-.end
-
-.sub test_shift
- .param pmc number
- .param pmc integer_modulus
- new $P1, 'Integer'
- set $P1, 1
- .local int i_number
- i_number = number
-
- ## Start the loop.
- loop:
- if $P1 > 100 goto done
- ## shift number and i_number into $P2 and $I2.
- shl $P2, number, $P1
- $I1 = $P1
- shl $I2, i_number, $I1
- ## compare in I registers.
- $P3 = mod $P2, integer_modulus
- $I3 = $P3
- if $I2 >= 0 goto pos_check
- ## The register op gave a negative result, but the modulus will always be
- ## positive. If the truncated result is correct, then the difference will
- ## be the most negative INTVAL, which is the only number for which -x==x.
- $I4 = $I3 - $I2
- $I5 = - $I4
- if $I4 == $I5 goto ok
- goto bad
- pos_check:
- if $I2 == $I3 goto ok
- bad:
- ok( 0, "oops; not ok: " )
- diag( i_number )
- diag( ' << ' )
- diag( $I1 )
- diag( ' gives I ' )
- diag( $I2 )
- diag( ' vs. P ' )
- diag( $P3 )
- diag( ".\n" )
- diag( $I5 )
- diag( "\n" )
- ok:
- ## set up for the next one
- inc $P1
- goto loop
- done:
- ok( 1, 'finished ok' )
-.end
-
-# Local Variables:
-# mode: pir
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: trunk/t/op/trans.t
==============================================================================
--- trunk/t/op/trans.t Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/t/op/trans.t Sat Feb 13 02:10:36 2010 (r43921)
@@ -4,7 +4,7 @@
=head1 NAME
-t/op/bitwise.t - Bitwise Ops
+t/op/trans.t - Bitwise Ops
=head1 SYNOPSIS
@@ -12,7 +12,7 @@
=head1 DESCRIPTION
-Tests various bitwise logical operations.
+Tests various transcendental operations
=cut
@@ -20,7 +20,7 @@
.include 'test_more.pir'
plan(16)
-
+
test_sin_n()
test_sin_i()
test_cos_n()
@@ -44,17 +44,17 @@
.sub test_sin_n
.local num epsilon
epsilon = _epsilon()
-
+
$N0 = sin 0.0
is($N0, 0.0, "sin(0.0)", epsilon)
-
+
$N0 = sin 1.0
is($N0, 0.841471, "sin(1.0)", epsilon)
-
+
$N1 = _pi()
$N0 = sin $N1
is($N0, 0.0, "sin(pi)", epsilon)
-
+
$N1 = _pi()
$N1 = $N1 / 2
$N0 = sin $N1
@@ -64,10 +64,10 @@
.sub test_sin_i
.local num epsilon
epsilon = _epsilon()
-
+
$N0 = sin 0
is($N0, 0.0, "sin(0)", epsilon)
-
+
$N0 = sin 1
is($N0, 0.841471, "sin(1)", epsilon)
.end
@@ -75,17 +75,17 @@
.sub test_cos_n
.local num epsilon
epsilon = _epsilon()
-
+
$N0 = cos 0.0
is($N0, 1.0, "cos(0.0)", epsilon)
-
+
$N0 = cos 1.0
is($N0, 0.540302, "cos(1.0)", epsilon)
-
+
$N1 = _pi()
$N0 = cos $N1
is($N0, -1.0, "cos(pi)", epsilon)
-
+
$N1 = _pi()
$N1 = $N1 / 2
$N0 = cos $N1
@@ -95,10 +95,10 @@
.sub test_cos_i
.local num epsilon
epsilon = _epsilon()
-
+
$N0 = cos 0
is($N0, 1.0, "cos(0)", epsilon)
-
+
$N0 = cos 1
is($N0, 0.540302, "cos(1)", epsilon)
.end
@@ -106,22 +106,22 @@
.sub test_tan_n
.local num epsilon
epsilon = _epsilon()
-
+
$N0 = tan 0.0
is($N0, 0.0, "tan(0.0)", epsilon)
-
+
$N0 = tan 1.0
is($N0, 1.557408, "tan(1.0)", epsilon)
-.end
+.end
.sub test_tan_i
.local num epsilon
epsilon = _epsilon()
-
+
$N0 = tan 0
is($N0, 0.0, "tan(0)", epsilon)
-
+
$N0 = tan 1
is($N0, 1.557408, "tan(1)", epsilon)
-.end
+.end
Modified: trunk/t/pmc/bigint.t
==============================================================================
--- trunk/t/pmc/bigint.t Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/t/pmc/bigint.t Sat Feb 13 02:10:36 2010 (r43921)
@@ -1,5 +1,5 @@
#!parrot
-# Copyright (C) 2001-2009, Parrot Foundation.
+# Copyright (C) 2001-2010, Parrot Foundation.
# $Id$
=head1 NAME
@@ -20,7 +20,7 @@
.include 'test_more.pir'
- plan(45)
+ plan(34)
check_libgmp_good()
set_and_get()
@@ -35,8 +35,6 @@
interface()
boolean()
pi()
- left_shift()
- right_shift()
bugfixes()
.end
@@ -935,348 +933,6 @@
ret:
.end
-.sub left_shift
- $I1 = 1
-
- $P0 = new ['BigInt']
- $P1 = new ['BigInt']
-
-# shl with a positive shift
- $P0 = 2
- $P1 = 2
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '8', OK1
- $I1 = 0
- say 'shl(bigint 2,bigint 2) did not return 8'
-OK1:
- $P0 = '100000000000'
- $P1 = 10
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '102400000000000', OK2
- $I1 = 0
- say 'shl(bigint 100000000000,bigint 10) did not return 102400000000000'
-OK2:
-
-# shl with a negative shift
- $P0 = 8
- $P1 = -2
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- is($S0, '2', 'shl(bigint, -bigint)')
- $P0 = '102400000000000'
- $P1 = -10
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '100000000000', OK3
- $I1 = 0
- say 'shl(bigint 102400000000000,bigint -10) did not return 100000000000'
-OK3:
-
- ok($I1, 'shl(bigint, +bigint)')
- $I1 = 1
-
-# shl_int with a positive shift
- $P0 = 2
- $P1 = 1
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '4', OK4
- $I1 = 0
- say 'shl(bigint 2,integer 1) did not return 4'
-OK4:
- $P0 = '100000000000'
- $P1 = 1
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '200000000000', OK5
- $I1 = 0
- say 'shl(bigint 100000000000,integer 1) did not return 200000000000'
-OK5:
- $P0 = '100000000000'
- $P1 = 10
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '102400000000000', OK6
- $I1 = 0
- say 'shl(bigint 100000000000,integer 10) did not return 102400000000000'
-OK6:
-
-# shl_int with a negative shift
-
- $P0 = 4
- $P1 = -1
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '2', OK7
- $I1 = 0
- say 'shl(bigint 4,integer -1) did not return 2'
-OK7:
- $P0 = '200000000000'
- $P1 = -1
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '100000000000', OK8
- $I1 = 0
- say 'shl(bigint 200000000000,integer -1) did not return 100000000000'
-OK8:
- $P0 = '102400000000000'
- $P1 = -10
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S0 = $P2
- eq $S0, '100000000000', OK9
- $I1 = 0
- say 'shl(bigint 102400000000000,integer -10) did not return 100000000000'
-OK9:
- ok($I1, 'shl(bigint,integer)')
- $I1 = 1
-
-# shl_int throws an error when promotion is disabled
-
- errorson .PARROT_ERRORS_OVERFLOW_FLAG
- $P0 = new ['Integer']
- $P0 = 1000001
- $P1 = new ['Integer']
- $P1 = 10
-
- ## shift by 10 bits . . .
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S1 = $P2
- $S2 = typeof $P2
- eq $S2, 'Integer', OK11
- $I1 = 0
- print 'shl(integer 1000001,integer 10) did not return an Integer PMC; got a '
- print $S2
- say ' instead.'
-
-OK11:
- eq $S1,'1024001024', OK12
- $I1 = 0
- print 'shl(integer 1000001,integer 10) did not return 1024001024; got '
- print $S1
- say ' instead.'
-OK12:
-
- ## then by 60 bits.
- $P0 = 1000001
- $P1 = 60
- push_eh E1
- $I1 = 1
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $I1 = 0
- $S1 = $P2
- $S2 = typeof $P2
- print 'Failed to throw exception; return type '
- print $S2
- print ', return value '
- say $P1
-E1:
- pop_eh
- get_results '0', $P2
- $S0 = $P2
- eq $S0, 'Integer overflow', OK13
- $I1 = 0
- say 'shl(integer 1000001, integer 60) throws exception, but wrong type'
-OK13:
- ok($I1, 'shl(integer 1000001, integer 60) throws "Integer overflow" exception')
- $I1 = 1
-
-# shl_int and i_shl_int promote Integer to Bigint
-
- errorsoff .PARROT_ERRORS_OVERFLOW_FLAG
- ## shift left by 20 bits ...
- $P0 = new ['Integer']
- $P0 = 1000001
- $P1 = new ['Integer']
- $P1 = 20
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- ## ... then by another 40 bits (total 60) in place.
- $P1 = 40
- $P2 = shl $P2, $P1
- $S1 = $P2
- $S2 = typeof $P2
- eq $S2, 'BigInt', OK14
- $S1 = ''
-OK14:
- is($S1, '1152922657528351582846976', 'shl(shl(integer 1000001, 20), 40) => bigint 1152922657528351582846976')
-
-# shl_int by 64 bits also promotes to Bigint
-## The C << and >> ops take the right arg modulo the word size in bits (at least
-## on all the systems I have available), so both 32- and 64-bit systems treat
-## shifting by 64 bits as shifting by zero.
- $P0 = new ['Integer']
- $P0 = 1000001
- $P1 = new ['Integer']
- $P1 = 64
- $P2 = new ['Integer']
- $P2 = shl $P0, $P1
- $S1 = $P2
- $S2 = typeof $P2
- eq $S2, 'BigInt', OK15
- $S1 = ''
-OK15:
- is($S1, '18446762520453625325551616', 'shl(integer 1000001, 64) => bigint 18446762520453625325551616')
-.end
-
-.sub right_shift
- $I1 = 1
-#shr_int and i_shr_int with a neg shift promote Integer to Bigint
-
- $P0 = new ['Integer']
- $P0 = 1000001
- $P1 = new ['Integer']
- $P1 = -10
- $P2 = new ['Integer']
- ## shift by 10 bits . . .
- $P2 = shr $P0, $P1
-# $S2 = typeof $P2
-# ne $S2, 'Integer', OK2
-
- ## then by another 50 bits (total 60) in place.
- $P1 = -50
- $P2 = shr $P1
- $S1 = $P2
- $S2 = typeof $P2
- eq $S2, 'BigInt', OK2
- $S1 = ''
-OK2:
- is($S1, '1152922657528351582846976', 'shr(shr(integer 1000001, integer -10), -50) => bigint 1152922657528351582846976')
-
-# shr_bigint
- $P0 = new ['BigInt']
- $P0 = 8
- $P1 = new ['BigInt']
- $P1 = 2
- $P2 = new ['BigInt']
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '2', OK3
- $I1 = 0
- say 'shr(bigint 8, bigint 2) did not return 2'
-OK3:
-
- $P0 = '102400000000000'
- $P1 = 10
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '100000000000', OK4
- $I1 = 0
- say 'shr(bigint 102400000000000, bigint 10) did not return 100000000000'
-OK4:
- ok($I1, 'shr(bigint, +bigint)')
- $I1 = 1
-
-# shr_bigint with a negative shift
-## cf the shl_bigint case.
-
- $P0 = new ['BigInt']
- $P0 = 2
- $P1 = new['BigInt']
- $P1 = -2
- $P2 = new ['BigInt']
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '8', OK5
- $I1 = 0
- say 'shr(bigint 2, bigint -2) did not return 8'
-OK5:
-
- $P0 = '100000000000'
- $P1 = -10
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '102400000000000', OK6
- $I1 = 0
- say 'shr(bigint 100000000000, bigint -10) did not return 102400000000000'
-OK6:
- ok($I1, 'shr(bigint, -bigint)')
- $I1 = 1
-
-# shr_int
- $P0 = new ['BigInt']
- $P0 = 4
- $P1 = new ['Integer']
- $P1 = 1
- $P2 = new ['BigInt']
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '2', OK7
- $I1 = 0
- say 'shr(bigint 4, integer 1) did not return 2'
-OK7:
-
- $P0 = '200000000000'
- $P1 = 1
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '100000000000', OK8
- $I1 = 0
- say 'shr(bigint 200000000000, integer 1) did not return 100000000000'
-OK8:
-
- $P0 = '102400000000000'
- $P1 = 10
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '100000000000', OK9
- $I1 = 0
- say 'shr(bigint 102400000000000, integer 10) did not return 100000000000'
-OK9:
-
- ok($I1,'shr(bigint, +integer)')
- $I1 = 1
-
-# shr_int with a negative shift
-## cf the shl_int case.
-
- $P0 = new ['BigInt']
- $P0 = 2
- $P1 = new ['Integer']
- $P1 = -1
- $P2 = new ['BigInt']
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '4', OK10
- $I1 = 0
- say 'shr(bigint 2, int -1) did not return 4'
-OK10:
-
- $P0 = '100000000000'
- $P1 = -1
- $P2 = new ['BigInt']
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '200000000000', OK11
- $I1 = 0
- say 'shr(bigint 100000000000, int -1) did not return 200000000000'
-OK11:
-
- $P1 = -10
- $P2 = new ['BigInt']
- $P2 = shr $P0, $P1
- $S0 = $P2
- eq $S0, '102400000000000', OK12
- $I1 = 0
- say 'shr(bigint 100000000000,int -10) did not return 102400000000000'
-OK12:
-
- ok($I1,'shr(bigint, -integer)')
-.end
-
.sub bugfixes
$P0 = new ['BigInt']
Modified: trunk/t/pmc/complex.t
==============================================================================
--- trunk/t/pmc/complex.t Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/t/pmc/complex.t Sat Feb 13 02:10:36 2010 (r43921)
@@ -21,7 +21,7 @@
.include 'fp_equality.pasm'
.include "iglobals.pasm"
- plan(467)
+ plan(458)
string_parsing()
exception_malformed_string__real_part()
@@ -53,7 +53,6 @@
test_sub()
test_i_sub()
sprintf_with_a_complex()
- pow_with_complex_numbers()
e_raised_pi_time_i__plus_1_equal_0()
ln_of_complex_numbers()
exp_of_complex_numbers()
@@ -641,33 +640,6 @@
.sprintf_is( "%.3f%+.3fi", "0+i", "0.000+1.000i" )
.end
-.macro pow_test_is(base, power, message)
- c = .base
- c2 = .power
- c3 = pow c, c2
- $S0 = sprintf "%.6f%+.6fi", c3
- $S1 = .message
- is( $S0, $S1, $S1 )
-.endm
-
-.sub pow_with_complex_numbers
- .local pmc c, c2, c3
- c = new ['Complex']
- c2 = new ['Complex']
- c3 = new ['Complex']
- .pow_test_is( "i", "i", "0.207880+0.000000i" )
- .pow_test_is( "i", "2", "-1.000000+0.000000i" )
- .pow_test_is( "2i", "2", "-4.000000+0.000000i" )
- .pow_test_is( "2+2i", "2+2i", "-1.452505-0.809890i" )
- .pow_test_is( "i", "0.5i", "0.455938+0.000000i" )
- .pow_test_is( 2, "2i", "0.183457+0.983028i" )
- c2 = new ['Integer']
- .pow_test_is( "2i", 2, "-4.000000+0.000000i" )
- .pow_test_is( "2", 4, "16.000000+0.000000i" )
- c2 = new ['Float']
- .pow_test_is( "2i", 0.5, "1.000000+1.000000i" )
-.end
-
.sub e_raised_pi_time_i__plus_1_equal_0
.local pmc c, c2, c3
c = new ['Complex']
Modified: trunk/t/pmc/multidispatch.t
==============================================================================
--- trunk/t/pmc/multidispatch.t Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/t/pmc/multidispatch.t Sat Feb 13 02:10:36 2010 (r43921)
@@ -9,7 +9,7 @@
use Test::More;
use Parrot::Test::Util 'create_tempfile';
-use Parrot::Test tests => 48;
+use Parrot::Test tests => 45;
=head1 NAME
@@ -239,88 +239,6 @@
42
OUTPUT
-pasm_output_is( <<'CODE', <<'OUTPUT', "PASM INTVAL - new result", todo => 'TT #452' );
-.include "datatypes.pasm"
- get_global P10, "Integer_bxor_Intval"
- add_multi "bitwise_xor_int", "Integer,INTVAL,PMC", P10
-
- new P1, ['Integer']
- set P1, 3
- bxor P9, P1, 2
- print P9
- print "\n"
- end
-.pcc_sub Integer_bxor_Intval:
- get_params "0,0,0", P5, I5, P6
- print "ok\n"
- set I10, P5
- bxor I11, I10, I5
- new P6, ['Integer']
- set P6, I11
- set_returns "0", P6
- returncc
-CODE
-ok
-1
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "PASM INTVAL - existing result", todo => 'TT #452' );
-.include "datatypes.pasm"
- get_global P10, "Integer_bxor_Intval"
- add_multi "bitwise_xor_int", "Integer,INTVAL,PMC", P10
-
- new P0, ['Integer']
- new P1, ['Integer']
- set P1, 3
- bxor P0, P1, 2
- print P0
- print "\n"
- end
-.pcc_sub Integer_bxor_Intval:
- get_params "0,0,0", P5, I5, P6
- print "ok\n"
- set I10, P5
- bxor I11, I10, I5
- set P6, I11
- set_returns "0", P6
- returncc
-CODE
-ok
-1
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "PASM INTVAL - mixed", todo => 'TT #452' );
-.include "datatypes.pasm"
- get_global P10, "Integer_bxor_Intval"
- add_multi "bitwise_xor_int", "Integer,INTVAL,PMC", P10
-
- new P0, ['Integer']
- new P1, ['Integer']
- set P1, 3
- bxor P0, P1, 2
- print P0
- print "\n"
- bxor P9, P1, 2
- print P9
- print "\n"
- end
-.pcc_sub Integer_bxor_Intval:
- get_params "0,0,0", P5, I5, P6
- print "ok\n"
- set I10, P5
- bxor I11, I10, I5
- new P6, ['Integer']
- set P6, I11
- set_returns "0", P6
- returncc
-
-CODE
-ok
-1
-ok
-1
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUT', "first dynamic MMD call" );
.sub main :main
Modified: trunk/t/pmc/string.t
==============================================================================
--- trunk/t/pmc/string.t Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/t/pmc/string.t Sat Feb 13 02:10:36 2010 (r43921)
@@ -230,7 +230,7 @@
new $P1, ['Float']
set $P1, 6.5
repeat $P2, $P0, $P1
- is( $P2, 'yyyyyy', 'Float arg to repeat' )
+ is( $P2, 'yyyyyy', 'Float arg to repeat' )
set $P0, "z"
new $P1, ['String']
@@ -256,7 +256,7 @@
new $P1, ['Float']
set $P1, 6.5
repeat $P3, $P0, $P1
- is( $P3, 'yyyyyy', 'Float arg to repeat' )
+ is( $P3, 'yyyyyy', 'Float arg to repeat' )
set $P0, "z"
new $P1, ['String']
@@ -1026,11 +1026,11 @@
# Get
$S0 = s[0]
is($S0, 'B', 'Get string by index')
-
+
$I0 = s[1]
$I1 = ord 'A'
is($I0, $I1, 'Get integer by index')
-
+
$P0 = s[2]
is($P0, 'R', 'Get PMC by index')
Modified: trunk/tools/dev/vtablize.pl
==============================================================================
--- trunk/tools/dev/vtablize.pl Fri Feb 12 21:03:49 2010 (r43920)
+++ trunk/tools/dev/vtablize.pl Sat Feb 13 02:10:36 2010 (r43921)
@@ -63,7 +63,6 @@
s/^(\s*)(PMC\s+\*get_pmc_keyed\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*get_pmc_keyed_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*get_pmc_keyed_str\(STRING\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*get_bignum\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*slice\(PMC\s+\*\w*,\s+INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+\*get_pointer\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+\*get_pointer_keyed\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
@@ -157,58 +156,12 @@
s/^(\s*)(void\s+i_cmodulus\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+i_cmodulus_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+i_cmodulus_float\(FLOATVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*pow\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*pow_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*pow_float\(FLOATVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_pow\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_pow_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_pow_float\(FLOATVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+increment\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+decrement\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*absolute\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+i_absolute\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*neg\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+i_neg\(\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_or\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_or_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_or\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_or_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_xor\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_xor_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_xor\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_xor_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_ors\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_ors_str\(STRING\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_ors\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_ors_str\(STRING\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_xors\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_xors_str\(STRING\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_xors\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_xors_str\(STRING\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_and\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_and_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_and\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_and_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_ands\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_ands_str\(STRING\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_ands\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_ands_str\(STRING\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_not\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_not\(\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_nots\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_nots\(\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_shl\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_shl_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_shl\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_shl_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_shr\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_shr_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_shr\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_shr_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_lsr\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*bitwise_lsr_int\(INTVAL\s+\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_lsr\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(void\s+i_bitwise_lsr_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(INTVAL\s+is_equal\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(INTVAL\s+is_equal_num\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(INTVAL\s+is_equal_string\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
More information about the parrot-commits
mailing list