Operating System - HP-UX
1753922 Members
7460 Online
108810 Solutions
New Discussion

Strange behavior with long methods

 
nervilamax1
New Member

Strange behavior with long methods

Hi all

I have build 1.3.1 1.3.1.05-JPSE_1.3.1.05_20020425 PA2.0 on HP-UX PA RISC v11.11. It seems there is a very strange thing happening. I have 2 static methods in 2 different classes. First method calls the second method. The second method has many parameters but a particular long parameter behaves strangely.

I have
public static String method1(long parameter)
public static String method2(long parameter)

method 1 is simply calling method 2:

String s= Myclass.method2(1);

However, after some point the although I pass parameter value as 1, inside method 2 if I do a System.out.println the value of this parameter is 0 WIHTOUT any line changing this parameter.
I put

public static String method1(long parameter)
{
System.out.println(parameter);
String s = Myclass2.method2(parameter);
return s;
}


public static String method2(long parameter)
{
System.out.println(parameter);
//other logic
}

I get 1 printed in method1 then 0 printed in method2. These successive method calls are in the same thread, I am sure about this.
These methods are being run in a server application and are being called numerous times before the problem appears. This happens only with these 2 methods and it is intermittent when 2nd method is called with parameter =1. Because I thought the issue starts occurring after a while I thought the problem might appear because method2 is getting compiled and no longer running in interpreted mode, but I'm not able to prove it yet as 1.3.1.05 doesn't allow many VM options.
If I run java command line with -Xcomp parameter, I always (not intermittent) get the parameter changed to value 0 in method2 only the first time method2 is being called.After this, it works OK.In order to reproduce the issue again I either do a kill -HUP on the java process or restart the JVM.
I tried with JDK 1.3.1.20 and I cannot reproduce it yet, but a JDK upgrade would imply many regression testing. Parameter changing value all of a sudden doesn't make any sense, but it happens.

Are you aware of a such a bug in this JDK version with hotspot compiler?