8295661: CompileTask::compile_id() should be passed as int

Reviewed-by: thartmann, dnsimon, never
This commit is contained in:
Damon Fenacci 2022-12-19 08:50:44 +00:00 committed by Tobias Hartmann
parent 86d588b035
commit 8e49fcdde4
9 changed files with 44 additions and 46 deletions

View file

@ -1226,7 +1226,7 @@ int ciEnv::comp_level() {
// ------------------------------------------------------------------
// ciEnv::compile_id
uint ciEnv::compile_id() {
int ciEnv::compile_id() {
if (task() == NULL) return 0;
return task()->compile_id();
}

View file

@ -366,7 +366,7 @@ public:
// Handy forwards to the task:
int comp_level(); // task()->comp_level()
uint compile_id(); // task()->compile_id()
int compile_id(); // task()->compile_id()
// Register the result of a compilation.
void register_method(ciMethod* target,

View file

@ -258,7 +258,7 @@ static unsigned int used_topSizeBlocks = 0;
static struct SizeDistributionElement* SizeDistributionArray = NULL;
static unsigned int latest_compilation_id = 0;
static int latest_compilation_id = 0;
static volatile bool initialization_complete = false;
const char* CodeHeapState::get_heapName(CodeHeap* heap) {
@ -659,27 +659,27 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular
prepare_SizeDistArray(out, nSizeDistElements, heapName);
latest_compilation_id = CompileBroker::get_compilation_id();
unsigned int highest_compilation_id = 0;
size_t usedSpace = 0;
size_t t1Space = 0;
size_t t2Space = 0;
size_t aliveSpace = 0;
size_t disconnSpace = 0;
size_t notentrSpace = 0;
size_t stubSpace = 0;
size_t freeSpace = 0;
size_t maxFreeSize = 0;
HeapBlock* maxFreeBlock = NULL;
bool insane = false;
int highest_compilation_id = 0;
size_t usedSpace = 0;
size_t t1Space = 0;
size_t t2Space = 0;
size_t aliveSpace = 0;
size_t disconnSpace = 0;
size_t notentrSpace = 0;
size_t stubSpace = 0;
size_t freeSpace = 0;
size_t maxFreeSize = 0;
HeapBlock* maxFreeBlock = NULL;
bool insane = false;
unsigned int n_methods = 0;
unsigned int n_methods = 0;
for (HeapBlock *h = heap->first_block(); h != NULL && !insane; h = heap->next_block(h)) {
unsigned int hb_len = (unsigned int)h->length(); // despite being size_t, length can never overflow an unsigned int.
size_t hb_bytelen = ((size_t)hb_len)<<log2_seg_size;
unsigned int ix_beg = (unsigned int)(((char*)h-low_bound)/granule_size);
unsigned int ix_end = (unsigned int)(((char*)h-low_bound+(hb_bytelen-1))/granule_size);
unsigned int compile_id = 0;
int compile_id = 0;
CompLevel comp_lvl = CompLevel_none;
compType cType = noComp;
blobType cbType = noType;
@ -1959,10 +1959,10 @@ void CodeHeapState::print_age(outputStream* out, CodeHeap* heap) {
granules_per_line = 128;
for (unsigned int ix = 0; ix < alloc_granules; ix++) {
print_line_delim(out, ast, low_bound, ix, granules_per_line);
unsigned int age1 = StatArray[ix].t1_age;
unsigned int age2 = StatArray[ix].t2_age;
unsigned int agex = StatArray[ix].tx_age;
unsigned int age = age1 > age2 ? age1 : age2;
int age1 = StatArray[ix].t1_age;
int age2 = StatArray[ix].t2_age;
int agex = StatArray[ix].tx_age;
int age = age1 > age2 ? age1 : age2;
age = age > agex ? age : agex;
print_age_single(ast, age);
}
@ -2247,9 +2247,7 @@ void CodeHeapState::print_blobType_legend(outputStream* out) {
}
void CodeHeapState::print_space_legend(outputStream* out) {
unsigned int indicator = 0;
unsigned int age_range = 256;
unsigned int range_beg = latest_compilation_id;
int range_beg = latest_compilation_id;
out->cr();
printBox(out, '-', "Space ranges, based on granule occupancy", NULL);
out->print_cr(" - 0%% == occupancy");
@ -2263,12 +2261,12 @@ void CodeHeapState::print_space_legend(outputStream* out) {
void CodeHeapState::print_age_legend(outputStream* out) {
unsigned int indicator = 0;
unsigned int age_range = 256;
unsigned int range_beg = latest_compilation_id;
int age_range = 256;
int range_beg = latest_compilation_id;
out->cr();
printBox(out, '-', "Age ranges, based on compilation id", NULL);
while (age_range > 0) {
out->print_cr(" %d - %6d to %6d", indicator, range_beg, latest_compilation_id - latest_compilation_id/age_range);
out->print_cr(" %u - %6d to %6d", indicator, range_beg, latest_compilation_id - latest_compilation_id/age_range);
range_beg = latest_compilation_id - latest_compilation_id/age_range;
age_range /= 2;
indicator += 1;
@ -2293,9 +2291,9 @@ void CodeHeapState::print_space_single(outputStream* out, unsigned short space)
out->print("%c", fraction);
}
void CodeHeapState::print_age_single(outputStream* out, unsigned int age) {
void CodeHeapState::print_age_single(outputStream* out, int age) {
unsigned int indicator = 0;
unsigned int age_range = 256;
int age_range = 256;
if (age > 0) {
while ((age_range > 0) && (latest_compilation_id-age > latest_compilation_id/age_range)) {
age_range /= 2;

View file

@ -88,7 +88,7 @@ class CodeHeapState : public CHeapObj<mtCode> {
static void print_blobType_single(outputStream *ast, u2 /* blobType */ type);
static void print_count_single(outputStream *ast, unsigned short count);
static void print_space_single(outputStream *ast, unsigned short space);
static void print_age_single(outputStream *ast, unsigned int age);
static void print_age_single(outputStream *ast, int age);
static void print_line_delim(outputStream* out, bufferedStream *sst, char* low_bound, unsigned int ix, unsigned int gpl);
static void print_line_delim(outputStream* out, outputStream *sst, char* low_bound, unsigned int ix, unsigned int gpl);
static blobType get_cbType(CodeBlob* cb);
@ -119,9 +119,9 @@ class CodeHeapState : public CHeapObj<mtCode> {
class StatElement : public CHeapObj<mtCode> {
public:
// A note on ages: The compilation_id easily overflows unsigned short in large systems
unsigned int t1_age; // oldest compilation_id of tier1 nMethods.
unsigned int t2_age; // oldest compilation_id of tier2 nMethods.
unsigned int tx_age; // oldest compilation_id of inactive/not entrant nMethods.
int t1_age; // oldest compilation_id of tier1 nMethods.
int t2_age; // oldest compilation_id of tier2 nMethods.
int tx_age; // oldest compilation_id of inactive/not entrant nMethods.
unsigned short t1_space; // in units of _segment_size to "prevent" overflow
unsigned short t2_space; // in units of _segment_size to "prevent" overflow
unsigned short tx_space; // in units of _segment_size to "prevent" overflow

View file

@ -1566,7 +1566,7 @@ int CompileBroker::assign_compile_id(const methodHandle& method, int osr_bci) {
// CompileBroker::assign_compile_id_unlocked
//
// Public wrapper for assign_compile_id that acquires the needed locks
uint CompileBroker::assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci) {
int CompileBroker::assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci) {
MutexLocker locker(thread, MethodCompileQueue_lock);
return assign_compile_id(method, osr_bci);
}
@ -2109,7 +2109,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
}
// Common flags.
uint compile_id = task->compile_id();
int compile_id = task->compile_id();
int osr_bci = task->osr_bci();
bool is_osr = (osr_bci != standard_entry_bci);
bool should_log = (thread->log() != NULL);
@ -2432,7 +2432,7 @@ void CompileBroker::update_compile_perf_data(CompilerThread* thread, const metho
void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task) {
bool success = task->is_success();
methodHandle method (thread, task->method());
uint compile_id = task->compile_id();
int compile_id = task->compile_id();
bool is_osr = (task->osr_bci() != standard_entry_bci);
const int comp_level = task->comp_level();
CompilerCounters* counters = thread->counters();

View file

@ -312,10 +312,10 @@ public:
TRAPS);
// Acquire any needed locks and assign a compile id
static uint assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci);
static int assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci);
static void compiler_thread_loop();
static uint get_compilation_id() { return _compilation_id; }
static int get_compilation_id() { return _compilation_id; }
// Set _should_block.
// Call this from the VM, with Threads_lock held and a safepoint requested.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -76,7 +76,7 @@ class CompileTask : public CHeapObj<mtCompiler> {
private:
static CompileTask* _task_free_list;
Monitor* _lock;
uint _compile_id;
int _compile_id;
Method* _method;
jobject _method_holder;
int _osr_bci;

View file

@ -577,7 +577,7 @@
<Event name="Compilation" category="Java Virtual Machine, Compiler" label="Compilation"
description="Results of method compilation attempts"
thread="true">
<Field type="uint" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="int" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="CompilerType" name="compiler" label="Compiler" />
<Field type="Method" name="method" label="Method" />
<Field type="ushort" name="compileLevel" label="Compilation Level" />
@ -591,7 +591,7 @@
description="Describes various phases of the compilation process like inlining or string optimization related phases"
thread="true">
<Field type="CompilerPhaseType" name="phase" label="Compile Phase" />
<Field type="uint" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="int" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="ushort" name="phaseLevel" label="Phase Level" />
</Event>
@ -599,7 +599,7 @@
description="In case a JIT compilation failed, a compilation failure is triggered, reporting the reason"
thread="true" startTime="false">
<Field type="string" name="failureMessage" label="Failure Message" />
<Field type="uint" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="int" name="compileId" label="Compilation Identifier" relation="CompileId" />
</Event>
<Type name="CalleeMethod">
@ -611,7 +611,7 @@
<Event name="CompilerInlining" category="Java Virtual Machine, Compiler, Optimization" label="Method Inlining"
description="Describes the result of a method inlining attempt"
thread="true" startTime="false">
<Field type="uint" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="int" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="Method" name="caller" label="Caller Method" />
<Field type="CalleeMethod" name="callee" struct="true" label="Callee Method" />
<Field type="boolean" name="succeeded" label="Succeeded" />
@ -637,7 +637,7 @@
<Event name="Deoptimization" category="Java Virtual Machine, Compiler" label="Deoptimization"
description="Describes the detection of an uncommon situation in a compiled method which may lead to deoptimization of the method"
thread="true" stackTrace="true" startTime="false">
<Field type="uint" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="int" name="compileId" label="Compilation Identifier" relation="CompileId" />
<Field type="CompilerType" name="compiler" label="Compiler" />
<Field type="Method" name="method" label="Method" />
<Field type="int" name="lineNumber" label="Line Number" />

View file

@ -1066,7 +1066,7 @@
nonstatic_field(CompileTask, _method, Method*) \
nonstatic_field(CompileTask, _osr_bci, int) \
nonstatic_field(CompileTask, _comp_level, int) \
nonstatic_field(CompileTask, _compile_id, uint) \
nonstatic_field(CompileTask, _compile_id, int) \
nonstatic_field(CompileTask, _num_inlined_bytecodes, int) \
nonstatic_field(CompileTask, _next, CompileTask*) \
nonstatic_field(CompileTask, _prev, CompileTask*) \