Browse Source

[PATCH 06/83] cleaning up jvm reference

From db7919d463beffb3b6bc610300436bf32dc6e823 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Fri, 30 Aug 2019 12:07:28 -0400

git-svn-id: branches/wasm@45883 -
nickysn 5 years ago
parent
commit
8d485c3db3
4 changed files with 19 additions and 64 deletions
  1. 4 41
      compiler/wasm/aasmcpu.pas
  2. 9 4
      compiler/wasm/cpubase.pas
  3. 3 7
      compiler/wasm/cpuinfo.pas
  4. 3 12
      compiler/wasm/hlcgcpu.pas

+ 4 - 41
compiler/wasm/aasmcpu.pas

@@ -228,47 +228,10 @@ implementation
 
     function taicpu.spilling_get_operation_type(opnr: longint): topertype;
       begin
-        {case opcode of
-          a_iinc:
-            result:=operand_readwrite;
-          a_aastore,
-          a_astore,
-          a_astore_0,
-          a_astore_1,
-          a_astore_2,
-          a_astore_3,
-          a_bastore,
-          a_castore,
-          a_dastore,
-          a_dstore,
-          a_dstore_0,
-          a_dstore_1,
-          a_dstore_2,
-          a_dstore_3,
-          a_fastore,
-          a_fstore,
-          a_fstore_0,
-          a_fstore_1,
-          a_fstore_2,
-          a_fstore_3,
-          a_iastore,
-          a_istore,
-          a_istore_0,
-          a_istore_1,
-          a_istore_2,
-          a_istore_3,
-          a_lastore,
-          a_lstore,
-          a_lstore_0,
-          a_lstore_1,
-          a_lstore_2,
-          a_lstore_3,
-          a_sastore:
-            result:=operand_write;
-          else
-            result:=operand_read;
-        end;}
-        result:=operand_read;
+        if opcode in AsmOp_Store then
+          result:=operand_write
+        else
+          result:=operand_read;
       end;
 
 

+ 9 - 4
compiler/wasm/cpubase.pas

@@ -94,6 +94,11 @@ uses
       {# Last value of opcode enumeration  }
       lastop  = high(tasmop);
 
+      AsmOp_Store = [
+         a_i32_store, a_i32_store16, a_i32_store8
+        ,a_i64_store, a_i64_store16, a_i64_store8, a_i64_store32
+        ,a_f32_store, a_f64_store
+      ];
 
 {*****************************************************************************
                                   Registers
@@ -156,7 +161,7 @@ uses
 *****************************************************************************}
 
    type
-     // not used by jvm target
+     // not used by wasm target
      TAsmCond=(C_None);
 
 {*****************************************************************************
@@ -182,7 +187,7 @@ uses
       OS_SINT = OS_S64;
 {$else}
       {# Defines the default address size for a processor,
-        -- fake for JVM, only influences default width of
+        -- fake for wasm, only influences default width of
            arithmetic calculations }
       OS_ADDR = OS_32;
       {# the natural int size for a processor,
@@ -199,7 +204,7 @@ uses
                           Generic Register names
 *****************************************************************************}
 
-      { dummies, not used for JVM }
+      { dummies, not used for Wasm }
 
       {# Stack pointer register }
       { used as base register in references to indicate that it's a local }
@@ -238,7 +243,7 @@ uses
                        GCC /ABI linking information
 *****************************************************************************}
 
-      { dummies, not used for JVM }
+      { dummies, not used for Wasm }
 
       {# Required parameter alignment when calling a routine
       }

+ 3 - 7
compiler/wasm/cpuinfo.pas

@@ -37,11 +37,8 @@ Type
    { possible supported processors for this target }
    tcputype =
       (cpu_none,
-       { jvm, same as cpu_none }
-       cpu_jvm,
-       { jvm byte code to be translated into Dalvik bytecode: more type-
-         sensitive }
-       cpu_dalvik
+       { wasm, same as cpu_none }
+       cpu_wasm
       );
 
    tfputype =
@@ -80,8 +77,7 @@ Const
    ];
 
    cputypestr : array[tcputype] of string[9] = ('',
-     'JVM',
-     'JVMDALVIK'
+     'WASM'
    );
 
    fputypestr : array[tfputype] of string[8] = (

+ 3 - 12
compiler/wasm/hlcgcpu.pas

@@ -912,8 +912,7 @@ implementation
       const
         overflowops = [OP_MUL,OP_SHL,OP_ADD,OP_SUB,OP_NOT,OP_NEG];
       begin
-        if ((op in overflowops) or
-            (current_settings.cputype=cpu_dalvik)) and
+        if (op in overflowops) and
            (def_cgsize(size) in [OS_8,OS_S8,OS_16,OS_S16]) then
           resize_stack_int_val(list,s32inttype,size,false);
       end;
@@ -2157,18 +2156,10 @@ implementation
         destination type is smaller that the source type, or has a different
         sign. In case the destination is a widechar and the source is not, we
         also have to insert a conversion to widechar.
-
-        In case of Dalvik, we also have to insert conversions for e.g. byte
-        -> smallint, because truncating a byte happens via "and 255", and the
-        result is a longint in Dalvik's type verification model (so we have
-        to "truncate" it back to smallint) }
+       }
       if (not(fromcgsize in [OS_S64,OS_64,OS_32,OS_S32]) or
           not(tocgsize in [OS_S64,OS_64,OS_32,OS_S32])) and
-         (((current_settings.cputype=cpu_dalvik) and
-           not(tocgsize in [OS_32,OS_S32]) and
-           not is_signed(fromsize) and
-           is_signed(tosize)) or
-          (tcgsize2size[fromcgsize]>tcgsize2size[tocgsize]) or
+         ((tcgsize2size[fromcgsize]>tcgsize2size[tocgsize]) or
           ((tcgsize2size[fromcgsize]=tcgsize2size[tocgsize]) and
            (fromcgsize<>tocgsize)) or
           { needs to mask out the sign in the top 16 bits }