view test/compiler/6894807/IsInstanceTest.java @ 10988:cd54c7e92908

8015660: Test8009761.java "Failed: init recursive calls: 24. After deopt 25" Summary: Windows reserves and only partially commits thread stack. For detecting more thread stack space for execution, Windows installs one-shot page as guard page just before the current commited edge. It will trigger STACK_OVERFLOW_EXCEPTION when lands on last 4 pages of thread stack space. StackYellowPages default value is 2 on Windows (plus 1 page of StackRedPages, 3 pages guarded by hotspot) so the exception happens one page before Yellow pages. Same route executed second time will have one more page brought in, this leads same execution with different stack depth(interpreter mode). We need match Windows settings so the stack overflow exception will not happen before Yellow pages. Reviewed-by: dholmes Contributed-by: andreas.schoesser@sap.com
author minqi
date Tue, 18 Jun 2013 09:08:35 -0700
parents 495caa35b1b5
children
line wrap: on
line source

/*
 * @test
 * @bug 6894807
 * @summary No ClassCastException for HashAttributeSet constructors if run with -Xcomp
 * @compile IsInstanceTest.java
 * @run shell Test6894807.sh
*/

public class IsInstanceTest {

    public static void main(String[] args) {
        BaseInterface baseInterfaceImpl = new BaseInterfaceImpl();
        for (int i = 0; i < 100000; i++) {
            if (isInstanceOf(baseInterfaceImpl, ExtendedInterface.class)) {
                System.out.println("Failed at index:" + i);
                System.out.println("Arch: "+System.getProperty("os.arch", "")+
                                   " OS: "+System.getProperty("os.name", "")+
                                   " OSV: "+System.getProperty("os.version", "")+
                                   " Cores: "+Runtime.getRuntime().availableProcessors()+
                                   " JVM: "+System.getProperty("java.version", "")+" "+System.getProperty("sun.arch.data.model", ""));
                break;
            }
        }
        System.out.println("Done!");
    }

    public static boolean isInstanceOf(BaseInterface baseInterfaceImpl, Class... baseInterfaceClasses) {
        for (Class baseInterfaceClass : baseInterfaceClasses) {
            if (baseInterfaceClass.isInstance(baseInterfaceImpl)) {
                return true;
            }
        }
        return false;
    }

    private interface BaseInterface {
    }

    private interface ExtendedInterface extends BaseInterface {
    }

    private static class BaseInterfaceImpl implements BaseInterface {
    }
}