double call on array store; possible bug in branch front end?
Adam Megacz
gcj@lists.megacz.com
Sun Mar 10 15:34:00 GMT 2002
I've been banging my head against the wall all day over
this.... Observe the two Java snippets below, (CASE1 and CASE2). The
only difference is that CASE 2 assigns the return value to an array
element.
For some strange reason, the disassembly for CASE2 includes *two*
calls to generateFunctionICode. When you run it, it actually invokes
the method twice. I'm using -O0 on mingw/i86, 3.1 branch from two days
ago, plus the two patches for the two outstanding mingw PRs and the
pending patch to boehm-gc.
Is this a bug? If it is likely to be a bug, I can construct a small
test case, but that's likely to require a good bit of work (this is
deep down in the guts of Rhino, the Mozilla JS compiler), so I'd
appreciate a little bit of pre-screening before I go through the
effort (thanks).
- a
______________________________________________________________________________
CASE 1:
private void generateNestedFunctions(Scriptable scope,
Context cx,
Object securityDomain)
{
new Interpreter().generateFunctionICode(cx, scope,
(FunctionNode)itsFunctionList.elementAt(0),
securityDomain);
}
00000812 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE>:
812: 55 push %ebp
813: 89 e5 mov %esp,%ebp
815: 53 push %ebx
816: 83 ec 24 sub 0ドルx24,%esp
819: c7 04 24 c0 04 00 00 movl 0ドルx4c0,(%esp,1)
820: c7 44 24 04 44 00 00 movl 0ドルx44,0x4(%esp,1)
827: 00
828: e8 00 00 00 00 call 82d <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x1b>
82d: 89 c3 mov %eax,%ebx
82f: 89 1c 24 mov %ebx,(%esp,1)
832: e8 d3 f2 00 00 call fb0a <__ZN3org7mozilla10javascript11InterpreterC1Ev>
837: 89 5d f8 mov %ebx,0xfffffff8(%ebp)
83a: 83 7d f8 00 cmpl 0ドルx0,0xfffffff8(%ebp)
83e: 75 05 jne 845 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x33>
840: e8 00 00 00 00 call 845 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x33>
845: 8b 45 08 mov 0x8(%ebp),%eax
848: 8b 40 14 mov 0x14(%eax),%eax
84b: 8b 10 mov (%eax),%edx
84d: 81 c2 a4 00 00 00 add 0ドルxa4,%edx
853: 89 04 24 mov %eax,(%esp,1)
856: c7 44 24 04 00 00 00 movl 0ドルx0,0x4(%esp,1)
85d: 00
85e: 8b 02 mov (%edx),%eax
860: ff d0 call *%eax
862: c7 04 24 00 00 00 00 movl 0ドルx0,(%esp,1)
869: 89 44 24 04 mov %eax,0x4(%esp,1)
86d: e8 00 00 00 00 call 872 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x60>
872: 89 c2 mov %eax,%edx
874: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
877: 89 04 24 mov %eax,(%esp,1)
87a: 8b 45 10 mov 0x10(%ebp),%eax
87d: 89 44 24 04 mov %eax,0x4(%esp,1)
881: 8b 45 0c mov 0xc(%ebp),%eax
884: 89 44 24 08 mov %eax,0x8(%esp,1)
888: 89 54 24 0c mov %edx,0xc(%esp,1)
88c: 8b 45 14 mov 0x14(%ebp),%eax
88f: 89 44 24 10 mov %eax,0x10(%esp,1)
893: e8 06 00 00 00 call 89e <__ZN3org7mozilla10javascript11Interpreter21generateFunctionICodeEPNS1_7ContextEPNS1_10ScriptableEPNS1_12FunctionNodeEPN4java4lang6ObjectE>
898: 83 c4 24 add 0ドルx24,%esp
89b: 5b pop %ebx
89c: 5d pop %ebp
89d: c3 ret
______________________________________________________________________________
CASE 2:
private void generateNestedFunctions(Scriptable scope,
Context cx,
Object securityDomain)
{
itsNestedFunctions[0] = new Interpreter().generateFunctionICode(cx, scope,
(FunctionNode)itsFunctionList.elementAt(0),
securityDomain);
}
00000812 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE>:
812: 55 push %ebp
813: 89 e5 mov %esp,%ebp
815: 53 push %ebx
816: 83 ec 24 sub 0ドルx24,%esp
819: 8b 45 08 mov 0x8(%ebp),%eax
81c: 8b 40 34 mov 0x34(%eax),%eax
81f: 89 45 f8 mov %eax,0xfffffff8(%ebp)
822: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
825: 83 78 08 00 cmpl 0ドルx0,0x8(%eax)
829: 75 0c jne 837 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x25>
82b: c7 04 24 00 00 00 00 movl 0ドルx0,(%esp,1)
832: e8 00 00 00 00 call 837 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x25>
837: c7 04 24 c0 04 00 00 movl 0ドルx4c0,(%esp,1)
83e: c7 44 24 04 44 00 00 movl 0ドルx44,0x4(%esp,1)
845: 00
846: e8 00 00 00 00 call 84b <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x39>
84b: 89 c3 mov %eax,%ebx
84d: 89 1c 24 mov %ebx,(%esp,1)
850: e8 35 f3 00 00 call fb8a <__ZN3org7mozilla10javascript11InterpreterC1Ev>
855: 89 5d f4 mov %ebx,0xfffffff4(%ebp)
858: 83 7d f4 00 cmpl 0ドルx0,0xfffffff4(%ebp)
85c: 75 05 jne 863 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x51>
85e: e8 00 00 00 00 call 863 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x51>
863: 8b 45 08 mov 0x8(%ebp),%eax
866: 8b 40 14 mov 0x14(%eax),%eax
869: 8b 10 mov (%eax),%edx
86b: 81 c2 a4 00 00 00 add 0ドルxa4,%edx
871: 89 04 24 mov %eax,(%esp,1)
874: c7 44 24 04 00 00 00 movl 0ドルx0,0x4(%esp,1)
87b: 00
87c: 8b 02 mov (%edx),%eax
87e: ff d0 call *%eax
880: 89 45 f0 mov %eax,0xfffffff0(%ebp)
883: c7 04 24 00 00 00 00 movl 0ドルx0,(%esp,1)
88a: 8b 55 f0 mov 0xfffffff0(%ebp),%edx
88d: 89 54 24 04 mov %edx,0x4(%esp,1)
891: e8 00 00 00 00 call 896 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0x84>
896: 89 c2 mov %eax,%edx
898: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
89b: 89 04 24 mov %eax,(%esp,1)
89e: 8b 45 10 mov 0x10(%ebp),%eax
8a1: 89 44 24 04 mov %eax,0x4(%esp,1)
8a5: 8b 45 0c mov 0xc(%ebp),%eax
8a8: 89 44 24 08 mov %eax,0x8(%esp,1)
8ac: 89 54 24 0c mov %edx,0xc(%esp,1)
8b0: 8b 45 14 mov 0x14(%ebp),%eax
8b3: 89 44 24 10 mov %eax,0x10(%esp,1)
8b7: e8 60 00 00 00 call 91c <__ZN3org7mozilla10javascript11Interpreter21generateFunctionICodeEPNS1_7ContextEPNS1_10ScriptableEPNS1_12FunctionNodeEPN4java4lang6ObjectE>
8bc: 8b 55 f8 mov 0xfffffff8(%ebp),%edx
8bf: 89 14 24 mov %edx,(%esp,1)
8c2: 89 44 24 04 mov %eax,0x4(%esp,1)
8c6: e8 00 00 00 00 call 8cb <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0xb9>
8cb: 83 7d f4 00 cmpl 0ドルx0,0xfffffff4(%ebp)
8cf: 75 05 jne 8d6 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0xc4>
8d1: e8 00 00 00 00 call 8d6 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0xc4>
8d6: c7 04 24 00 00 00 00 movl 0ドルx0,(%esp,1)
8dd: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
8e0: 89 44 24 04 mov %eax,0x4(%esp,1)
8e4: e8 00 00 00 00 call 8e9 <__ZN3org7mozilla10javascript11Interpreter23generateNestedFunctionsEPNS1_10ScriptableEPNS1_7ContextEPN4java4lang6ObjectE+0xd7>
8e9: 89 c2 mov %eax,%edx
8eb: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
8ee: 89 04 24 mov %eax,(%esp,1)
8f1: 8b 45 10 mov 0x10(%ebp),%eax
8f4: 89 44 24 04 mov %eax,0x4(%esp,1)
8f8: 8b 45 0c mov 0xc(%ebp),%eax
8fb: 89 44 24 08 mov %eax,0x8(%esp,1)
8ff: 89 54 24 0c mov %edx,0xc(%esp,1)
903: 8b 45 14 mov 0x14(%ebp),%eax
906: 89 44 24 10 mov %eax,0x10(%esp,1)
90a: e8 0d 00 00 00 call 91c <__ZN3org7mozilla10javascript11Interpreter21generateFunctionICodeEPNS1_7ContextEPNS1_10ScriptableEPNS1_12FunctionNodeEPN4java4lang6ObjectE>
90f: 8b 55 f8 mov 0xfffffff8(%ebp),%edx
912: 89 42 0c mov %eax,0xc(%edx)
915: 83 c4 24 add 0ドルx24,%esp
918: 5b pop %ebx
919: 5d pop %ebp
91a: c3 ret
91b: 90 nop
More information about the Java
mailing list