diff options
| author | 2015-06-18 10:05:11 -0700 | |
|---|---|---|
| committer | 2015-06-22 14:13:30 -0700 | |
| commit | 2ee54e249ad21c74f29a161e248bebe7d22fddf1 (patch) | |
| tree | 125465dd7a6d23f83ecbf2d3454f21471868422c /runtime/interpreter/interpreter_switch_impl.cc | |
| parent | 158f35c98e2ec0d40d2c032b8cdce5fb60944a7f (diff) | |
runtime: Partially implement box-lambda and unbox-lambda experimental opcodes
These opcodes are not yet fully specified, and *will* change before they become shippable.
Do not write production code against experimental opcodes.
--
Implement partial interpreter support for new dex instructions box/unbox-lambda.
* box-lambda will take a closure and convert it into an Object
* unbox-lambda will take an Object and convert it to a closure
(Currently does not implement object identity or variable capture).
All new opcodes are disabled by default, use runtime option -Xexperimental-lambdas to enable them.
Change-Id: I3c15ccf8a26ccecd1d35808a8c1b4149220f6019
Diffstat (limited to 'runtime/interpreter/interpreter_switch_impl.cc')
| -rw-r--r-- | runtime/interpreter/interpreter_switch_impl.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index 80401977cd..78090bbe0c 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -2245,7 +2245,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } case Instruction::UNUSED_F4: case Instruction::UNUSED_F5: - case Instruction::UNUSED_F7 ... Instruction::UNUSED_F9: { + case Instruction::UNUSED_F7: { if (!IsExperimentalInstructionEnabled(inst)) { UnexpectedOpcode(inst, shadow_frame); } @@ -2253,6 +2253,26 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, CHECK(false); // TODO(iam): Implement opcodes for lambdas break; } + case Instruction::BOX_LAMBDA: { + if (!IsExperimentalInstructionEnabled(inst)) { + UnexpectedOpcode(inst, shadow_frame); + } + + PREAMBLE(); + bool success = DoBoxLambda<do_access_check>(self, shadow_frame, inst, inst_data); + POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); + break; + } + case Instruction::UNBOX_LAMBDA: { + if (!IsExperimentalInstructionEnabled(inst)) { + UnexpectedOpcode(inst, shadow_frame); + } + + PREAMBLE(); + bool success = DoUnboxLambda<do_access_check>(self, shadow_frame, inst, inst_data); + POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_2xx); + break; + } case Instruction::UNUSED_3E ... Instruction::UNUSED_43: case Instruction::UNUSED_FA ... Instruction::UNUSED_FF: case Instruction::UNUSED_79: |