本文整理汇总了Java中gnu.bytecode.CodeAttr类的典型用法代码示例。如果您正苦于以下问题:Java CodeAttr类的具体用法?Java CodeAttr怎么用?Java CodeAttr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeAttr类属于gnu.bytecode包,在下文中一共展示了CodeAttr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compileToNode
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
public void compileToNode(ApplyExp exp, Compilation comp,
ConsumerTarget target) {
CodeAttr code = comp.getCode();
Expression[] args = exp.getArgs();
args[0].compile(comp, Target.pushObject);
args[1].compile(comp, Target.pushObject);
String mname;
if (target.isContextTarget()) {
comp.loadCallContext();
mname = "applyTemplates$X";
} else {
code.emitLoad(target.getConsumerVariable());
mname = "applyTemplates$C";
}
code.emitInvokeStatic(ClassType.make("gnu.kawa.xslt.ApplyTemplates")
.getDeclaredMethod(mname, 3));
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:18,代码来源:ApplyTemplates.java
示例2: compile
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
public void compile (Compilation comp, Target target)
{
pushOptions(comp);
try
{
int n = length, i;
CodeAttr code = comp.getCode();
for (i = 0; i < n - 1; i++)
{
exps[i].compileWithPosition(comp, Target.Ignore);
if (! code.reachableHere())
{
if (comp.warnUnreachable())
comp.error('w', "unreachable code", exps[i+1]);
return;
}
}
exps[i].compileWithPosition(comp, target);
}
finally
{
popOptions(comp);
}
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:25,代码来源:BeginExp.java
示例3: compileWithPosition
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
/** Same as 2-argument compileWithPosition,
* but use some other Expression's line number. */
public final void compileWithPosition(Compilation comp, Target target,
Expression position) {
CodeAttr code = comp.getCode();
if (! code.reachableHere())
return;
int line = position.getLineNumber ();
if (line > 0) {
code.putLineNumber(position.getFileName(), line);
String saveFilename = comp.getFileName();
int saveLine = comp.getLineNumber();
int saveColumn = comp.getColumnNumber();
comp.setLine(position);
compile(comp, target);
// This might logically belong in a `finally' clause. It is
// intentionally not so, so that if there is an internal error
// causing an exception, we get the line number where the
// exception was thrown.
comp.setLine(saveFilename, saveLine, saveColumn);
} else
compile(comp, target);
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:24,代码来源:Expression.java
示例4: gnuByteCodeHelloWorld
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
static byte[] gnuByteCodeHelloWorld() {
ClassType c = new ClassType("HelloWorld");
c.setSuper("java.lang.Object");
c.setModifiers(Access.PUBLIC);
c.setSourceFile("HelloWorld.java");
Method m = c.addMethod("<init>", "()V", Access.PUBLIC);
CodeAttr code = m.startCode();
code.pushScope();
code.emitPushThis();
code.emitInvokeSpecial(objectCtor);
code.emitReturn();
code.popScope();
m = c.addMethod("main", "([Ljava/lang/String;)V", Access.PUBLIC
| Access.STATIC);
code = m.startCode();
code.pushScope();
code.emitGetStatic(outField);
code.emitPushString("Hello world!");
code.emitInvokeVirtual(printlnMethod);
code.emitReturn();
code.popScope();
return c.writeToArray();
}
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:27,代码来源:GenPerfTest.java
示例5: emitPushBoolean
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
@Override
public void emitPushBoolean(boolean value)
{
CodeAttr code = getCode();
if (value)
code.emitGetStatic(ClassType.make("gnu.commonlisp.lang.Lisp2").getDeclaredField("TRUE"));
else
code.emitGetStatic(Compilation.scmListType.getDeclaredField("Empty"));
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:10,代码来源:Lisp2Compilation.java
示例6: compileKey
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
/**
* Compiles the key of the case expression,
* then computes the hash code, optimizing
* according to the type.
*/
private void compileKey(Compilation comp) {
CodeAttr code = comp.getCode();
if (key.getType() == Type.intType
|| key.getType() == Type.shortType
|| key.getType() == Type.byteType
|| key.getType() == LangPrimType.charType
|| key.getType() == LangPrimType.characterType) {
// hashCode for an int is the int itself
key.compile(comp, Type.intType);
} else if (key.getType() == Type.longType) {
// hashCode function for longs, inlined
key.compile(comp, Type.longType);
key.compile(comp, Type.longType);
code.emitPushInt(32);
code.emitShr();
code.emitXOr();
StackTarget st = new StackTarget(Type.intType);
st.compileFromStack(comp, Type.longType);
} else {
// hashCode computed using hashCode method
// of java.lang.Object
key.compile(comp, Type.objectType);
code.emitInvokeVirtual(hashCodeMethod);
}
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:33,代码来源:CaseExp.java
示例7: compileFromStack
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
public void compileFromStack(Compilation comp, Type stackType) {
if (! stackType.isVoid()) {
CodeAttr code = comp.getCode();
if (code.reachableHere())
code.emitPop(1);
}
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:8,代码来源:IgnoreTarget.java
示例8: emitPushBoolean
import gnu.bytecode.CodeAttr; //导入依赖的package包/类
public void emitPushBoolean(boolean value, CodeAttr code)
{
if (value)
code.emitGetStatic(ClassType.make("gnu.commonlisp.lang.Lisp2").getDeclaredField("TRUE"));
else
code.emitGetStatic(Compilation.scmListType.getDeclaredField("Empty"));
}
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:8,代码来源:Lisp2.java
注:本文中的gnu.bytecode.CodeAttr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论