The following statement is taken from iPXE. It compiles fine with gcc 7.3 but fails with gcc 8.2 on the aarch64 architecture. Here I get an error
error: invalid 'asm': invalid address mode
The macro argument einfo is a list of 5 parameters.
#define __einfo_error( einfo ) ( {
__asm__ ( ".section \".einfo\", \"\", " PROGBITS_OPS "\n\t" \
".align 8\n\t" \
"\n1:\n\t" \
".long ( 4f - 1b )\n\t" \
".long %a0\n\t" \
".long ( 2f - 1b )\n\t" \
".long ( 3f - 1b )\n\t" \
".long %a1\n\t" \
"\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
"\n3:\t.asciz \"" __FILE__ "\"\n\t" \
".align 8\n\t" \
"\n4:\n\t" \
".previous\n\t" : : \
"i" ( __einfo_errno ( einfo ) ), \
"i" ( __LINE__ ) ); \
From where does
.long %a0
take its value?
What is the "i" statement doing?
Where is a reference for this syntax? - Has it changed with gcc 8.2?
Related
Background:
Syntax highlighting for perl files is extremely slow at times for large files (1k+ lines).
I profiled using:
:syntime on
"*** Do some slow actions ***
:syntime report
There were many slowly performaning regions, like: perlStatementProc
I significantly improved performance by removing some of the slowly performing syntax regions (there are more):
:syntax clear perlStatementProc
Now I want to use this vimrc with these improvements on a different machine which may not have a specific region defined.
I am seeing this ERROR when opening Vim:
E28: No such highlight group name: perlStatementProc
How can I check if the syntax region name perlStatementProc exists?
I found out about hlexists and implemented this solution in my vimrc:
" Remove some syntax highlighting from large perl files.
function! RemovePerlSyntax()
if line('$') > 1000
let perl_syntaxes = [
\ "perlStatementProc",
\ "perlMatch",
\ "perlStatementPword",
\ "perlQR",
\ "perlQW",
\ "perlQQ",
\ "perlQ",
\ "perlStatementIndirObjWrap",
\ "perlVarPlain",
\ "perlVarPlain",
\ "perlOperator",
\ "perlStatementFiledesc",
\ "perlStatementScalar",
\ "perlStatementInclude",
\ "perlStatementNumeric",
\ "perlStatementSocket",
\ "perlFloat",
\ "perlFormat",
\ "perlStatementMisc",
\ "perlStatementFiles",
\ "perlStatementList",
\ "perlStatementIPC",
\ "perlStatementNetwork",
\ "perlStatementTime",
\ "perlStatementIOfunc",
\ "perlStatementFlow",
\ "perlStatementControl",
\ "perlHereDoc",
\ "perlHereDocStart",
\ "perlVarPlain2",
\ "perlVarBlock",
\ "perlVarBlock2",
\ "perlDATA",
\ "perlControl",
\ "perlStatementHash",
\ "perlStatementVector",
\ "perlIndentedHereDoc",
\ "perlLabel",
\ "perlConditional",
\ "perlRepeat",
\ "perlNumber",
\ "perlStatementRegexp",
\ ]
for perl_syntax in perl_syntaxes
" NEW - Was missing this check before.
if hlexists( perl_syntax )
exec "syntax clear " . perl_syntax
endif
endfor
let b:remove_perl_syntax = 1
else
let b:remove_perl_syntax = 0
endif
endfunction
augroup remove_perl_syntax
autocmd!
autocmd BufNewFile,BufRead,BufReadPost,FileType perl call RemovePerlSyntax()
augroup END
I found two fine tune ways for Sequence Classification with transformer:
1,BertForSequenceClassification.from_pretrained(https://huggingface.co/transformers/training.html):
from transformers import BertForSequenceClassification
model = BertForSequenceClassification.from_pretrained('bert-base-uncased')
model.train()
2,python run_glue.py(https://github.com/huggingface/transformers/tree/master/examples/text-classification):
export GLUE_DIR=/path/to/glue
export TASK_NAME=MRPC
python run_glue.py \
--model_name_or_path bert-base-cased \
--task_name $TASK_NAME \
--do_train \
--do_eval \
--data_dir $GLUE_DIR/$TASK_NAME \
--max_seq_length 128 \
--per_device_train_batch_size 32 \
--learning_rate 2e-5 \
--num_train_epochs 3.0 \
--output_dir /tmp/$TASK_NAME/
Are there any difference between them?
I've installed vim-go with all needed binaries, added tagbar plugin from https://github.com/majutsushi/tagbar, gotags and ctags binaries exist in may $PATH.
The problem is that some functions/variables redirect me to the absolutely wrong line (same for multiple tagbar's functions), and some of them works properly. I can't open even main() function in a current project. And I don't see the differences in tagbar/code among these functions/objects.
This is also added to the .vimrc:
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
Please help to make tagbar work properly, what am I missing?
Im using the below query in the properties file and using in the shell script but due to special characters in the query it not giving me the output with special characters.
query="select top 10 source_system,updt_etl_instnc_run_id,negative_posting_flag, to_number(to_varchar(to_date(create_tmstmp),'yyyymm')) as part_date from c_fin_a.gl_transaction_data where to_number(to_varchar(to_date(create_tmstmp),'yyyymm'))=$NOW and \$CONDITIONS"
I have used escape characters for all special chars then also its not giving me same output with escape characters.
query= \ " select top 10 source_system,updt_etl_instnc_run_id,negative_posting_flag, to_number \ (to_varchar \ ( to_date \ ( create_tmstmp \ ) , \ ' yyyymm \ ' \ ) \ ) as part_date from c_fin_a.gl_transaction_data where to_number \ ( to_varchar \ ( to_date \ ( create_tmstmp \ ) , \ ' yyyymm \ ' \ ) \ )= \ $NOW and \ \$CONDITIONS \ "
First: never use spaces around the equal sign when you assign a value to variable. I mean var=value is OK, var = value is not ok.
Now, let's assume your shell variables have the following values:
NOW=201603
CONDITIONS="city='New York'"
Then you need to use the following:
query="select top 10 source_system,updt_etl_instnc_run_id,negative_posting_flag, to_number(to_varchar(to_date(create_tmstmp),'yyyymm')) as part_date from c_fin_a.gl_transaction_data where to_number(to_varchar(to_date(create_tmstmp),'yyyymm'))=${NOW} and ${CONDITIONS}"
to generate a valid SQL statement.
I am new to linux kernel and do not know much about it. For some reason I have to trace the latency issues on linux host kernel and the kvm guest kernel as well. Now I just have to compare native_apic_msr_write(this is used in linux host kernel) with naitve_apic_mem_write(used in kvm guset kernel).
Based on my limited knowledge, I tried to read the source code for these two function calls, and I believe native_apic_msr_write is used to write a value to msr register(hope this is correct).
My problem is I don't understand what native_apic_mem_write does because it calls some inline assembly called ALTERNATIVE and I am not familiar with that, either.
I attached the code below.
Can some one explain what happens inside? It does not have to be very detailed. Any information would be helpful, thanks.
#define ALTERNATIVE(oldinstr, newinstr, feature) \
80 \
81 "661:\n\t" oldinstr "\n662:\n" \
82 ".section .altinstructions,\"a\"\n" \
83 " .long 661b - .\n" /* label */ \
84 " .long 663f - .\n" /* new instruction */ \
85 " .word " __stringify(feature) "\n" /* feature bit */ \
86 " .byte 662b-661b\n" /* sourcelen */ \
87 " .byte 664f-663f\n" /* replacementlen */ \
88 ".previous\n" \
89 ".section .discard,\"aw\",#progbits\n" \
90 " .byte 0xff + (664f-663f) - (662b-661b)\n" /* rlen <= slen */ \
91 ".previous\n" \
92 ".section .altinstr_replacement, \"ax\"\n" \
93 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
94 ".previous"
I believe these are SMP alternatives - a way for the same binary kernel to run different instructions on SMP and UP systems.