/*******************************************************************************1* Copyright (c) 1991, 2014 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#include "j9.h"2324#include "jitavl.h"25#include "jithash.h"262728void avl_jit_artifact_free_all(J9JavaVM *javaVM, J9AVLTree *tree) {29PORT_ACCESS_FROM_PORT(javaVM->portLibrary);3031avl_jit_artifact_free_node(PORTLIB, (J9JITHashTable *)tree->rootNode);32j9mem_free_memory(tree);33}343536void avl_jit_artifact_free_node(J9PortLibrary *portLib, J9JITHashTable *nodeToDelete) {37PORT_ACCESS_FROM_PORT(portLib);3839if (!nodeToDelete) {40return;41}4243avl_jit_artifact_free_node(portLib, (J9JITHashTable *)J9JITHASHTABLE_LEFTCHILD(nodeToDelete));44avl_jit_artifact_free_node(portLib, (J9JITHashTable *)J9JITHASHTABLE_RIGHTCHILD(nodeToDelete));4546if ( !(nodeToDelete->flags & JIT_HASH_IN_DATA_CACHE)) {47hash_jit_free(portLib, nodeToDelete);48}49}50515253IDATA avl_jit_artifact_insertionCompare(J9AVLTree *tree, J9JITHashTable *insertNode, J9JITHashTable *walkNode) {54if (walkNode->start > insertNode->start) {55return 1;56} else if (walkNode->start < insertNode->start) {57return -1;58}59return 0;60}6162636465IDATA avl_jit_artifact_searchCompare(J9AVLTree *tree, UDATA searchValue, J9JITHashTable *walkNode) {66if (searchValue >= walkNode->end)67return -1;6869if (searchValue < walkNode->start)70return 1;7172return 0;73}74757677787980