Skip to content

Commit

Permalink
Introduce an API for creating loads/stores based on nodes
Browse files Browse the repository at this point in the history
Previously, evaluation of loads and stores based on nodes was generally
handled by manually using TR::MemoryReference::createWithRootLoadOrStore
and then performing operations on the resulting memory reference.
However, this turns out to be wildly unsafe in the presence of volatile
symrefs (it requires the caller to manually check) and also requires
that MemoryReference be coupled to tree evaluation.

As a first step towards addressing this, a new API has been introduced
that generates loads and stores based on a node. This new API has the
requisite options to support existing optimizations that perform
loads/stores with different opcodes to what the node might suggest while
still hiding the details about TR::MemoryReference and volatile fences
behind a unified interface.

Signed-off-by: Ben Thomas <ben@benthomas.ca>
  • Loading branch information
aviansie-ben committed Feb 11, 2021
1 parent 2076fd4 commit c475615
Show file tree
Hide file tree
Showing 5 changed files with 749 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/p/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ compiler_library(p
${CMAKE_CURRENT_LIST_DIR}/codegen/TreeEvaluatorVMX.cpp
${CMAKE_CURRENT_LIST_DIR}/codegen/UnaryEvaluator.cpp
${CMAKE_CURRENT_LIST_DIR}/codegen/OMRConstantDataSnippet.cpp
${CMAKE_CURRENT_LIST_DIR}/codegen/OMRLoadStoreHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/env/OMRCPU.cpp
)
33 changes: 33 additions & 0 deletions compiler/p/codegen/LoadStoreHandler.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2020, 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
* distribution and is available at http://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
*******************************************************************************/

#ifndef TR_LOADSTOREHANDLER_INCL
#define TR_LOADSTOREHANDLER_INCL

#include "codegen/OMRLoadStoreHandler.hpp"

namespace TR
{
class OMR_EXTENSIBLE LoadStoreHandler : public OMR::Power::LoadStoreHandler {};
class OMR_EXTENSIBLE LoadStoreHandlerImpl : public OMR::Power::LoadStoreHandlerImpl {};
}

#endif
Loading

0 comments on commit c475615

Please sign in to comment.