Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/hotspot/share/c1/c1_Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "c1/c1_ValueMap.hpp"
#include "c1/c1_ValueStack.hpp"
#include "code/debugInfoRec.hpp"
#include "compiler/abstractCompiler.hpp"
#include "compiler/compilationFailureInfo.hpp"
#include "compiler/compilationMemoryStatistic.hpp"
#include "compiler/compilerDirectives.hpp"
Expand All @@ -42,6 +43,7 @@
#include "memory/resourceArea.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/timerTrace.hpp"
#include "utilities/debug.hpp"

typedef enum {
_t_compile,
Expand Down Expand Up @@ -734,3 +736,9 @@ Interval* find_interval(int reg_num) {
}

#endif // NOT PRODUCT

#ifdef ASSERT
void Compilation::check_current_compiler_c1() {
assert(CompilerThread::current()->compiler()->is_c1(), "Not on C1");
}
#endif // ASSERT
3 changes: 3 additions & 0 deletions src/hotspot/share/c1/c1_Compilation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class Compilation: public StackObj {
CFGPrinterOutput* _cfg_printer_output;
#endif // PRODUCT

static void check_current_compiler_c1() NOT_DEBUG({});

public:
// creation
Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
Expand All @@ -130,6 +132,7 @@ class Compilation: public StackObj {


static Compilation* current() {
check_current_compiler_c1();
return (Compilation*) ciEnv::current()->compiler_data();
}

Expand Down
8 changes: 8 additions & 0 deletions src/hotspot/share/opto/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "classfile/javaClasses.hpp"
#include "code/exceptionHandlerTable.hpp"
#include "code/nmethod.hpp"
#include "compiler/abstractCompiler.hpp"
#include "compiler/compilationFailureInfo.hpp"
#include "compiler/compilationMemoryStatistic.hpp"
#include "compiler/compileBroker.hpp"
Expand Down Expand Up @@ -83,6 +84,7 @@
#include "runtime/timer.hpp"
#include "utilities/align.hpp"
#include "utilities/copy.hpp"
#include "utilities/debug.hpp"
#include "utilities/macros.hpp"
#include "utilities/resourceHash.hpp"

Expand Down Expand Up @@ -5209,3 +5211,9 @@ Node* Compile::narrow_value(BasicType bt, Node* value, const Type* type, PhaseGV
void Compile::record_method_not_compilable_oom() {
record_method_not_compilable(CompilationMemoryStatistic::failure_reason_memlimit());
}

#ifdef ASSERT
void Compile::check_current_compiler_c2() {
assert(CompilerThread::current()->compiler()->is_c2(), "Not on C2");
}
#endif // ASSERT
5 changes: 4 additions & 1 deletion src/hotspot/share/opto/compile.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, 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 @@ -491,6 +491,8 @@ class Compile : public Phase {

InlinePrinter _inline_printer;

static void check_current_compiler_c2() NOT_DEBUG({}});

public:
void* barrier_set_state() const { return _barrier_set_state; }

Expand Down Expand Up @@ -530,6 +532,7 @@ class Compile : public Phase {

// The Compile instance currently active in this (compiler) thread.
static Compile* current() {
check_current_compiler_c2();
return (Compile*) ciEnv::current()->compiler_data();
}

Expand Down