Mercurial > hg > truffle
comparison src/share/vm/opto/callGenerator.cpp @ 3900:a32de5085326
7079673: JSR 292: C1 should inline bytecoded method handle adapters
Reviewed-by: never
author | twisti |
---|---|
date | Thu, 01 Sep 2011 01:31:25 -0700 |
parents | b27c72d69fd1 |
children | aa67216400d3 |
comparison
equal
deleted
inserted
replaced
3899:c124e2e7463e | 3900:a32de5085326 |
---|---|
59 ParseGenerator(ciMethod* method, float expected_uses, bool is_osr = false) | 59 ParseGenerator(ciMethod* method, float expected_uses, bool is_osr = false) |
60 : InlineCallGenerator(method) | 60 : InlineCallGenerator(method) |
61 { | 61 { |
62 _is_osr = is_osr; | 62 _is_osr = is_osr; |
63 _expected_uses = expected_uses; | 63 _expected_uses = expected_uses; |
64 assert(can_parse(method, is_osr), "parse must be possible"); | 64 assert(InlineTree::check_can_parse(method) == NULL, "parse must be possible"); |
65 } | 65 } |
66 | |
67 // Can we build either an OSR or a regular parser for this method? | |
68 static bool can_parse(ciMethod* method, int is_osr = false); | |
69 | 66 |
70 virtual bool is_parse() const { return true; } | 67 virtual bool is_parse() const { return true; } |
71 virtual JVMState* generate(JVMState* jvms); | 68 virtual JVMState* generate(JVMState* jvms); |
72 int is_osr() { return _is_osr; } | 69 int is_osr() { return _is_osr; } |
73 | 70 |
301 // his JVMS gets adjusted. | 298 // his JVMS gets adjusted. |
302 kit.cast_not_null(receiver); | 299 kit.cast_not_null(receiver); |
303 return kit.transfer_exceptions_into_jvms(); | 300 return kit.transfer_exceptions_into_jvms(); |
304 } | 301 } |
305 | 302 |
306 bool ParseGenerator::can_parse(ciMethod* m, int entry_bci) { | |
307 // Certain methods cannot be parsed at all: | |
308 if (!m->can_be_compiled()) return false; | |
309 if (!m->has_balanced_monitors()) return false; | |
310 if (m->get_flow_analysis()->failing()) return false; | |
311 | |
312 // (Methods may bail out for other reasons, after the parser is run. | |
313 // We try to avoid this, but if forced, we must return (Node*)NULL. | |
314 // The user of the CallGenerator must check for this condition.) | |
315 return true; | |
316 } | |
317 | |
318 CallGenerator* CallGenerator::for_inline(ciMethod* m, float expected_uses) { | 303 CallGenerator* CallGenerator::for_inline(ciMethod* m, float expected_uses) { |
319 if (!ParseGenerator::can_parse(m)) return NULL; | 304 if (InlineTree::check_can_parse(m) != NULL) return NULL; |
320 return new ParseGenerator(m, expected_uses); | 305 return new ParseGenerator(m, expected_uses); |
321 } | 306 } |
322 | 307 |
323 // As a special case, the JVMS passed to this CallGenerator is | 308 // As a special case, the JVMS passed to this CallGenerator is |
324 // for the method execution already in progress, not just the JVMS | 309 // for the method execution already in progress, not just the JVMS |
325 // of the caller. Thus, this CallGenerator cannot be mixed with others! | 310 // of the caller. Thus, this CallGenerator cannot be mixed with others! |
326 CallGenerator* CallGenerator::for_osr(ciMethod* m, int osr_bci) { | 311 CallGenerator* CallGenerator::for_osr(ciMethod* m, int osr_bci) { |
327 if (!ParseGenerator::can_parse(m, true)) return NULL; | 312 if (InlineTree::check_can_parse(m) != NULL) return NULL; |
328 float past_uses = m->interpreter_invocation_count(); | 313 float past_uses = m->interpreter_invocation_count(); |
329 float expected_uses = past_uses; | 314 float expected_uses = past_uses; |
330 return new ParseGenerator(m, expected_uses, true); | 315 return new ParseGenerator(m, expected_uses, true); |
331 } | 316 } |
332 | 317 |