summaryrefslogtreecommitdiff
path: root/bytecomp/emitcode.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1995-07-02 16:45:21 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1995-07-02 16:45:21 +0000
commitbee1844ffe63f38abbdb8475d19e3980201e7ae3 (patch)
treed5250ddb8964462a496f67b670d4082351b4e558 /bytecomp/emitcode.ml
parenteef01845fe11d735e15e4b8b1ac0622bd02da033 (diff)
downloadocaml-bee1844ffe63f38abbdb8475d19e3980201e7ae3.tar.gz
Codage des constructeurs constants avec Const_pointer
Optimisation de match (a,b) with (p1,p2) -> Renommage de codegen -> bytegen, linker -> bytelink. emitcode: cas Kdummy 0. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@53 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'bytecomp/emitcode.ml')
-rw-r--r--bytecomp/emitcode.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml
index 1fa60e6497..d68b92b332 100644
--- a/bytecomp/emitcode.ml
+++ b/bytecomp/emitcode.ml
@@ -160,6 +160,10 @@ let emit_instr = function
else (out opCONSTINT; out_int i)
| Const_base(Const_char c) ->
out opCONSTINT; out_int (Char.code c)
+ | Const_pointer i ->
+ if i >= 0 & i <= 3
+ then out (opCONST0 + i)
+ else (out opCONSTINT; out_int i)
| Const_block(t, []) ->
if t = 0 then out opATOM0 else (out opATOM; out_int t)
| _ ->
@@ -174,7 +178,8 @@ let emit_instr = function
if n < 4 then out(opGETFIELD0 + n) else (out opGETFIELD; out_int n)
| Ksetfield n ->
if n < 4 then out(opSETFIELD0 + n) else (out opSETFIELD; out_int n)
- | Kdummy n -> out opDUMMY; out_int n
+ | Kdummy n ->
+ if n = 0 then out opATOM0 else (out opDUMMY; out_int n)
| Kupdate n -> out opUPDATE
| Kvectlength -> out opVECTLENGTH
| Kgetvectitem -> out opGETVECTITEM