Difference between revisions of "Language related articles/id"

From Lazarus wiki
Jump to navigationJump to search
Line 41: Line 41:
 
For new rtl related stuff have a look at [[New in the 1.9.x rtl (not yet in the docs)]].
 
For new rtl related stuff have a look at [[New in the 1.9.x rtl (not yet in the docs)]].
  
=== SSE Usage ===
+
=== Penggunaan SSE ===
To determine the supported instruction set, use the is_sse_cpu and is_sse2_cpu of the mmx unit. Because the sse code is usually faster than x87-fpu code, it's recommended to use these switches for heavy floating point calculations. If you want an application which runs on all fpu architectures, a possible solution is to put the code into an include file and include this file twice into your program: once compiled with e.g. -Cfsse2 and once without. Use the e.g. is_sse2_cpu variable to select the appropriate code:<br>
+
Untuk menentukan set instruksi yang didukung, gunakan is_sse_cpu dan is_sse2_cpu pada unit mmx unit. Karena kode sse biasanya lebih cepat dari kode x87-fpu, direkomendasikan untuk menggunakan saklar ini untuk perhitungan floating point berat. Jika anda ingin aplikasi berjalan pada semua arsitektur fpu, solusi yang mungkin adalah untuk menyimpan kode ke dalam file include dan sertakan file ini ke dalam program anda: sekali dikompilasi misalnya -Cfsse2 dan sekali tanpa itu. Gunakan misalnya variabel is_sse2_cpu untuk memilih kode yang sesuai:<br>
 
   {$fputype x87}
 
   {$fputype x87}
 
   procedure calc_x87;
 
   procedure calc_x87;

Revision as of 22:18, 27 September 2007

Kembali ke Artikel pengembangan kompilator

Hal-hal yang saat ini tidak didukung FPC 2.x.x

Hal-hal yang sebagian didukung FPC 1.9.x

  • Dukungan variant lebih maju atau buggy (detail bugs, dukungan variants kustom kurang, masalah vararray masih dalam pengembangan)
  • saat ini diperlukan dukungan pengujian (ada beberapa pekerjaan yang selesai akhir-akhir ini)
  • Dynarrays, termasuk fungsi Slice nampaknya bermasalah
  • Reintroduce; hanya dilewati bukan diproses (setidaknya kompilator mengatakan tidak)
    • saya sangat yakin bahwa reintroduce telah melewati peringatan dalam Plugwash
  • widestrings. Rutin konversi standar untuk ansistring<>widestring hanya mengubah karakter dalam ascii jangkauan (poin kode 0-127). Rutin dapat diganti melalui procvars tapi ia didesain dalam cara yang menjadi sia-sia untuk setiap charset lokal yang tidak memiliki pemetaan 1:1 ke unicode.

02:56, 1 Jan 2005 (CET)

Variant bear menggunakan paket DECAL telah ditulis baru-baru ini dan bekerja baik. Maka saya pikir masalah variant banyak yang selesai, dan hanya konversi tipikal yang kurang. (yang biasanya dibetulkan dengan mudah jika anda mengirimkan bug dengan contoh sederhana yang bekerja dalam Delphi dan tidak dalam FPC). Akan tetapi beberapa dukungan RTL (pelapis kelas) banyak yang tidak diimplementasikan

New in 1.9.x (not yet in the docs)

  • {$fputype xxx) to select a certain fpu style or -Cfxxx on command line/cfg file
    • all: soft (not yet implemented)
    • i386: x87, sse, sse2
      • code compiled with sse uses the sse to do calculations with the single data type. This code runs only on Pentium III and above and AthlonXP and above
      • code compiled with sse2 uses the sse unit to do calculations with the single and double data type. This code runs only on PentiumIV and above and Athlon64 and above
    • x86-64: sse64
    • powerpc: standard
    • arm: libgcc, fpa, fpa10, fpa11, vfp
  • procedural property support (property outside a class with normal procedures as getters/setters.
  • A -Fa parameter that lets you USES an unit as first unit in each unit. Great for e.g. redefining base types etc.
  • reuse keywords imports all units the reused unit imports.
  • reintroduce omits warning about hidden methods
  • Some mac pascal extensions, see Mode MacPas.
  • system.prefetch(const mem); depending on the target processor the compiler generates a prefetch hint on the given memory location. On iA32 this is the sse instruction prefetchnta which is supported by Pentium3/AthlonXP and above. If the intruction set, selected with -Cp (on iA-32, prefetch instructions are generated for -Oppentium3 and above) doesn't support this instruction, no code is generated for prefetch.
  • Interface type selection: The commandline switch -SI and the directive $interfaces (possible values: corba and com) allow you to choose the type of interfaces which has no parent. Interfaces with parent inherit the style from their parent regardless of the currently selected interface type.
    • COM style interfaces work like Delphi interfaces: they inherit implicitly from IUnknown and they are reference counted.
    • CORBA style interfaces are neither ref. counted nor do they inherit from IUnknown.

For new rtl related stuff have a look at New in the 1.9.x rtl (not yet in the docs).

Penggunaan SSE

Untuk menentukan set instruksi yang didukung, gunakan is_sse_cpu dan is_sse2_cpu pada unit mmx unit. Karena kode sse biasanya lebih cepat dari kode x87-fpu, direkomendasikan untuk menggunakan saklar ini untuk perhitungan floating point berat. Jika anda ingin aplikasi berjalan pada semua arsitektur fpu, solusi yang mungkin adalah untuk menyimpan kode ke dalam file include dan sertakan file ini ke dalam program anda: sekali dikompilasi misalnya -Cfsse2 dan sekali tanpa itu. Gunakan misalnya variabel is_sse2_cpu untuk memilih kode yang sesuai:

 {$fputype x87}
 procedure calc_x87;
 {$i mymathcode.inc}
 {$fputype sse2}
 procedure calc_sse2;
 {$i mymathcode.inc}
 begin 
   if is_sse2_cpu then
     calc_sse2
   else
     calc_x87;
 end;

Baru dalam 2.0.x

Dukungan UTF-8

Support for utf-8 strings inside '...' has been added. The encoding can be either selected by passing -Fcutf8 on the command line, using the directive $codepage utf8 or adding the utf-8 signature $ef $bb $bf at the beginning of a file. Strings with chars>=$80 are converted to widestrings and handled internally as widestrings. Unicode chars > 65535 can't be represented this way, this will cause an error message.

Baru dalam 2.1.x

Unaligned Keyword

When typecasting a variable as "unaligned" you tell compiler that this variable should be read or write to one byte at a time.This is usefull on those systems that require aligned data accesses. This is currently only implemented on arm cpus.

Ide untuk hal baru

Generics

Modernised Pascal

Mac Local Procedure Parameters

OpenMP support