The included patch requires a new file t/op/exceptions.t, which tests basic exception
handling, in this case divide-by-zero.
Patch was generated against latest CVS, but it shouldn't matter -that- much.
-Jeff
[EMAIL PROTECTED]
diff --recursive -C 2 parrot_cvs/MANIFEST parrot/MANIFEST
*** parrot_cvs/MANIFEST Wed Oct 24 07:36:57 2001
--- parrot/MANIFEST Wed Oct 24 07:37:22 2001
***
*** 108,111
--- 108,112
t/op/basic.t
t/op/bitwise.t
+ t/op/exception.t
t/op/integer.t
t/op/number.t
Only in parrot/: Makefile
diff --recursive -C 2 parrot_cvs/Parrot/Assembler.pm parrot/Parrot/Assembler.pm
*** parrot_cvs/Parrot/Assembler.pm Wed Oct 24 07:36:57 2001
--- parrot/Parrot/Assembler.pm Wed Oct 24 07:54:22 2001
***
*** 110,114
=cut
! my(%type_to_suffix)=('I'='i', 'N'='n',
'S'='s', 'P'='p',
'i'='ic', 'n'='nc',
--- 110,115
=cut
! my(%type_to_suffix)=('E'='e',
!'I'='i', 'N'='n',
'S'='s', 'P'='p',
'i'='ic', 'n'='nc',
***
*** 923,927
#
! if (m/^([INPS])\d+$/) { # a register.
push @arg_t,lc($1);
} elsif (m/^\[([a-z]+):(\d+)\s*\]$/) { # string constant
--- 924,928
#
! if (m/^([EINPS])\d+$/) { # a register.
push @arg_t,lc($1);
} elsif (m/^\[([a-z]+):(\d+)\s*\]$/) { # string constant
***
*** 945,949
#
! my @grep_ops = grep($_ =~ /^$opcode(?:_(?:(?:[ins]c?)|p))+$/, keys(%opcodes));
foreach my $op (@grep_ops) {
--- 946,950
#
! my @grep_ops = grep($_ =~ /^$opcode(?:_(?:(?:[eins]c?)|p))+$/, keys(%opcodes));
foreach my $op (@grep_ops) {
***
*** 1056,1059
--- 1057,1061
my %rtype_map = (
+ e = E,
i = I,
n = N,
***
*** 1092,1100
#
! if($rtype eq I || $rtype eq N || $rtype eq P || $rtype eq S) {
# its a register argument
! $args[$_] =~ s/^[INPS](\d+)$/$1/i
! or error(Expected m/[INPS]\\d+/, but got '$args[$_]'!, $file, $line);
error(Register $1 out of range (should be 0-31) in '$opcode',$file,$line) if
$1 0 or $1 31;
--- 1094,1102
#
! if($rtype eq E || $rtype eq I || $rtype eq N || $rtype eq P || $rtype eq
S) {
# its a register argument
! $args[$_] =~ s/^[EINPS](\d+)$/$1/i
! or error(Expected m/[EINPS]\\d+/, but got '$args[$_]'!, $file, $line);
error(Register $1 out of range (should be 0-31) in '$opcode',$file,$line) if
$1 0 or $1 31;
Only in parrot/Parrot: Config.pm
Only in parrot/Parrot: Types.pm
diff --recursive -C 2 parrot_cvs/Types_pm.in parrot/Types_pm.in
*** parrot_cvs/Types_pm.in Wed Oct 24 07:36:57 2001
--- parrot/Types_pm.in Wed Oct 24 07:39:58 2001
***
*** 35,38
--- 35,39
my %how_to_pack = (
+ E = $pack_type{op},
I = $pack_type{op},
i = $pack_type{op},
Only in parrot/classes: intclass.o
diff --recursive -C 2 parrot_cvs/config_h.in parrot/config_h.in
*** parrot_cvs/config_h.in Wed Oct 24 07:36:57 2001
--- parrot/config_h.in Wed Oct 24 07:53:11 2001
***
*** 24,31
--- 24,33
#define FRAMES_PER_PMC_REG_CHUNK FRAMES_PER_CHUNK
#define FRAMES_PER_NUM_REG_CHUNK FRAMES_PER_CHUNK
+ #define FRAMES_PER_EXC_REG_CHUNK FRAMES_PER_CHUNK
#define FRAMES_PER_INT_REG_CHUNK FRAMES_PER_CHUNK
#define FRAMES_PER_STR_REG_CHUNK FRAMES_PER_CHUNK
#define MASK_STACK_CHUNK_LOW_BITS ${stacklow}
+ #define MASK_EXC_CHUNK_LOW_BITS ${intlow}
#define MASK_INT_CHUNK_LOW_BITS ${intlow}
#define MASK_NUM_CHUNK_LOW_BITS ${numlow}
diff --recursive -C 2 parrot_cvs/core.ops parrot/core.ops
*** parrot_cvs/core.ops Wed Oct 24 07:36:57 2001
--- parrot/core.ops Wed Oct 24 07:56:30 2001
***
*** 120,123
--- 120,127
+ =item Bset(e, i)
+
+ =item Bset(i, e)
+
=item Bset(i, i)
***
*** 136,141
=cut
! AUTO_OP set(i, i|ic) {
$1 = $2;
}
--- 140,148
=cut
+ AUTO_OP set(e, i) {
+ $1 = $2;
+ }
! AUTO_OP set(i, e|i|ic) {
$1 = $2;
}
***
*** 684,688
AUTO_OP div(i, i|ic, i|ic) {
! $1 = $2 / $3;
}
--- 691,701
AUTO_OP div(i, i|ic, i|ic) {
! INTVAL z = $3;
!
! if(z == 0) {
! interpreter-exc_reg-registers[0] = 1;
! } else {
! $1 = $2 / $3;
! }
}
***
*** 1504,1507
--- 1517,1522
+ =item Bpope()
+
=item Bpopi()
***
*** 1517,1520
--- 1532,1539
=cut
+ AUTO_OP pope() {
+ Parrot_pop_e(interpreter);
+ }
+
AUTO_OP popi() {
Parrot_pop_i(interpreter);
***
*** 1536,1539
--- 1555,1560
+ =item