由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - self-modifying code?
相关主题
Getting bytecode of a class怎麼得到字符串中的raw bytes?
type erasure weird problemHow to parse the bytes[]
Question on J2EE containerJava basic concept(1)
java virtual machine 急问!!在线等入门Java CLASSPATH问题:
[转载] 有用Eclipse的嘛?JSP is rubbish!
问个很简单的问题?请问java有办法隐藏source code吗
help about bitstream writerRe: how to access the overrided fields o
怎样吧byte[]变成java.security.Key?java的接口runnable
相关话题的讨论汇总
话题: code话题: machine话题: modifying话题: self话题: generates
进入Java版参与讨论
1 (共1页)
b**y
发帖数: 121
1
I heard that java can dynamically generate code, am I right?
My question is, in which level the code generation is? Is newly
generated code in high-level language or byte code that is machine
independent, then comile it to host machine language? Or it directly
generates new code in machine binary form?
g*****g
发帖数: 34805
2
Java can load bytecode in runtime, and expose the interface and field if you
need it. Of course, you can also write and compile source file in runtime.

【在 b**y 的大作中提到】
: I heard that java can dynamically generate code, am I right?
: My question is, in which level the code generation is? Is newly
: generated code in high-level language or byte code that is machine
: independent, then comile it to host machine language? Or it directly
: generates new code in machine binary form?

b**y
发帖数: 121
3

Thanks a lot! :o)
One more question, is it possible that the code generates machine binary
directly?

【在 g*****g 的大作中提到】
: Java can load bytecode in runtime, and expose the interface and field if you
: need it. Of course, you can also write and compile source file in runtime.

g*****g
发帖数: 34805
4
If you have JIT compiler, of course you can do that.

you

【在 b**y 的大作中提到】
:
: Thanks a lot! :o)
: One more question, is it possible that the code generates machine binary
: directly?

m******t
发帖数: 2416
5

That's still one step away from "self-modifying", though - you can't reload a
class.

【在 g*****g 的大作中提到】
: Java can load bytecode in runtime, and expose the interface and field if you
: need it. Of course, you can also write and compile source file in runtime.

e***g
发帖数: 158
6
http://jakarta.apache.org/bcel/

【在 b**y 的大作中提到】
: I heard that java can dynamically generate code, am I right?
: My question is, in which level the code generation is? Is newly
: generated code in high-level language or byte code that is machine
: independent, then comile it to host machine language? Or it directly
: generates new code in machine binary form?

e***g
发帖数: 158
7

http://java.sun.com/j2se/1.4.1/docs/guide/jpda/enhancements.html#hotswap
haha.

【在 m******t 的大作中提到】
:
: That's still one step away from "self-modifying", though - you can't reload a
: class.

m******t
发帖数: 2416
8

That's part of the JPDA. You have to do it through the debugger interface
- doesn't that sound weird to you when you need to do this on a production
server? 8-)

【在 e***g 的大作中提到】
:
: http://java.sun.com/j2se/1.4.1/docs/guide/jpda/enhancements.html#hotswap
: haha.

1 (共1页)
进入Java版参与讨论
相关主题
java的接口runnable[转载] 有用Eclipse的嘛?
c,java, 数据库内核,数据库应用问个很简单的问题?
求助大家 如何用 Eclipse 给一个project加入imagehelp about bitstream writer
anyone using Scala ?怎样吧byte[]变成java.security.Key?
Getting bytecode of a class怎麼得到字符串中的raw bytes?
type erasure weird problemHow to parse the bytes[]
Question on J2EE containerJava basic concept(1)
java virtual machine 急问!!在线等入门Java CLASSPATH问题:
相关话题的讨论汇总
话题: code话题: machine话题: modifying话题: self话题: generates