Skip to content

Commit

Permalink
Change misc code for RISC-V in OMR (part5/misc)
Browse files Browse the repository at this point in the history
The changes mainly include miscellaneous code
to enable RISC-V 64bit from the OMR perspective.

Issue: eclipse#4426

Signed-off-by: Cheng Jin <jincheng@ca.ibm.com>
  • Loading branch information
Cheng Jin committed Jan 21, 2020
1 parent 7ebf8a4 commit 072ca7c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion include_core/ute_dataformat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1998, 2015 IBM Corp. and others
* Copyright (c) 1998, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -116,6 +116,7 @@ typedef enum {
UT_PIV,
UT_TREX,
UT_OPTERON,
UT_RV64G,
UT_SUBTYPE_FORCE_INTEGER = INT_MAX
} UtSubtype;

Expand Down Expand Up @@ -145,6 +146,7 @@ typedef enum {
UT_IA64,
UT_S390X,
UT_AMD64,
UT_RISCV,
UT_ARCHITECTURE_FORCE_INTEGER = INT_MAX
} UtArchitecture;

Expand Down
5 changes: 4 additions & 1 deletion omrtrace/omrtracelog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1998, 2016 IBM Corp. and others
* Copyright (c) 1998, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -1311,6 +1311,9 @@ getProcessorInfo(void)
} else if (strcmp(osarch, OMRPORT_ARCH_X86) == 0) {
ret->architecture = UT_X86;
ret->procInfo.subtype = UT_PIV;
} else if (0 == strcmp(osarch, OMRPORT_ARCH_RISCV)) {
ret->architecture = UT_RISCV;
ret->procInfo.subtype = UT_RV64G;
} else {
ret->architecture = UT_UNKNOWN;
}
Expand Down
4 changes: 2 additions & 2 deletions thread/common/thrprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ omrthread_get_process_times(omrthread_process_time_t *processTime)
uint64_t
omrthread_get_hires_clock(void)
{
#if defined(LINUX) && (defined(J9HAMMER) || defined(J9X86))
#if defined(LINUX) && (defined(J9HAMMER) || defined(J9X86) || defined(RISCV64))
#define J9TIME_NANOSECONDS_PER_SECOND J9CONST_U64(1000000000)
struct timespec ts;
uint64_t hiresTime = 0;
Expand All @@ -833,7 +833,7 @@ omrthread_get_hires_clock(void)
}

return hiresTime;
#elif defined(OMR_OS_WINDOWS) /* defined(LINUX) && (defined(J9HAMMER) || defined(J9X86)) */
#elif defined(OMR_OS_WINDOWS) /* defined(LINUX) && (defined(J9HAMMER) || defined(J9X86) || defined(RISCV64)) */
LARGE_INTEGER i;

if (QueryPerformanceCounter(&i)) {
Expand Down
4 changes: 2 additions & 2 deletions util/omrutil/gettimebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "omrcomp.h"
#include "omrutilbase.h"

#if defined(LINUX) && (defined(OMR_ARCH_ARM) || defined(OMR_ARCH_RISCV))
#if defined(LINUX) && (defined(OMR_ARCH_ARM) || defined(OMR_ARCH_RISCV) || defined(RISCV64))
#include <time.h>
#endif

Expand Down Expand Up @@ -81,7 +81,7 @@ getTimebase(void)
asm("stck %0" : "=m" (tsc));
#elif defined(J9ZOS390)
__stck(&tsc);
#elif defined(LINUX) && (defined(OMR_ARCH_ARM) || defined(OMR_ARCH_RISCV))
#elif defined(LINUX) && (defined(OMR_ARCH_ARM) || defined(OMR_ARCH_RISCV) || defined(RISCV64))
/* For now, use the system nano clock */
#define J9TIME_NANOSECONDS_PER_SECOND J9CONST_U64(1000000000)
struct timespec ts;
Expand Down

0 comments on commit 072ca7c

Please sign in to comment.