Skip to content

Commit dbbc8a9

Browse files
authored
Merge pull request eclipse-openj9#1 from TobiAjila/akshayben/suballocator
Added CMD Options and JVMImage Header
2 parents a8956eb + 0366a6a commit dbbc8a9

File tree

5 files changed

+66
-0
lines changed

5 files changed

+66
-0
lines changed

runtime/oti/j9consts.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ extern "C" {
327327
#define J9_EXTENDED_RUNTIME2_ENABLE_VALHALLA 0x1
328328
#define J9_EXTENDED_RUNTIME2_COMPRESS_OBJECT_REFERENCES 0x2
329329
#define J9_EXTENDED_RUNTIME2_ENABLE_PREVIEW 0x4
330+
#define J9_EXTENDED_RUNTIME2_RAMSTATE_COLD_RUN 0x8
331+
#define J9_EXTENDED_RUNTIME2_RAMSTATE_WARM_RUN 0x10
330332

331333

332334
/* TODO: Define this until the JIT removes it */

runtime/oti/j9nonbuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5029,6 +5029,7 @@ typedef struct J9JavaVM {
50295029
struct J9PortLibrary * portLibrary;
50305030
UDATA j2seVersion;
50315031
void* zipCachePool;
5032+
char* ramStateFilePath;
50325033
struct J9VMInterface vmInterface;
50335034
struct HarmonyVMInterface harmonyVMInterface;
50345035
UDATA dynamicLoadClassAllocationIncrement;

runtime/oti/jvminit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ enum INIT_STAGE {
253253
#define VMOPT_XFASTRESOLVE "-Xfastresolve"
254254
#define VMOPT_XSHARECLASSES "-Xshareclasses"
255255
#define VMOPT_XSHARECLASSES_COLON "-Xshareclasses:"
256+
#define VMOPT_XSAVERAMSTATE "-Xsaveramstate="
257+
#define VMOPT_XRESTORERAMSTATE "-Xrestoreramstate="
256258
#define VMOPT_XSERVICE_EQUALS "-Xservice="
257259
#define VMOPT_XISS "-Xiss"
258260
#define VMOPT_XSSI "-Xssi"

runtime/vm/JVMImage.hpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2001, 2019 IBM Corp. and others
3+
*
4+
* This program and the accompanying materials are made available under
5+
* the terms of the Eclipse Public License 2.0 which accompanies this
6+
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7+
* or the Apache License, Version 2.0 which accompanies this distribution and
8+
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9+
*
10+
* This Source Code may also be made available under the following
11+
* Secondary Licenses when the conditions for such availability set
12+
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13+
* General Public License, version 2 with the GNU Classpath
14+
* Exception [1] and GNU General Public License, version 2 with the
15+
* OpenJDK Assembly Exception [2].
16+
*
17+
* [1] https://www.gnu.org/software/classpath/license.html
18+
* [2] http://openjdk.java.net/legal/assembly-exception.html
19+
*
20+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21+
*******************************************************************************/
22+
/*
23+
* JVMImage.hpp
24+
*/
25+
26+
#ifndef JVMIMAGE_HPP_
27+
#define JVMIMAGE_HPP_
28+
29+
#include "j9_types.h"
30+
31+
class JVMImage
32+
{
33+
public:
34+
JVMImage();
35+
~JVMImage();
36+
void allocateImageMemory(UDATA size);
37+
void subAllocateMemory(uintptr_t size);
38+
void freeSubAllocatedMemory();
39+
40+
private:
41+
UDATA _memoryStart;
42+
UDATA _size;
43+
};
44+
45+
#endif /* JVMIMAGE_H_ */
46+

runtime/vm/jvminit.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,21 @@ IDATA VMInitStages(J9JavaVM *vm, IDATA stage, void* reserved) {
17591759
}
17601760
}
17611761
#endif
1762+
{
1763+
IDATA restoreStateIndex = FIND_AND_CONSUME_ARG(STARTSWITH_MATCH, VMOPT_XRESTORERAMSTATE, NULL);
1764+
IDATA saveStateIndex = FIND_AND_CONSUME_ARG(STARTSWITH_MATCH, VMOPT_XSAVERAMSTATE, NULL);
1765+
char *optionValue = NULL;
1766+
// If both restore (warm run) and save (cold run) are specified save state takes precedence
1767+
if (saveStateIndex >= 0) {
1768+
GET_OPTION_VALUE(saveStateIndex, '=', &optionValue);
1769+
vm->extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_RAMSTATE_COLD_RUN;
1770+
}
1771+
else if (restoreStateIndex >= 0) {
1772+
GET_OPTION_VALUE(restoreStateIndex, '=', &optionValue);
1773+
vm->extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_RAMSTATE_WARM_RUN;
1774+
}
1775+
vm->ramStateFilePath = optionValue;
1776+
}
17621777

17631778
if (FIND_AND_CONSUME_ARG(EXACT_MATCH, VMOPT_XDFPBD, NULL) >= 0) {
17641779
vm->runtimeFlags |= J9_RUNTIME_DFPBD;

0 commit comments

Comments
 (0)