// Path: src/main/java/tr/com/serkanozal/mysafe/config/AllocationPointConfig.java
// public class AllocationPointConfig {
// 
//     public static final int DEFAULT_SIZE_PARAMETER_ORDER = 1;
//     
//     public final int sizeParameterOrder;
//     
//     public AllocationPointConfig() {
//         this.sizeParameterOrder = DEFAULT_SIZE_PARAMETER_ORDER;
//     }
//     
//     public AllocationPointConfig(int sizeParameterOrder) {
//         this.sizeParameterOrder = sizeParameterOrder;
//     }
// 
// }
// 
// Path: src/main/java/tr/com/serkanozal/mysafe/config/FreePointConfig.java
// public class FreePointConfig {
// 
//     public static final int DEFAULT_ADDRESS_PARAMETER_ORDER = 1;
//     
//     public final int addressParameterOrder;
//     
//     public FreePointConfig() {
//         this.addressParameterOrder = DEFAULT_ADDRESS_PARAMETER_ORDER;
//     }
//     
//     public FreePointConfig(int addressParameterOrder) {
//         this.addressParameterOrder = addressParameterOrder;
//     }
//     
// }
// 
// Path: src/main/java/tr/com/serkanozal/mysafe/config/ReallocationPointConfig.java
// public class ReallocationPointConfig {
// 
//     public static final int DEFAULT_OLD_ADDRESS_PARAMETER_ORDER = 1;
//     public static final int DEFAULT_NEW_SIZE_PARAMETER_ORDER = 2;
//     
//     public final int oldAddressParameterOrder;
//     public final int newSizeParameterOrder;
//     
//     public ReallocationPointConfig() {
//         this.oldAddressParameterOrder = DEFAULT_OLD_ADDRESS_PARAMETER_ORDER;
//         this.newSizeParameterOrder = DEFAULT_NEW_SIZE_PARAMETER_ORDER;
//     }
//     
//     public ReallocationPointConfig(int oldAddressParameterOrder) {
//         this.oldAddressParameterOrder = oldAddressParameterOrder;
//         this.newSizeParameterOrder = DEFAULT_NEW_SIZE_PARAMETER_ORDER;
//     }
//     
//     public ReallocationPointConfig(int oldAddressParameterOrder, int newSizeParameterOrder) {
//         this.oldAddressParameterOrder = oldAddressParameterOrder;
//         this.newSizeParameterOrder = newSizeParameterOrder;
//     }
// 
// }


import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import static tr.com.serkanozal.mysafe.AllocatedMemoryStorage.INVALID;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import tr.com.serkanozal.mysafe.config.AllocationPoint;
import tr.com.serkanozal.mysafe.config.AllocationPointConfig;
import tr.com.serkanozal.mysafe.config.FreePoint;
import tr.com.serkanozal.mysafe.config.FreePointConfig;
import tr.com.serkanozal.mysafe.config.ReallocationPoint;
import tr.com.serkanozal.mysafe.config.ReallocationPointConfig;
/*
 * Copyright (c) 2017, Serkan OZAL, All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package tr.com.serkanozal.mysafe.impl.instrument;




class CustomMemoryManagementInstrumenter implements MySafeInstrumenter {

    private final boolean USE_CUSTOM_MEMORY_MANAGEMENT = 
            Boolean.getBoolean("mysafe.useCustomMemoryManagement");
    private final String CUSTOM_MEMORY_MANAGEMENT_PACKAGE_PREFIX = 
            System.getProperty("mysafe.customMemoryManagementPackagePrefix");
    private final ClassPool CP = new MySafeClassPool();
    private Map<String, AllocationPointConfig> configuredAllocationPoints;
    private Map<String, FreePointConfig> configuredFreePoints;
// Path: src/main/java/tr/com/serkanozal/mysafe/config/AllocationPointConfig.java
// public class AllocationPointConfig {
// 
//     public static final int DEFAULT_SIZE_PARAMETER_ORDER = 1;
//     
//     public final int sizeParameterOrder;
//     
//     public AllocationPointConfig() {
//         this.sizeParameterOrder = DEFAULT_SIZE_PARAMETER_ORDER;
//     }
//     
//     public AllocationPointConfig(int sizeParameterOrder) {
//         this.sizeParameterOrder = sizeParameterOrder;
//     }
// 
// }
// 
// Path: src/main/java/tr/com/serkanozal/mysafe/config/FreePointConfig.java
// public class FreePointConfig {
// 
//     public static final int DEFAULT_ADDRESS_PARAMETER_ORDER = 1;
//     
//     public final int addressParameterOrder;
//     
//     public FreePointConfig() {
//         this.addressParameterOrder = DEFAULT_ADDRESS_PARAMETER_ORDER;
//     }
//     
//     public FreePointConfig(int addressParameterOrder) {
//         this.addressParameterOrder = addressParameterOrder;
//     }
//     
// }
// 
// Path: src/main/java/tr/com/serkanozal/mysafe/config/ReallocationPointConfig.java
// public class ReallocationPointConfig {
// 
//     public static final int DEFAULT_OLD_ADDRESS_PARAMETER_ORDER = 1;
//     public static final int DEFAULT_NEW_SIZE_PARAMETER_ORDER = 2;
//     
//     public final int oldAddressParameterOrder;
//     public final int newSizeParameterOrder;
//     
//     public ReallocationPointConfig() {
//         this.oldAddressParameterOrder = DEFAULT_OLD_ADDRESS_PARAMETER_ORDER;
//         this.newSizeParameterOrder = DEFAULT_NEW_SIZE_PARAMETER_ORDER;
//     }
//     
//     public ReallocationPointConfig(int oldAddressParameterOrder) {
//         this.oldAddressParameterOrder = oldAddressParameterOrder;
//         this.newSizeParameterOrder = DEFAULT_NEW_SIZE_PARAMETER_ORDER;
//     }
//     
//     public ReallocationPointConfig(int oldAddressParameterOrder, int newSizeParameterOrder) {
//         this.oldAddressParameterOrder = oldAddressParameterOrder;
//         this.newSizeParameterOrder = newSizeParameterOrder;
//     }
// 
// }


// Path: src/main/java/tr/com/serkanozal/mysafe/impl/instrument/CustomMemoryManagementInstrumenter.java
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import static tr.com.serkanozal.mysafe.AllocatedMemoryStorage.INVALID;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import tr.com.serkanozal.mysafe.config.AllocationPoint;
import tr.com.serkanozal.mysafe.config.AllocationPointConfig;
import tr.com.serkanozal.mysafe.config.FreePoint;
import tr.com.serkanozal.mysafe.config.FreePointConfig;
import tr.com.serkanozal.mysafe.config.ReallocationPoint;
import tr.com.serkanozal.mysafe.config.ReallocationPointConfig;

/*
 * Copyright (c) 2017, Serkan OZAL, All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package tr.com.serkanozal.mysafe.impl.instrument;




class CustomMemoryManagementInstrumenter implements MySafeInstrumenter {

    private final boolean USE_CUSTOM_MEMORY_MANAGEMENT = 
            Boolean.getBoolean("mysafe.useCustomMemoryManagement");
    private final String CUSTOM_MEMORY_MANAGEMENT_PACKAGE_PREFIX = 
            System.getProperty("mysafe.customMemoryManagementPackagePrefix");
    private final ClassPool CP = new MySafeClassPool();
    private Map<String, AllocationPointConfig> configuredAllocationPoints;
    private Map<String, FreePointConfig> configuredFreePoints;
    private Map<String, ReallocationPointConfig> configuredReallocationPoints;