Mercurial > hg > truffle
changeset 12944:1327b7f85503
Merge
author | ccheung |
---|---|
date | Mon, 21 Oct 2013 17:26:46 -0700 |
parents | 996d1f2f056f (diff) 384c92148c68 (current diff) |
children | 662c154d2749 b8860472c377 a997d762fa20 |
files | |
diffstat | 29 files changed, 167 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/src/os/linux/ps_core.c Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/os/linux/ps_core.c Mon Oct 21 17:26:46 2013 -0700 @@ -719,7 +719,7 @@ ELF_PHDR* phbuf; ELF_PHDR* lib_php = NULL; - int page_size=sysconf(_SC_PAGE_SIZE); + int page_size = sysconf(_SC_PAGE_SIZE); if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) { return false; @@ -736,26 +736,29 @@ if (existing_map == NULL){ if (add_map_info(ph, lib_fd, lib_php->p_offset, - target_vaddr, lib_php->p_filesz) == NULL) { + target_vaddr, lib_php->p_memsz) == NULL) { goto err; } } else { + // Coredump stores value of p_memsz elf field + // rounded up to page boundary. + if ((existing_map->memsz != page_size) && (existing_map->fd != lib_fd) && - (existing_map->memsz != lib_php->p_filesz)){ + (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) { - print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)", - target_vaddr, lib_php->p_filesz, lib_php->p_flags); + print_debug("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n", + target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags); goto err; } /* replace PT_LOAD segment with library segment */ print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n", - existing_map->memsz, lib_php->p_filesz); + existing_map->memsz, ROUNDUP(lib_php->p_memsz, page_size)); existing_map->fd = lib_fd; existing_map->offset = lib_php->p_offset; - existing_map->memsz = lib_php->p_filesz; + existing_map->memsz = ROUNDUP(lib_php->p_memsz, page_size); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java Mon Oct 21 17:26:46 2013 -0700 @@ -51,6 +51,7 @@ private static int HAS_GENERIC_SIGNATURE; private static int HAS_METHOD_ANNOTATIONS; private static int HAS_PARAMETER_ANNOTATIONS; + private static int HAS_METHOD_PARAMETERS; private static int HAS_DEFAULT_ANNOTATIONS; private static int HAS_TYPE_ANNOTATIONS; @@ -70,6 +71,7 @@ HAS_GENERIC_SIGNATURE = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue(); HAS_METHOD_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_method_annotations").intValue(); HAS_PARAMETER_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_parameter_annotations").intValue(); + HAS_METHOD_PARAMETERS = db.lookupIntConstant("ConstMethod::_has_method_parameters").intValue(); HAS_DEFAULT_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_default_annotations").intValue(); HAS_TYPE_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_type_annotations").intValue(); @@ -85,6 +87,9 @@ // start of byte code bytecodeOffset = type.getSize(); + type = db.lookupType("MethodParametersElement"); + methodParametersElementSize = type.getSize(); + type = db.lookupType("CheckedExceptionElement"); checkedExceptionElementSize = type.getSize(); @@ -113,7 +118,7 @@ // start of bytecode private static long bytecodeOffset; - + private static long methodParametersElementSize; private static long checkedExceptionElementSize; private static long localVariableTableElementSize; private static long exceptionTableElementSize; @@ -387,6 +392,10 @@ return ret; } + private boolean hasMethodParameters() { + return (getFlags() & HAS_METHOD_PARAMETERS) != 0; + } + private boolean hasGenericSignature() { return (getFlags() & HAS_GENERIC_SIGNATURE) != 0; } @@ -442,11 +451,41 @@ return offsetOfLastU2Element(); } - private long offsetOfCheckedExceptionsLength() { + private long offsetOfMethodParametersLength() { + if (Assert.ASSERTS_ENABLED) { + Assert.that(hasMethodParameters(), "should only be called if table is present"); + } return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort : offsetOfLastU2Element(); } + private int getMethodParametersLength() { + if (hasMethodParameters()) + return (int) getAddress().getCIntegerAt(offsetOfMethodParametersLength(), 2, true); + else + return 0; + } + + // Offset of start of checked exceptions + private long offsetOfMethodParameters() { + long offset = offsetOfMethodParametersLength(); + long length = getMethodParametersLength(); + if (Assert.ASSERTS_ENABLED) { + Assert.that(length > 0, "should only be called if method parameter information is present"); + } + offset -= length * methodParametersElementSize; + return offset; + } + + private long offsetOfCheckedExceptionsLength() { + if (hasMethodParameters()) + return offsetOfMethodParameters() - sizeofShort; + else { + return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort : + offsetOfLastU2Element(); + } + } + private int getCheckedExceptionsLength() { if (hasCheckedExceptions()) { return (int) getAddress().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true); @@ -496,6 +535,8 @@ return offsetOfExceptionTable() - sizeofShort; } else if (hasCheckedExceptions()) { return offsetOfCheckedExceptions() - sizeofShort; + } else if (hasMethodParameters()) { + return offsetOfMethodParameters() - sizeofShort; } else { return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort : offsetOfLastU2Element(); @@ -526,6 +567,8 @@ } if (hasCheckedExceptions()) { return offsetOfCheckedExceptions() - sizeofShort; + } else if (hasMethodParameters()) { + return offsetOfMethodParameters() - sizeofShort; } else { return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort : offsetOfLastU2Element();
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Mon Oct 21 17:26:46 2013 -0700 @@ -51,8 +51,7 @@ public static void main(String[] args) { ClassLoaderStats cls = new ClassLoaderStats(); - cls.start(args); - cls.stop(); + cls.execute(args); } private static class ClassData {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Mon Oct 21 17:26:46 2013 -0700 @@ -54,8 +54,7 @@ public static void main(String[] args) { FinalizerInfo finfo = new FinalizerInfo(); - finfo.start(args); - finfo.stop(); + finfo.execute(args); } public void run() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Mon Oct 21 17:26:46 2013 -0700 @@ -54,7 +54,6 @@ public static void main(String[] args) { FlagDumper fd = new FlagDumper(); - fd.start(args); - fd.stop(); + fd.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Mon Oct 21 17:26:46 2013 -0700 @@ -80,8 +80,7 @@ } HeapDumper dumper = new HeapDumper(file); - dumper.start(args); - dumper.stop(); + dumper.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Mon Oct 21 17:26:46 2013 -0700 @@ -46,8 +46,7 @@ public static void main(String[] args) { HeapSummary hs = new HeapSummary(); - hs.start(args); - hs.stop(); + hs.execute(args); } public void run() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Mon Oct 21 17:26:46 2013 -0700 @@ -134,8 +134,7 @@ } JInfo jinfo = new JInfo(mode); - jinfo.start(args); - jinfo.stop(); + jinfo.execute(args); } private void printVMFlags() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java Mon Oct 21 17:26:46 2013 -0700 @@ -136,7 +136,9 @@ mode = MODE_HEAP_GRAPH_GXL; } else { System.err.println("unknown heap format:" + format); - return; + + // Exit with error status + System.exit(1); } } else { copyArgs = false; @@ -153,8 +155,7 @@ } JMap jmap = new JMap(mode); - jmap.start(args); - jmap.stop(); + jmap.execute(args); } public boolean writeHeapHprofBin(String fileName) {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Mon Oct 21 17:26:46 2013 -0700 @@ -64,7 +64,6 @@ public static void main(String[] args) { JSnap js = new JSnap(); - js.start(args); - js.stop(); + js.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Mon Oct 21 17:26:46 2013 -0700 @@ -89,8 +89,7 @@ } JStack jstack = new JStack(mixedMode, concurrentLocks); - jstack.start(args); - jstack.stop(); + jstack.execute(args); } private boolean mixedMode;
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Mon Oct 21 17:26:46 2013 -0700 @@ -61,7 +61,6 @@ public static void main(String[] args) { ObjectHistogram oh = new ObjectHistogram(); - oh.start(args); - oh.stop(); + oh.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Mon Oct 21 17:26:46 2013 -0700 @@ -69,7 +69,6 @@ public static void main(String[] args) throws Exception { PMap t = new PMap(); - t.start(args); - t.stop(); + t.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Mon Oct 21 17:26:46 2013 -0700 @@ -182,8 +182,7 @@ public static void main(String[] args) throws Exception { PStack t = new PStack(); - t.start(args); - t.stop(); + t.execute(args); } // -- Internals only below this point
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Mon Oct 21 17:26:46 2013 -0700 @@ -137,8 +137,7 @@ public static void main(String[] args) { StackTrace st = new StackTrace(); - st.start(args); - st.stop(); + st.execute(args); } private boolean verbose;
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Mon Oct 21 17:26:46 2013 -0700 @@ -58,7 +58,6 @@ public static void main(String[] args) { SysPropsDumper pd = new SysPropsDumper(); - pd.start(args); - pd.stop(); + pd.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Mon Oct 21 17:26:46 2013 -0700 @@ -26,6 +26,7 @@ import java.io.PrintStream; import java.util.Hashtable; + import sun.jvm.hotspot.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.debugger.*; @@ -105,26 +106,44 @@ public static void main(String[] args) { <derived class> obj = new <derived class>; - obj.start(args); + obj.execute(args); } */ - protected void stop() { + protected void execute(String[] args) { + int returnStatus = 1; + + try { + returnStatus = start(args); + } finally { + stop(); + } + + // Exit with 0 or 1 + System.exit(returnStatus); + } + + public void stop() { if (agent != null) { agent.detach(); } } - protected void start(String[] args) { + private int start(String[] args) { + if ((args.length < 1) || (args.length > 2)) { usage(); - return; + return 1; } // Attempt to handle -h or -help or some invalid flag - if (args[0].startsWith("-")) { + if (args[0].startsWith("-h")) { usage(); + return 0; + } else if (args[0].startsWith("-")) { + usage(); + return 1; } PrintStream err = System.err; @@ -154,6 +173,7 @@ default: usage(); + return 1; } agent = new HotSpotAgent(); @@ -191,15 +211,16 @@ break; } if (e.getMessage() != null) { - err.print(e.getMessage()); + err.println(e.getMessage()); e.printStackTrace(); } err.println(); - return; + return 1; } err.println("Debugger attached successfully."); startInternal(); + return 0; } // When using an existing JVMDebugger.
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java Mon Oct 21 17:26:46 2013 -0700 @@ -177,7 +177,6 @@ public static void main(String[] args) { ClassDump cd = new ClassDump(); - cd.start(args); - cd.stop(); + cd.execute(args); } }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Mon Oct 21 17:26:46 2013 -0700 @@ -42,8 +42,7 @@ public static void main(String[] args) { JSDB jsdb = new JSDB(); - jsdb.start(args); - jsdb.stop(); + jsdb.execute(args); } public void run() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Mon Oct 21 14:38:11 2013 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Mon Oct 21 17:26:46 2013 -0700 @@ -40,8 +40,7 @@ public class SOQL extends Tool { public static void main(String[] args) { SOQL soql = new SOQL(); - soql.start(args); - soql.stop(); + soql.execute(args); } public SOQL() {
--- a/make/windows/makefiles/trace.make Mon Oct 21 14:38:11 2013 -0700 +++ b/make/windows/makefiles/trace.make Mon Oct 21 17:26:46 2013 -0700 @@ -40,8 +40,7 @@ traceEventIds.hpp \ traceTypes.hpp - -!if "$(OPENJDK)" != "true" +!if EXISTS($(TraceAltSrcDir)) TraceGeneratedNames = $(TraceGeneratedNames) \ traceRequestables.hpp \ traceEventControl.hpp \ @@ -56,7 +55,7 @@ $(TraceOutDir)/traceEventIds.hpp \ $(TraceOutDir)/traceTypes.hpp -!if "$(OPENJDK)" != "true" +!if EXISTS($(TraceAltSrcDir)) TraceGeneratedFiles = $(TraceGeneratedFiles) \ $(TraceOutDir)/traceRequestables.hpp \ $(TraceOutDir)/traceEventControl.hpp \ @@ -68,7 +67,7 @@ XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \ $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod -!if "$(OPENJDK)" != "true" +!if EXISTS($(TraceAltSrcDir)) XML_DEPS = $(XML_DEPS) $(TraceAltSrcDir)/traceevents.xml !endif @@ -87,7 +86,7 @@ @echo Generating $@ @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceTypes.xsl -OUT $(TraceOutDir)/traceTypes.hpp -!if "$(OPENJDK)" == "true" +!if !EXISTS($(TraceAltSrcDir)) $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) @echo Generating OpenJDK $@
--- a/src/share/vm/interpreter/linkResolver.cpp Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/interpreter/linkResolver.cpp Mon Oct 21 17:26:46 2013 -0700 @@ -265,7 +265,7 @@ void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) { Method* result_oop = klass->uncached_lookup_method(name, signature); result = methodHandle(THREAD, result_oop); - while (!result.is_null() && result->is_static()) { + while (!result.is_null() && result->is_static() && result->method_holder()->super() != NULL) { klass = KlassHandle(THREAD, result->method_holder()->super()); result = methodHandle(THREAD, klass->uncached_lookup_method(name, signature)); }
--- a/src/share/vm/runtime/vmStructs.cpp Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/runtime/vmStructs.cpp Mon Oct 21 17:26:46 2013 -0700 @@ -1464,6 +1464,7 @@ declare_toplevel_type(CheckedExceptionElement) \ declare_toplevel_type(LocalVariableTableElement) \ declare_toplevel_type(ExceptionTableElement) \ + declare_toplevel_type(MethodParametersElement) \ \ declare_toplevel_type(ClassLoaderData) \ declare_toplevel_type(ClassLoaderDataGraph) \ @@ -2336,6 +2337,7 @@ declare_constant(ConstMethod::_has_localvariable_table) \ declare_constant(ConstMethod::_has_exception_table) \ declare_constant(ConstMethod::_has_generic_signature) \ + declare_constant(ConstMethod::_has_method_parameters) \ declare_constant(ConstMethod::_has_method_annotations) \ declare_constant(ConstMethod::_has_parameter_annotations) \ declare_constant(ConstMethod::_has_default_annotations) \
--- a/src/share/vm/services/diagnosticCommand.cpp Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/services/diagnosticCommand.cpp Mon Oct 21 17:26:46 2013 -0700 @@ -505,7 +505,11 @@ _jdp_pause ("jdp.pause", - "set com.sun.management.jdp.pause", "INT", false) + "set com.sun.management.jdp.pause", "INT", false), + + _jdp_name + ("jdp.name", + "set com.sun.management.jdp.name", "STRING", false) { _dcmdparser.add_dcmd_option(&_config_file); @@ -527,6 +531,7 @@ _dcmdparser.add_dcmd_option(&_jdp_source_addr); _dcmdparser.add_dcmd_option(&_jdp_ttl); _dcmdparser.add_dcmd_option(&_jdp_pause); + _dcmdparser.add_dcmd_option(&_jdp_name); } @@ -596,6 +601,7 @@ PUT_OPTION(_jdp_source_addr); PUT_OPTION(_jdp_ttl); PUT_OPTION(_jdp_pause); + PUT_OPTION(_jdp_name); #undef PUT_OPTION
--- a/src/share/vm/services/diagnosticCommand.hpp Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/services/diagnosticCommand.hpp Mon Oct 21 17:26:46 2013 -0700 @@ -302,6 +302,7 @@ DCmdArgument<char *> _jdp_source_addr; DCmdArgument<jlong> _jdp_ttl; DCmdArgument<jlong> _jdp_pause; + DCmdArgument<char *> _jdp_name; public: JMXStartRemoteDCmd(outputStream *output, bool heap_allocated);
--- a/src/share/vm/trace/traceEventClasses.xsl Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/trace/traceEventClasses.xsl Mon Oct 21 17:26:46 2013 -0700 @@ -23,8 +23,8 @@ --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +<xsl:import href="xsl_util.xsl"/> <xsl:output method="text" indent="no" omit-xml-declaration="yes"/> -<xsl:import href="xsl_util.xsl"/> <xsl:template match="/"> <xsl:call-template name="file-header"/>
--- a/src/share/vm/trace/traceEventIds.xsl Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/trace/traceEventIds.xsl Mon Oct 21 17:26:46 2013 -0700 @@ -23,8 +23,8 @@ --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +<xsl:import href="xsl_util.xsl"/> <xsl:output method="text" indent="no" omit-xml-declaration="yes"/> -<xsl:import href="xsl_util.xsl"/> <xsl:template match="/"> <xsl:call-template name="file-header"/>
--- a/src/share/vm/trace/traceTypes.xsl Mon Oct 21 14:38:11 2013 -0700 +++ b/src/share/vm/trace/traceTypes.xsl Mon Oct 21 17:26:46 2013 -0700 @@ -23,8 +23,8 @@ --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +<xsl:import href="xsl_util.xsl"/> <xsl:output method="text" indent="no" omit-xml-declaration="yes"/> -<xsl:import href="xsl_util.xsl"/> <xsl:template match="/"> <xsl:call-template name="file-header"/>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/runtime/8024804/RegisterNatives.java Mon Oct 21 17:26:46 2013 -0700 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8024804 + * @summary registerNatives() interface resolution should receive IAE + * @run main RegisterNatives + */ +public class RegisterNatives { + interface I { void registerNatives(); } + interface J extends I {} + static class B implements J { public void registerNatives() { System.out.println("B"); } } + public static void main(String... args) { + System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n"); + J val = new B(); + try { + val.registerNatives(); + } catch (IllegalAccessError e) { + System.out.println("TEST PASSES - according to current JVM spec, IAE expected\n"); + return; + } + System.out.println("TEST FAILS - no IAE resulted\n"); + System.exit(1); + } +}