This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: Calling Wrong Method
- To: Tom Tromey <tromey at cygnus dot com>
- Subject: Re: Calling Wrong Method
- From: "Gregory R. Warnes" <warnes at biostat dot washington dot edu>
- Date: Fri, 19 May 2000 15:30:34 +0000 (GMT)
- cc: Bryce McKinlay <bryce at albatross dot co dot nz>, Jeff Sturm <jsturm at sigma6 dot com>, gcj Discussion List <java-discuss at sourceware dot cygnus dot com>
Hmmm. I just recompiled and the error vanished. My code now runs
perfectly, and is sooo much faster than any of the JIT's.
-Greg
On Fri, 19 May 2000, Gregory R. Warnes wrote:
GRW>>
GRW>> OK, I hardcoded all of the stull I was using gnuopt to set and ran the
GRW>> program under gdb. Now I have something *really*wierd* happening....
GRW>>
GRW>> Method calls are being resolved to the WRONG METHOD !!!
GRW>>
GRW>> When the code reaches
GRW>> org.omegahat.Simulation.MCMC.Dissertation.Paper1.OneModeTarget.trueCov,
GRW>> which is
GRW>>
GRW>> public double[][] trueCov()
GRW>> {
GRW>> return ((MVNormal) target).getCovariance();
GRW>> }
GRW>>
GRW>> The call ends up in:
GRW>>
GRW>> org.omegahat.Probability.Distributions.MVNormal.PDF (this=@81fd580,
GRW>> x=@8223420, mean=@82208c0, cov=@c)
GRW>>
GRW>> public double PDF( double[] x, double[] mean, double[][] cov )
GRW>> {
GRW>> checkConformity( x, mean, cov );
GRW>>
GRW>> return dnorm(x,mean,cov);
GRW>> }
GRW>>
GRW>>
GRW>> This is the WRONG METHOD! Correct class, wrong name, wrong arguments.
GRW>>
GRW>> BTW, I get the same method call problem when I'm not running under gdb.
GRW>> I can tell because checkConformity() checks its arguments, which are trash
GRW>> and throws a RuntimeException resulting in a core dump and stack trace.
GRW>>
GRW>>
GRW>> My only guess is that I'm overloading something in the compiler because
GRW>> I'm doing a single massive compile command, passing all of the source
GRW>> files to gcj at once.
GRW>>
GRW>> I'm working on getting my stuff packed up so you can have the actual code
GRW>> to work on....
GRW>>
GRW>> -Greg
GRW>>
GRW>>
GRW>> ------------ GDB Backtrace
GRW>>
GRW>> #0 org.omegahat.Probability.Distributions.MVNormal.PDF (this=@81fd580,
GRW>> x=@8223420, mean=@82208c0, cov=@c) at
GRW>> Probability/Distributions/MVNormal.java:394
GRW>> #1 0x807852d in
GRW>> org.omegahat.Simulation.MCMC.Dissertation.Paper1.OneModeTarget.trueCov
GRW>> () at
GRW>> org/omegahat/Simulation/MCMC/Dissertation/Paper1/OneModeTarget.java:46
GRW>> #2 0x8080442 in
GRW>> org.omegahat.Simulation.MCMC.Dissertation.Paper1.Simulate.setupTarget
GRW>> () at org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:499
GRW>> #3 0x80789f9 in
GRW>> org.omegahat.Simulation.MCMC.Dissertation.Paper1.Simulate.Simulate () at
GRW>> org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:974
GRW>> #4 0x80799a6 in
GRW>> org.omegahat.Simulation.MCMC.Dissertation.Paper1.Simulate.main () at
GRW>> org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:1040
GRW>> #5 0x4014dec5 in gnu::gcj::runtime::FirstThread::run (this=@81a5ea0) at
GRW>> ../../../libgcj/libjava/gnu/gcj/runtime/natFirstThread.cc:146
GRW>> #6 0x40158a2b in java::lang::Thread::run_ (obj=@81a5ea0) at
GRW>> ../../../libgcj/libjava/java/lang/natThread.cc:263
GRW>> #7 0x40168e7e in _Jv_ThreadStart (thread=@81a5ea0, meth=0x40158860
GRW>> <java::lang::Thread::run_(java::lang::Object *) at
GRW>> ../../../libgcj/libjava/java/lang/natThread.cc:205>) at
GRW>> ../../../libgcj/libjava/no-threads.cc:28
GRW>> #8 0x40158b60 in java::lang::Thread::start (this=@81a5ea0) at
GRW>> ../../../libgcj/libjava/java/lang/natThread.cc:294
GRW>> #9 0x400afd8c in JvRunMain (klass=@814cc80, argc=1, argv=@bffff6e4) at
GRW>> ../../../libgcj/libjava/prims.cc:867
GRW>> #10 0x812d9cd in main (argc=1, argv=@bffff6e4) at /tmp/ccveHkVGmain.i:11
GRW>>
GRW>>
GRW>> ------------- Runtime Exception
GRW>>
GRW>> hydra:~/sandbox> ./Simulate
GRW>> Started at: Fri May 19 14:14:50 GMT 2000
GRW>> java.lang.RuntimeException: Object passed to PDF does not conform to
GRW>> length of mean vector.
GRW>> at 0x400fccf4: java::lang::Throwable::Throwable(java::lang::String
GRW>> *) (/usr/lib/libgcj.so.1)
GRW>> at 0x400f0561: java::lang::Exception::Exception(java::lang::String
GRW>> *) (/usr/lib/libgcj.so.1)
GRW>> at
GRW>> 0x400f5089: java::lang::RuntimeException::RuntimeException(java::lang::String
GRW>> *) (/usr/lib/libgcj.so.1)
GRW>> at
GRW>> 0x0805f3f5: org::omegahat::Probability::Distributions::MVNormal::checkConformity(JArray<double>
GRW>> *, JArray<double> *, JArray<JArray<double> *>
GRW>> *) (/home/warnes/sandbox/Probability/Distributions/MVNormal.java:379)
GRW>> at
GRW>> 0x0805f4be: org::omegahat::Probability::Distributions::MVNormal::PDF(JArray<double>
GRW>> *, JArray<double> *, JArray<JArray<double> *>
GRW>> *) (/home/warnes/sandbox/Probability/Distributions/MVNormal.java:394)
GRW>> at
GRW>> 0x0807852d: org::omegahat::Simulation::MCMC::Dissertation::Paper1::OneModeTarget::trueCov(void) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/OneModeTarget.java:46)
GRW>> at
GRW>> 0x08080442: org::omegahat::Simulation::MCMC::Dissertation::Paper1::Simulate::setupTarget(void) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:499)
GRW>> at
GRW>> 0x080789f9: org::omegahat::Simulation::MCMC::Dissertation::Paper1::Simulate::Simulate(JArray<java::lang::String
GRW>> *>
GRW>> *) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:974)
GRW>> at
GRW>> 0x080799a6: org::omegahat::Simulation::MCMC::Dissertation::Paper1::Simulate::main(JArray<java::lang::String
GRW>> *>
GRW>> *) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:1040)
GRW>> at
GRW>> 0x4014dec5: gnu::gcj::runtime::FirstThread::run(void) (/usr/lib/libgcj.so.1)
GRW>> at 0x40158a2b: java::lang::Thread::run_(java::lang::Object
GRW>> *) (/usr/lib/libgcj.so.1)
GRW>> at 0x40168e7e: _Jv_ThreadStart(java::lang::Thread *, int *, void
GRW>> (*)(java::lang::Thread *)) (/usr/lib/libgcj.so.1)
GRW>> at 0x40158b60: java::lang::Thread::start(void) (/usr/lib/libgcj.so.1)
GRW>> at 0x400afd8c: JvRunMain (/usr/lib/libgcj.so.1)
GRW>> at 0x0812d9cd: main (/tmp/ccveHkVGmain.i:11)
GRW>> at 0x4028ba42: __libc_start_main (/lib/libc.so.6)
GRW>> at 0x0804c501: _start (??:0)
GRW>>
GRW>>
GRW>>
GRW>>
GRW>>
GRW>>
GRW>>
GRW>>
GRW>>