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 24 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. 16
      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> 2001-05-27 Jochen Hoenicke <jochen@gnu.org>
* configure.in: Set version to 1.1. * configure.in: Set version to 1.1.

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

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

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

Loading…
Cancel
Save