Mercurial > hg > truffle
comparison src/share/vm/interpreter/bytecode.cpp @ 726:be93aad57795
6655646: dynamic languages need dynamically linked call sites
Summary: invokedynamic instruction (JSR 292 RI)
Reviewed-by: twisti, never
author | jrose |
---|---|
date | Tue, 21 Apr 2009 23:21:04 -0700 |
parents | a61af66fc99e |
children | bd02caa94611 |
comparison
equal
deleted
inserted
replaced
725:928912ce8438 | 726:be93aad57795 |
---|---|
29 // Should eventually get rid of these functions and use ThisRelativeObj methods instead | 29 // Should eventually get rid of these functions and use ThisRelativeObj methods instead |
30 | 30 |
31 void Bytecode::set_code(Bytecodes::Code code) { | 31 void Bytecode::set_code(Bytecodes::Code code) { |
32 Bytecodes::check(code); | 32 Bytecodes::check(code); |
33 *addr_at(0) = u_char(code); | 33 *addr_at(0) = u_char(code); |
34 } | |
35 | |
36 | |
37 void Bytecode::set_fast_index(int i) { | |
38 assert(0 <= i && i < 0x10000, "illegal index value"); | |
39 Bytes::put_native_u2(addr_at(1), (jushort)i); | |
40 } | 34 } |
41 | 35 |
42 | 36 |
43 bool Bytecode::check_must_rewrite() const { | 37 bool Bytecode::check_must_rewrite() const { |
44 assert(Bytecodes::can_rewrite(code()), "post-check only"); | 38 assert(Bytecodes::can_rewrite(code()), "post-check only"); |
116 return m; | 110 return m; |
117 } | 111 } |
118 | 112 |
119 | 113 |
120 int Bytecode_invoke::index() const { | 114 int Bytecode_invoke::index() const { |
121 return Bytes::get_Java_u2(bcp() + 1); | 115 // Note: Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4, |
116 // at the same time it allocates per-call-site CP cache entries. | |
117 if (has_giant_index()) | |
118 return Bytes::get_native_u4(bcp() + 1); | |
119 else | |
120 return Bytes::get_Java_u2(bcp() + 1); | |
122 } | 121 } |
123 | 122 |
124 | 123 |
125 // Implementation of Bytecode_static | 124 // Implementation of Bytecode_static |
126 | 125 |