Path: blob/master/runtime/compiler/arm/codegen/J9ARMSnippet.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2000, 2016 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 J9ARMSNIPPET_INCL23#define J9ARMSNIPPET_INCL2425#include "codegen/Snippet.hpp"26#include "j9cfg.h"27#include "codegen/ARMHelperCallSnippet.hpp"28#include "env/IO.hpp"2930#define LOCK_INC_DEC_VALUE OBJECT_HEADER_LOCK_FIRST_RECURSION_BIT31#define LOCK_THREAD_PTR_MASK (~OBJECT_HEADER_LOCK_BITS_MASK)32#define LOCK_THREAD_PTR_AND_UPPER_COUNT_BIT_MASK (LOCK_THREAD_PTR_MASK | OBJECT_HEADER_LOCK_LAST_RECURSION_BIT)33#define LOCK_OWNING_NON_INFLATED_COMPLEMENT (OBJECT_HEADER_LOCK_BITS_MASK & ~OBJECT_HEADER_LOCK_INFLATED)34#define LOCK_RESERVATION_BIT OBJECT_HEADER_LOCK_RESERVED35#define LOCK_RES_PRIMITIVE_ENTER_MASK (OBJECT_HEADER_LOCK_RECURSION_MASK | OBJECT_HEADER_LOCK_FLC)36#define LOCK_RES_PRIMITIVE_EXIT_MASK (OBJECT_HEADER_LOCK_BITS_MASK & ~OBJECT_HEADER_LOCK_RECURSION_MASK)37#define LOCK_RES_NON_PRIMITIVE_ENTER_MASK (OBJECT_HEADER_LOCK_RECURSION_MASK & ~OBJECT_HEADER_LOCK_LAST_RECURSION_BIT)38#define LOCK_RES_NON_PRIMITIVE_EXIT_MASK (OBJECT_HEADER_LOCK_RECURSION_MASK & ~OBJECT_HEADER_LOCK_FIRST_RECURSION_BIT)39#define LOCK_RES_OWNING_COMPLEMENT (OBJECT_HEADER_LOCK_RECURSION_MASK | OBJECT_HEADER_LOCK_FLC)40#define LOCK_RES_PRESERVE_ENTER_COMPLEMENT (OBJECT_HEADER_LOCK_RECURSION_MASK & ~OBJECT_HEADER_LOCK_LAST_RECURSION_BIT)41#define LOCK_RES_CONTENDED_VALUE (OBJECT_HEADER_LOCK_FIRST_RECURSION_BIT|OBJECT_HEADER_LOCK_RESERVED|OBJECT_HEADER_LOCK_FLC)4243namespace TR {4445class ARMMonitorEnterSnippet : public TR::ARMHelperCallSnippet46{47TR::LabelSymbol *_incLabel;48int32_t _lwOffset;49//bool _isReservationPreserving;5051public:5253ARMMonitorEnterSnippet(TR::CodeGenerator *codeGen,54TR::Node *monitorNode,55int32_t lwOffset,56//bool isPreserving,57TR::LabelSymbol *incLabel,58TR::LabelSymbol *callLabel,59TR::LabelSymbol *restartLabel);6061virtual Kind getKind() { return IsMonitorEnter; }6263virtual uint8_t *emitSnippetBody();64virtual void print(TR::FILE *, TR_Debug *);65virtual uint32_t getLength(int32_t estimatedSnippetStart);6667virtual int32_t setEstimatedCodeLocation(int32_t p);6869TR::LabelSymbol * getIncLabel() { return _incLabel; };70int32_t getLockWordOffset() { return _lwOffset; }71//bool isReservationPreserving() { return _isReservationPreserving; }72};7374class ARMMonitorExitSnippet : public TR::ARMHelperCallSnippet75{76TR::LabelSymbol *_decLabel;77//TR::LabelSymbol *_restoreAndCallLabel;78int32_t _lwOffset;79//bool _isReservationPreserving;80//bool _isReadOnly;8182public:8384ARMMonitorExitSnippet(TR::CodeGenerator *codeGen,85TR::Node *monitorNode,86int32_t lwOffset,87//bool flag,88//bool isPreserving,89TR::LabelSymbol *decLabel,90//TR::LabelSymbol *restoreAndCallLabel,91TR::LabelSymbol *callLabel,92TR::LabelSymbol *restartLabel);9394virtual Kind getKind() { return IsMonitorExit; }9596virtual uint8_t *emitSnippetBody();97virtual void print(TR::FILE *, TR_Debug *);98virtual uint32_t getLength(int32_t estimatedSnippetStart);99100virtual int32_t setEstimatedCodeLocation(int32_t p);101102TR::LabelSymbol * getDecLabel() { return _decLabel; }103//TR::LabelSymbol * getRestoreAndCallLabel() { return _restoreAndCallLabel; }104int32_t getLockWordOffset() { return _lwOffset; }105//bool isReservationPreserving() { return _isReservationPreserving; }106};107108}109110#endif111112113114