Path: blob/master/runtime/compiler/p/codegen/J9PPCSnippet.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2000, 2020 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#ifndef J9PPCSNIPPET_INCL23#define J9PPCSNIPPET_INCL2425#include "p/codegen/InstOpCode.hpp"26#include "codegen/Snippet.hpp"27#include "p/codegen/PPCHelperCallSnippet.hpp"28#include "env/IO.hpp"29#include "j9cfg.h"3031#define LOCK_THREAD_PTR_MASK (~OBJECT_HEADER_LOCK_BITS_MASK)32#define LOCK_LAST_RECURSION_BIT_NUMBER leadingZeroes(OBJECT_HEADER_LOCK_LAST_RECURSION_BIT)3334namespace TR {3536class PPCReadMonitorSnippet : public TR::PPCHelperCallSnippet37{38TR::SymbolReference *_monitorEnterHelper;39TR::LabelSymbol *_recurCheckLabel;40TR::InstOpCode::Mnemonic _loadOpCode;41int32_t _loadOffset;42TR::Register *_objectClassReg;4344public:4546PPCReadMonitorSnippet(TR::CodeGenerator *codeGen,47TR::Node *monitorEnterNode,48TR::Node *monitorExitNode,49TR::LabelSymbol *recurCheckLabel,50TR::LabelSymbol *monExitCallLabel,51TR::LabelSymbol *restartLabel,52TR::InstOpCode::Mnemonic loadOpCode,53int32_t loadOffset,54TR::Register *objectClassReg);5556virtual Kind getKind() { return IsReadMonitor; }5758virtual uint8_t *emitSnippetBody();5960virtual uint32_t getLength(int32_t estimatedSnippetStart);61virtual void print(TR::FILE *, TR_Debug*);6263virtual int32_t setEstimatedCodeLocation(int32_t p);6465TR::SymbolReference *getMonitorEnterHelper() { return _monitorEnterHelper; };6667TR::LabelSymbol *getRecurCheckLabel() { return _recurCheckLabel; };6869TR::InstOpCode::Mnemonic getLoadOpCode() { return _loadOpCode; }7071int32_t getLoadOffset() { return _loadOffset; }72};7374class PPCAllocPrefetchSnippet : public TR::Snippet75{7677public:7879PPCAllocPrefetchSnippet(TR::CodeGenerator *codeGen,80TR::Node *node,81TR::LabelSymbol *callLabel);8283virtual Kind getKind() { return IsAllocPrefetch; }8485virtual uint8_t *emitSnippetBody();86virtual void print(TR::FILE *, TR_Debug*);8788virtual uint32_t getLength(int32_t estimatedSnippetStart);89};9091class PPCNonZeroAllocPrefetchSnippet : public TR::Snippet92{9394public:9596PPCNonZeroAllocPrefetchSnippet(TR::CodeGenerator *codeGen,97TR::Node *node,98TR::LabelSymbol *callLabel);99100virtual Kind getKind() { return IsNonZeroAllocPrefetch; }101102virtual uint8_t *emitSnippetBody();103virtual void print(TR::FILE *, TR_Debug*);104105virtual uint32_t getLength(int32_t estimatedSnippetStart);106};107108uint32_t getCCPreLoadedCodeSize();109void createCCPreLoadedCode(uint8_t *CCPreLoadedCodeBase, uint8_t *CCPreLoadedCodeTop, void **CCPreLoadedCodeTable, TR::CodeGenerator *cg);110111}112113#endif // J9PPCSNIPPET_INCL114115116