Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/* Soot - a J*va Optimization Framework
* Copyright (C) 1997-1999 Raja Vallee-Rai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the Sable Research Group and others 1997-1999.
* See the 'credits' file distributed with Soot for the complete list of
* contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
*/
package soot.toolkits.scalar;
import soot.options.*;
import soot.*;
import soot.util.*;
import java.util.*;
import soot.jimple.*;
/**
* A BodyTransformer that attemps to minimize the number of local variables used in
* Body by 'reusing' them when possible. Implemented as a singleton.
* For example the code:
*
* for(int i; i < k; i++);
* for(int j; j < k; j++);
*
* would be transformed into:
* for(int i; i < k; i++);
* for(int i; i < k; i++);
*
* assuming to further conflicting uses of i and j.
*
* Note: LocalSplitter is corresponds to the inverse transformation.
*
* @see BodyTransformer
* @see Body
* @see LocalSplitter
*/
public class LocalPacker extends BodyTransformer
{
public LocalPacker( Singletons.Global g ) {}
public static LocalPacker v() { return G.v().soot_toolkits_scalar_LocalPacker(); }
protected void internalTransform(Body body, String phaseName, Map options)
{
boolean isUnsplit = PhaseOptions.getBoolean(options, "unsplit-original-locals");
if(Options.v().verbose())
G.v().out.println("[" + body.getMethod().getName() + "] Packing locals...");
Map localToGroup = new DeterministicHashMap(body.getLocalCount() * 2 + 1, 0.7f);
// A group represents a bunch of locals which may potentially intefere with each other
// 2 separate groups can not possibly interfere with each other
// (coloring say ints and doubles)
Map