cvsuser 04/04/21 04:06:13
Modified: jit/i386 core.jit
src string.c
Log:
quick fail unequal strings
Courtesy of Jeff Clites <[EMAIL PROTECTED]>
use string_equal in JIT/i386 (leo)
Revision Changes Path
1.53 +33 -18 parrot/jit/i386/core.jit
Index: core.jit
===================================================================
RCS file: /cvs/public/parrot/jit/i386/core.jit,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -w -r1.52 -r1.53
--- core.jit 10 Apr 2004 12:50:07 -0000 1.52
+++ core.jit 21 Apr 2004 11:06:07 -0000 1.53
@@ -1,7 +1,7 @@
;
; i386/core.jit
;
-; $Id: core.jit,v 1.52 2004/04/10 12:50:07 leo Exp $
+; $Id: core.jit,v 1.53 2004/04/21 11:06:07 leo Exp $
;
# TODO complete this
@@ -1209,7 +1209,7 @@
jit_emit_mov_mr_i(NATIVECODE, &STRING_REG[1], emit_EAX );
}
-TEMPLATE Parrot_eq_sx_sx_ic {
+TEMPLATE Parrot_cmp_sx_sx_ic {
# define push_r(i) \
jit_emit_mov_rm_i(NATIVECODE, emit_EAX, &SREG(i)); \
emitm_pushl_r(NATIVECODE, emit_EAX)
@@ -1222,7 +1222,22 @@
emitm_addb_i_r(NATIVECODE, 12, emit_ESP);
jit_emit_test_r_i(NATIVECODE, emit_EAX);
jit_emit_jcc(jit_info, <op>, *INT_CONST[3]);
+#undef push_r
+#undef push_c
+}
+TEMPLATE Parrot_eq_sx_sx_ic {
+# define push_r(i) \
+ jit_emit_mov_rm_i(NATIVECODE, emit_EAX, &SREG(i)); \
+ emitm_pushl_r(NATIVECODE, emit_EAX)
+# define push_c(i) emitm_pushl_i(NATIVECODE, CONST(i)->u.string)
+ push_<typ2>(2);
+ push_<typ1>(1);
+ emitm_pushl_i(NATIVECODE, interpreter);
+ call_func(jit_info, (void*)string_equal);
+ emitm_addb_i_r(NATIVECODE, 12, emit_ESP);
+ jit_emit_test_r_i(NATIVECODE, emit_EAX);
+ jit_emit_jcc(jit_info, <op>, *INT_CONST[3]);
#undef push_r
#undef push_c
}
@@ -1260,68 +1275,68 @@
}
Parrot_le_s_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jle/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jle/
}
Parrot_le_s_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jle/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jle/
}
Parrot_le_sc_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jle/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jle/
}
Parrot_le_sc_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jle/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jle/
}
Parrot_lt_s_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jl/
}
Parrot_lt_s_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jl/
}
Parrot_lt_sc_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jl/
}
Parrot_lt_sc_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jl/
}
Parrot_ge_s_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jnl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jnl/
}
Parrot_ge_s_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jnl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jnl/
}
Parrot_ge_sc_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jnl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jnl/
}
Parrot_ge_sc_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jnl/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jnl/
}
Parrot_gt_s_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jg/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/r/ s/<op>/emitm_jg/
}
Parrot_gt_s_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jg/
+ Parrot_cmp_sx_sx_ic s/<typ1>/r/ s/<typ2>/c/ s/<op>/emitm_jg/
}
Parrot_gt_sc_s_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jg/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/r/ s/<op>/emitm_jg/
}
Parrot_gt_sc_sc_ic {
- Parrot_eq_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jg/
+ Parrot_cmp_sx_sx_ic s/<typ1>/c/ s/<typ2>/c/ s/<op>/emitm_jg/
}
1.197 +4 -1 parrot/src/string.c
Index: string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -w -r1.196 -r1.197
--- string.c 19 Apr 2004 16:33:00 -0000 1.196
+++ string.c 21 Apr 2004 11:06:13 -0000 1.197
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: string.c,v 1.196 2004/04/19 16:33:00 leo Exp $
+$Id: string.c,v 1.197 2004/04/21 11:06:13 leo Exp $
=head1 NAME
@@ -1754,6 +1754,9 @@
}
else if (s1->strlen != s2->strlen) {
return 1; /* we don't care which is bigger */
+ }
+ else if (s1->hashval != s2->hashval && s1->hashval && s2->hashval) {
+ return 1;
}
else if (!s1->strlen && !s2->strlen) {
return 0;