diff --git a/src/hotspot/cpu/x86/methodHandles_x86.hpp b/src/hotspot/cpu/x86/methodHandles_x86.hpp index b158720ca87..8be6ec8ffe3 100644 --- a/src/hotspot/cpu/x86/methodHandles_x86.hpp +++ b/src/hotspot/cpu/x86/methodHandles_x86.hpp @@ -27,7 +27,7 @@ // Adapters enum /* platform_dependent_constants */ { - adapter_code_size = 6000 DEBUG_ONLY(+ 6000) + adapter_code_size = 8000 DEBUG_ONLY(+ 6000) }; // Additional helper methods for MethodHandles code generation: diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 78259157dfa..a0e0530427d 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -3644,7 +3644,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() { }; const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id); - CodeBuffer code(name, 1024, 64); + CodeBuffer code(name, 1024 + (UseAPX ? 1024 : 0), 64); MacroAssembler* masm = new MacroAssembler(&code); address start = __ pc(); diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index f82e96be6ae..05589f8cc4d 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -593,6 +593,10 @@ void CompilerConfig::ergo_initialize() { } #ifdef COMPILER2 + // Xcomp has no reasonable profiling information, enable inlining cold methods + if (Arguments::is_compiler_only() && FLAG_IS_DEFAULT(InlineColdMethods)) { + FLAG_SET_DEFAULT(InlineColdMethods, true); + } if (!EliminateLocks) { EliminateNestedLocks = false; } diff --git a/src/hotspot/share/opto/bytecodeInfo.cpp b/src/hotspot/share/opto/bytecodeInfo.cpp index 908fff22a77..b66b43c2a7e 100644 --- a/src/hotspot/share/opto/bytecodeInfo.cpp +++ b/src/hotspot/share/opto/bytecodeInfo.cpp @@ -295,32 +295,34 @@ bool InlineTree::should_not_inline(ciMethod* callee_method, ciMethod* caller_met return false; } - // don't use counts with -Xcomp - if (UseInterpreter) { - if (!callee_method->has_compiled_code() && - !callee_method->was_executed_more_than(0)) { - set_msg("never executed"); - return true; - } + // accept cold methods in CTW or -Xcomp + if (InlineColdMethods) { + return false; + } - if (is_init_with_ea(callee_method, caller_method, C)) { - // Escape Analysis: inline all executed constructors - return false; - } + if (!callee_method->has_compiled_code() && + !callee_method->was_executed_more_than(0)) { + set_msg("never executed"); + return true; + } - if (MinInlineFrequencyRatio > 0) { - int call_site_count = caller_method->scale_count(profile.count()); - int invoke_count = caller_method->interpreter_invocation_count(); - assert(invoke_count != 0, "require invocation count greater than zero"); - double freq = (double)call_site_count / (double)invoke_count; - // avoid division by 0, set divisor to at least 1 - int cp_min_inv = MAX2(1, CompilationPolicy::min_invocations()); - double min_freq = MAX2(MinInlineFrequencyRatio, 1.0 / cp_min_inv); - - if (freq < min_freq) { - set_msg("low call site frequency"); - return true; - } + if (is_init_with_ea(callee_method, caller_method, C)) { + // Escape Analysis: inline all executed constructors + return false; + } + + if (MinInlineFrequencyRatio > 0) { + int call_site_count = caller_method->scale_count(profile.count()); + int invoke_count = caller_method->interpreter_invocation_count(); + assert(invoke_count != 0, "require invocation count greater than zero"); + double freq = (double)call_site_count / (double)invoke_count; + // avoid division by 0, set divisor to at least 1 + int cp_min_inv = MAX2(1, CompilationPolicy::min_invocations()); + double min_freq = MAX2(MinInlineFrequencyRatio, 1.0 / cp_min_inv); + + if (freq < min_freq) { + set_msg("low call site frequency"); + return true; } } @@ -328,8 +330,8 @@ bool InlineTree::should_not_inline(ciMethod* callee_method, ciMethod* caller_met } bool InlineTree::is_not_reached(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile) { - if (!UseInterpreter) { - return false; // -Xcomp + if (InlineColdMethods) { + return false; // CTW or -Xcomp } if (profile.count() > 0) { return false; // reachable according to profile @@ -403,7 +405,7 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, } } - if (!UseInterpreter && + if (InlineColdMethods && is_init_with_ea(callee_method, caller_method, C)) { // Escape Analysis stress testing when running Xcomp: // inline constructors even if they are not reached. diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index fd55f2fd666..4ebc5baebe1 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -737,6 +737,11 @@ "high tier compiler") \ range(0, max_jint) \ \ + product(bool, InlineColdMethods, false, DIAGNOSTIC, \ + "Inline cold methods that would otherwise be rejected due to " \ + "cold profile counters. Useful for compiler testing to expose " \ + "more code to compilers.") \ + \ product(bool, IncrementalInline, true, \ "do post parse inlining") \ \ diff --git a/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java b/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java index 1951dbc925a..6748c3d03a4 100644 --- a/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java +++ b/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java @@ -529,7 +529,7 @@ private boolean issueCommand(String cmd) throws IOException, if (cmd.indexOf('\n') != -1 || cmd.indexOf('\r') != -1) { sun.net.ftp.FtpProtocolException ex = new sun.net.ftp.FtpProtocolException("Illegal FTP command"); - ex.initCause(new IllegalArgumentException("Illegal carriage return")); + ex.initCause(new IllegalArgumentException("Illegal carriage return or line feed")); throw ex; } sendServer(cmd + "\r\n"); diff --git a/src/java.base/share/classes/sun/net/smtp/SmtpClient.java b/src/java.base/share/classes/sun/net/smtp/SmtpClient.java index 73968ddf192..c8807b645b3 100644 --- a/src/java.base/share/classes/sun/net/smtp/SmtpClient.java +++ b/src/java.base/share/classes/sun/net/smtp/SmtpClient.java @@ -76,7 +76,7 @@ private void toCanonical(String s) throws IOException { public void to(String s) throws IOException { if (s.indexOf('\n') != -1 || s.indexOf('\r') != -1) { throw new IOException("Illegal SMTP command", - new IllegalArgumentException("Illegal carriage return")); + new IllegalArgumentException("Illegal carriage return or line feed")); } int st = 0; int limit = s.length(); @@ -122,7 +122,7 @@ else if (st == pos) public void from(String s) throws IOException { if (s.indexOf('\n') != -1 || s.indexOf('\r') != -1) { throw new IOException("Illegal SMTP command", - new IllegalArgumentException("Illegal carriage return")); + new IllegalArgumentException("Illegal carriage return or line feed")); } if (s.startsWith("<")) { issueCommand("mail from: " + s + "\r\n", 250); diff --git a/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c b/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c index 4022cb85bd4..86146ec7f18 100644 --- a/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c +++ b/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c @@ -1723,17 +1723,6 @@ jboolean ProcessPath(ProcessHandler* hnd, return JNI_TRUE; } -/* TODO Add checking of the result of the malloc/realloc functions to handle - * out of memory error and don't leak earlier allocated data - */ - - -#define ALLOC(ptr, type, n) \ - ptr = (type *)malloc((n)*sizeof(type)) -#define REALLOC(ptr, type, n) \ - ptr = (type *)realloc(ptr, (n)*sizeof(type)) - - struct _Edge; typedef struct _Point { @@ -1980,12 +1969,18 @@ void FillPolygon(ProcessHandler* hnd, if (n <=1) return; - ALLOC(yHash, Point*, hashSize); + yHash = (Point**) malloc(hashSize * sizeof(Point*)); + if (yHash == NULL) return; + for (k = 0; k < hashSize; k++) { yHash[k] = NULL; } - ALLOC(active, Edge, n); + active = (Edge*) malloc(n * sizeof(Edge)); + if (active == NULL) { + free(yHash); + return; + } /* Creating double linked list (prev, next links) describing path order and * hash table with points which fall between scanlines. nextByY link is diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/util.c b/src/jdk.jdwp.agent/share/native/libjdwp/util.c index 45de2ba7b7a..d8675499e31 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/util.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, 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 @@ -718,6 +718,10 @@ methodSignature(jmethodID method, error = JVMTI_FUNC_PTR(gdata->jvmti,GetMethodName) (gdata->jvmti, method, &name, &signature, &generic_signature); + if (error != JVMTI_ERROR_NONE) { + EXIT_ERROR(error, "GetMethodName failed"); + } + if ( pname != NULL ) { *pname = name; } else if ( name != NULL ) {