Skip to content

Commit b6b0317

Browse files
committed
8290840: Refactor the "os" class
Reviewed-by: dholmes, gziemski, stuefe, stefank
1 parent 4cfbb3b commit b6b0317

File tree

88 files changed

+622
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+622
-613
lines changed

src/hotspot/cpu/aarch64/vm_version_aarch64.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@
2828
#include "runtime/arguments.hpp"
2929
#include "runtime/globals_extension.hpp"
3030
#include "runtime/java.hpp"
31-
#include "runtime/os.hpp"
31+
#include "runtime/os.inline.hpp"
3232
#include "runtime/vm_version.hpp"
3333
#include "utilities/formatBuffer.hpp"
3434
#include "utilities/macros.hpp"
3535

36-
#include OS_HEADER_INLINE(os)
37-
3836
int VM_Version::_cpu;
3937
int VM_Version::_model;
4038
int VM_Version::_model2;

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "oops/compressedOops.hpp"
3939
#include "oops/objArrayKlass.hpp"
4040
#include "runtime/frame.inline.hpp"
41+
#include "runtime/os.inline.hpp"
4142
#include "runtime/safepointMechanism.inline.hpp"
4243
#include "runtime/sharedRuntime.hpp"
4344
#include "runtime/stubRoutines.hpp"

src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "gc/shared/barrierSetAssembler.hpp"
3535
#include "oops/accessDecorators.hpp"
3636
#include "oops/compressedOops.hpp"
37+
#include "runtime/os.inline.hpp"
3738
#include "runtime/safepointMechanism.hpp"
3839
#include "runtime/vm_version.hpp"
3940
#include "utilities/powerOfTwo.hpp"

src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "oops/klass.inline.hpp"
3939
#include "prims/methodHandles.hpp"
4040
#include "runtime/jniHandles.hpp"
41+
#include "runtime/os.inline.hpp"
4142
#include "runtime/safepointMechanism.hpp"
4243
#include "runtime/sharedRuntime.hpp"
4344
#include "runtime/signature.hpp"

src/hotspot/cpu/ppc/vm_version_ppc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#include <sys/sysinfo.h>
4343
#if defined(_AIX)
44+
#include "os_aix.hpp"
4445
#include <libperfstat.h>
4546
#endif
4647

src/hotspot/cpu/riscv/icache_riscv.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -29,8 +29,27 @@
2929

3030
#define __ _masm->
3131

32+
// SYSCALL_RISCV_FLUSH_ICACHE is used to flush instruction cache. The "fence.i" instruction
33+
// only work on the current hart, so kernel provides the icache flush syscall to flush icache
34+
// on each hart. You can pass a flag to determine a global or local icache flush.
35+
static void icache_flush(long int start, long int end)
36+
{
37+
const int SYSCALL_RISCV_FLUSH_ICACHE = 259;
38+
register long int __a7 asm ("a7") = SYSCALL_RISCV_FLUSH_ICACHE;
39+
register long int __a0 asm ("a0") = start;
40+
register long int __a1 asm ("a1") = end;
41+
// the flush can be applied to either all threads or only the current.
42+
// 0 means a global icache flush, and the icache flush will be applied
43+
// to other harts concurrently executing.
44+
register long int __a2 asm ("a2") = 0;
45+
__asm__ volatile ("ecall\n\t"
46+
: "+r" (__a0)
47+
: "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a7)
48+
: "memory");
49+
}
50+
3251
static int icache_flush(address addr, int lines, int magic) {
33-
os::icache_flush((long int) addr, (long int) (addr + (lines << ICache::log2_line_size)));
52+
icache_flush((long int) addr, (long int) (addr + (lines << ICache::log2_line_size)));
3453
return magic;
3554
}
3655

src/hotspot/cpu/riscv/vm_version_riscv.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -25,13 +25,11 @@
2525

2626
#include "precompiled.hpp"
2727
#include "runtime/java.hpp"
28-
#include "runtime/os.hpp"
28+
#include "runtime/os.inline.hpp"
2929
#include "runtime/vm_version.hpp"
3030
#include "utilities/formatBuffer.hpp"
3131
#include "utilities/macros.hpp"
3232

33-
#include OS_HEADER_INLINE(os)
34-
3533
const char* VM_Version::_uarch = "";
3634
uint32_t VM_Version::_initial_vector_length = 0;
3735

src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
2828
#include "prims/jniFastGetField.hpp"
2929
#include "prims/jvm_misc.hpp"
3030
#include "prims/jvmtiExport.hpp"
31+
#include "runtime/os.inline.hpp"
3132
#include "runtime/safepoint.hpp"
3233
#include "runtime/stubRoutines.hpp"
3334

src/hotspot/cpu/x86/rdtsc_x86.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,10 @@
2626
#include "rdtsc_x86.hpp"
2727
#include "runtime/globals_extension.hpp"
2828
#include "runtime/javaThread.hpp"
29+
#include "runtime/os.inline.hpp"
2930
#include "runtime/orderAccess.hpp"
3031
#include "vm_version_x86.hpp"
3132

32-
// The following header contains the implementations of rdtsc()
33-
#include OS_CPU_HEADER_INLINE(os)
34-
3533
static jlong _epoch = 0;
3634
static bool rdtsc_elapsed_counter_enabled = false;
3735
static jlong tsc_frequency = 0;

src/hotspot/cpu/x86/vm_version_x86.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@
3333
#include "memory/universe.hpp"
3434
#include "runtime/globals_extension.hpp"
3535
#include "runtime/java.hpp"
36-
#include "runtime/os.hpp"
36+
#include "runtime/os.inline.hpp"
3737
#include "runtime/stubCodeGenerator.hpp"
3838
#include "runtime/vm_version.hpp"
3939
#include "utilities/powerOfTwo.hpp"
4040
#include "utilities/virtualizationSupport.hpp"
4141

42-
#include OS_HEADER_INLINE(os)
43-
4442
int VM_Version::_cpu;
4543
int VM_Version::_model;
4644
int VM_Version::_stepping;

0 commit comments

Comments
 (0)