cxbrooks / test

Second test for bugzilla to git
0 stars 0 forks source link

Codegen PointerTokens do not work on 64 bit Java because PointerToken assumes 32 bits #182

Open cxbrooks opened 15 years ago

cxbrooks commented 15 years ago

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#285 From: @cxbrooks Reported version: 7.1.devel CC: pt-dev@chess.eecs.berkeley.edu

cxbrooks commented 15 years ago

The problem is that running:

rm -rf ~/codegen java -classpath $PTII ptolemy.moml.MoMLSimpleApplication $PTII/ptolemy/codegen/c/actor/lib/jni/test/auto/SimplePassPointerWithECFATest.xml java -classpath $PTII ptolemy.moml.MoMLSimpleApplication $PTII/ptolemy/codegen/c/actor/lib/jni/test/auto/SimplePassPointerWithECFATest.xml

crashes the JVM on Sisyphus, our 64-bit Linux box.

I have reproduced the crash with Java 1.5.0_18, 1.5.0_19 and 1.6.0_14. The model works fine on 32-bit machines.

The problem is that the ptolemy.actor.lib.jni.PointerToken assumes that an int can be used to hold the value of a memory

/** The memory address of the pointer.
 */
private int _value;

When the above model is run, there are various warnings about casts.

I started down the path of fixing this, but it seems tricky.

For example, in PointerToken, should _value be an int or a long? It depends on the runtime environment, will the JVM be 32 bit or 64 bit? Should we have a Pointer32Token and a Pointer64Token?

BTW - This is a 64-Bit java: [bldmastr@ sisyphus ptII]$ java -version java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)

This is 32-bit: -bash-3.1$ /usr/java/jdk1.6.0/bin/java -version java version "1.6.0" Java(TM) SE Runtime Environment (build 1.6.0-b105) Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)