summaryrefslogtreecommitdiff
path: root/runtime/interpreter/mterp/gen_mterp.py
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/interpreter/mterp/gen_mterp.py')
-rwxr-xr-xruntime/interpreter/mterp/gen_mterp.py38
1 files changed, 16 insertions, 22 deletions
diff --git a/runtime/interpreter/mterp/gen_mterp.py b/runtime/interpreter/mterp/gen_mterp.py
index 64114d747a..75c5174bcb 100755
--- a/runtime/interpreter/mterp/gen_mterp.py
+++ b/runtime/interpreter/mterp/gen_mterp.py
@@ -279,13 +279,8 @@ def loadAndEmitOpcodes():
sister_list = []
assert len(opcodes) == kNumPackedOpcodes
need_dummy_start = False
- start_label = global_name_format % "artMterpAsmInstructionStart"
- end_label = global_name_format % "artMterpAsmInstructionEnd"
- # point MterpAsmInstructionStart at the first handler or stub
- asm_fp.write("\n .global %s\n" % start_label)
- asm_fp.write("%s = " % start_label + label_prefix + "_op_nop\n")
- asm_fp.write(" .text\n\n")
+ loadAndEmitGenericAsm("instruction_start")
for i in xrange(kNumPackedOpcodes):
op = opcodes[i]
@@ -309,20 +304,14 @@ def loadAndEmitOpcodes():
asm_fp.write(label_prefix + "_op_nop: /* dummy */\n");
emitAlign()
- asm_fp.write(" .global %s\n" % end_label)
- asm_fp.write("%s:\n" % end_label)
+
+ loadAndEmitGenericAsm("instruction_end")
if style == "computed-goto":
- start_sister_label = global_name_format % "artMterpAsmSisterStart"
- end_sister_label = global_name_format % "artMterpAsmSisterEnd"
emitSectionComment("Sister implementations", asm_fp)
- asm_fp.write(" .global %s\n" % start_sister_label)
- asm_fp.write(" .text\n")
- asm_fp.write(" .balign 4\n")
- asm_fp.write("%s:\n" % start_sister_label)
+ loadAndEmitGenericAsm("instruction_start_sister")
asm_fp.writelines(sister_list)
- asm_fp.write(" .global %s\n" % end_sister_label)
- asm_fp.write("%s:\n\n" % end_sister_label)
+ loadAndEmitGenericAsm("instruction_end_sister")
#
# Load an alternate entry stub
@@ -345,10 +334,7 @@ def loadAndEmitAltOpcodes():
start_label = global_name_format % "artMterpAsmAltInstructionStart"
end_label = global_name_format % "artMterpAsmAltInstructionEnd"
- # point MterpAsmInstructionStart at the first handler or stub
- asm_fp.write("\n .global %s\n" % start_label)
- asm_fp.write(" .text\n\n")
- asm_fp.write("%s = " % start_label + label_prefix + "_ALT_op_nop\n")
+ loadAndEmitGenericAsm("instruction_start_alt")
for i in xrange(kNumPackedOpcodes):
op = opcodes[i]
@@ -359,8 +345,8 @@ def loadAndEmitAltOpcodes():
loadAndEmitAltStub(source, i)
emitAlign()
- asm_fp.write(" .global %s\n" % end_label)
- asm_fp.write("%s:\n" % end_label)
+
+ loadAndEmitGenericAsm("instruction_end_alt")
#
# Load an assembly fragment and emit it.
@@ -377,6 +363,14 @@ def loadAndEmitAsm(location, opindex, sister_list):
appendSourceFile(source, dict, asm_fp, sister_list)
#
+# Load a non-handler assembly fragment and emit it.
+#
+def loadAndEmitGenericAsm(name):
+ source = "%s/%s.S" % (default_op_dir, name)
+ dict = getGlobalSubDict()
+ appendSourceFile(source, dict, asm_fp, None)
+
+#
# Emit fallback fragment
#
def emitFallback(opindex):