Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#1 from TobiAjila/akshayben/suballoc…
Browse files Browse the repository at this point in the history
…ator

Added CMD Options and JVMImage Header
  • Loading branch information
akshayben authored Jun 5, 2019
2 parents a8956eb + 0366a6a commit dbbc8a9
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/oti/j9consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ extern "C" {
#define J9_EXTENDED_RUNTIME2_ENABLE_VALHALLA 0x1
#define J9_EXTENDED_RUNTIME2_COMPRESS_OBJECT_REFERENCES 0x2
#define J9_EXTENDED_RUNTIME2_ENABLE_PREVIEW 0x4
#define J9_EXTENDED_RUNTIME2_RAMSTATE_COLD_RUN 0x8
#define J9_EXTENDED_RUNTIME2_RAMSTATE_WARM_RUN 0x10


/* TODO: Define this until the JIT removes it */
Expand Down
1 change: 1 addition & 0 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5029,6 +5029,7 @@ typedef struct J9JavaVM {
struct J9PortLibrary * portLibrary;
UDATA j2seVersion;
void* zipCachePool;
char* ramStateFilePath;
struct J9VMInterface vmInterface;
struct HarmonyVMInterface harmonyVMInterface;
UDATA dynamicLoadClassAllocationIncrement;
Expand Down
2 changes: 2 additions & 0 deletions runtime/oti/jvminit.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ enum INIT_STAGE {
#define VMOPT_XFASTRESOLVE "-Xfastresolve"
#define VMOPT_XSHARECLASSES "-Xshareclasses"
#define VMOPT_XSHARECLASSES_COLON "-Xshareclasses:"
#define VMOPT_XSAVERAMSTATE "-Xsaveramstate="
#define VMOPT_XRESTORERAMSTATE "-Xrestoreramstate="
#define VMOPT_XSERVICE_EQUALS "-Xservice="
#define VMOPT_XISS "-Xiss"
#define VMOPT_XSSI "-Xssi"
Expand Down
46 changes: 46 additions & 0 deletions runtime/vm/JVMImage.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2001, 2019 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
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* 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
*******************************************************************************/
/*
* JVMImage.hpp
*/

#ifndef JVMIMAGE_HPP_
#define JVMIMAGE_HPP_

#include "j9_types.h"

class JVMImage
{
public:
JVMImage();
~JVMImage();
void allocateImageMemory(UDATA size);
void subAllocateMemory(uintptr_t size);
void freeSubAllocatedMemory();

private:
UDATA _memoryStart;
UDATA _size;
};

#endif /* JVMIMAGE_H_ */

15 changes: 15 additions & 0 deletions runtime/vm/jvminit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,21 @@ IDATA VMInitStages(J9JavaVM *vm, IDATA stage, void* reserved) {
}
}
#endif
{
IDATA restoreStateIndex = FIND_AND_CONSUME_ARG(STARTSWITH_MATCH, VMOPT_XRESTORERAMSTATE, NULL);
IDATA saveStateIndex = FIND_AND_CONSUME_ARG(STARTSWITH_MATCH, VMOPT_XSAVERAMSTATE, NULL);
char *optionValue = NULL;
// If both restore (warm run) and save (cold run) are specified save state takes precedence
if (saveStateIndex >= 0) {
GET_OPTION_VALUE(saveStateIndex, '=', &optionValue);
vm->extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_RAMSTATE_COLD_RUN;
}
else if (restoreStateIndex >= 0) {
GET_OPTION_VALUE(restoreStateIndex, '=', &optionValue);
vm->extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_RAMSTATE_WARM_RUN;
}
vm->ramStateFilePath = optionValue;
}

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

0 comments on commit dbbc8a9

Please sign in to comment.