mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 12:39:38 +01:00 
			
		
		
		
	+ added wasm32 inline procedure for generating the 'unreachable' instruction
git-svn-id: branches/wasm@48442 -
This commit is contained in:
		
							parent
							
								
									605246ac3c
								
							
						
					
					
						commit
						4ef1367019
					
				@ -13,5 +13,6 @@
 | 
			
		||||
 **********************************************************************}
 | 
			
		||||
 | 
			
		||||
  in_wasm32_memory_size = in_cpu_first,
 | 
			
		||||
  in_wasm32_memory_grow = in_cpu_first+1
 | 
			
		||||
  in_wasm32_memory_grow = in_cpu_first+1,
 | 
			
		||||
  in_wasm32_unreachable = in_cpu_first+2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,7 @@ interface
 | 
			
		||||
      private
 | 
			
		||||
        procedure second_memory_size;
 | 
			
		||||
        procedure second_memory_grow;
 | 
			
		||||
        procedure second_unreachable;
 | 
			
		||||
      public
 | 
			
		||||
        function pass_typecheck_cpu: tnode; override;
 | 
			
		||||
        function first_cpu: tnode; override;
 | 
			
		||||
@ -84,6 +85,13 @@ implementation
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    procedure twasminlinenode.second_unreachable;
 | 
			
		||||
      begin
 | 
			
		||||
        location_reset(location,LOC_VOID,OS_NO);
 | 
			
		||||
        current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_unreachable));
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    function twasminlinenode.pass_typecheck_cpu: tnode;
 | 
			
		||||
      begin
 | 
			
		||||
        Result:=nil;
 | 
			
		||||
@ -98,6 +106,11 @@ implementation
 | 
			
		||||
              CheckParameters(1);
 | 
			
		||||
              resultdef:=u32inttype;
 | 
			
		||||
            end;
 | 
			
		||||
          in_wasm32_unreachable:
 | 
			
		||||
            begin
 | 
			
		||||
              CheckParameters(0);
 | 
			
		||||
              resultdef:=voidtype;
 | 
			
		||||
            end;
 | 
			
		||||
          else
 | 
			
		||||
            Result:=inherited pass_typecheck_cpu;
 | 
			
		||||
        end;
 | 
			
		||||
@ -111,6 +124,8 @@ implementation
 | 
			
		||||
          in_wasm32_memory_size,
 | 
			
		||||
          in_wasm32_memory_grow:
 | 
			
		||||
            expectloc:=LOC_REGISTER;
 | 
			
		||||
          in_wasm32_unreachable:
 | 
			
		||||
            expectloc:=LOC_VOID;
 | 
			
		||||
          else
 | 
			
		||||
            Result:=inherited first_cpu;
 | 
			
		||||
        end;
 | 
			
		||||
@ -124,6 +139,8 @@ implementation
 | 
			
		||||
            second_memory_size;
 | 
			
		||||
          in_wasm32_memory_grow:
 | 
			
		||||
            second_memory_grow;
 | 
			
		||||
          in_wasm32_unreachable:
 | 
			
		||||
            second_unreachable;
 | 
			
		||||
          else
 | 
			
		||||
            inherited pass_generate_code_cpu;
 | 
			
		||||
        end;
 | 
			
		||||
 | 
			
		||||
@ -19,3 +19,4 @@ const
 | 
			
		||||
 | 
			
		||||
function fpc_wasm32_memory_size: longword;[internproc:fpc_in_wasm32_memory_size];
 | 
			
		||||
function fpc_wasm32_memory_grow(n: longword): longword;[internproc:fpc_in_wasm32_memory_grow];
 | 
			
		||||
procedure fpc_wasm32_unreachable;[internproc:fpc_in_wasm32_unreachable];
 | 
			
		||||
 | 
			
		||||
@ -14,4 +14,5 @@
 | 
			
		||||
 | 
			
		||||
  fpc_in_wasm32_memory_size = fpc_in_cpu_first;
 | 
			
		||||
  fpc_in_wasm32_memory_grow = fpc_in_cpu_first+1;
 | 
			
		||||
  fpc_in_wasm32_unreachable = fpc_in_cpu_first+2;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user