Skip to main content

Does CVM_REMOTE_EXCEPTIONS_SUPPORTED works ?

2 replies [Last post]
gyu
Offline
Joined: 2007-06-03

Hello,

I have two questions on CVM_REMOTE_EXCEPTIONS_SUPPORTED.

Q1.

I write a test code for CVM_REMOTE_EXCEPTIONS_SUPPORTED as follows:

import sun.misc.CVM;

public class Hello extends Thread
{
private int countDown = 400;

public Hello(String s)
{
super(s);
}

public String toString()
{
return "#" + getName() + ": " + countDown;
}

public void run()
{
while (true)
{
System.out.println(this);
if (--countDown == 0) return;
}
}

public static void main(String[] args)
{
System.out.println("Hello RemoteException.");

Hello h = new Hello("Hello");
h.start();
System.out.println("RemoteException.");
try {
sleep(500);
CVM.throwRemoteException(h, new NullPointerException());
} catch (InterruptedException e) { };
System.out.println("Bye RemoteException.");
}

}

It shows abnormal behavior about one per ten trials.
( I have build cvm with CVM_JIT=false)

# bin/cvm Hello
Hello RemoteException.
RemoteException.
#Hello: 400
#Hello: 399
#Hello: 398
#Hello: 397
...
#Hello: 325
#Hello: 324
#Hello: 323
#Hello: 322#Hello: 322#Hello: 322Bye RemoteException.

That is, the same number 322 is printed three times at the end of execution.

Is there any bug in my test program?

or

CVM_REMOTE_EXCEPTIONS_SUPPORTED does not work in phoneme-advanced-mr1.

Q2.

Does phoneme-advanced-mr1 support CVM_REMOTE_EXCEPTIONS_SUPPORTED on CVM_JIT=true ?

Put it another way,

Is there any modification necessary for CVM_REMOTE_EXCEPTIONS_SUPPORTED to work on CVM_JIT=true?

Best Regards,
Brian

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gyu
Offline
Joined: 2007-06-03

The test is done on arm926ej-s.

The same test (except for increased countdown number 40000) show different behavior in x86 or MIPS or arm.

1. linux-x86 ( it ignores second parameter in CVM.throwRemoteException)

#Hello: 37646
#Hello: 37645
#Hello: 37644
#Hello: 37643
Bye RemoteException.

2. linux-mips (it works best)

#Hello: 39415
#Hello: 39414
#Hello: 39413
Bye RemoteException.
java.lang.NullPointerException
at Hello.main([Ljava/lang/String;)V(Hello.java:36)
at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;
)Ljava/lang/Object;(Method.java:316)
at sun.misc.CVM.runMain()V(CVM.java:478)

x86 and mips don't show abnormal behavior (i.e., printing same number three times on the end of execution).

So, here is additional question:

Is CVM_REMOTE_EXCEPTIONS_SUPPORTED is platform-dependent?

Where should I start to check for CVM_REMOTE_EXCEPTIONS_SUPPORTED to work well on linux-arm ?

- Brian

Message was edited by: gyu

cjplummer
Offline
Joined: 2006-10-16

Hi Brian,

CVM_REMOTE_EXCEPTIONS_SUPPORTED is not officially supported. It is off by default, and only enabled when LVM is enabled, and LVM is not supported.

There is no platform specific code that I know of. Differences you are seeing could be related to thread scheduling differences on the platforms. It could also be related to whether or not the JIT is enabled (see below). The JIT is off by default for x86, but enabled from ARM and MIPS.

The support that is in there for CVM_REMOTE_EXCEPTIONS_SUPPORTED does not support the JIT. You'll note the interpreter loop polls for remote exception. Generated JIT'd code does not do this, so the remote exception will not be noticed by JIT'd code.

Chris