Fixed a bug in the obfuscator.

Added include files to DIST in Makefile.am


git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1320 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 23 years ago
parent af086625d8
commit 5a4dbe0b02
  1. 12
      jode/ChangeLog
  2. 3
      jode/doc/Makefile.am
  3. 7
      jode/jode/obfuscator/ConstantRuntimeEnvironment.java.in
  4. 18
      jode/jode/obfuscator/modules/ConstantAnalyzer.java.in

@ -1,3 +1,15 @@
2001-06-01 Jochen Hoenicke <jochen@gnu.org>
* jode/obfuscator/modules/ConstantAnalyzer.java.in:
(analyzeCode): set field listener of RuntimeEnvironment.
(replaceWith): Fixed the invoke_xxx case.
* jode/obfuscator/ConstantRuntimeEnvironment.java.in:
(getField): add current field listener to field if constant value
was used.
(currentFieldAnalyzer): New field.
(setFieldAnalyzer): New method.
2001-05-27 Jochen Hoenicke <jochen@gnu.org>
* configure.in: Set version to 1.1.

@ -16,6 +16,9 @@ HTML_FILES = $(PHP_FILES:%.php=$(srcdir)/%.html)
noinst_DATA = $(HTML_FILES)
EXTRA_DIST = $(PHP_FILES) $(notdir $(HTML_FILES)) \
header.inc \
menu.inc \
footer.inc \
a-logo.gif \
myproject.jos \
dasm_to_java.perl \

@ -215,11 +215,16 @@ public class ConstantRuntimeEnvironment extends SimpleRuntimeEnvironment {
}
private Interpreter interpreter;
private Identifier currentFieldListener;
public ConstantRuntimeEnvironment() {
interpreter = new Interpreter(this);
}
public void setFieldListener(Identifier fl) {
currentFieldListener = fl;
}
public static Object getDefaultValue(String typeSig) {
switch(typeSig.charAt(0)) {
case 'Z':
@ -247,6 +252,8 @@ public class ConstantRuntimeEnvironment extends SimpleRuntimeEnvironment {
= (FieldIdentifier) Main.getClassBundle().getIdentifier(ref);
if (fi != null && !fi.isNotConstant()) {
Object result = fi.getConstant();
if (currentFieldListener != null)
fi.addFieldListener(currentFieldListener);
if (result == null)
result = getDefaultValue(ref.getType());
return result;

@ -602,7 +602,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
public void handleOpcode(StackLocalInfo info, Identifier fieldListener) {
Instruction instr = info.instr;
info.constInfo = unknownConstInfo;
int opcode = instr.getOpcode();
Handler[] handlers = bytecode.getExceptionHandlers();
for (int i=0; i< handlers.length; i++) {
@ -1470,12 +1470,14 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
firstInfo.instr = (Instruction) bytecode.getInstructions().get(0);
firstInfo.instr.setTmpInfo(firstInfo);
firstInfo.enqueue();
runtime.setFieldListener(methodIdent);
while (modifiedQueue.first != null) {
StackLocalInfo info = modifiedQueue.first;
modifiedQueue.first = info.nextOnQueue;
info.nextOnQueue = null;
handleOpcode(info, methodIdent);
}
runtime.setFieldListener(null);
Handler[] handlers = bytecode.getExceptionHandlers();
for (int i=0; i< handlers.length; i++) {
@ -1577,12 +1579,17 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
String[] pt = TypeSignature.getParameterTypes(ref.getType());
int len = pt.length;
if (len > 0)
if (len > 0) {
iter.set(new Instruction(TypeSignature.getTypeSize(pt[--len])
+ opc_pop - 1));
else if (instr.getOpcode() != opc_invokestatic)
for (int i = len - 1; i >= 0; i--)
iter.add(new Instruction(TypeSignature.getTypeSize(pt[i])
+ opc_pop - 1));
if (instr.getOpcode() != opc_invokestatic)
iter.add(new Instruction(opc_pop));
} else if (instr.getOpcode() != opc_invokestatic) {
iter.set(new Instruction(opc_pop));
else {
} else {
if (replacement == null)
iter.remove();
else
@ -1590,9 +1597,6 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
return;
}
for (int i = len - 1; i >= 0; i++)
iter.add(new Instruction(TypeSignature.getTypeSize(pt[i])
+ opc_pop - 1));
}
}
if (replacement != null)

Loading…
Cancel
Save