Skip to content

Commit

Permalink
8283298: Make CodeCacheSegmentSize a product flag
Browse files Browse the repository at this point in the history
Reviewed-by: phh
Backport-of: 026b85303c01326bc49a1105a89853d7641fcd50
  • Loading branch information
Dmitry Chuyko authored and Paul Hohensee committed Oct 19, 2022
1 parent 2f2b914 commit fe4819b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/hotspot/share/interpreter/templateInterpreter.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
Expand Down Expand Up @@ -47,7 +47,11 @@ void TemplateInterpreter::initialize_stub() {
// allocate interpreter
int code_size = InterpreterCodeSize;
NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
_code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
// 270+ interpreter codelets are generated and each of them is required to be aligned to
// CodeEntryAlignment twice. So we need additional size due to alignment.
int max_aligned_codelets = 280;
int max_aligned_bytes = max_aligned_codelets * CodeEntryAlignment * 2;
_code = new StubQueue(new InterpreterCodeletInterface, code_size + max_aligned_bytes, NULL,
"Interpreter");
}

Expand Down
8 changes: 6 additions & 2 deletions src/hotspot/share/prims/methodHandles.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, 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
Expand Down Expand Up @@ -89,7 +89,11 @@ void MethodHandles::generate_adapters() {

ResourceMark rm;
TraceTime timer("MethodHandles adapters generation", TRACETIME_LOG(Info, startuptime));
_adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size);
// The adapter entry is required to be aligned to CodeEntryAlignment.
// So we need additional bytes due to alignment.
int adapter_num = (int)Interpreter::method_handle_invoke_LAST - (int)Interpreter::method_handle_invoke_FIRST + 1;
int max_aligned_bytes = adapter_num * CodeEntryAlignment;
_adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size + max_aligned_bytes);
CodeBuffer code(_adapter_code);
MethodHandlesAdapterGenerator g(&code);
g.generate();
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/globals.hpp
Expand Up @@ -1572,7 +1572,7 @@ const intx ObjectAlignmentInBytes = 8;
"Stack space (bytes) required for JVM_InvokeMethod to complete") \
\
/* code cache parameters */ \
develop_pd(uintx, CodeCacheSegmentSize, \
product_pd(uintx, CodeCacheSegmentSize, EXPERIMENTAL, \
"Code cache segment size (in bytes) - smallest unit of " \
"allocation") \
range(1, 1024) \
Expand Down

0 comments on commit fe4819b

Please sign in to comment.