本文整理匯總了Java中com.sun.squawk.util.Tracer.trace方法的典型用法代碼示例。如果您正苦於以下問題:Java Tracer.trace方法的具體用法?Java Tracer.trace怎麽用?Java Tracer.trace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.squawk.util.Tracer
的用法示例。
在下文中一共展示了Tracer.trace方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: traceType
import com.sun.squawk.util.Tracer; //導入方法依賴的package包/類
/**
* Traces a type on the operand stack or in a local variable.
*
* @param type the type to trace
* @param prefix the prefix to use if <code>isDerived</code> is true
* otherwise a prefix of spaces the same length as
* <code>prefix</code> is used instead
* @param isDerived specifies if this a type derived by the verifer or
* is specified by a stack map entry
*/
private void traceType(Klass type, String prefix, boolean isDerived) {
if (Translator.TRACING_ENABLED) {
if (!isDerived) {
char[] spaces = new char[prefix.length()];
Arrays.fill(spaces, ' ');
Tracer.trace(new String(spaces));
} else {
Tracer.trace(prefix);
}
String name = (type == null ? "-T-" : type.getInternalName());
if (isDerived) {
Tracer.traceln(" "+name);
} else {
Tracer.traceln("{"+name+"}");
}
}
}
示例2: traceProgress
import com.sun.squawk.util.Tracer; //導入方法依賴的package包/類
/**
* Returns true if the translator should print verbose progress
*/
public void traceProgress() {
if (verbose()) {
progressCounter++;
Tracer.trace(".");
if (progressCounter % 40 == 0) {
Tracer.trace("\n");
}
}
}
示例3: stripFields
import com.sun.squawk.util.Tracer; //導入方法依賴的package包/類
/**
* Prunes the fields based on a given suite type.
*
* @param klass the enclosing class
* @param type specifies a closed suite type. Must be {@link Suite#LIBRARY} or {@link Suite#EXTENDABLE_LIBRARY}.
* @param category specifies instance or static fields
* @param types the collection to which the types in the signatures of the remaining fields should be added
* @return an integer with the only the bit in position 'category' set if at least one field was not stripped otherwise 0
*/
private int stripFields(Klass klass, int type, int category, SquawkVector types) {
Assert.that(category == INSTANCE_FIELDS || category == STATIC_FIELDS);
int count = getMemberCount(category);
boolean keptAtLeastOne = false;
if (count != 0) {
for (int i = 0; i != count; ++i) {
select(category, i);
Klass fieldType = getSignatureType(getSignatureAt(0));
Field field = klass.getField(i, category == STATIC_FIELDS);
if (keepForRuntimeStatics(klass, fieldType, category)
|| (retainMember(type, modifiers, fieldType) && VM.isExported(field))) {
if (!keptAtLeastOne) {
symbolsBuffer.addUnsignedByte(category);
keptAtLeastOne = true;
}
membersBuffer.reset();
membersBuffer.addUnsignedShort(modifiers);
membersBuffer.addUnsignedShort(getOffset());
membersBuffer.addUtf8(getName());
if (Modifier.hasPragmas(modifiers)) {
membersBuffer.addUnsignedShort(0);
}
membersBuffer.addUnsignedShort(KlassMetadata.addSignatureType(types, fieldType));
if (Modifier.hasConstant(modifiers)) {
if (!fieldType.isPrimitive()) {
membersBuffer.addUtf8(getStringConstantValue());
} else {
long value = getPrimitiveConstantValue();
int dataSize = fieldType.getDataSize();
for (int bite = 0; bite != dataSize; ++bite) {
membersBuffer.addUnencodedByte((byte)value);
value = value >> 8;
}
}
}
symbolsBuffer.add(membersBuffer);
} else if (Klass.TRACING_ENABLED && Tracer.isTracing("stripping")) {
Tracer.trace(" discarded metadata for field: " + fieldType.getInternalName() + " " + getName());
if (Modifier.hasConstant(modifiers)) {
Tracer.trace(" [constantValue=" + (fieldType.isPrimitive() ? ""+getPrimitiveConstantValue() : getStringConstantValue()) + "]");
}
Tracer.traceln("");
}
}
}
return keptAtLeastOne ? 1 << category : 0;
}
示例4: close
import com.sun.squawk.util.Tracer; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void close(int suiteType) throws NoClassDefFoundError {
long time = 0;
this.suiteType = suiteType;
if (verbose()) {
Tracer.trace("[Translator: computing closure...");
time = System.currentTimeMillis();
}
computeClosure();
if (translationStrategy == BY_SUITE || translationStrategy == BY_TRANSLATION) {
if (verbose()) {
time = System.currentTimeMillis() - time;
Tracer.traceln(time + "ms.]");
Tracer.trace("[Translator: whole-suite optimizing and inlining...");
time = System.currentTimeMillis();
}
// bytecode optimizations and inlining go here
if (Arg.get(Arg.DEAD_METHOD_ELIMINATION).getBool()) {
dme = new DeadMethodEliminator(this);
dme.computeMethodsUsed();
}
if (Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool()) {
dce = new DeadClassEliminator(this);
dce.computeClassesUsed();
}
if (Arg.get(Arg.DEAD_METHOD_ELIMINATION).getBool()) {
dme = new DeadMethodEliminator(this);
dme.computeMethodsUsed();
}
if (verbose()) {
time = System.currentTimeMillis() - time;
Tracer.traceln(time + "ms.]");
Tracer.trace("[Translator: phase2...");
time = System.currentTimeMillis();
}
for (int cno = 0; cno < suite.getClassCount(); cno++) {
Klass klass = suite.getKlass(cno);
Assert.always(Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool() || (klass != null));
if (klass != null) {
convertPhase2(klass);
}
}
}
classFiles.clear();
if (verbose()) {
time = System.currentTimeMillis() - time;
Tracer.traceln(time + "ms.]");
/*if[ENABLE_VERBOSE]*/
if (VM.isVeryVerbose()) {
InstructionEmitter.printUncalledNativeMethods();
}
/*end[ENABLE_VERBOSE]*/
}
Assert.always(lastClassNameStack.empty());
}
示例5: stripFields
import com.sun.squawk.util.Tracer; //導入方法依賴的package包/類
/**
* Prunes the fields based on a given suite type.
*
* @param klass the enclosing class
* @param type specifies a closed suite type. Must be {@link Suite#LIBRARY} or {@link Suite#EXTENDABLE_LIBRARY}.
* @param category specifies instance or static fields
* @param types the collection to which the types in the signatures of the remaining fields should be added
* @return an integer with the only the bit in position 'category' set if at least one field was not stripped otherwise 0
*/
private int stripFields(Klass klass, int type, int category, SquawkVector types) {
if (false) Assert.that(category == INSTANCE_FIELDS || category == STATIC_FIELDS);
int count = getMemberCount(category);
boolean keptAtLeastOne = false;
if (count != 0) {
for (int i = 0; i != count; ++i) {
select(category, i);
Klass fieldType = getSignatureType(getSignatureAt(0));
Field field = klass.getField(i, category == STATIC_FIELDS);
if (keepForRuntimeStatics(klass, fieldType, category)
|| (retainMember(type, modifiers, fieldType) && VM.isExported(field))) {
if (!keptAtLeastOne) {
symbolsBuffer.addUnsignedByte(category);
keptAtLeastOne = true;
}
membersBuffer.reset();
membersBuffer.addUnsignedShort(modifiers);
membersBuffer.addUnsignedShort(getOffset());
membersBuffer.addUtf8(getName());
if (Modifier.hasPragmas(modifiers)) {
membersBuffer.addUnsignedShort(0);
}
membersBuffer.addUnsignedShort(KlassMetadata.addSignatureType(types, fieldType));
if (Modifier.hasConstant(modifiers)) {
if (!fieldType.isPrimitive()) {
membersBuffer.addUtf8(getStringConstantValue());
} else {
long value = getPrimitiveConstantValue();
int dataSize = fieldType.getDataSize();
for (int bite = 0; bite != dataSize; ++bite) {
membersBuffer.addUnencodedByte((byte)value);
value = value >> 8;
}
}
}
symbolsBuffer.add(membersBuffer);
} else if (Klass.TRACING_ENABLED && Tracer.isTracing("stripping")) {
Tracer.trace(" discarded metadata for field: " + fieldType.getInternalName() + " " + getName());
if (Modifier.hasConstant(modifiers)) {
Tracer.trace(" [constantValue=" + (fieldType.isPrimitive() ? ""+getPrimitiveConstantValue() : getStringConstantValue()) + "]");
}
Tracer.traceln("");
}
}
}
return keptAtLeastOne ? 1 << category : 0;
}
示例6: close
import com.sun.squawk.util.Tracer; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void close(int suiteType) throws NoClassDefFoundError {
long time = 0;
this.suiteType = suiteType;
if (verbose()) {
Tracer.trace("[Translator: computing closure...");
time = System.currentTimeMillis();
}
computeClosure();
if (translationStrategy == BY_SUITE || translationStrategy == BY_TRANSLATION) {
if (verbose()) {
time = System.currentTimeMillis() - time;
Tracer.traceln(time + "ms.]");
Tracer.trace("[Translator: whole-suite optimizing and inlining...");
time = System.currentTimeMillis();
}
// bytecode optimizations and inlining go here
if (Arg.get(Arg.DEAD_METHOD_ELIMINATION).getBool()) {
dme = new DeadMethodEliminator(this);
dme.computeMethodsUsed();
}
if (Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool()) {
dce = new DeadClassEliminator(this);
dce.computeClassesUsed();
}
if (verbose()) {
time = System.currentTimeMillis() - time;
Tracer.traceln(time + "ms.]");
Tracer.trace("[Translator: phase2...");
time = System.currentTimeMillis();
}
for (int cno = 0; cno < suite.getClassCount(); cno++) {
Klass klass = suite.getKlass(cno);
Assert.always(Arg.get(Arg.DEAD_CLASS_ELIMINATION).getBool() || (klass != null));
if (klass != null) {
convertPhase2(klass);
}
}
}
classFiles.clear();
if (verbose()) {
time = System.currentTimeMillis() - time;
Tracer.traceln(time + "ms.]");
if (VM.isVeryVerbose()) {
InstructionEmitter.printUncalledNativeMethods();
}
}
Assert.always(lastClassNameStack.empty());
}